Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1131,10 +1131,10 @@ the JS library:
Given an WebAssembly.Exception object, returns the actual user-thrown C++
object address in Wasm memory.

Setting this option also adds refcount increasing and decreasing functions
('incrementExceptionRefcount' and 'decrementExceptionRefcount') in the JS
library because if you catch an exception from JS, you may need to manipulate
the refcount manually not to leak memory.
Setting this option also adds refcount incrementing and decrementing
functions ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in
the JS library because if you catch an exception from JS, you may need to
manipulate the refcount manually to avoid memory leaks.

See test_EXPORT_EXCEPTION_HANDLING_HELPERS in test/test_core.py for an
example usage.
Expand Down
8 changes: 4 additions & 4 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,10 @@ var DISABLE_EXCEPTION_THROWING = false;
// Given an WebAssembly.Exception object, returns the actual user-thrown C++
// object address in Wasm memory.
//
// Setting this option also adds refcount increasing and decreasing functions
// ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in the JS
// library because if you catch an exception from JS, you may need to manipulate
// the refcount manually not to leak memory.
// Setting this option also adds refcount incrementing and decrementing
// functions ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in
// the JS library because if you catch an exception from JS, you may need to
// manipulate the refcount manually to avoid memory leaks.
//
// See test_EXPORT_EXCEPTION_HANDLING_HELPERS in test/test_core.py for an
// example usage.
Expand Down
9 changes: 4 additions & 5 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,11 +1835,10 @@ def get_full_import_name(name):
# enabling EH, errors out.
if settings.DISABLE_EXCEPTION_CATCHING and not settings.WASM_EXCEPTIONS:
exit_with_error('EXPORT_EXCEPTION_HANDLING_HELPERS requires either of -fexceptions or -fwasm-exceptions')
# We also export refcount increasing and decreasing functions because if you
# catch an exception, be it an Emscripten exception or a Wasm exception, in
# JS, you may need to manipulate the refcount manually not to leak memory.
# What you need to do is different depending on the kind of EH you use
# (https://github.com/emscripten-core/emscripten/issues/17115).
# We also export refcount incrementing and decrementing functions because if
# you catch an exception from JS, you may need to manipulate the refcount
# manually to avoid memory leaks. See test_EXPORT_EXCEPTION_HANDLING_HELPERS
# in test/test_core.py for an example usage.
settings.EXPORTED_FUNCTIONS += ['getExceptionMessage', 'incrementExceptionRefcount', 'decrementExceptionRefcount']
if settings.WASM_EXCEPTIONS:
settings.REQUIRED_EXPORTS += ['__cpp_exception']
Expand Down