-
Notifications
You must be signed in to change notification settings - Fork 786
[custom-descriptors] Update struct.new parsing and validation #7643
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
When allocating structs that have custom descriptors, struct.new and struct.new_default must take an additional operand for the descriptor.
src/wasm.h
Outdated
|
||
bool isWithDefault() { | ||
return hasDescriptor() ? (operands.size() == 1) : operands.empty(); | ||
} |
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.
The comment on line 1670 should be updated?
But, perhaps another option is to add a designated field for this?
Expression* descriptor = nullptr;
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.
Yes, adding an optional designated field probably makes sense.
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.
Following offline discussion I'll work towards that in this branch.
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.
@tlively done, ptal
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, LGTM % comment. Thanks for taking this over. (GH won't let me hit the approve button because it's my PR originally.)
src/wasm/wasm-ir-builder.cpp
Outdated
curr.operands.resize(type.getStruct().fields.size()); | ||
CHECK_ERR(visitStructNew(&curr)); | ||
push(builder.makeStructNew(type, std::move(curr.operands))); | ||
CHECK_ERR(ChildPopper{*this}.visitStructNew(&curr)); |
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.
Since the ChildPopper visitor doesn't take any additional arguments, this can remain simply visitStructNew
here and below.
When allocating structs that have custom descriptors, struct.new and
struct.new_default must take an additional operand for the descriptor.