Skip to content

Commit fb8375f

Browse files
authored
jsifier: Rename libraryFunction -> librarySymbols (#17411)
1 parent 0b923f3 commit fb8375f

File tree

6 files changed

+7
-27
lines changed

6 files changed

+7
-27
lines changed

emcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def get_all_js_syms():
461461
glue, forwarded_data = emscripten.compile_settings()
462462
forwarded_json = json.loads(forwarded_data)
463463
library_syms = set()
464-
for name in forwarded_json['libraryFunctions']:
464+
for name in forwarded_json['librarySymbols']:
465465
if shared.is_c_symbol(name):
466466
name = shared.demangle_c_symbol_name(name)
467467
library_syms.add(name)

emscripten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def emscript(in_wasm, out_wasm, outfile_js, memfile):
375375
if settings.ASYNCIFY:
376376
exports += ['asyncify_start_unwind', 'asyncify_stop_unwind', 'asyncify_start_rewind', 'asyncify_stop_rewind']
377377

378-
report_missing_symbols(forwarded_json['libraryFunctions'])
378+
report_missing_symbols(forwarded_json['librarySymbols'])
379379

380380
if not outfile_js:
381381
logger.debug('emscript: skipping remaining js glue generation')

src/jsifier.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,6 @@ function ${name}(${args}) {
317317
deps.push(snippet);
318318
snippet = mangleCSymbolName(snippet);
319319
}
320-
// In asm, we need to know about library functions. If there is a target, though, then no
321-
// need to consider this a library function - we will call directly to it anyhow
322-
if (!redirectedIdent && (typeof target == 'function')) {
323-
libraryFunctions.push(finalName);
324-
}
325320
}
326321
} else if (typeof snippet == 'object') {
327322
snippet = stringifyWithFunctions(snippet);
@@ -330,14 +325,9 @@ function ${name}(${args}) {
330325
isFunction = true;
331326
snippet = processLibraryFunction(snippet, ident, finalName, deps);
332327
addImplicitDeps(snippet, deps);
333-
libraryFunctions.push(finalName);
334328
}
335329

336-
// If a JS library item specifies xxx_import: true, then explicitly mark that symbol to be exported
337-
// to wasm module.
338-
if (LibraryManager.library[ident + '__import']) {
339-
libraryFunctions.push(finalName);
340-
}
330+
librarySymbols.push(finalName);
341331

342332
if (ONLY_CALC_JS_SYMBOLS) {
343333
return '';
@@ -555,7 +545,7 @@ function ${name}(${args}) {
555545
print(processMacros(preprocess(shellParts[1], shellFile)));
556546

557547
print('\n//FORWARDED_DATA:' + JSON.stringify({
558-
libraryFunctions: libraryFunctions,
548+
librarySymbols: librarySymbols,
559549
warnings: warnings,
560550
ATINITS: ATINITS.join('\n'),
561551
ATMAINS: ATMAINS.join('\n'),

src/library.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ mergeInto(LibraryManager.library, {
385385
// AppleWebKit/605.1.15 Safari/604.1 Version/13.0.4 iPhone OS 13_3 on iPhone 6s with iOS 13.3
386386
// AppleWebKit/605.1.15 Version/13.0.3 Intel Mac OS X 10_15_1 on Safari 13.0.3 (15608.3.10.1.4) on macOS Catalina 10.15.1
387387
// Hence the support status of .copyWithin() for Safari version range [10.0.0, 10.1.0] is unknown.
388-
emscripten_memcpy_big__import: true,
389388
emscripten_memcpy_big: '= Uint8Array.prototype.copyWithin\n' +
390389
' ? function(dest, src, num) { HEAPU8.copyWithin(dest, src, src + num); }\n' +
391390
' : function(dest, src, num) { HEAPU8.set(HEAPU8.subarray(src, src+num), dest); }\n',
@@ -2293,7 +2292,6 @@ mergeInto(LibraryManager.library, {
22932292
return Math.random();
22942293
},
22952294

2296-
emscripten_get_now__import: true,
22972295
emscripten_get_now__sig: 'd',
22982296
emscripten_get_now: ';' +
22992297
#if ENVIRONMENT_MAY_BE_NODE
@@ -3591,16 +3589,11 @@ mergeInto(LibraryManager.library, {
35913589
#if RELOCATABLE
35923590
// Globals that are normally exported from the wasm module but in relocatable
35933591
// mode are created here and imported by the module.
3594-
// Mark with `__import` so these are usable from native code. This is needed
3595-
// because, by default, only functions can be be imported.
35963592
__stack_pointer: "new WebAssembly.Global({'value': '{{{ POINTER_WASM_TYPE }}}', 'mutable': true}, {{{ to64(STACK_BASE) }}})",
3597-
__stack_pointer__import: true,
35983593
// tell the memory segments where to place themselves
35993594
__memory_base: "new WebAssembly.Global({'value': '{{{ POINTER_WASM_TYPE }}}', 'mutable': false}, {{{ to64(GLOBAL_BASE) }}})",
3600-
__memory_base__import: true,
36013595
// the wasm backend reserves slot 0 for the NULL function pointer
36023596
__table_base: "new WebAssembly.Global({'value': '{{{ POINTER_WASM_TYPE }}}', 'mutable': false}, {{{ to64(1) }}})",
3603-
__table_base__import: true,
36043597
#if MEMORY64
36053598
__table_base32: 1,
36063599
#endif
@@ -3610,11 +3603,9 @@ mergeInto(LibraryManager.library, {
36103603
// have __heap_base hardcoded into it - it receives it from JS as an extern
36113604
// global, basically).
36123605
__heap_base: '{{{ to64(HEAP_BASE) }}}',
3613-
__heap_base__import: true,
36143606
#if WASM_EXCEPTIONS
36153607
// In dynamic linking we define tags here and feed them to each module
36163608
__cpp_exception: "new WebAssembly.Tag({'parameters': ['{{{ POINTER_WASM_TYPE }}}']})",
3617-
__cpp_exception__import: true,
36183609
#endif
36193610
#if SUPPORT_LONGJMP == 'wasm'
36203611
__c_longjmp: "new WebAssembly.Tag({'parameters': ['{{{ POINTER_WASM_TYPE }}}']})",

src/modules.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ function genArgSequence(n) {
1717
return args;
1818
}
1919

20-
// List of functions that were added from the library.
21-
global.libraryFunctions = [];
20+
// List of symbols that were added from the library.
21+
global.librarySymbols = [];
2222

2323
global.LibraryManager = {
2424
library: {},
@@ -362,7 +362,7 @@ function isInternalSymbol(ident) {
362362
function addMissingLibraryStubs() {
363363
if (!ASSERTIONS) return '';
364364
let rtn = '';
365-
const librarySymbolSet = new Set(libraryFunctions);
365+
const librarySymbolSet = new Set(librarySymbols);
366366
for (const ident in LibraryManager.library) {
367367
if (typeof LibraryManager.library[ident] === 'function') {
368368
if (ident[0] === '$' && !isJsLibraryConfigIdentifier(ident) && !isInternalSymbol(ident)) {

src/utility.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ function isJsLibraryConfigIdentifier(ident) {
113113
'__deps',
114114
'__postset',
115115
'__docs',
116-
'__import',
117116
'__nothrow',
118117
'__noleakcheck',
119118
'__internal',

0 commit comments

Comments
 (0)