-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix dyncall() functions on i64 parameters in WASM_BIGINT mode #19689
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.
lgtm % comments
test/core/dyncall_specific.c
Outdated
// Note that these would need to use BigInts if the file were built with | ||
// -sWASM_BIGINT | ||
|
||
#ifndef WASM_BIGINT |
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 flip the arms of the #if so this condition is in the positive?
test/test_core.py
Outdated
# define DYNCALLS because this test does test calling them directly, and | ||
# in WASM_BIGINT mode we do not enable them by default (since we can do | ||
# more without them - we don't need to legalize) | ||
args = list(args) + ['-sDYNCALLS=1', '-DWASM_BIGINT'] |
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 think you can just do args +=
here
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.
That modifies the input array, however, which can mean these accumulate, depending on how the test runner works? With the parallelism and all that I'd rather not make assumptions there.
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.
But you are using *arg .. which mean python is creating an array based on the inputs.. and it will be fresh each time I believe.
At the very least you can do args = args + ['-sDYNCALLS=1', '-DWASM_BIGINT']
since that also makes a copy.
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 checked now to make sure. It turns out that *args
is always a tuple, not a list. So we do need the full syntax here, to turn the tuple into a list.
Instead, we could avoid *args
, by replacing
'': [],
with
'': ([],),
and it is received as test_dyncall_specific(self, args)
, after which the code is simpler. Tradeoffs both ways, I don't feel strongly.
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.
Either way lgtm
test/test_core.py
Outdated
# define DYNCALLS because this test does test calling them directly, and | ||
# in WASM_BIGINT mode we do not enable them by default (since we can do | ||
# more without them - we don't need to legalize) | ||
args = list(args) + ['-sDYNCALLS=1', '-DWASM_BIGINT'] |
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.
Drop the =1
With BigInt support we don't legalize, so a
'j'
parameter is just a single value(a BigInt) and not two legalized i32s.
This is the last remaining useful fix in #19156 that is worth landing standalone.
The test now works in both BigInt and non-BigInt mode. To make that simple
I moved some of the expectations from the text output into assertions.