unix/alloc: Don't trace executable memory for GC pointers.
This tracing was originally needed for three reasons: 1. To trace object/raw-code pointers embedded in native code, eg from @micropython.native functions. 2. To trace pointers to BSS/rodata from relocated viper code. 3. For libffi tracing. The tracing in point 1 was made unnecessary long ago in commit 7d4b6cc868ebf0e1cc5dfe5276b22e1b857c411b (see also commit bbccb0f630dc9b2769a891c2c28fbbe810284225 which removed scanning of native code on the esp8266 port). Since the previous commit, point 2 is no longer needed. For point 3, this was made unnecessary in the recent commit 97966254577167f4c50200af1af89109a275da1c. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
5b22bde044
commit
36fe9bbf00
@ -31,7 +31,6 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include "py/mpstate.h"
|
#include "py/mpstate.h"
|
||||||
#include "py/gc.h"
|
|
||||||
|
|
||||||
#if MICROPY_EMIT_NATIVE || (MICROPY_PY_FFI && MICROPY_FORCE_PLAT_ALLOC_EXEC)
|
#if MICROPY_EMIT_NATIVE || (MICROPY_PY_FFI && MICROPY_FORCE_PLAT_ALLOC_EXEC)
|
||||||
|
|
||||||
@ -79,12 +78,6 @@ void mp_unix_free_exec(void *ptr, size_t size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mp_unix_mark_exec(void) {
|
|
||||||
for (mmap_region_t *rg = MP_STATE_VM(mmap_region_head); rg != NULL; rg = rg->next) {
|
|
||||||
gc_collect_root(rg->ptr, rg->len / sizeof(mp_uint_t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MP_REGISTER_ROOT_POINTER(void *mmap_region_head);
|
MP_REGISTER_ROOT_POINTER(void *mmap_region_head);
|
||||||
|
|
||||||
#endif // MICROPY_EMIT_NATIVE || (MICROPY_PY_FFI && MICROPY_FORCE_PLAT_ALLOC_EXEC)
|
#endif // MICROPY_EMIT_NATIVE || (MICROPY_PY_FFI && MICROPY_FORCE_PLAT_ALLOC_EXEC)
|
||||||
|
|||||||
@ -39,9 +39,6 @@ void gc_collect(void) {
|
|||||||
#if MICROPY_PY_THREAD
|
#if MICROPY_PY_THREAD
|
||||||
mp_thread_gc_others();
|
mp_thread_gc_others();
|
||||||
#endif
|
#endif
|
||||||
#if MICROPY_EMIT_NATIVE
|
|
||||||
mp_unix_mark_exec();
|
|
||||||
#endif
|
|
||||||
gc_collect_end();
|
gc_collect_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -168,7 +168,6 @@ extern const struct _mp_print_t mp_stderr_print;
|
|||||||
// For the native emitter configure how to mark a region as executable.
|
// For the native emitter configure how to mark a region as executable.
|
||||||
void mp_unix_alloc_exec(size_t min_size, void **ptr, size_t *size);
|
void mp_unix_alloc_exec(size_t min_size, void **ptr, size_t *size);
|
||||||
void mp_unix_free_exec(void *ptr, size_t size);
|
void mp_unix_free_exec(void *ptr, size_t size);
|
||||||
void mp_unix_mark_exec(void);
|
|
||||||
#define MP_PLAT_ALLOC_EXEC(min_size, ptr, size) mp_unix_alloc_exec(min_size, ptr, size)
|
#define MP_PLAT_ALLOC_EXEC(min_size, ptr, size) mp_unix_alloc_exec(min_size, ptr, size)
|
||||||
#define MP_PLAT_FREE_EXEC(ptr, size) mp_unix_free_exec(ptr, size)
|
#define MP_PLAT_FREE_EXEC(ptr, size) mp_unix_free_exec(ptr, size)
|
||||||
#ifndef MICROPY_FORCE_PLAT_ALLOC_EXEC
|
#ifndef MICROPY_FORCE_PLAT_ALLOC_EXEC
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user