Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move modularization code into js compiler #23261

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 30, 2024

Prior to this change the mudularization was done as a post-processing step in python. This complicated things since acorn and closure passes would only see the inner code and not the whole module.

One concrete benefit is that we can now use await in the body of the factory function since closure no longer sees it as top level (which it isn't).

Fixes: #23158

@sbc100 sbc100 marked this pull request as draft December 30, 2024 19:40
@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 30, 2024

WDYT @brendandahl ?

sbc100 added a commit to sbc100/emscripten that referenced this pull request Dec 30, 2024
sbc100 added a commit to sbc100/emscripten that referenced this pull request Dec 31, 2024
sbc100 added a commit to sbc100/emscripten that referenced this pull request Dec 31, 2024
sbc100 added a commit that referenced this pull request Dec 31, 2024
@sbc100 sbc100 force-pushed the modularize_closure branch 2 times, most recently from c015e1f to 04c36e3 Compare December 31, 2024 00:32
sbc100 added a commit to sbc100/emscripten that referenced this pull request Dec 31, 2024
Processing them early (in phase_linker_setup) meant that they values
of some settings had not yet been finalized.

Split out from emscripten-core#23261
sbc100 added a commit that referenced this pull request Dec 31, 2024
Processing them early (in phase_linker_setup) meant that they values of
some settings had not yet been finalized.

Split out from #23261
@sbc100 sbc100 force-pushed the modularize_closure branch from 04c36e3 to 9c7603d Compare January 2, 2025 20:39
sbc100 added a commit to sbc100/emscripten that referenced this pull request Jan 2, 2025
I don't see why `-sMINIMAL_RUNTIME` users would not want the same
exporting of the module.  The EXPORT_ES6 behaviour was already matching.
This change is necessary are part of emscripten-core#23261 which feeds the modularized
code through closure and our acorn optimizations.  Without this closer
things the entire module factory is seen as unused and is deleted.
sbc100 added 2 commits January 3, 2025 13:52
I don't see why `-sMINIMAL_RUNTIME` users would not want the same
exporting of the module.  The EXPORT_ES6 behaviour was already matching.
This change is necessary are part of emscripten-core#23261 which feeds the modularized
code through closure and our acorn optimizations.  Without this closer
things the entire module factory is seen as unused and is deleted.
fafb1a877e851f84c71de6531fe37de2c7700c29
Move modularization code into js compiler

Prior to this change the mudularization was done as a post-processing
step in python.  This complicated things since acorn and closure passes
would only see the inner code and not the whole module.

One concrete benefit is that we can now use `await` in the body of the
factory function since closure no longer sees it as top level (which it
isn't).

Fixes: emscripten-core#23158, emscripten-core#23283
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.

Closure only runs on the subset of the generated JS code not, for example, modularized code
1 participant