-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Immediate] Switch immediate mode from MCJIT to LLJIT. #29863
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
LLJIT is a simple LLVM IR JIT. Its interface is similar to MCJIT, but its implementation is based on LLVM's newer ORC APIs. This initial patch does not make use of any of LLJIT/ORC's advanced features, but will provide better diagnostics when JIT'd code fails to link. Once LLJIT has proven usable in this basic configuration we can start experimenting with more advanced features, including lazy compilation.
@swift-ci Please test |
Build failed |
We're failing on Linux in runAsMain(...). Best guess off the top of my head is that this is due to runAsMain not setting an envp argument. I'll try fixing that tomorrow. |
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.
Awesome!
@swift-ci test windows |
Hrm. Let's try that again... @swift-ci test platform windows |
This matches MCJIT's default, and may solve some of the linux test failures seen in #29863.
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci smoke test |
Thanks Duncan! What’s the bar for merging? Is a pass on the smoke tests enough? |
I'm not really the expert for this repo. Looking above, those are the only two with the "Required" badge. But it's moot since the smoke test also crashed out with java.io.EOFException and it looks like infrastructure issues again. @shahmishal , are you comfortable merging this despite the lack of signal? |
@swift-ci test |
Are these expected failures with this change? We need to make sure these checks are green before merging the change into master branch. |
Build failed |
@swift-ci test |
@shahmishal Those tests depended on the LLVM fix in swiftlang/llvm-project@0051515 . I can’t tell whether that had been merged before those CI tests ran. I’m re-running them now... |
@swift-ci smoke test |
Build failed |
rdar://problem/57405697 |
@lhames - seems that this is causing some problems on Windows due to the import symbol not being setup in the JIT. IIRC, I had made some changes to the MCJIT to actually synthesize the import symbols which may be missing from LLJIT? Any idea on that? https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/322/ |
Hi Saleem. I’m on the road today, but can take a look tomorrow. Can you point me to the import symbol synthesis code? On Windows LLJIT should be using RuntimeDyldCOFF, but if the synthesis code is in MCJIT I will just need to replicate that in LLJIT, which should be a relatively quick fix. |
@lhames hmm, I'll take a quick glance, but its been far too long (~3 years?) since I added that. The IAT is similar to the PLT/GOT except that it is per module rather than AS-wide. Each imported symbol has a synthetic symbol e.g.
(note that it contains both function and data addresses) |
This patch switch's the underlying implementation of Swift's immediate mode from MCJIT to LLJIT.
LLJIT is a simple LLVM IR JIT. Its interface is similar to MCJIT, but its implementation is based on LLVM's newer ORC APIs. This initial patch does not make use of any of LLJIT/ORC's advanced features, but will provide better diagnostics when JIT'd code fails to link. Once LLJIT has proven usable in this basic configuration we can start experimenting with more advanced features, including lazy compilation.