Skip to content

馃敡 build wasm with DYNAMIC_EXECUTION=0 - #92

Open
ben-polinsky wants to merge 1 commit into
drumath2237:mainfrom
ben-polinsky:feature/#91-dynamic-execution-0
Open

馃敡 build wasm with DYNAMIC_EXECUTION=0#92
ben-polinsky wants to merge 1 commit into
drumath2237:mainfrom
ben-polinsky:feature/#91-dynamic-execution-0

Conversation

@ben-polinsky

Copy link
Copy Markdown

embind builds its argument-marshaling invokers by generating JavaScript source at runtime and compiling it with new Function. Two such sites survive into the published dist, so loadSpz() fails initialization under any Content-Security-Policy without 'unsafe-eval'.

Setting DYNAMIC_EXECUTION=0 makes embind emit its closure-based invoker fallback instead: the same argument marshaling, destructor handling and return conversion, expressed as a closure that iterates the argument-type table at call time. Public API and behavior are unchanged.

See #91

embind builds its argument-marshaling invokers by generating JavaScript
source at runtime and compiling it with `new Function`. Two such sites
survive into the published dist, so `loadSpz()` fails initialization
under any Content-Security-Policy without 'unsafe-eval'.

Setting DYNAMIC_EXECUTION=0 makes embind emit its closure-based invoker
fallback instead: the same argument marshaling, destructor handling and
return conversion, expressed as a closure that iterates the argument-type
table at call time. Public API and behavior are unchanged.

Refs drumath2237#91
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@ben-polinsky

Copy link
Copy Markdown
Author

@drumath2237 Let me know if you'd consider this change.

Some benchmarks - first go.

I rebuilt the stock and DYNAMIC_EXECUTION=0 variants from the same source, SPZ submodule, and Emscripten image. In a local browser, I couldn't measure any observable difference in speed.

@drumath2237

Copy link
Copy Markdown
Owner

@ben-polinsky
Thank you for opening this PR.
I'm sorry, but it will take more time to review because I'm busy with work and other personal projects at the moment.
I will reply when I'm ready to review!

@ben-polinsky

Copy link
Copy Markdown
Author

@ben-polinsky

Thank you for opening this PR.

I'm sorry, but it will take more time to review because I'm busy with work and other personal projects at the moment.

I will reply when I'm ready to review!

All good! Thanks for the check-in.

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

Labels

None yet

Projects

Status: 馃啎 New

Development

Successfully merging this pull request may close these issues.

2 participants