You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two ways I can think of doing this (one more preferred IMO than the other).
Preferred: extract this value from the binary. We're already doing this when trying to determine the initial memory page size here.
We'll need to analyze the wasm binary to find the best way to do this. I'd recommend the following approach:
build module "foo" twice, with two different ASYNCIFY_STACK_SIZEs
convert both to WAT
diff, and see where the stack size is stored (most likely in the "length" property of a global buffer instance)
If we can extract this stack size in a deterministic way with all asyncify-compiled modules, then we should continue with this approach.
Fallback: Inject a getter into the wasm binary upon compilation. Maybe something like _wrap_compiler_config which returns a tuple of (version, config). In the initial implementation, version would be 0x01 and config would be a single value $ASYNCIFY_STACK_SIZE.
Activity
dOrgJelli commentedon Jun 26, 2023
Two ways I can think of doing this (one more preferred IMO than the other).
Preferred: extract this value from the binary. We're already doing this when trying to determine the initial memory page size here.
We'll need to analyze the wasm binary to find the best way to do this. I'd recommend the following approach:
ASYNCIFY_STACK_SIZEsIf we can extract this stack size in a deterministic way with all asyncify-compiled modules, then we should continue with this approach.
Fallback: Inject a getter into the wasm binary upon compilation. Maybe something like
_wrap_compiler_configwhich returns a tuple of(version, config). In the initial implementation,versionwould be0x01andconfigwould be a single value$ASYNCIFY_STACK_SIZE.dOrgJelli commentedon Jun 26, 2023
EDIT! before proceeding with the above, we should probably revisit this code here:
javascript-client/packages/asyncify/src/AsyncWasmInstance.ts
Lines 134 to 137 in 9aee0cf
It could actually be the case that we're overwriting existing values in the wasm module with our hard-coded ones in JS.