Skip to content

Commit

Permalink
modules.js: Remove old elements from runtimeElements. NFC (#18569)
Browse files Browse the repository at this point in the history
Most of these symbols simply no longer exist as runtime symbols.
`getCompilerSetting` and `prettyPrint` still exist but conditionally.

Any attempt to export these symbols using EXPORTED_RUNTIME_METHODS would
silently succeed at build time and then result in an undefined symbol at
JS load time.

I noticed this while working on a change to have `EXPORT_ALL` apply to
runtime symbols too.
  • Loading branch information
sbc100 committed Jan 20, 2023
1 parent 9a61a14 commit a290909
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions src/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,6 @@ function exportRuntime() {
'FS_createLink',
'FS_createDevice',
'FS_unlink',
'getLEB',
'getFunctionTables',
'alignFunctionTables',
'registerFunctions',
'prettyPrint',
'getCompilerSetting',
'out',
'err',
'callMain',
Expand Down Expand Up @@ -399,6 +393,14 @@ function exportRuntime() {
runtimeElements.push('tryParseAsDataURI');
}

if (RETAIN_COMPILER_SETTINGS) {
runtimeElements.push('getCompilerSetting')
}

if (RUNTIME_DEBUG) {
runtimeElements.push('prettyPrint')
}

// dynCall_* methods are not hardcoded here, as they
// depend on the file being compiled. check for them
// and add them.
Expand Down
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
27057
26963
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_minimal_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23706
23612
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
67220
67096
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_strict.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
66086
65962

0 comments on commit a290909

Please sign in to comment.