Skip to content

[Wasm][IRGen] Add initial support for unconditional absolute function pointer #42094

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

Conversation

kateinoigakukun
Copy link
Member

@kateinoigakukun kateinoigakukun commented Mar 30, 2022

I discussed this with @rjmccall and @jckarter on a forum thread,
and we've got a consensus on how to upstream the relative pointer
support for Wasm.
The runtime part and id resolution of KeyPath will come in another PR.

On some Harvard architectures like WebAssembly that allow sliding code
and data address space offsets independently, it's impossible to make
direct relative reference to code from data because the relative offset
between them is not representable.
Use absolute function references instead of relative ones on such targets.

@kateinoigakukun
Copy link
Member Author

@swift-ci Please test

On some Harvard architectures like WebAssembly that allow sliding code
and data address space offsets independently, it's impossible to make
direct relative reference to code from data because the relative offset
between them is not representable.
Use absolute function references instead of relative ones on such targets.
@kateinoigakukun kateinoigakukun force-pushed the katei/wasm-uncond-abs-func-ptr branch from c93ca42 to 43a25e8 Compare March 30, 2022 08:13
@kateinoigakukun
Copy link
Member Author

@swift-ci Please test

@kateinoigakukun
Copy link
Member Author

@swift-ci Please test macOS platform

1 similar comment
@kateinoigakukun
Copy link
Member Author

@swift-ci Please test macOS platform

@kateinoigakukun
Copy link
Member Author

All code paths added in this change don't affect targets other than Wasm

@kateinoigakukun kateinoigakukun merged commit 26ba097 into swiftlang:main Mar 31, 2022
@kateinoigakukun kateinoigakukun deleted the katei/wasm-uncond-abs-func-ptr branch March 31, 2022 14:50
beccadax added a commit to beccadax/swift that referenced this pull request Mar 31, 2022
swiftlang#42094 added a new `IRGenOptions::CompactAbsoluteFunctionPointer` field, but did not initialize it. We subsequently started seeing flaky test failures in LLDB tests that tried to resolve relocations in metadata, so we think this may have resulted in the option sometimes being set to `true` in the REPL.
kateinoigakukun added a commit to swiftwasm/swift that referenced this pull request Apr 2, 2022
I added an assertion to catch new relative function pointers in
swiftlang#42094, so we should enable
assertions to utilize it while building stdlib and corelibs
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.

1 participant