Skip to content

Update closure-compiler. NFC - #24679

Closed
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:update_closure
Closed

Update closure-compiler. NFC#24679
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:update_closure

Conversation

@sbc100

@sbc100 sbc100 commented Jul 9, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@sbc100
sbc100 requested a review from kripken July 9, 2025 23:52
@sbc100
sbc100 enabled auto-merge (squash) July 9, 2025 23:54

@kripken kripken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code diffs look fine, but most of the size changes are small but worse. Maybe worth investigating one to see what changed?

@sbc100

sbc100 commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator Author

files.zip

@sbc100

sbc100 commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator Author

I attached the JS generated for the test_minimal_runtime_code_size_hello_embind test. The size differs by just one byte, but if I clang-format the files they don't differ at all.

Any idea how to find which is the differing byte here?

@sbc100

sbc100 commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator Author

Ah, I found an interesting hunk in the code generated by test_codesize_mem_O3_standalone_narg_flto:

@@ -139,7 +139,7 @@
   if (b.instantiateWasm)
     return new Promise(d => {b.instantiateWasm(c, (f, e) => {d(a(f, e))})});
   z ??= b.locateFile ? b.locateFile("a.out.wasm", n) : n + "a.out.wasm";
-  return a((await C(c)).instance)
+  return function(d) { return a(d.instance) }(await C(c))

@sbc100

sbc100 commented Jul 15, 2025

Copy link
Copy Markdown
Collaborator Author

Looks like maybe some subtle async/await difference ?

@kripken

kripken commented Jul 15, 2025

Copy link
Copy Markdown
Member
-  return a((await C(c)).instance)
+  return function(d) { return a(d.instance) }(await C(c))

Hmm these are identical in every way I think, except that a stack trace would show that nameless thunk function..? Weird closure doesn't remove it, since it does inlining etc. so it is ok with changes to stack traces in principle.

@sbc100

sbc100 commented May 11, 2026

Copy link
Copy Markdown
Collaborator Author

Closing favor of #26869

@sbc100 sbc100 closed this May 11, 2026
auto-merge was automatically disabled May 11, 2026 02:57

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants