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
[Wasm-GC] Generate correct LLInt code for structs containing reference types #10342
Conversation
EWS run on previous version of this PR (hash dcec6d4) |
@@ -2000,17 +2000,41 @@ auto LLIntGenerator::addStructNew(uint32_t index, Vector<ExpressionType>& args, | |||
{ | |||
result = push(); | |||
|
|||
// We have to shift all the arguments up the stack by one slot, because we just |
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 we add a new dummy argument to avoid 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.
I don't think that adding an extra argument helps. Suppose we enter addStructNew()
with 3 arguments and the stack depth (before pushing the arguments) is 18. If these arguments are non-constants, they will already have been assigned to locations 19, 20, and 21. The dummy argument would either have to be 22 or 18, but there's no way to use 18 since that's deeper on the stack. If we use 22, the stack consistency checker will complain, or at least I couldn't find a way to do that without getting assertion failures.
I realized I could change it to just re-use the first argument for the return value (and special-case the 0-argument case). The previous version avoided overwriting any of the arguments, but I don't think that was necessary. The new version doesn't seem as clean, but all the tests pass.
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.
Pinged you on slack
dcec6d4
to
48dcb94
Compare
EWS run on previous version of this PR (hash 48dcb94)
|
EWS run on previous version of this PR (hash 8fc1e60)
|
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.
r=me
EWS run on current version of this PR (hash 8635254)
|
β¦e types https://bugs.webkit.org/show_bug.cgi?id=252538 Reviewed by Justin Michaud. The LLInt generated code for `addStructNew` only worked if the struct initializers weren't on the stack, as it overwrote live stack slots. Fixed it to not overwrite live data. * JSTests/wasm/gc/bug252538.js: Added. (module): (testStructOfInts): (testStructDeclaration): * Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::addStructNew): * Source/JavaScriptCore/wasm/WasmOperationsInlines.h: (JSC::Wasm::structNew): Canonical link: https://commits.webkit.org/261902@main
8635254
to
400ec97
Compare
Committed 261902@main (400ec97): https://commits.webkit.org/261902@main Reviewed commits have been landed. Closing PR #10342 and removing active labels. |
400ec97
8635254