Skip to content

Commit d51281a

Browse files
authored
[EH] Change Wasm EH setting's name (#17068)
I named it EXCEPTION_HANDLING thinking we will eventually remove Emscripten EH and this will be the only mode of EH, but maybe that won't happen for a while, and code is confusing because if you write `if !EXCEPTION_HANDLING` it sounds like all exception handling should be disabled.
1 parent eab8755 commit d51281a

11 files changed

+20
-20
lines changed

Diff for: emcc.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ def get_cflags(user_args):
844844

845845
# if exception catching is disabled, we can prevent that code from being
846846
# generated in the frontend
847-
if settings.DISABLE_EXCEPTION_CATCHING and not settings.EXCEPTION_HANDLING:
847+
if settings.DISABLE_EXCEPTION_CATCHING and not settings.WASM_EXCEPTIONS:
848848
cflags.append('-fignore-exceptions')
849849

850850
if settings.INLINING_LIMIT:
@@ -2570,12 +2570,12 @@ def get_full_import_name(name):
25702570
# Export tag objects which are likely needed by the native code, but which are
25712571
# currently not reported in the metadata of wasm-emscripten-finalize
25722572
if settings.RELOCATABLE:
2573-
if settings.EXCEPTION_HANDLING:
2573+
if settings.WASM_EXCEPTIONS:
25742574
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.append('__cpp_exception')
25752575
if settings.SUPPORT_LONGJMP == 'wasm':
25762576
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.append('__c_longjmp')
25772577

2578-
if settings.EXCEPTION_HANDLING:
2578+
if settings.WASM_EXCEPTIONS:
25792579
settings.REQUIRED_EXPORTS += ['__trap']
25802580

25812581
return target, wasm_target
@@ -3220,7 +3220,7 @@ def consume_arg_file():
32203220
elif arg == '-fno-exceptions':
32213221
settings.DISABLE_EXCEPTION_CATCHING = 1
32223222
settings.DISABLE_EXCEPTION_THROWING = 1
3223-
settings.EXCEPTION_HANDLING = 0
3223+
settings.WASM_EXCEPTIONS = 0
32243224
elif arg == '-fexceptions':
32253225
eh_enabled = True
32263226
elif arg == '-fwasm-exceptions':
@@ -3283,11 +3283,11 @@ def consume_arg_file():
32833283
# exception handling by default when -fexceptions is given when wasm
32843284
# exception handling becomes stable.
32853285
if wasm_eh_enabled:
3286-
settings.EXCEPTION_HANDLING = 1
3286+
settings.WASM_EXCEPTIONS = 1
32873287
settings.DISABLE_EXCEPTION_THROWING = 1
32883288
settings.DISABLE_EXCEPTION_CATCHING = 1
32893289
elif eh_enabled:
3290-
settings.EXCEPTION_HANDLING = 0
3290+
settings.WASM_EXCEPTIONS = 0
32913291
settings.DISABLE_EXCEPTION_THROWING = 0
32923292
settings.DISABLE_EXCEPTION_CATCHING = 0
32933293

Diff for: emscripten.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ def add_standard_wasm_imports(send_items_map):
635635

636636
if settings.RELOCATABLE:
637637
send_items_map['__indirect_function_table'] = 'wasmTable'
638-
if settings.EXCEPTION_HANDLING:
638+
if settings.WASM_EXCEPTIONS:
639639
send_items_map['__cpp_exception'] = '___cpp_exception'
640640
if settings.SUPPORT_LONGJMP == 'wasm':
641641
send_items_map['__c_longjmp'] = '___c_longjmp'

