Skip to content

Commit e37b89b

Browse files
committed
cleanup
1 parent b6bf7e7 commit e37b89b

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

emscripten.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,6 @@ def update_settings_glue(metadata):
665665
shared.Settings.MAX_GLOBAL_ALIGN = metadata['maxGlobalAlign']
666666
shared.Settings.IMPLEMENTED_FUNCTIONS = metadata['implementedFunctions']
667667

668-
# addFunction support for Wasm backend
669-
if shared.Settings.WASM_BACKEND and shared.Settings.RESERVED_FUNCTION_POINTERS > 0:
670-
start_index = metadata['jsCallStartIndex']
671-
# e.g. jsCallFunctionType ['v', 'ii'] -> sig2order{'v': 0, 'ii': 1}
672-
sig2order = {sig: i for i, sig in enumerate(metadata['jsCallFuncType'])}
673-
# Index in the Wasm function table in which jsCall thunk function starts
674-
shared.Settings.JSCALL_START_INDEX = start_index
675-
shared.Settings.JSCALL_SIG_ORDER = sig2order
676-
677668
# Extract the list of function signatures that MAIN_THREAD_EM_ASM blocks in
678669
# the compiled code have, each signature will need a proxy function invoker
679670
# generated for it.
@@ -2382,8 +2373,6 @@ def load_metadata_wasm(metadata_raw, DEBUG):
23822373
'externs': [],
23832374
'simd': False,
23842375
'maxGlobalAlign': 0,
2385-
'jsCallStartIndex': 0,
2386-
'jsCallFuncType': [],
23872376
'staticBump': 0,
23882377
'tableSize': 0,
23892378
'initializers': [],

src/support.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ Module['registerFunctions'] = registerFunctions;
602602
#if !WASM_BACKEND && EMULATED_FUNCTION_POINTERS == 0
603603
var jsCallStartIndex = 1;
604604
var functionPointers = new Array({{{ RESERVED_FUNCTION_POINTERS }}});
605-
#endif // EMULATED_FUNCTION_POINTERS == 0
605+
#endif // !WASM_BACKEND && EMULATED_FUNCTION_POINTERS == 0
606606

607607
#if WASM
608608
// Wraps a JS function as a wasm function with a given signature.
@@ -671,7 +671,6 @@ function convertJsFunctionToWasm(func, sig) {
671671
}
672672

673673
// Add a wasm function to the table.
674-
// Attempting to call this with JS function will cause of table.set() to fail
675674
function addWasmFunction(func, sig) {
676675
var table = wasmTable;
677676
var ret = table.length;
@@ -687,10 +686,12 @@ function addWasmFunction(func, sig) {
687686

688687
// Insert new element
689688
try {
689+
// Attempting to call this with JS function will cause of table.set() to fail
690690
table.set(ret, func);
691691
} catch (err) {
692692
if (!err instanceof TypeError)
693693
throw err;
694+
assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');
694695
var wrapped = convertJsFunctionToWasm(func, sig);
695696
table.set(ret, wrapped);
696697
}
@@ -709,9 +710,6 @@ function addFunction(func, sig) {
709710
#endif // ASSERTIONS
710711

711712
#if WASM_BACKEND
712-
assert(typeof sig !== 'undefined',
713-
'Second argument of addFunction should be a wasm function signature ' +
714-
'string');
715713
return addWasmFunction(func, sig);
716714
#else
717715

@@ -753,13 +751,15 @@ function removeFunction(index) {
753751
#if EMULATED_FUNCTION_POINTERS == 0
754752
functionPointers[index-jsCallStartIndex] = null;
755753
#else
754+
#if !WASM
756755
alignFunctionTables(); // XXX we should rely on this being an invariant
757756
var tables = getFunctionTables();
758757
for (var sig in tables) {
759758
tables[sig][index] = null;
760759
}
761760
#endif
762761
#endif
762+
#endif
763763
}
764764

765765
var funcWrappers = {};

0 commit comments

Comments
 (0)