Skip to content

Commit 411f677

Browse files
authored
Merge pull request #4894 from juj/no_dyncall_garbage
no_dyncall_garbage
2 parents f682375 + 7ee40f3 commit 411f677

13 files changed

+104
-105
lines changed

src/Fetch.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function emscripten_start_fetch(fetch, successcb, errorcb, progresscb) {
478478
#if FETCH_DEBUG
479479
console.log('fetch: operation success. e: ' + e);
480480
#endif
481-
if (onsuccess && Runtime.dynCall) Runtime.dynCall('vi', onsuccess, [fetch]);
481+
if (onsuccess && Runtime.dynCall) Module['dynCall_vi'](onsuccess, fetch);
482482
else if (successcb) successcb(fetch);
483483
};
484484

@@ -497,20 +497,20 @@ function emscripten_start_fetch(fetch, successcb, errorcb, progresscb) {
497497
#endif
498498
};
499499
__emscripten_fetch_cache_data(Fetch.dbInstance, fetch, xhr.response, storeSuccess, storeError);
500-
if (onsuccess && Runtime.dynCall) Runtime.dynCall('vi', onsuccess, [fetch]);
500+
if (onsuccess && Runtime.dynCall) Module['dynCall_vi'](onsuccess, fetch);
501501
else if (successcb) successcb(fetch);
502502
};
503503

504504
var reportProgress = function(fetch, xhr, e) {
505-
if (onprogress && Runtime.dynCall) Runtime.dynCall('vi', onprogress, [fetch]);
505+
if (onprogress && Runtime.dynCall) Module['dynCall_vi'](onprogress, fetch);
506506
else if (progresscb) progresscb(fetch);
507507
};
508508

509509
var reportError = function(fetch, xhr, e) {
510510
#if FETCH_DEBUG
511511
console.error('fetch: operation failed: ' + e);
512512
#endif
513-
if (onerror && Runtime.dynCall) Runtime.dynCall('vi', onerror, [fetch]);
513+
if (onerror && Runtime.dynCall) Module['dynCall_vi'](onerror, fetch);
514514
else if (errorcb) errorcb(fetch);
515515
};
516516

src/library.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,10 @@ LibraryManager.library = {
10921092
if (info.refcount === 0 && !info.rethrown) {
10931093
if (info.destructor) {
10941094
#if WASM_BACKEND == 0
1095-
Runtime.dynCall('vi', info.destructor, [ptr]);
1095+
Module['dynCall_vi'](info.destructor, ptr);
10961096
#else
10971097
// In Wasm, destructors return 'this' as in ARM
1098-
Runtime.dynCall('ii', info.destructor, [ptr]);
1098+
Module['dynCall_ii'](info.destructor, ptr);
10991099
#endif
11001100
}
11011101
delete EXCEPTIONS.infos[ptr];
@@ -4192,7 +4192,7 @@ LibraryManager.library = {
41924192
var trace = _emscripten_get_callstack_js();
41934193
var parts = trace.split('\n');
41944194
for (var i = 0; i < parts.length; i++) {
4195-
var ret = Runtime.dynCall('iii', [0, arg]);
4195+
var ret = Module['dynCall_iii'](func, 0, arg);
41964196
if (ret !== 0) return;
41974197
}
41984198
},

src/library_browser.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ var LibraryBrowser = {
746746
function doCallback(callback) {
747747
if (callback) {
748748
var stack = Runtime.stackSave();
749-
Runtime.dynCall('vi', callback, [allocate(intArrayFromString(_file), 'i8', ALLOC_STACK)]);
749+
Module['dynCall_vi'](callback, allocate(intArrayFromString(_file), 'i8', ALLOC_STACK));
750750
Runtime.stackRestore(stack);
751751
}
752752
}
@@ -778,10 +778,10 @@ var LibraryBrowser = {
778778
Browser.asyncLoad(Pointer_stringify(url), function(byteArray) {
779779
var buffer = _malloc(byteArray.length);
780780
HEAPU8.set(byteArray, buffer);
781-
Runtime.dynCall('viii', onload, [arg, buffer, byteArray.length]);
781+
Module['dynCall_viii'](onload, arg, buffer, byteArray.length);
782782
_free(buffer);
783783
}, function() {
784-
if (onerror) Runtime.dynCall('vi', onerror, [arg]);
784+
if (onerror) Module['dynCall_vi'](onerror, arg);
785785
}, true /* no need for run dependency, this is async but will not do any prepare etc. step */ );
786786
},
787787

@@ -816,27 +816,27 @@ var LibraryBrowser = {
816816
FS.createDataFile( _file.substr(0, index), _file.substr(index + 1), new Uint8Array(http.response), true, true, false);
817817
if (onload) {
818818
var stack = Runtime.stackSave();
819-
Runtime.dynCall('viii', onload, [handle, arg, allocate(intArrayFromString(_file), 'i8', ALLOC_STACK)]);
819+
Module['dynCall_viii'](onload, handle, arg, allocate(intArrayFromString(_file), 'i8', ALLOC_STACK));
820820
Runtime.stackRestore(stack);
821821
}
822822
} else {
823-
if (onerror) Runtime.dynCall('viii', onerror, [handle, arg, http.status]);
823+
if (onerror) Module['dynCall_viii'](onerror, handle, arg, http.status);
824824
}
825825

826826
delete Browser.wgetRequests[handle];
827827
};
828828

829829
// ERROR
830830
http.onerror = function http_onerror(e) {
831-
if (onerror) Runtime.dynCall('viii', onerror, [handle, arg, http.status]);
831+
if (onerror) Module['dynCall_viii'](onerror, handle, arg, http.status);
832832
delete Browser.wgetRequests[handle];
833833
};
834834

835835
// PROGRESS
836836
http.onprogress = function http_onprogress(e) {
837837
if (e.lengthComputable || (e.lengthComputable === undefined && e.total != 0)) {
838838
var percentComplete = (e.loaded / e.total)*100;
839-
if (onprogress) Runtime.dynCall('viii', onprogress, [handle, arg, percentComplete]);
839+
if (onprogress) Module['dynCall_viii'](onprogress, handle, arg, percentComplete);
840840
}
841841
};
842842

@@ -881,25 +881,25 @@ var LibraryBrowser = {
881881
var byteArray = new Uint8Array(http.response);
882882
var buffer = _malloc(byteArray.length);
883883
HEAPU8.set(byteArray, buffer);
884-
if (onload) Runtime.dynCall('viiii', onload, [handle, arg, buffer, byteArray.length]);
884+
if (onload) Module['dynCall_viiii'](onload, handle, arg, buffer, byteArray.length);
885885
if (free) _free(buffer);
886886
} else {
887-
if (onerror) Runtime.dynCall('viiii', onerror, [handle, arg, http.status, http.statusText]);
887+
if (onerror) Module['dynCall_viiii'](onerror, handle, arg, http.status, http.statusText);
888888
}
889889
delete Browser.wgetRequests[handle];
890890
};
891891

892892
// ERROR
893893
http.onerror = function http_onerror(e) {
894894
if (onerror) {
895-
Runtime.dynCall('viiii', onerror, [handle, arg, http.status, http.statusText]);
895+
Module['dynCall_viiii'](onerror, handle, arg, http.status, http.statusText);
896896
}
897897
delete Browser.wgetRequests[handle];
898898
};
899899

900900
// PROGRESS
901901
http.onprogress = function http_onprogress(e) {
902-
if (onprogress) Runtime.dynCall('viiii', onprogress, [handle, arg, e.loaded, e.lengthComputable || e.lengthComputable === undefined ? e.total : 0]);
902+
if (onprogress) Module['dynCall_viiii'](onprogress, handle, arg, e.loaded, e.lengthComputable || e.lengthComputable === undefined ? e.total : 0);
903903
};
904904

905905
// ABORT
@@ -945,10 +945,10 @@ var LibraryBrowser = {
945945
PATH.basename(_file),
946946
new Uint8Array(data.object.contents), true, true,
947947
function() {
948-
if (onload) Runtime.dynCall('vi', onload, [file]);
948+
if (onload) Module['dynCall_vi'](onload, file);
949949
},
950950
function() {
951-
if (onerror) Runtime.dynCall('vi', onerror, [file]);
951+
if (onerror) Module['dynCall_vi'](onerror, file);
952952
},
953953
true // don'tCreateFile - it's already there
954954
);
@@ -970,10 +970,10 @@ var LibraryBrowser = {
970970
{{{ makeHEAPView('U8', 'data', 'data + size') }}},
971971
true, true,
972972
function() {
973-
if (onload) Runtime.dynCall('vii', onload, [arg, cname]);
973+
if (onload) Module['dynCall_vii'](onload, arg, cname);
974974
},
975975
function() {
976-
if (onerror) Runtime.dynCall('vi', onerror, [arg]);
976+
if (onerror) Module['dynCall_vi'](onerror, arg);
977977
},
978978
true // don'tCreateFile - it's already there
979979
);
@@ -1076,13 +1076,12 @@ var LibraryBrowser = {
10761076

10771077
var browserIterationFunc;
10781078
if (typeof arg !== 'undefined') {
1079-
var argArray = [arg];
10801079
browserIterationFunc = function() {
1081-
Runtime.dynCall('vi', func, argArray);
1080+
Module['dynCall_vi'](func, arg);
10821081
};
10831082
} else {
10841083
browserIterationFunc = function() {
1085-
Runtime.dynCall('v', func);
1084+
Module['dynCall_v'](func);
10861085
};
10871086
}
10881087

@@ -1197,14 +1196,14 @@ var LibraryBrowser = {
11971196

11981197
_emscripten_push_main_loop_blocker: function(func, arg, name) {
11991198
Browser.mainLoop.queue.push({ func: function() {
1200-
Runtime.dynCall('vi', func, [arg]);
1199+
Module['dynCall_vi'](func, arg);
12011200
}, name: Pointer_stringify(name), counted: true });
12021201
Browser.mainLoop.updateStatus();
12031202
},
12041203

12051204
_emscripten_push_uncounted_main_loop_blocker: function(func, arg, name) {
12061205
Browser.mainLoop.queue.push({ func: function() {
1207-
Runtime.dynCall('vi', func, [arg]);
1206+
Module['dynCall_vi'](func, arg);
12081207
}, name: Pointer_stringify(name), counted: false });
12091208
Browser.mainLoop.updateStatus();
12101209
},

src/library_glfw.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ var LibraryGLFW = {
349349
if (charCode == 0 || (charCode >= 0x00 && charCode <= 0x1F)) return;
350350

351351
#if USE_GLFW == 2
352-
Runtime.dynCall('vii', GLFW.active.charFunc, [charCode, 1]);
352+
Module['dynCall_vii'](GLFW.active.charFunc, charCode, 1);
353353
#endif
354354

355355
#if USE_GLFW == 3
356-
Runtime.dynCall('vii', GLFW.active.charFunc, [GLFW.active.id, charCode]);
356+
Module['dynCall_vii'](GLFW.active.charFunc, GLFW.active.id, charCode);
357357
#endif
358358
},
359359

@@ -370,12 +370,12 @@ var LibraryGLFW = {
370370
if (!GLFW.active.keyFunc) return;
371371

372372
#if USE_GLFW == 2
373-
Runtime.dynCall('vii', GLFW.active.keyFunc, [key, status]);
373+
Module['dynCall_vii'](GLFW.active.keyFunc, key, status);
374374
#endif
375375

376376
#if USE_GLFW == 3
377377
if (repeat) status = 2; // GLFW_REPEAT
378-
Runtime.dynCall('viiiii', GLFW.active.keyFunc, [GLFW.active.id, key, event.keyCode, status, GLFW.getModBits(GLFW.active)]);
378+
Module['dynCall_viiiii'](GLFW.active.keyFunc, GLFW.active.id, key, event.keyCode, status, GLFW.getModBits(GLFW.active));
379379
#endif
380380
},
381381

@@ -402,11 +402,11 @@ var LibraryGLFW = {
402402
if (event.target != Module["canvas"] || !GLFW.active.cursorPosFunc) return;
403403

404404
#if USE_GLFW == 2
405-
Runtime.dynCall('vii', GLFW.active.cursorPosFunc, [Browser.mouseX, Browser.mouseY]);
405+
Module['dynCall_vii'](GLFW.active.cursorPosFunc, Browser.mouseX, Browser.mouseY);
406406
#endif
407407

408408
#if USE_GLFW == 3
409-
Runtime.dynCall('vidd', GLFW.active.cursorPosFunc, [GLFW.active.id, Browser.mouseX, Browser.mouseY]);
409+
Module['dynCall_vidd'](GLFW.active.cursorPosFunc, GLFW.active.id, Browser.mouseX, Browser.mouseY);
410410
#endif
411411
},
412412

@@ -430,7 +430,7 @@ var LibraryGLFW = {
430430
if (event.target != Module["canvas"] || !GLFW.active.cursorEnterFunc) return;
431431

432432
#if USE_GLFW == 3
433-
Runtime.dynCall('vii', GLFW.active.cursorEnterFunc, [GLFW.active.id, 1]);
433+
Module['dynCall_vii'](GLFW.active.cursorEnterFunc, GLFW.active.id, 1);
434434
#endif
435435
},
436436

@@ -440,7 +440,7 @@ var LibraryGLFW = {
440440
if (event.target != Module["canvas"] || !GLFW.active.cursorEnterFunc) return;
441441

442442
#if USE_GLFW == 3
443-
Runtime.dynCall('vii', GLFW.active.cursorEnterFunc, [GLFW.active.id, 0]);
443+
Module['dynCall_vii'](GLFW.active.cursorEnterFunc, GLFW.active.id, 0);
444444
#endif
445445
},
446446

@@ -465,11 +465,11 @@ var LibraryGLFW = {
465465
if (!GLFW.active.mouseButtonFunc) return;
466466

467467
#if USE_GLFW == 2
468-
Runtime.dynCall('vii', GLFW.active.mouseButtonFunc, [eventButton, status]);
468+
Module['dynCall_vii'](GLFW.active.mouseButtonFunc, eventButton, status);
469469
#endif
470470

471471
#if USE_GLFW == 3
472-
Runtime.dynCall('viiii', GLFW.active.mouseButtonFunc, [GLFW.active.id, eventButton, status, GLFW.getModBits(GLFW.active)]);
472+
Module['dynCall_viiii'](GLFW.active.mouseButtonFunc, GLFW.active.id, eventButton, status, GLFW.getModBits(GLFW.active));
473473
#endif
474474
},
475475

@@ -492,7 +492,7 @@ var LibraryGLFW = {
492492
if (!GLFW.active || !GLFW.active.scrollFunc || event.target != Module['canvas']) return;
493493

494494
#if USE_GLFW == 2
495-
Runtime.dynCall('vi', GLFW.active.scrollFunc, [GLFW.wheelPos]);
495+
Module['dynCall_vi'](GLFW.active.scrollFunc, GLFW.wheelPos);
496496
#endif
497497

498498
#if USE_GLFW == 3
@@ -506,7 +506,7 @@ var LibraryGLFW = {
506506
sy = event.deltaY;
507507
}
508508

509-
Runtime.dynCall('vidd', GLFW.active.scrollFunc, [GLFW.active.id, sx, sy]);
509+
Module['dynCall_vidd'](GLFW.active.scrollFunc, GLFW.active.id, sx, sy);
510510
#endif
511511

512512
event.preventDefault();
@@ -561,11 +561,11 @@ var LibraryGLFW = {
561561
if (!GLFW.active.windowSizeFunc) return;
562562

563563
#if USE_GLFW == 2
564-
Runtime.dynCall('vii', GLFW.active.windowSizeFunc, [GLFW.active.width, GLFW.active.height]);
564+
Module['dynCall_vii'](GLFW.active.windowSizeFunc, GLFW.active.width, GLFW.active.height);
565565
#endif
566566

567567
#if USE_GLFW == 3
568-
Runtime.dynCall('viii', GLFW.active.windowSizeFunc, [GLFW.active.id, GLFW.active.width, GLFW.active.height]);
568+
Module['dynCall_viii'](GLFW.active.windowSizeFunc, GLFW.active.id, GLFW.active.width, GLFW.active.height);
569569
#endif
570570
},
571571

@@ -575,7 +575,7 @@ var LibraryGLFW = {
575575
if (!GLFW.active.framebufferSizeFunc) return;
576576

577577
#if USE_GLFW == 3
578-
Runtime.dynCall('viii', GLFW.active.framebufferSizeFunc, [GLFW.active.id, GLFW.active.width, GLFW.active.height]);
578+
Module['dynCall_viii'](GLFW.active.framebufferSizeFunc, GLFW.active.id, GLFW.active.width, GLFW.active.height);
579579
#endif
580580
},
581581

@@ -669,7 +669,7 @@ var LibraryGLFW = {
669669
// function returns.
670670
// GLFW3 on the over hand doesn't have this behavior (https://github.com/glfw/glfw/issues/62).
671671
if (!win.windowSizeFunc) return;
672-
Runtime.dynCall('vii', win.windowSizeFunc, [win.width, win.height]);
672+
Module['dynCall_vii'](win.windowSizeFunc, win.width, win.height);
673673
#endif
674674
},
675675

@@ -815,11 +815,11 @@ var LibraryGLFW = {
815815
if (!win.windowSizeFunc) return;
816816

817817
#if USE_GLFW == 2
818-
Runtime.dynCall('vii', win.windowSizeFunc, [width, height]);
818+
Module['dynCall_vii'](win.windowSizeFunc, width, height);
819819
#endif
820820

821821
#if USE_GLFW == 3
822-
Runtime.dynCall('viii', win.windowSizeFunc, [win.id, width, height]);
822+
Module['dynCall_viii'](win.windowSizeFunc, win.id, width, height);
823823
#endif
824824
},
825825

@@ -875,7 +875,7 @@ var LibraryGLFW = {
875875

876876
#if USE_GLFW == 3
877877
if (win.windowCloseFunc)
878-
Runtime.dynCall('vi', win.windowCloseFunc, [win.id]);
878+
Module['dynCall_vi'](win.windowCloseFunc, win.id);
879879
#endif
880880

881881
GLFW.windows[win.id - 1] = null;

0 commit comments

Comments
 (0)