Skip to content

Commit

Permalink
Remove dead code from callRuntimeCallbacks. NFC
Browse files Browse the repository at this point in the history
Runtime callbacks can only be functions, not numbers.  In the past we
used to handle C atexit using this mechansim which is why this used to
be needed but that changd in #15905.
  • Loading branch information
sbc100 committed Jun 23, 2022
1 parent 25591f3 commit c0eab28
Show file tree
Hide file tree
Showing 32 changed files with 32 additions and 46 deletions.
16 changes: 1 addition & 15 deletions src/library.js
Expand Up @@ -3250,22 +3250,8 @@ mergeInto(LibraryManager.library, {
var callback = callbacks.shift();
if (typeof callback == 'function') {
callback(Module); // Pass the module as the first argument.
continue;
}
var func = callback.func;
if (typeof func == 'number') {
if (callback.arg === undefined) {
// Run the wasm function ptr with signature 'v'. If no function
// with such signature was exported, this call does not need
// to be emitted (and would confuse Closure)
{{{ makeDynCall('v', 'func') }}}();
} else {
// If any function with signature 'vi' was exported, run
// the callback with that signature.
{{{ makeDynCall('vi', 'func') }}}(callback.arg);
}
} else {
func(callback.arg === undefined ? null : callback.arg);
callback.func(callback.arg === undefined ? null : callback.arg);
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_cxx_ctors1.jssize
@@ -1 +1 @@
26479
26272
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_cxx_ctors2.jssize
@@ -1 +1 @@
26442
26236
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_cxx_except.jssize
@@ -1 +1 @@
31733
31666
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_cxx_except_wasm.jssize
@@ -1 +1 @@
26632
26426
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_cxx_mangle.jssize
@@ -1 +1 @@
31833
31766
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_cxx_noexcept.jssize
@@ -1 +1 @@
26479
26272
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_hello_O0.jssize
@@ -1 +1 @@
27026
26693
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_hello_O1.jssize
@@ -1 +1 @@
9622
9331
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_hello_O2.jssize
@@ -1 +1 @@
6911
6706
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_hello_O3.jssize
@@ -1 +1 @@
6246
6066
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_hello_Os.jssize
@@ -1 +1 @@
6156
6066
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_hello_Oz.jssize
@@ -1 +1 @@
6115
6025
@@ -1 +1 @@
4823
4736
@@ -1 +1 @@
5446
5275
@@ -1 +1 @@
5548
5351
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_mem_O3.jssize
@@ -1 +1 @@
6395
6216
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_mem_O3_grow.jssize
@@ -1 +1 @@
6726
6546
@@ -1 +1 @@
6051
5849
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_mem_O3_standalone.jssize
@@ -1 +1 @@
5974
5773
@@ -1 +1 @@
5471
5276
@@ -1 +1 @@
5548
5351
@@ -1 +1 @@
5548
5351
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_O0.jssize
@@ -1 +1 @@
21715
21384
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_O1.jssize
@@ -1 +1 @@
6078
5796
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_O2.jssize
@@ -1 +1 @@
4699
4504
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_O3.jssize
@@ -1 +1 @@
4123
3952
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_Os.jssize
@@ -1 +1 @@
4039
3952
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_Oz-ctors.jssize
@@ -1 +1 @@
3928
3841
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_Oz.jssize
@@ -1 +1 @@
4039
3952
2 changes: 1 addition & 1 deletion tests/other/metadce/test_metadce_minimal_pthreads.jssize
@@ -1 +1 @@
16051
15976
2 changes: 1 addition & 1 deletion tests/test_other.py
Expand Up @@ -9927,7 +9927,7 @@ def test(args):
# Changing this option to [] should decrease code size.
self.assertLess(changed, normal)
# Check an absolute code size as well, with some slack.
self.assertLess(abs(changed - 4975), 150)
self.assertLess(abs(changed - 4748), 150)

def test_INCOMING_MODULE_JS_API_missing(self):
create_file('pre.js', '''
Expand Down

0 comments on commit c0eab28

Please sign in to comment.