Skip to content

Commit 2e58e5d

Browse files
authored
Merge pull request #16613 from eeckstein/fix-jit-4.2
2 parents 3ba267b + 7971f9e commit 2e58e5d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ bool IRGenerator::tryEnableLazyTypeMetadata(NominalTypeDecl *Nominal) {
7979
// is not used by the program itself.
8080
if (!Opts.shouldOptimize())
8181
return false;
82+
if (Opts.UseJIT)
83+
return false;
8284

8385
switch (Nominal->getKind()) {
8486
case DeclKind::Enum:

test/Interpreter/unused-type.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %target-jit-run -O %s | %FileCheck %s
2+
// REQUIRES: executable_test
3+
// REQUIRES: swift_interpreter
4+
5+
// Check that when running the jit with -O we don't crash with an unresolved
6+
// metadata symbol.
7+
8+
protocol Foo {
9+
func foo() -> Int
10+
}
11+
12+
struct Dummy: Foo {
13+
func foo() -> Int { return 42 }
14+
}
15+
16+
// CHECK: ok
17+
print("ok")

0 commit comments

Comments
 (0)