From 507d3f4c60d9973f7486104cb7b5ec613d543a51 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Thu, 13 Nov 2025 17:46:10 -0500 Subject: [PATCH 1/2] fix addEmJs when parameter is indirect pointer --- src/lib/libdylink.js | 2 +- test/other/test_em_js_main.out | 1 + test/other/test_em_js_side.c | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/libdylink.js b/src/lib/libdylink.js index 87f8ea2ee1371..9f45e32cb9900 100644 --- a/src/lib/libdylink.js +++ b/src/lib/libdylink.js @@ -880,7 +880,7 @@ var LibraryDylink = { cSig = cSig.split(','); for (var arg of cSig) { var jsArg = arg.split(' ').pop(); - jsArgs.push(jsArg.replace('*', '')); + jsArgs.push(jsArg.replaceAll('*', '')); } } var func = `(${jsArgs}) => ${body};`; diff --git a/test/other/test_em_js_main.out b/test/other/test_em_js_main.out index eb0ab8066d2b9..cbf7cbf9556da 100644 --- a/test/other/test_em_js_main.out +++ b/test/other/test_em_js_main.out @@ -2,3 +2,4 @@ in main hello from side module 42 + hello hello again hello from void func +hello diff --git a/test/other/test_em_js_side.c b/test/other/test_em_js_side.c index 11844c452a06a..246f9b00efbdc 100644 --- a/test/other/test_em_js_side.c +++ b/test/other/test_em_js_side.c @@ -14,9 +14,15 @@ EM_JS(void, js_side_func_void, (), { out(`hello from void func`); }); +EM_JS(void, js_side_func_indirect_ptr, (const char **pptr), { + out(UTF8ToString(getValue(pptr, '*'))); +}); + int test_side() { + const char *hello = "hello"; js_side_func(42, "hello"); js_side_func2("hello again"); js_side_func_void(); + js_side_func_indirect_ptr(&hello); return 0; } From 91681a3084eb68482036fd33b6973b7b224b5890 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Thu, 13 Nov 2025 17:54:40 -0500 Subject: [PATCH 2/2] Automatic rebaseline of codesize expectations. NFC This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (2) test expectation files were updated by running the tests with `--rebaseline`: ``` codesize/test_codesize_hello_dylink.json: 44307 => 44310 [+3 bytes / +0.01%] codesize/test_codesize_hello_dylink_all.json: 819461 => 819464 [+3 bytes / +0.00%] Average change: +0.00% (+0.00% - +0.01%) ``` --- test/codesize/test_codesize_hello_dylink.json | 8 ++++---- test/codesize/test_codesize_hello_dylink_all.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/codesize/test_codesize_hello_dylink.json b/test/codesize/test_codesize_hello_dylink.json index 565c180431299..0e78d62ce3e77 100644 --- a/test/codesize/test_codesize_hello_dylink.json +++ b/test/codesize/test_codesize_hello_dylink.json @@ -1,10 +1,10 @@ { - "a.out.js": 26546, - "a.out.js.gz": 11349, + "a.out.js": 26549, + "a.out.js.gz": 11353, "a.out.nodebug.wasm": 17761, "a.out.nodebug.wasm.gz": 9003, - "total": 44307, - "total_gz": 20352, + "total": 44310, + "total_gz": 20356, "sent": [ "__syscall_stat64", "emscripten_resize_heap", diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index d8afa1e025859..93a7838e9f34d 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { - "a.out.js": 245299, + "a.out.js": 245302, "a.out.nodebug.wasm": 574162, - "total": 819461, + "total": 819464, "sent": [ "IMG_Init", "IMG_Load",