Commit 76c8a4c9 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix: Add setjmp-based GC register helper implementation.

As I suspected for a long time, for x86, register helper doesn't really make
any difference - there's simply not enough register to keep anything in
them for any prolonged time. Anything gets pushed on stack anyway. So, on
x86, uPy passed all tests even with empty reg helper. So, this setjmp
implementation goes as "untested".
parent 30583f58
......@@ -34,6 +34,17 @@
extern void *stack_top;
#include <setjmp.h>
typedef jmp_buf regs_t;
void gc_helper_get_regs(regs_t arr) {
// We capture here callee-save registers, i.e. ones which may contain
// interesting values held there by our callers. It doesn't make sense
// to capture caller-saved registers, because they, well, put on the
......@@ -112,6 +123,7 @@ void gc_helper_get_regs(regs_t arr) {
arr[9] = r13;
void gc_collect(void) {
......@@ -49,6 +49,9 @@
// Define to MICROPY_ERROR_REPORTING_DETAILED to get function, etc.
// names in exception messages (may require more RAM).
// Define to 1 to use untested inefficient GC helper implementation
// (if more efficient arch-specific one is not available).
extern const struct _mp_obj_module_t mp_module_os;
extern const struct _mp_obj_module_t mp_module_time;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment