-
Notifications
You must be signed in to change notification settings - Fork 107
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
experiment: lazy migration for stable memory for regions #4171
Conversation
…ses ifs consuming multiple values that trip up wasmopt (sigh)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, modulo the StableMem
and StableMemory
distinction in compile.ml
. Maybe we can combine and consolidate these in the future, or explain why they are separate?
Okay. Sounds good.
Also sounds good. |
@matthewhammer thanks for taking a look! |
@@ -532,8 +532,17 @@ module E = struct | |||
| ts -> VarBlockType (nr (func_type env (FuncType ([], ts)))) | |||
|
|||
let if_ env tys thn els = G.if_ (as_block_type env tys) thn els | |||
|
|||
(* NB: confuses wasm-opt, don't use for now | |||
let _multi_if_ env tys1 tys2 thn els = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity: Is wasm-opt
failing or creating invalid code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully recall, but I think it was failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit 280ed54 produces this error. Basically I was trying to conditionally call one of two functions with args already on the stack and wasm-opt barfed:
test-bench> @@ -0,0 +1,4 @@
test-bench> +Error: Failed to read module
test-bench> +
test-bench> +Caused by:
test-bench> + [parse exception: Block requires more values than are available (at 0:57416)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably be a good citizen and report the bug, but I'd rather make progress..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great simplification with lazy region metadata allocation.
Also, very nice refactoring regarding region0
.
…really); change assert in get_region0 to debug assert for perf
builds on the unwieldly #3768.
Introduces lazy migration of stable memory format 0/1 (no ESM, some ESM) to 2 (Regions) by
As a result programs have zero overhead until they allocate the first region and all programs can access Region.mo without having to set a flag.
In addition, ExperimentalStableMemory retains the same low space overhead as before, at least until the first region is allocated. Each ESM read-write is slightly slower since it has to switch on the version, but I can live with that.
Avoids:
Removes the need for a user facing --stable-regions flag. Instead, for testing, the flag now just forces eager
(not lazy) migration to version 2.
Drive-by: remove prim stableMemoryRegion since its dangerous (the region returned won't alias the internal region0 after an upgrade without more work).