Skip to content

Commit de71520

Browse files
authored
library_async.js cleanup (#11867)
Follow up to #11868 * Fix subtle regression in `emscripten_scan_registers` introduced by #9859 * Replace some hardcoded offsets with `C_STRUCT` references * Remove stub functions for the old fastcomp-only coroutines API
1 parent 9b5c5b9 commit de71520

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

src/library_async.js

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ mergeInto(LibraryManager.library, {
345345
// We must first unwind, so things are spilled to the stack. We
346346
// can resume right after unwinding, no need for a timeout.
347347
Asyncify.afterUnwind = function() {
348-
{{{ makeDynCall('vii') }}}(func, Asyncify.currData + 8, HEAP32[Asyncify.currData >> 2]);
348+
var stackBegin = Asyncify.currData + {{{ C_STRUCTS.asyncify_data_s.__size__ }}};
349+
var stackEnd = HEAP32[Asyncify.currData >> 2];
350+
{{{ makeDynCall('vii') }}}(func, stackBegin, stackEnd);
349351
wakeUp();
350352
};
351353
});
@@ -408,7 +410,7 @@ mergeInto(LibraryManager.library, {
408410
var userData = {{{ makeGetValue('newFiber', C_STRUCTS.emscripten_fiber_s.user_data, 'i32') }}};
409411
{{{ makeDynCall('vi') }}}(entryPoint, userData);
410412
} else {
411-
var asyncifyData = newFiber + 20;
413+
var asyncifyData = newFiber + {{{ C_STRUCTS.emscripten_fiber_s.asyncify_data }}};
412414
Asyncify.currData = asyncifyData;
413415

414416
#if ASYNCIFY_DEBUG
@@ -487,36 +489,17 @@ mergeInto(LibraryManager.library, {
487489
Asyncify.currData = null;
488490
}
489491
},
490-
491-
emscripten_coroutine_create: function() {
492-
throw 'emscripten_coroutine_create has been removed. Please use the Fibers API';
493-
},
494-
emscripten_coroutine_next: function() {
495-
throw 'emscripten_coroutine_next has been removed. Please use the Fibers API';
496-
},
497-
emscripten_yield: function() {
498-
throw 'emscripten_yield has been removed. Please use the Fibers API';
499-
},
500492
#else // ASYNCIFY
501493
emscripten_sleep: function() {
502494
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_sleep';
503495
},
504-
emscripten_coroutine_create: function() {
505-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_coroutine_create';
506-
},
507-
emscripten_coroutine_next: function() {
508-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_coroutine_next';
509-
},
510-
emscripten_yield: function() {
511-
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_yield';
512-
},
513-
emscripten_wget: function(url, file) {
496+
emscripten_wget: function() {
514497
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget';
515498
},
516-
emscripten_wget_data: function(url, file) {
499+
emscripten_wget_data: function() {
517500
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_wget_data';
518501
},
519-
emscripten_scan_registers: function(url, file) {
502+
emscripten_scan_registers: function() {
520503
throw 'Please compile your program with async support in order to use asynchronous operations like emscripten_scan_registers';
521504
},
522505
emscripten_fiber_init: function() {

0 commit comments

Comments
 (0)