Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.emscripten #651

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions docs/platforms/README.emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@
The build system (at least autotools-based) should detect and configure
emscripten correctly.

Due to limitations of webassembly, finding all roots on the stack
needs more coordination with the code using the gc than on other
platforms. There are two strategies for dealing with this issue:

1. Compile any code using the gc with
-sBINARYEN_EXTRA_PASSES='--spill-pointers'. This instructs the C
compiler to always keep roots in a place where the gc can find them.
This is the simplest option but there is some impact on code size and
run time.

2. Only trigger the gc at points where it can be guaranteed that there
are no pointers on the stack. When running in the browser, this can
be done for instance in the main event loop using
emscripten_set_timeout(). Triggering the gc manually involves
calling GC_enable(), GC_collect() and GC_disable() in succession.
This method does not impact code size or runtime but might lead to
the gc running too often or not often enough if the timeouts are
chosen incorrectly.

As of now, gctest almost passes, except for the tests that involve a_get().

No thread support for now. No idea how to stop other threads (perhaps we need
Expand All @@ -10,6 +29,6 @@ support from JS side).
How to build:

# source EMSDK first
emconfigure ./configure
LDFLAGS="-sBINARYEN_EXTRA_PASSES='--spill-pointers'" emconfigure ./configure
emmake make gctest.html
# point your browser at .libs/gctest.html
# point your browser at .libs/gctest.html or call `node .libs/gctest.js`
Loading