Skip to content

Commit 0a1d02d

Browse files
authored
Use Binaryen's new --inline-main pass, to inline __original_main into main (#9888)
1 parent b0ee7f8 commit 0a1d02d

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

emcc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,9 @@ def parse_passes(string):
16711671
if shared.Settings.SAFE_HEAP:
16721672
passes += ['--safe-heap']
16731673
passes += ['--post-emscripten']
1674+
# always inline __original_main into main, as otherwise it makes debugging confusing,
1675+
# and doing so is never bad for code size
1676+
passes += ['--inline-main']
16741677
if not shared.Settings.EXIT_RUNTIME:
16751678
passes += ['--no-exit-runtime']
16761679
if options.opt_level > 0 or options.shrink_level > 0:

tests/other/metadce/hello_world_O1.funcs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ $__errno_location
44
$__fwritex
55
$__growWasmMemory
66
$__lockfile
7-
$__original_main
87
$__overflow
98
$__stdio_write
109
$__towrite

tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.funcs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
$__original_main
21
$_start
32
$dlmalloc
43
$main

tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.funcs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
$__original_main
21
$_start
32
$dlmalloc
43
$main

tests/test_other.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8187,7 +8187,7 @@ def test_metadce_cxx_fastcomp(self, *args):
81878187

81888188
@parameterized({
81898189
'O0': ([], 9, [], ['waka'], 22185, 8, 17, 57), # noqa
8190-
'O1': (['-O1'], 7, [], ['waka'], 10415, 6, 14, 31), # noqa
8190+
'O1': (['-O1'], 7, [], ['waka'], 10415, 6, 14, 30), # noqa
81918191
'O2': (['-O2'], 7, [], ['waka'], 10183, 6, 14, 24), # noqa
81928192
'O3': (['-O3'], 4, [], [], 1957, 4, 2, 12), # noqa; in -O3, -Os and -Oz we metadce
81938193
'Os': (['-Os'], 4, [], [], 1963, 4, 2, 12), # noqa
@@ -8235,7 +8235,7 @@ def test_metadce_hello_fastcomp(self, *args):
82358235
3, [], [], 6309, 3, 3, 5), # noqa
82368236
# without argc/argv, no support code for them is emitted
82378237
'O3_standalone_narg': ('mem_no_argv.c', ['-O3', '-s', 'STANDALONE_WASM'],
8238-
1, [], [], 6309, 1, 3, 5), # noqa
8238+
1, [], [], 6309, 1, 3, 4), # noqa
82398239
# without main, no support code for argc/argv is emitted either
82408240
'O3_standalone_lib': ('mem_no_main.c', ['-O3', '-s', 'STANDALONE_WASM'],
82418241
0, [], [], 6309, 0, 3, 4), # noqa
@@ -8248,7 +8248,7 @@ def test_metadce_hello_fastcomp(self, *args):
82488248
# without argc/argv, no support code for them is emitted, even with lto
82498249
'O3_standalone_narg_flto':
82508250
('mem_no_argv.c', ['-O3', '-s', 'STANDALONE_WASM', '-flto'],
8251-
1, [], [], 6309, 1, 3, 5), # noqa
8251+
1, [], [], 6309, 1, 3, 4), # noqa
82528252
})
82538253
@no_fastcomp()
82548254
def test_metadce_mem(self, filename, *args):

0 commit comments

Comments
 (0)