Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Nov 18, 2019

#9810 mostly fixed i64 pointers in MAIN_MODULE, but it
turns out that a corner case was a function that is illegal
only due to its return value.

fixes #9850

tools/shared.py Outdated
ret = [sig[0]]
# a return of i64 is legalized into an i32 (and the high bits are
# accessible on the side through getTempRet0).
ret = ['i' if sig[0] == 'j' else sig[0]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I find this more readable:

ret = [sig[0]]
# a return of i64(j) is legalized into an i32(i) (and the high bits are
# accessible on the side through getTempRet0).
if ret == ['j']:
  ret = ['i']

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, use of ret here is a little confusing. When I was first reading this I assumed it refered to return part of the signature. Maybe result or sig_legalized or sig_out?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both good points, thanks.

How about just legal for the legalized signature?

@sbc100
Copy link
Collaborator

sbc100 commented Nov 19, 2019

lgtm

@kripken kripken merged commit 1488c44 into incoming Nov 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the leg branch November 19, 2019 18:20
belraquib pushed a commit to belraquib/emscripten that referenced this pull request Dec 23, 2020
…-core#9855)

emscripten-core#9810 mostly fixed i64 pointers in MAIN_MODULE, but it
turns out that a corner case was a function that is illegal
only due to its return value.

fixes emscripten-core#9850
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.

Indirect call signature mismatch with MAIN_MODULE=1

3 participants