Skip to content

Commit 8222d67

Browse files
committed
---
yaml --- r: 293751 b: refs/heads/tensorflow c: e7ef638 h: refs/heads/master i: 293749: 7d9e04f 293747: 52b5f33 293743: e33d3c1
1 parent 5c4343c commit 8222d67

File tree

7 files changed

+48
-42
lines changed

7 files changed

+48
-42
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 10087ebb99f6026aa72b350040ac82a1887f689c
819+
refs/heads/tensorflow: e7ef63828503f1247b8ea50ac01e92802f054778
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/benchmark/single-source/ObjectiveCBridging.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public let ObjectiveCBridging = [
7373
BenchmarkInfo(name: "ObjectiveCBridgeFromNSDateComponents",
7474
runFunction: run_ObjectiveCBridgeFromNSDateComponents, tags: t,
7575
setUpFunction: setup_dateComponents),
76+
BenchmarkInfo(name: "ObjectiveCBridgeASCIIStringFromFile",
77+
runFunction: run_ASCIIStringFromFile, tags: ts,
78+
setUpFunction: setup_ASCIIStringFromFile),
7679
]
7780

7881
#if _runtime(_ObjC)
@@ -709,3 +712,35 @@ public func run_ObjectiveCBridgeFromNSDateComponents(_ N: Int) {
709712
}
710713
#endif
711714
}
715+
716+
var ASCIIStringFromFile:String? = nil
717+
public func setup_ASCIIStringFromFile() {
718+
#if _runtime(_ObjC)
719+
let url:URL
720+
if #available(OSX 10.12, iOS 10.0, *) {
721+
url = FileManager.default.temporaryDirectory.appendingPathComponent(
722+
"sphinx.txt"
723+
)
724+
} else {
725+
url = URL(fileURLWithPath: "/tmp/sphinx.txt")
726+
}
727+
var str = "Sphinx of black quartz judge my vow"
728+
str = Array(repeating: str, count: 100).joined()
729+
try? str.write(
730+
to: url,
731+
atomically: true,
732+
encoding: .ascii
733+
)
734+
ASCIIStringFromFile = try! String(contentsOf: url, encoding: .ascii)
735+
#endif
736+
}
737+
738+
@inline(never)
739+
public func run_ASCIIStringFromFile(_ N: Int) {
740+
#if _runtime(_ObjC)
741+
for _ in 0 ..< N {
742+
blackHole((ASCIIStringFromFile! + "").utf8.count)
743+
}
744+
#endif
745+
}
746+

