Skip to content

[Wasm][KeyPath] Resolve absolute function pointer as identity #42096

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

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Mar 30, 2022

Emit and resolve idValue of KeyPath as an absolute pointer if relative
function pointer is turned-off on Wasm target.
The existing ABI can't distinguish an idValue between function pointer
or data pointer in use-site at compile-time and also at runtime. So this
patch adds a new id resolution scheme ResolvedAbsolute to distinguish
them at runtime properly.

Emit and resolve idValue of KeyPath as an absolute pointer if relative
function pointer is turned-off on Wasm target.
The existing ABI can't distinguish an idValue between function pointer
or data pointer in use-site at compile-time and also at runtime. So this
patch adds a new id resolution scheme `ResolvedAbsolute` to distinguish
them at runtime properly.
@kateinoigakukun kateinoigakukun force-pushed the pr-24e8c53c23a06f91bc290068f3209e095a88bdcf branch from 0f25085 to ed7ab2a Compare April 2, 2022 16:27
@kateinoigakukun
Copy link
Member Author

@swift-ci Please test

@kateinoigakukun
Copy link
Member Author

@swift-ci Please test

@kateinoigakukun
Copy link
Member Author

@jckarter Could you take a look when you have time?

@jckarter
Copy link
Contributor

I don't think we need to introduce a new runtime representation, since the absolute and relative representations should be mutually exclusive for any one runtime platform. It would be better to conditionalize the interpretation based on whether the platform uses absolute or relative references.

@kateinoigakukun
Copy link
Member Author

kateinoigakukun commented Apr 19, 2022

@jckarter

since the absolute and relative representations should be mutually exclusive for any one runtime platform

ResolvedAbsolute and relative Resolved are not mutually exclusive at runtime because both resolution schemes are used on Wasm. Pointers to data section (for ComputedPropertyId::DeclRef) are relative, and pointers to function (for ComputedPropertyId::Function) are absolute on Wasm.

@jckarter
Copy link
Contributor

I see. In that case, this looks OK.

@kateinoigakukun
Copy link
Member Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 4184a0b into swiftlang:main Apr 20, 2022
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.

3 participants