mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
add stack roots scanning
This commit is contained in:
parent
98f9cc0254
commit
16d3f839ce
6 changed files with 1784 additions and 27 deletions
|
|
@ -351,18 +351,24 @@ extern int Lwrite (int n) {
|
|||
/* GC starts here */
|
||||
|
||||
extern const size_t __gc_data_end, __gc_data_start;
|
||||
extern size_t __gc_stack_bottom, __gc_stack_top;
|
||||
|
||||
extern void L__gc_init ();
|
||||
|
||||
extern void __gc_root_scan_data () {
|
||||
size_t * p = &__gc_data_start;
|
||||
|
||||
printf ("Start, end: %d, %d\n", &__gc_data_start, &__gc_data_end);
|
||||
printf ("Start, end: %lx, %lx\n", &__gc_data_start, &__gc_data_end);
|
||||
|
||||
while (p != &__gc_data_end) {
|
||||
if (!UNBOXED(*p)) printf ("Root: %d\n", p);
|
||||
if (!UNBOXED(*p)) printf ("Root: %lx\n", *p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
extern void __gc_root_scan_stack ();
|
||||
|
||||
|
||||
/* extern const void * __gc_data_end, * __gc_data_start; */
|
||||
|
||||
/* extern void __gc_root_scan_data () { */
|
||||
|
|
@ -376,6 +382,17 @@ extern void __gc_root_scan_data () {
|
|||
/* } */
|
||||
/* } */
|
||||
|
||||
extern char __executable_start;
|
||||
extern char __etext;
|
||||
|
||||
extern void Ltest () {
|
||||
printf("\n");
|
||||
printf("STA 0x%lx\n", (unsigned long)&__executable_start);
|
||||
printf("END 0x%lx\n", (unsigned long)&__etext);
|
||||
__gc_root_scan_data ();
|
||||
__gc_root_scan_stack ();
|
||||
|
||||
// printf("STA 0x%lx\n", (unsigned long)&__executable_start);
|
||||
// printf("END 0x%lx\n", (unsigned long)&__etext);
|
||||
// printf("RET 0x%lx\n\n", __builtin_return_address(0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue