-
Notifications
You must be signed in to change notification settings - Fork 786
Refactor Host expression to MemorySize and MemoryGrow #3137
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
Conversation
|
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.
Thanks for doing this :)
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.
Can you add readsMemory
to memory.grow as well? It technically does a read-modify-write operation on the memory size in the successful case and just a read operation on the memory size in the failure case.
|
This caused a ton of conflicts in #3130.. given that this was just a nice to have refactor, that could have waited. |
Oh, sorry, I actually thought this would help to tackle the |
I've already made all the changes. |
Would it be possible to pass it upon construction of the respective expression and keep it as a field, like in the builder? |
That would be fine with me.. @kripken does that sound acceptable? I guess the total number of |
I would add it as an argument to the finalize calls and force everyone that explicitly calls |
Given these are rare nodes, memory isn't an issue, yeah. So it could be either way. I think I agree with @tlively that passing it to finalize makes sense (avoids duplicating info that could get stale). |
@tlively that's what we had so far, but it was problematic, since finalize is called from sites that don't have the current memory/module already available. |
@aardappel can you share a link to such a site in your PR? |
@tlively it's in one of the comments on the PR #3130:
But I've already changed it to work the way @dcodeIO suggested. |
The complexity of the
Host
expression in the C and JS APIs has bugged me for quite a while, and in #3130 (comment) I was reminded of it, so I thought I may as well just refactor it to get it out of the way. Now aligns well with other memory instructions, passes can optimizememory.size
away if unused, and the APIs are much simpler.