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

Support rtt.{canon,sub} in constant expressions #16

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

binji
Copy link
Member

@binji binji commented Oct 23, 2020

Also allow multiple instructions when GC feature is enabled. It should
only be used by rtt.sub, since all other instructions have no
operands.

Also allow multiple instructions when GC feature is enabled. It should
only be used by rtt.sub, since all other instructions have no
operands.
@binji
Copy link
Member Author

binji commented Oct 23, 2020

Fixes #12.

@binji binji requested a review from sbc100 October 23, 2020 19:10
@binji
Copy link
Member Author

binji commented Oct 26, 2020

cc @jakobkummerow

@binji
Copy link
Member Author

binji commented Oct 26, 2020

@sbc100 BTW, the diff looks complicated, but the main change here is that a global initializer can be multiple instructions, so it occurs in a loop. This already works with other instruction lists (like a function body), so I reuse regular instruction validation for most instructions. global.get is weird, since if you use it inside of a global initializer, then only imported globals can be referenced.

@@ -208,6 +208,25 @@ TEST(ValidateTest, ConstantExpression_WrongInstructionCount) {
VT_I32, 0));
}

TEST(ValidateTest, ConstantExpression_GC) {
Copy link
Member

Choose a reason for hiding this comment

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

Is what you call ConstantExpression here what I normally think of an initializer expression? Why choose a different term here?

Copy link
Member Author

Choose a reason for hiding this comment

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

ConstantExpression is what the spec calls it: https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions

They're used for global initializers but also for data/element segments.

@binji binji merged commit 44c7b09 into master Oct 26, 2020
@binji binji deleted the constant-rtt-canon-sub branch October 26, 2020 21:52
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