mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Fix GC bug: add swap spaces when extend; Fix debug info
This commit is contained in:
parent
ff197744f6
commit
dfa1380262
1 changed files with 8 additions and 3 deletions
|
|
@ -1443,6 +1443,7 @@ static void * gc (size_t size) {
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
#endif
|
#endif
|
||||||
if (extend_spaces ()) {
|
if (extend_spaces ()) {
|
||||||
|
gc_swap_spaces ();
|
||||||
init_to_space (1);
|
init_to_space (1);
|
||||||
return gc (size);
|
return gc (size);
|
||||||
}
|
}
|
||||||
|
|
@ -1560,13 +1561,17 @@ extern void * alloc (size_t size) {
|
||||||
#endif
|
#endif
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
init_to_space (0);
|
||||||
#ifdef DEBUG_PRINT
|
#ifdef DEBUG_PRINT
|
||||||
printf ("alloc: call gc: %zu\n", size); fflush (stdout);
|
printf ("alloc: call gc: %zu\n", size); fflush (stdout);
|
||||||
printFromSpace(); fflush (stdout);
|
printFromSpace(); fflush (stdout);
|
||||||
printf("gc END\n\n"); fflush (stdout);
|
p = gc (size);
|
||||||
|
printf("gc END %p %p %p\n\n", from_space.begin,
|
||||||
|
from_space.end, from_space.current); fflush (stdout);
|
||||||
printFromSpace(); fflush (stdout);
|
printFromSpace(); fflush (stdout);
|
||||||
#endif
|
return p;
|
||||||
init_to_space (0);
|
#else
|
||||||
return gc (size);
|
return gc (size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue