summaryrefslogtreecommitdiffstatshomepage
path: root/unix/gccollect.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-05 04:32:17 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-05 04:32:17 +0300
commit76c8a4c91bccf27d188b5dcbc44899684d27d8da (patch)
tree7a732ebeb44cfd3cb7830091d668faa7088d874c /unix/gccollect.c
parent30583f58d5363657d74829160097c58aed4f3ce1 (diff)
downloadmicropython-76c8a4c91bccf27d188b5dcbc44899684d27d8da.tar.gz
micropython-76c8a4c91bccf27d188b5dcbc44899684d27d8da.zip
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".
Diffstat (limited to 'unix/gccollect.c')
-rw-r--r--unix/gccollect.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/unix/gccollect.c b/unix/gccollect.c
index d934f9cae2..4f3b786e72 100644
--- a/unix/gccollect.c
+++ b/unix/gccollect.c
@@ -34,6 +34,17 @@
extern void *stack_top;
+#if MICROPY_GCREGS_SETJMP
+#include <setjmp.h>
+
+typedef jmp_buf regs_t;
+
+void gc_helper_get_regs(regs_t arr) {
+ setjmp(arr);
+}
+
+#else // !MICROPY_GCREGS_SETJMP
+
// 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;
}
#endif
+#endif // !MICROPY_GCREGS_SETJMP
void gc_collect(void) {
//gc_dump_info();