-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IRGen] Use Singleton metadata strategy in JIT mode. #25504
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
@@ -0,0 +1,39 @@ | |||
// RUN: %target-swift-frontend -interpret %s | |||
// REQUIRES: executable_test |
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.
I think that this is better tested in terms of IRGen, rather than checking that the executable executes.
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.
You could also have both.
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.
Sure, as long as they are in separate files. The reason for preferring checking IRGen is that means that you can verify IRGen irrespective of the target that you are on. This massively helped for example in the Windows bring up where I did the entirety of the work on Linux before I started running the executable tests.
The test currently fails on Linux, because it can't import Foundation. |
@jirid You can |
No, that is wrong. I've had to (as has @yln) go through the test suite cleaning up misuse of that require. If you want to test it on Darwin only, fine, you can do |
Thanks for the feedback, I'll look into it and update the PR. |
@jirid Let me know if you need any help writing the IRGen tests. The fix is good to go other than that! |
@slavapestov I am working on trying to create a runtime test case (crash) without using I have not started looking into designing a test case in terms of IRGen. |
b3f9624
to
6a75a6c
Compare
@jirid Sorry I forgot about that part. Grep the existing tests for |
If the tests pass, we can merge this now since I'd like to put the fix into swift-5.1-branch as well. You can decouple the test cases from Foundation in a follow-up PR if you want. |
@swift-ci Please test |
Build failed |
Test passes on macOS but fails on iPhone simulator. I'll investigate. |
@@ -0,0 +1,40 @@ | |||
// RUN: %target-swift-frontend -interpret %s | |||
// REQUIRES: executable_test | |||
// REQUIRES: foundation |
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.
You should use REQUIRES: OS=macosx. I don't think simulator or device testing supports the JIT.
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.
This one is REQUIRES: swift_interpreter
.
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.
Ah, nice. I'll fix that up and cherry-pick this to the 5.1 branch.
FixedOrUpdate strategy does not work for non-generic classes in JIT mode. Fixes rdar://49639321
6a75a6c
to
8150a01
Compare
@swift-ci Please test and merge |
@swift-ci Please test |
Build failed |
Build failed |
In Xcode 10.2.1, the Swift compiler crashes when interpreting https://github.com/JiriTrecak/Laurine/blob/master/LaurineGenerator.swift. I have reduced the problem and am adding it as a test case. The swift compiler built from the master branch at the time of writing fails this test. My change makes this test pass and does not brake any other tests (on my machine).
The fix approach is based on work I have done on try! Swift San Jose and would like to thank Slava Pestov for providing explanation and ideas how to fix this.
This commit: jirid@d2f1d36
shows the original fix recommended by Slava, unfortunately that did break the following tests:
IRGen/playground.swift
Interpreter/imported_objc_generics.swift
IRGen/objc_generic_class_metadata.sil
Please review thoroughly as my understanding of the Swift compiler is very limited and this is my first contribution to Swift.
Resolves rdar://49639321