diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-14 00:11:09 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-14 00:11:09 +0000 |
commit | 2127e9a844ae46cb2149e7c38eb9f4345075f6e4 (patch) | |
tree | 6f2acc16b4df40c34782b262541de420a7c4115c /py | |
parent | c935d69f743af14bc1ddedf1d4123f2c6d110f05 (diff) | |
download | micropython-2127e9a844ae46cb2149e7c38eb9f4345075f6e4.tar.gz micropython-2127e9a844ae46cb2149e7c38eb9f4345075f6e4.zip |
py, unix: Trace root pointers with native emitter under unix port.
Native code has GC-heap pointers in it so it must be scanned. But on
unix port memory for native functions is mmap'd, and so it must have
explicit code to scan it for root pointers.
Diffstat (limited to 'py')
-rw-r--r-- | py/emitnative.c | 1 | ||||
-rw-r--r-- | py/mpconfig.h | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index 211d2895a3..c7cbbf4516 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -1174,6 +1174,7 @@ STATIC void emit_native_load_const_str(emit_t *emit, qstr qst, bool bytes) { STATIC void emit_native_load_const_obj(emit_t *emit, void *obj) { emit_native_pre(emit); + need_reg_single(emit, REG_RET, 0); ASM_MOV_ALIGNED_IMM_TO_REG(emit->as, (mp_uint_t)obj, REG_RET); emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } diff --git a/py/mpconfig.h b/py/mpconfig.h index 541f7c75a5..5718ffacbc 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -569,6 +569,9 @@ typedef double mp_float_t; #define MICROPY_MAKE_POINTER_CALLABLE(p) (p) #endif +// If these MP_PLAT_* macros are overridden then the memory allocated by them +// must be somehow reachable for marking by the GC, since the native code +// generators store pointers to GC managed memory in the code. #ifndef MP_PLAT_ALLOC_EXEC #define MP_PLAT_ALLOC_EXEC(min_size, ptr, size) do { *ptr = m_new(byte, min_size); *size = min_size; } while(0) #endif |