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

Add experimental memory.discard instruction #882

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

bvisness
Copy link
Contributor

@bvisness bvisness commented Jan 20, 2023

Adding support for a memory.discard instruction proposed in the memory control proposal, which I am prototyping within SpiderMonkey.

@eqrion

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks! With a new fresh proposal gating this instruction happy to merge

@@ -325,6 +325,7 @@ macro_rules! for_each_operator {
@bulk_memory DataDrop { data_index: u32 } => visit_data_drop
@bulk_memory MemoryCopy { dst_mem: u32, src_mem: u32 } => visit_memory_copy
@bulk_memory MemoryFill { mem: u32 } => visit_memory_fill
@bulk_memory MemoryDiscard { mem: u32 } => visit_memory_discard
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @bulk_memory here is used as a proposal to gate access to this instruction, so this'll want to be something other than bulk_memory since otherwise memory.discard will be enabled by default.

In lieu of an official proposal, could this perhaps be something like @experimental or @memory_control? That'll require adding a field to WasmFeatures which is ok and would be necessary for this anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add @memory_control I think!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a @memory_control feature. I hope I set true/false correctly in the various places where it was required.

crates/wasmprinter/src/operator.rs Show resolved Hide resolved
@alexcrichton
Copy link
Member

All looks good to me, thanks again! I think CI is showing there's at least one more place to update WasmFeatures though

@bvisness
Copy link
Contributor Author

Just patching up those last couple places. Didn't realize I had to run cargo test --all.

@alexcrichton alexcrichton enabled auto-merge (squash) January 20, 2023 18:35
@alexcrichton alexcrichton merged commit 398b367 into bytecodealliance:main Jan 20, 2023
@alexcrichton alexcrichton mentioned this pull request Jan 20, 2023
@alexcrichton
Copy link
Member

I stepped over myself a bit during publication but these crates are now all published on crates.io

@bvisness bvisness deleted the memory-discard branch January 23, 2023 18:33
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