branches/tensorflow/lib/IRGen/GenDecl.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,6 @@ void IRGenerator::emitTypeMetadataRecords() {
10821082
void IRGenerator::emitLazyDefinitions() {
10831083
while (!LazyTypeMetadata.empty() ||
10841084
!LazyTypeContextDescriptors.empty() ||
1085-
!LazyOpaqueTypeDescriptors.empty() ||
10861085
!LazyFieldDescriptors.empty() ||
10871086
!LazyFunctionDefinitions.empty() ||
10881087
!LazyWitnessTables.empty()) {
@@ -1107,15 +1106,6 @@ void IRGenerator::emitLazyDefinitions() {
11071106
emitLazyTypeContextDescriptor(*IGM.get(), type,
11081107
RequireMetadata_t(entry.IsMetadataUsed));
11091108
}
1110-
while (!LazyOpaqueTypeDescriptors.empty()) {
1111-
OpaqueTypeDecl *type = LazyOpaqueTypeDescriptors.pop_back_val();
1112-
auto &entry = LazyOpaqueTypes.find(type)->second;
1113-
assert(hasLazyMetadata(type));
1114-
assert(entry.IsDescriptorUsed && !entry.IsDescriptorEmitted);
1115-
entry.IsDescriptorEmitted = true;
1116-
CurrentIGMPtr IGM = getGenModule(type->getDeclContext());
1117-
IGM->emitOpaqueTypeDecl(type);
1118-
}
11191109
while (!LazyFieldDescriptors.empty()) {
11201110
NominalTypeDecl *type = LazyFieldDescriptors.pop_back_val();
11211111
CurrentIGMPtr IGM = getGenModule(type->getDeclContext());
@@ -1276,10 +1266,7 @@ void IRGenerator::noteUseOfFieldDescriptor(NominalTypeDecl *type) {
12761266
void IRGenerator::noteUseOfOpaqueTypeDescriptor(OpaqueTypeDecl *opaque) {
12771267
if (!opaque)
12781268
return;
1279-
1280-
if (!hasLazyMetadata(opaque))
1281-
return;
1282-
1269+
12831270
auto insertResult = LazyOpaqueTypes.try_emplace(opaque);
12841271
auto &entry = insertResult.first->second;
12851272

branches/tensorflow/lib/IRGen/IRGenModule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ class IRGenerator {
245245
struct LazyOpaqueInfo {
246246
bool IsLazy = false;
247247
bool IsDescriptorUsed = false;
248-
bool IsDescriptorEmitted = false;
249248
};
250249
/// The set of opaque types enqueued for lazy emission.
251250
llvm::DenseMap<OpaqueTypeDecl*, LazyOpaqueInfo> LazyOpaqueTypes;

branches/tensorflow/lib/Sema/CodeSynthesis.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,7 @@ static VarDecl *synthesizePropertyDelegateStorageDelegateProperty(
14931493
ctx, property->getCorrectStaticSpelling(), pbdPattern,
14941494
/*init*/nullptr, dc, SourceLoc());
14951495
addMemberToContextIfNeeded(pbd, dc, var);
1496+
pbd->setStatic(var->isStatic());
14961497

14971498
// Determine the access level for the property.
14981499
AccessLevel access =
@@ -1575,6 +1576,7 @@ PropertyDelegateBackingPropertyInfoRequest::evaluate(Evaluator &evaluator,
15751576
ctx, backingVar->getCorrectStaticSpelling(), pbdPattern,
15761577
/*init*/nullptr, dc, SourceLoc());
15771578
addMemberToContextIfNeeded(pbd, dc, var);
1579+
pbd->setStatic(var->isStatic());
15781580

15791581
// Take the initializer from the original property.
15801582
auto parentPBD = var->getParentPatternBinding();

branches/tensorflow/test/IRGen/lazy_opaque_result_type.swift

Lines changed: 0 additions & 26 deletions
This file was deleted.

branches/tensorflow/test/SILGen/property_delegates.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ func forceHasMemberwiseInit() {
4040
_ = HasMemberwiseInit<Int>()
4141
}
4242

43+
// CHECK: sil_global hidden @$s18property_delegates9UseStaticV13$staticWibbleAA4LazyOySaySiGGvpZ : $Lazy<Array<Int>>
44+
4345
// HasMemberwiseInit.x.setter
4446
// CHECK-LABEL: sil hidden [transparent] [ossa] @$s18property_delegates17HasMemberwiseInitV1xSbvs : $@convention(method) <T where T : DefaultInit> (Bool, @inout HasMemberwiseInit<T>) -> () {
4547
// CHECK: bb0(%0 : $Bool, %1 : $*HasMemberwiseInit<T>):
@@ -250,3 +252,10 @@ func triggerUseLazy() {
250252
_ = UseLazy(bar: 17)
251253
_ = UseLazy<Int>(wibble: [1, 2, 3])
252254
}
255+
256+
struct UseStatic {
257+
// CHECK: sil hidden [transparent] [ossa] @$s18property_delegates9UseStaticV12staticWibbleSaySiGvgZ
258+
// CHECK: sil hidden [global_init] [ossa] @$s18property_delegates9UseStaticV13$staticWibbleAA4LazyOySaySiGGvau
259+
// CHECK: sil hidden [transparent] [ossa] @$s18property_delegates9UseStaticV12staticWibbleSaySiGvsZ
260+
@Lazy static var staticWibble = [1, 2, 3]
261+
}

0 commit comments

Comments
 (0)