Skip to content

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

Merged
merged 6 commits into from
Jun 23, 2023
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Jun 22, 2023

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.

@kripken kripken requested a review from sbc100 June 22, 2023 21:53
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

lgtm % comments

// Note that these would need to use BigInts if the file were built with
// -sWASM_BIGINT

#ifndef WASM_BIGINT
Copy link
Collaborator

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?

# 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']
Copy link
Collaborator

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

Copy link
Member Author

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.

Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Either way lgtm

# 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']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Drop the =1

@kripken kripken merged commit 62c2b33 into main Jun 23, 2023
@kripken kripken deleted the find.test branch June 23, 2023 00:03
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