Skip to content

Commit 4e33590

Browse files
authored
Rename internal setting IMPLEMENTED_FUNCTIONS -> WASM_EXPORTS. NFC (emscripten-core#13917)
As of emscripten-core#13873 this settings not also included exported globals so the name stopped making as much sense.
1 parent 87a7b63 commit 4e33590

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

emscripten.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def update_settings_glue(metadata, DEBUG):
117117
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += metadata['globalImports']
118118

119119
all_exports = metadata['exports'] + list(metadata['namedGlobals'].keys())
120-
settings.IMPLEMENTED_FUNCTIONS = [asmjs_mangle(x) for x in all_exports]
120+
settings.WASM_EXPORTS = [asmjs_mangle(x) for x in all_exports]
121121

122122
settings.BINARYEN_FEATURES = metadata['features']
123123
if settings.RELOCATABLE:
@@ -127,7 +127,7 @@ def update_settings_glue(metadata, DEBUG):
127127
if settings.INITIAL_TABLE == -1:
128128
settings.INITIAL_TABLE = metadata['tableSize'] + 1
129129

130-
settings.HAS_MAIN = settings.MAIN_MODULE or settings.STANDALONE_WASM or '_main' in settings.IMPLEMENTED_FUNCTIONS
130+
settings.HAS_MAIN = settings.MAIN_MODULE or settings.STANDALONE_WASM or '_main' in settings.WASM_EXPORTS
131131

132132
# When using dynamic linking the main function might be in a side module.
133133
# To be safe assume they do take input parametes.
@@ -187,7 +187,7 @@ def set_memory(static_bump):
187187
def report_missing_symbols(pre):
188188
# the initial list of missing functions are that the user explicitly exported
189189
# but were not implemented in compiled code
190-
missing = set(settings.USER_EXPORTED_FUNCTIONS) - set(settings.IMPLEMENTED_FUNCTIONS)
190+
missing = set(settings.USER_EXPORTED_FUNCTIONS) - set(settings.WASM_EXPORTS)
191191

192192
for requested in sorted(missing):
193193
if (f'function {requested}(') not in pre:
@@ -205,7 +205,7 @@ def report_missing_symbols(pre):
205205
# maximum compatibility.
206206
return
207207

208-
if settings.EXPECT_MAIN and '_main' not in settings.IMPLEMENTED_FUNCTIONS:
208+
if settings.EXPECT_MAIN and '_main' not in settings.WASM_EXPORTS:
209209
# For compatibility with the output of wasm-ld we use the same wording here in our
210210
# error message as if wasm-ld had failed (i.e. in LLD_REPORT_UNDEFINED mode).
211211
exit_with_error('entry symbol not defined (pass --no-entry to suppress): main')

src/compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (settingsFile) {
6666

6767
EXPORTED_FUNCTIONS = set(EXPORTED_FUNCTIONS);
6868
EXCEPTION_CATCHING_ALLOWED = set(EXCEPTION_CATCHING_ALLOWED);
69-
IMPLEMENTED_FUNCTIONS = set(IMPLEMENTED_FUNCTIONS);
69+
WASM_EXPORTS = set(WASM_EXPORTS);
7070
INCOMING_MODULE_JS_API = set(INCOMING_MODULE_JS_API);
7171

7272
RUNTIME_DEBUG = LIBRARY_DEBUG || GL_DEBUG;

src/jsifier.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function JSify(functionsOnly) {
134134
}
135135

136136
// if the function was implemented in compiled code, we just need to export it so we can reach it from JS
137-
if (finalName in IMPLEMENTED_FUNCTIONS) {
137+
if (finalName in WASM_EXPORTS) {
138138
EXPORTED_FUNCTIONS[finalName] = 1;
139139
// stop here: we don't need to add anything from our js libraries, not even deps, compiled code is on it
140140
return '';
@@ -147,7 +147,7 @@ function JSify(functionsOnly) {
147147
var noExport = false;
148148

149149
if (!LibraryManager.library.hasOwnProperty(ident)) {
150-
if (!(finalName in IMPLEMENTED_FUNCTIONS) && !LINKABLE) {
150+
if (!(finalName in WASM_EXPORTS) && !LINKABLE) {
151151
var msg = 'undefined symbol: ' + ident;
152152
if (dependent) msg += ' (referenced by ' + dependent + ')';
153153
if (ERROR_ON_UNDEFINED_SYMBOLS) {

src/parseTools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ function addReadyPromiseAssertions(promise) {
13011301
}
13021302

13031303
function makeMalloc(source, param) {
1304-
if ('_malloc' in IMPLEMENTED_FUNCTIONS) {
1304+
if ('_malloc' in WASM_EXPORTS) {
13051305
return `_malloc(${param})`;
13061306
}
13071307
// It should be impossible to call some functions without malloc being

src/postamble_minimal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function initRuntime(asm) {
7676
#endif
7777
#endif
7878

79-
#if '___wasm_call_ctors' in IMPLEMENTED_FUNCTIONS
79+
#if '___wasm_call_ctors' in WASM_EXPORTS
8080
asm['__wasm_call_ctors']();
8181
#endif
8282

src/preamble.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ function cwrap(ident, returnType, argTypes, opts) {
184184
#if ASSERTIONS
185185
// We used to include malloc/free by default in the past. Show a helpful error in
186186
// builds with assertions.
187-
#if !('_malloc' in IMPLEMENTED_FUNCTIONS)
187+
#if !('_malloc' in WASM_EXPORTS)
188188
function _malloc() {
189189
abort("malloc() called but not included in the build - add '_malloc' to EXPORTED_FUNCTIONS");
190190
}
191191
#endif // malloc
192-
#if !('_free' in IMPLEMENTED_FUNCTIONS)
192+
#if !('_free' in WASM_EXPORTS)
193193
function _free() {
194194
// Show a helpful error since we used to include free by default in the past.
195195
abort("free() called but not included in the build - add '_free' to EXPORTED_FUNCTIONS");
@@ -972,7 +972,7 @@ function createWasm() {
972972
#endif
973973
#endif
974974

975-
#if '___wasm_call_ctors' in IMPLEMENTED_FUNCTIONS
975+
#if '___wasm_call_ctors' in WASM_EXPORTS
976976
addOnInit(Module['asm']['__wasm_call_ctors']);
977977
#endif
978978

src/settings_internal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ var EMBIND = 0;
6262
// Whether the main() function reads the argc/argv parameters.
6363
var MAIN_READS_PARAMS = 1;
6464

65-
// List of functions implemented in compiled code; received from the backend.
66-
var IMPLEMENTED_FUNCTIONS = [];
65+
// List of symbols exported from compiled code
66+
var WASM_EXPORTS = [];
6767

6868
// Name of the file containing the Fetch *.fetch.js, if relevant
6969
var FETCH_WORKER_FILE = '';

0 commit comments

Comments
 (0)