mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
gc data scan init + temp test
This commit is contained in:
parent
975126e2bd
commit
98f9cc0254
2 changed files with 42 additions and 0 deletions
|
|
@ -348,3 +348,34 @@ extern int Lwrite (int n) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GC starts here */
|
||||||
|
|
||||||
|
extern const size_t __gc_data_end, __gc_data_start;
|
||||||
|
|
||||||
|
extern void __gc_root_scan_data () {
|
||||||
|
size_t * p = &__gc_data_start;
|
||||||
|
|
||||||
|
printf ("Start, end: %d, %d\n", &__gc_data_start, &__gc_data_end);
|
||||||
|
|
||||||
|
while (p != &__gc_data_end) {
|
||||||
|
if (!UNBOXED(*p)) printf ("Root: %d\n", p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* extern const void * __gc_data_end, * __gc_data_start; */
|
||||||
|
|
||||||
|
/* extern void __gc_root_scan_data () { */
|
||||||
|
/* void * p = &__gc_data_start; */
|
||||||
|
|
||||||
|
/* printf ("Start, end: %d, %d\n", &__gc_data_start, &__gc_data_end); */
|
||||||
|
|
||||||
|
/* while (p != &__gc_data_end) { */
|
||||||
|
/* if (!UNBOXED(* (size_t *) p)) printf ("Root: %d\n", p); */
|
||||||
|
/* p = p + sizeof(size_t); */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
extern void Ltest () {
|
||||||
|
__gc_root_scan_data ();
|
||||||
|
}
|
||||||
|
|
|
||||||
11
src/testgc.expr
Normal file
11
src/testgc.expr
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
x := 0;
|
||||||
|
y := 0;
|
||||||
|
z := 0;
|
||||||
|
t := 0;
|
||||||
|
test ();
|
||||||
|
y := "abc";
|
||||||
|
test ();
|
||||||
|
t := [];
|
||||||
|
test ();
|
||||||
|
t := 0;
|
||||||
|
test ()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue