WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 188641
189326
[WHLSL] The interpreter should evaluate arguments right-to-left
https://bugs.webkit.org/show_bug.cgi?id=189326
Summary
[WHLSL] The interpreter should evaluate arguments right-to-left
Thomas Denney
Reported
2018-09-05 16:17:52 PDT
In order to be consistent with C, the arguments of function calls should be evaluated right-to-left. C doesn’t define an evaluation order for operators (like +) but because we treat them as “native functions” we should strictly evaluate them right-to-left.
Attachments
Patch
(3.40 KB, patch)
2018-09-05 16:21 PDT
,
Thomas Denney
no flags
Details
Formatted Diff
Diff
Patch
(3.75 KB, patch)
2018-09-05 17:12 PDT
,
Thomas Denney
no flags
Details
Formatted Diff
Diff
WIP
(4.83 KB, patch)
2018-09-06 11:24 PDT
,
Thomas Denney
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Thomas Denney
Comment 1
2018-09-05 16:21:52 PDT
Created
attachment 348978
[details]
Patch
Thomas Denney
Comment 2
2018-09-05 17:12:43 PDT
Created
attachment 348982
[details]
Patch
Alex Christensen
Comment 3
2018-09-05 18:20:20 PDT
Comment on
attachment 348982
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=348982&action=review
This order is not determined in C or C++, but it is commonly evaluated in a consistent order for reasons. See
https://en.cppreference.com/w/c/language/eval_order
I think it would be great if WHLSL had a defined order, but don't claim it's to be consistent with C.
> Tools/ChangeLog:8 > + The behavior of the interpreter now matches the behavior of the compiler
What compiler are you talking about? It's possible the behavior of that compiler is unspecified but it happens to be right-to-left in all the cases you've checked.
Myles C. Maxfield
Comment 4
2018-09-05 19:12:39 PDT
Comment on
attachment 348982
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=348982&action=review
> Tools/WebGPUShadingLanguageRI/Test.js:7637 > + int foo() { return *bar(10) + *bar(20); } > + > + thread int* bar(int value) > + { > + int x = value; > + return &x; > + }
I don't think we should commit a test that is fundamentally wrong.
Thomas Denney
Comment 5
2018-09-05 19:26:10 PDT
(In reply to Alex Christensen from
comment #3
)
> Comment on
attachment 348982
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=348982&action=review
> > This order is not determined in C or C++, but it is commonly evaluated in a > consistent order for reasons. See >
https://en.cppreference.com/w/c/language/eval_order
> I think it would be great if WHLSL had a defined order, but don't claim it's > to be consistent with C. > > > Tools/ChangeLog:8 > > + The behavior of the interpreter now matches the behavior of the compiler > > What compiler are you talking about? It's possible the behavior of that > compiler is unspecified but it happens to be right-to-left in all the cases > you've checked.
The WHLSL -> Metal code generation generates code so that the arguments are explicitly evaluated right-to-left before the function call and are then passed separately.
Thomas Denney
Comment 6
2018-09-06 11:24:10 PDT
Created
attachment 349046
[details]
WIP
Thomas Denney
Comment 7
2018-09-10 16:22:43 PDT
The most recent patch of
https://bugs.webkit.org/show_bug.cgi?id=188641
resolves this, and it would only be a two line change to that patch to resolve this bug. *** This bug has been marked as a duplicate of
bug 188641
***
Radar WebKit Bug Importer
Comment 8
2018-09-12 18:41:25 PDT
<
rdar://problem/44402790
>
Myles C. Maxfield
Comment 9
2018-10-13 14:35:40 PDT
Migrated to
https://github.com/gpuweb/WHLSL/issues/42
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug