Skip to content

Commit 162d17d

Browse files
committed
---
yaml --- r: 349535 b: refs/heads/master-next c: 0fd3e1d h: refs/heads/master i: 349533: 66ac745 349531: ee685b6 349527: 417081d 349519: da8a0a5 349503: 50ed6e1
1 parent decb5b9 commit 162d17d

File tree

5 files changed

+49
-8
lines changed

5 files changed

+49
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: bb83c392ffb3cce181857195d4533f61bfd534c5
3+
refs/heads/master-next: 0fd3e1dfb7f3f131d5d578f6b1e2322c7d4fd768
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/include/swift/Reflection/ReflectionContext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ class ReflectionContext
193193
}
194194
RangeStart = std::min(RangeStart, (uint64_t)S->addr + Slide);
195195
RangeEnd = std::max(RangeEnd, (uint64_t)(S->addr + S->size + Slide));
196+
// Keep the range rounded to 8 byte alignment on both ends so we don't
197+
// introduce misaligned pointers mapping between local and remote
198+
// address space.
199+
RangeStart = RangeStart & ~7;
200+
RangeEnd = RangeEnd + 7 & ~7;
196201
}
197202

198203
if (RangeStart == UINT64_MAX && RangeEnd == UINT64_MAX)

branches/master-next/include/swift/SIL/MemAccessUtils.h

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,29 @@
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
11-
// These utilities live in SIL/ so they be used by SIL verification.
12-
//
11+
//===----------------------------------------------------------------------===//
12+
///
13+
/// These utilities model formal memory access locations as marked by
14+
/// begin_access and end_access instructions. The formal memory locations
15+
/// identified here must be consistent with language rules for exclusity
16+
/// enforcement. This is not meant to be a utility to reason about other general
17+
/// properties of SIL memory operations such as reference count identity,
18+
/// ownership, or aliasing. Code that queries the properties of arbitrary memory
19+
/// operations independent of begin_access instructions should use a different
20+
/// interface.
21+
///
22+
/// SIL memory addresses used for formal access need to meet special
23+
/// requirements. In particular, it must be possible to identifiy the storage by
24+
/// following the pointer's provenance. This is *not* true for SIL memory
25+
/// operations in general. The utilities cannot simply bailout on unrecognized
26+
/// patterns. Doing so would lead to undefined program behavior, which isn't
27+
/// something that can be directly tested (i.e. if this breaks, we won't see
28+
/// test failures).
29+
///
30+
/// These utilities are mainly meant to be used by AccessEnforcement passes,
31+
/// which optimize exclusivity enforcement. They live in SIL so they can be used
32+
/// by SIL verification.
33+
///
1334
//===----------------------------------------------------------------------===//
1435

1536
#ifndef SWIFT_SIL_MEMACCESSUTILS_H
@@ -31,6 +52,23 @@ inline bool accessKindMayConflict(SILAccessKind a, SILAccessKind b) {
3152

3253
/// Represents the identity of a storage object being accessed.
3354
///
55+
/// AccessedStorage is carefully designed to solve three problems:
56+
///
57+
/// 1. Full specification and verification of SIL's model for exclusive
58+
/// formal memory access, as enforced by "access markers". It is not a
59+
/// model to encompass all SIL memory operations.
60+
///
61+
/// 2. A bitwise comparable encoding and hash key to identify each location
62+
/// being formally accessed. Any two accesses of uniquely identified storage
63+
/// must have the same key if they access the same storage and distinct keys
64+
/// if they access distinct storage. Accesses to non-uniquely identified
65+
/// storage should ideally have the same key if they may point to the same
66+
/// storage.
67+
///
68+
/// 3. Complete identification of all class or global accesses. Failing to
69+
/// identify a class or global access will introduce undefined program
70+
/// behavior which can't be tested.
71+
///
3472
/// AccessedStorage may be one of several kinds of "identified" storage
3573
/// objects, or may be valid, but Unidentified storage. An identified object
3674
/// is known to identify the base of the accessed storage, whether that is a
@@ -220,7 +258,8 @@ class AccessedStorage {
220258
/// Return true if the given storage objects have identical storage locations.
221259
///
222260
/// This compares only the AccessedStorage base class bits, ignoring the
223-
/// subclass bits. It is used for hash lookup equality.
261+
/// subclass bits. It is used for hash lookup equality, so it should not
262+
/// perform any additional lookups or dereference memory outside itself.
224263
bool hasIdenticalBase(const AccessedStorage &other) const {
225264
if (getKind() != other.getKind())
226265
return false;

branches/master-next/lib/SIL/MemAccessUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static void visitBuiltinAddress(BuiltinInst *builtin,
598598
switch (kind.getValue()) {
599599
default:
600600
builtin->dump();
601-
llvm_unreachable("unexpected bulitin memory access.");
601+
llvm_unreachable("unexpected builtin memory access.");
602602

603603
// WillThrow exists for the debugger, does nothing.
604604
case BuiltinValueKind::WillThrow:

branches/master-next/validation-test/Reflection/functions.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
// FIXME: Should not require objc_interop -- please put Objective-C-specific
88
// testcases in functions_objc.swift
99

10-
// rdar://54556791
11-
// UNSUPPORTED: CPU=armv7k
12-
1310
// REQUIRES: objc_interop
1411
// REQUIRES: executable_test
1512

0 commit comments

Comments
 (0)