Skip to content

Commit a30679b

Browse files
authored
Move _emval_coro_resume to bind.cpp (emscripten-core#20681)
1 parent a55946d commit a30679b

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

system/include/emscripten/val.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -705,14 +705,6 @@ class val_awaiter {
705705
// of the `co_await ...` expression - in our case, the stored value.
706706
val await_resume() { return std::move(std::get<STATE_RESULT>(state)); }
707707
};
708-
709-
extern "C" {
710-
// JS FFI helper for `val_awaiter::resume_with`.
711-
__attribute__((weak))
712-
void _emval_coro_resume(val_awaiter* awaiter, EM_VAL result) {
713-
awaiter->resume_with(val::take_ownership(result));
714-
}
715-
}
716708
}
717709

718710
// `promise_type` is a well-known subtype with well-known method names

system/lib/embind/bind.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ void _embind_register_bindings(InitFunc* f) {
6363
init_funcs = f;
6464
}
6565

66+
void _emval_coro_resume(val_awaiter* awaiter, EM_VAL result) {
67+
awaiter->resume_with(val::take_ownership(result));
68+
}
69+
6670
}
6771

6872
namespace {

test/code_size/embind_val_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"a.html.gz": 431,
44
"a.js": 7498,
55
"a.js.gz": 3142,
6-
"a.wasm": 9628,
7-
"a.wasm.gz": 4938,
8-
"total": 17799,
9-
"total_gz": 8511
6+
"a.wasm": 11450,
7+
"a.wasm.gz": 5732,
8+
"total": 19621,
9+
"total_gz": 9305
1010
}

test/test_other.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9053,6 +9053,7 @@ def test(check, extra):
90539053
'gl_emu': (['-sLEGACY_GL_EMULATION', '-sMAXIMUM_MEMORY=4GB', '-sALLOW_MEMORY_GROWTH'],),
90549054
'no_exception_throwing': (['-sDISABLE_EXCEPTION_THROWING'],),
90559055
'minimal_runtime': (['-sMINIMAL_RUNTIME'],),
9056+
'embind': (['-lembind'],),
90569057
})
90579058
def test_full_js_library(self, args):
90589059
self.run_process([EMCC, test_file('hello_world.c'), '-sSTRICT_JS', '-sINCLUDE_FULL_LIBRARY'] + args)

tools/system_libs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,7 @@ def __init__(self, **kwargs):
18081808

18091809
def get_cflags(self):
18101810
cflags = super().get_cflags()
1811+
cflags.append('-std=c++20')
18111812
if not self.with_rtti:
18121813
cflags += ['-fno-rtti', '-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0']
18131814
return cflags

0 commit comments

Comments
 (0)