Skip to content

Remove internal JS settings in favor of EmccOptions fields - #27537

Draft
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:opt-level-options
Draft

Remove internal JS settings in favor of EmccOptions fields#27537
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:opt-level-options

Conversation

@sbc100

@sbc100 sbc100 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Remove internal settings OPT_LEVEL, USE_RTTI, DEBUG_LEVEL, EMIT_SYMBOL_MAP, SOURCE_MAP_BASE, and MINIFICATION_MAP from src/settings_internal.js and tools/settings.py since they are toolchain-internal settings not used in JavaScript libraries or runtime code. Store their state on EmccOptions fields instead.

Remove internal settings `OPT_LEVEL`, `USE_RTTI`, `DEBUG_LEVEL`,
`EMIT_SYMBOL_MAP`, `SOURCE_MAP_BASE`, and `MINIFICATION_MAP` from
`src/settings_internal.js` and `tools/settings.py` since they are
toolchain-internal settings not used in JavaScript libraries or runtime
code. Store their state on `EmccOptions` fields instead.
@sbc100 sbc100 changed the title Remove internal settings in favor of EmccOptions fields Remove internal JS settings in favor of EmccOptions fields Aug 14, 2026
@sbc100
sbc100 requested review from dschuff and kripken August 14, 2026 17:57
@sbc100
sbc100 marked this pull request as draft August 14, 2026 18:13
@dschuff

dschuff commented Aug 14, 2026

Copy link
Copy Markdown
Member

So the idea is that settings would only be for things that are needed in JS libraries?
I will say the distinction has so far been unclear to me, so this can make sense. maybe we could even rename it for clarity. Does Settings directly correspond to -s options on the command line?

@sbc100

sbc100 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

So the idea is that settings would only be for things that are needed in JS libraries? I will say the distinction has so far been unclear to me, so this can make sense.
maybe we could even rename it for clarity. Does Settings directly correspond to -s options on the command line?

Public settings do correspond to -s flags. For internal settings they cannot be set with -s flags but are set indirectly.

All public and internal settings get serialized to from python to the JS compiler and the JS compiler can use things like #if INTERNAL_SETTING. So my feeling is that we should avoid adding internal settings if/when we an just keep things internal to python. It saves a little bit of serializing cost and it avoids user JS libraries accidentally depending on internal things that we would prefer them not to depend on. i.e. normally we just assume that we can rename/delete internal settings at will, and we do, but technically user JS could be depending on them.

@dschuff dschuff 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.

Makes sense to me.

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