[MIPS] Garbage collection crash during Unix port running on MIPS
Posted: Mon May 03, 2021 3:25 pm
Hi All,
This is my first post to the community. I'm pretty new to micropython and to the community.
I ran into issues while running micropython unix port on MIPS32. I have cross compiled micropython for a MIPS32 and running it alongwith openwrt.
The issue happens during garbage collection. When garbage collector runs, it probably marking some blocks as 'not referenced' which are still in use. The issue happens when the program tries to execute a callback stored before garbage collector runs. When the callback is called after garbage collection; it either ends in SIGSEGV or an object which is not callable.
I tried to look into the source code of unix port especially the functions which are run during garbage collection.
In unix port, gc_helper_collect_regs_and_stack() is called which reads the data from registers. In my compiled version, it calls the following version -
STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
setjmp(arr);
}
So my question is - should I fill the register array using specific registers or the setjmp() way of getting the register array is sufficient? In which scenarios, it can cause troubles?
Also any pointers hinting at where to look for when debugging garbage collection related crashes would be very useful
I can provide more information if needed
This is my first post to the community. I'm pretty new to micropython and to the community.
I ran into issues while running micropython unix port on MIPS32. I have cross compiled micropython for a MIPS32 and running it alongwith openwrt.
The issue happens during garbage collection. When garbage collector runs, it probably marking some blocks as 'not referenced' which are still in use. The issue happens when the program tries to execute a callback stored before garbage collector runs. When the callback is called after garbage collection; it either ends in SIGSEGV or an object which is not callable.
I tried to look into the source code of unix port especially the functions which are run during garbage collection.
In unix port, gc_helper_collect_regs_and_stack() is called which reads the data from registers. In my compiled version, it calls the following version -
STATIC void gc_helper_get_regs(gc_helper_regs_t arr) {
setjmp(arr);
}
So my question is - should I fill the register array using specific registers or the setjmp() way of getting the register array is sufficient? In which scenarios, it can cause troubles?
Also any pointers hinting at where to look for when debugging garbage collection related crashes would be very useful
I can provide more information if needed