diff options
author | Nguyen Thai Ngoc Duy <pclouds@gmail.com> | 2021-05-12 20:34:49 +0700 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2021-06-20 10:54:10 +0300 |
commit | 1431bda1a87d66d669faab00aefe34349c54a56a (patch) | |
tree | 92eff999a82a033967fcf34a74980a7d1b1c8957 /mach_dep.c | |
parent | 8fbb53983eb2229260edd6527d146ca9056f9b1a (diff) | |
download | bdwgc-1431bda1a87d66d669faab00aefe34349c54a56a.tar.gz |
Emscripten single-threaded support (detect stack base, push registers)
Issue #354 (bdwgc).
This adds a bit more in os_dep.c in order to scan the stack and
registers, which is possible if we enable ASYNCIFY (note, this adds
quite some overhead). gctest almost passes with this, except for the
test code that involves a_get().
* configure.ac (emscripten): Define (based __EMSCRIPTEN__ macro
presence).
* configure.ac [emscripten] (gc_cflags): Append ASYNCIFY[_STACK_SIZE]
(to set stack size to 128 KB).
* configure.ac [emscripten] (EMSCRIPTEN): Define AM variable.
* configure.ac [emscripten] (THREADS): Set to "no" by default.
* doc/README.emscripten: New file.
* include/private/gcconfig.h [I386 && __EMSCRIPTEN__]
(STACK_NOT_SCANNED): Remove it, along with the comment.
* include/private/gcconfig.h [I386 && __EMSCRIPTEN__] (USE_MMAP_ANON,
STACK_GROWS_DOWN): Define macro.
* mach_dep.c [!SN_TARGET_ORBIS && !SN_TARGET_PSP2 && !HAVE_PUSH_REGS
&& __EMSCRIPTEN__] (GC_with_callee_saves_pushed): Do nothing before fn
call.
* os_dep.c [__EMSCRIPTEN__]: Include emscripten.h.
* os_dep.c [__EMSCRIPTEN__] (emscripten_stack_base): New static
variable.
* os_dep.c [__EMSCRIPTEN__] (scan_stack_cb): New static function.
* os_dep.c [!THREADS && __EMSCRIPTEN__] (scan_regs_cb): Likewise.
* os_dep.c [__EMSCRIPTEN__] (GC_get_main_stack_base): Implement.
* os_dep.c [!THREADS && __EMSCRIPTEN__] (GC_default_push_other_roots):
Likewise.
* os_dep.c [__EMSCRIPTEN__] (GET_MAIN_STACKBASE_SPECIAL): Define macro.
* os_dep.c [USE_MUNMAP && !USE_WINALLOC && !SN_TARGET_PS3
&& __EMSCRIPTEN__]: Do not call mmap or mprotect.
* tests/test.c [__EMSCRIPTEN__] (reverse_test_inner): Do not call
check_ints(a_get(),1,49); add FIXME.
* tests/tests.am [EMSCRIPTEN] (check_PROGRAMS): Add gctest.html.
* tests/tests.am [EMSCRIPTEN] (gctest_html_SOURCES, gctest_html_LDADD,
gctest_html_LDFLAGS): Define variable.
Diffstat (limited to 'mach_dep.c')
-rw-r--r-- | mach_dep.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -232,6 +232,8 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), # if defined(HAVE_PUSH_REGS) GC_push_regs(); +# elif defined(__EMSCRIPTEN__) + /* No-op, "registers" are pushed in GC_push_other_roots(). */ # else # if defined(UNIX_LIKE) && !defined(NO_GETCONTEXT) /* Older versions of Darwin seem to lack getcontext(). */ |