Diff for: src/library.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3604,7 +3604,7 @@ mergeInto(LibraryManager.library, {
36043604
// global, basically).
36053605
__heap_base: '{{{ to64(HEAP_BASE) }}}',
36063606
__heap_base__import: true,
3607-
#if EXCEPTION_HANDLING
3607+
#if WASM_EXCEPTIONS
36083608
// In dynamic linking we define tags here and feed them to each module
36093609
__cpp_exception: "new WebAssembly.Tag({'parameters': ['{{{ POINTER_WASM_TYPE }}}']})",
36103610
__cpp_exception__import: true,

Diff for: src/modules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ global.LibraryManager = {
5050
'library_eventloop.js',
5151
];
5252

53-
if (LINK_AS_CXX && !EXCEPTION_HANDLING) {
53+
if (LINK_AS_CXX && !WASM_EXCEPTIONS) {
5454
if (DISABLE_EXCEPTION_THROWING) {
5555
libraries.push('library_exceptions_stub.js');
5656
} else {

Diff for: src/preamble.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ function abort(what) {
628628
// defintion for WebAssembly.RuntimeError claims it takes no arguments even
629629
// though it can.
630630
// TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
631-
#if EXCEPTION_HANDLING == 1
631+
#if WASM_EXCEPTIONS == 1
632632
// See above, in the meantime, we resort to wasm code for trapping.
633633
___trap();
634634
#else

Diff for: src/settings.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,8 @@ var LZ4 = false;
658658
// Emscripten exception handling options.
659659
// The three options below (DISABLE_EXCEPTION_CATCHING,
660660
// EXCEPTION_CATCHING_ALLOWED, and DISABLE_EXCEPTION_THROWING) only pertain to
661-
// Emscripten exception handling and do not control the experimental native wasm
662-
// exception handling option (EXCEPTION_HANDLING).
661+
// Emscripten exception handling and do not control the native wasm exception
662+
// handling option (-fwasm-exceptions, internal setting: WASM_EXCEPTIONS).
663663

664664
// Disables generating code to actually catch exceptions. This disabling is on
665665
// by default as the overhead of exceptions is quite high in size and speed

Diff for: src/settings_internal.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ var CAN_ADDRESS_2GB = false;
177177
// This has no effect if DWARF is not being emitted.
178178
var SEPARATE_DWARF = false;
179179

180-
// New WebAssembly exception handling (experimental)
181-
var EXCEPTION_HANDLING = false;
180+
// New WebAssembly exception handling
181+
var WASM_EXCEPTIONS = false;
182182

183183
// Used internally when running the JS compiler simply to generate list of all
184184
// JS symbols. This is used by LLD_REPORT_UNDEFINED to generate a list of all

Diff for: tools/building.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ def link_lld(args, target, external_symbols=None):
371371
for a in llvm_backend_args():
372372
cmd += ['-mllvm', a]
373373

374-
if settings.EXCEPTION_HANDLING:
374+
if settings.WASM_EXCEPTIONS:
375375
cmd += ['-mllvm', '-wasm-enable-eh']
376-
if settings.EXCEPTION_HANDLING or settings.SUPPORT_LONGJMP == 'wasm':
376+
if settings.WASM_EXCEPTIONS or settings.SUPPORT_LONGJMP == 'wasm':
377377
cmd += ['-mllvm', '-exception-model=wasm']
378378

379379
if settings.MEMORY64:

Diff for: tools/deps_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193

194194

195195
def get_deps_info():
196-
if not settings.EXCEPTION_HANDLING and settings.LINK_AS_CXX:
196+
if not settings.WASM_EXCEPTIONS and settings.LINK_AS_CXX:
197197
_deps_info['__cxa_begin_catch'] = ['__cxa_is_pointer_type']
198198
_deps_info['__cxa_throw'] = ['__cxa_is_pointer_type']
199199
_deps_info['__cxa_find_matching_catch'] = ['__cxa_can_catch']

Diff for: tools/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
# Internal settings used during compilation
7272
'EXCEPTION_CATCHING_ALLOWED',
73-
'EXCEPTION_HANDLING',
73+
'WASM_EXCEPTIONS',
7474
'LTO',
7575
'OPT_LEVEL',
7676
'DEBUG_LEVEL',

Diff for: tools/system_libs.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ def variations(cls, **kwargs): # noqa
607607

608608
@classmethod
609609
def get_default_variation(cls, **kwargs):
610-
if settings.EXCEPTION_HANDLING:
610+
if settings.WASM_EXCEPTIONS:
611611
eh_mode = Exceptions.WASM
612612
elif settings.DISABLE_EXCEPTION_CATCHING == 1:
613613
eh_mode = Exceptions.NONE
@@ -1853,7 +1853,7 @@ def add_library(libname):
18531853
add_library('libc++')
18541854
if settings.LINK_AS_CXX or sanitize:
18551855
add_library('libc++abi')
1856-
if settings.EXCEPTION_HANDLING:
1856+
if settings.WASM_EXCEPTIONS:
18571857
add_library('libunwind')
18581858

18591859
if settings.USE_ASAN:

0 commit comments

Comments
 (0)