Skip to content

Commit b609df8

Browse files
Merge pull request #4565 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents 1e4ea31 + 5318896 commit b609df8

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

stdlib/public/Concurrency/Deque.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ struct _Deque<Element> {
417417
internal func _internalInvariant(
418418
_ condition: @autoclosure () -> Bool,
419419
_ message: @autoclosure () -> String = String(),
420-
file: StaticString = #file, line: UInt = #line
420+
file: StaticString = #fileID, line: UInt = #line
421421
) {
422422
#if INTERNAL_CHECKS_ENABLED
423423
assert(condition(), message(), file: file, line: line)

stdlib/public/Concurrency/TaskLocal.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
136136
/// the operation closure.
137137
@discardableResult
138138
public func withValue<R>(_ valueDuringOperation: Value, operation: () async throws -> R,
139-
file: String = #file, line: UInt = #line) async rethrows -> R {
139+
file: String = #fileID, line: UInt = #line) async rethrows -> R {
140140
// check if we're not trying to bind a value from an illegal context; this may crash
141141
_checkIllegalTaskLocalBindingWithinWithTaskGroup(file: file, line: line)
142142

@@ -161,7 +161,7 @@ public final class TaskLocal<Value: Sendable>: Sendable, CustomStringConvertible
161161
/// the operation closure.
162162
@discardableResult
163163
public func withValue<R>(_ valueDuringOperation: Value, operation: () throws -> R,
164-
file: String = #file, line: UInt = #line) rethrows -> R {
164+
file: String = #fileID, line: UInt = #line) rethrows -> R {
165165
// check if we're not trying to bind a value from an illegal context; this may crash
166166
_checkIllegalTaskLocalBindingWithinWithTaskGroup(file: file, line: line)
167167

stdlib/public/runtime/Heap.cpp

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void *swift::swift_slowAlloc(size_t size, size_t alignMask) {
124124
// i.e. 0 < alignment <= _minAllocationAlignment:
125125
// The runtime may use either `free` or AlignedFree as long as it is
126126
// consistent with allocation with the same alignment.
127-
void swift::swift_slowDealloc(void *ptr, size_t bytes, size_t alignMask) {
127+
static void swift_slowDeallocImpl(void *ptr, size_t alignMask) {
128128
if (alignMask <= MALLOC_ALIGN_MASK) {
129129
#if defined(__APPLE__) && SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC
130130
malloc_zone_free(DEFAULT_ZONE(), ptr);
@@ -135,3 +135,34 @@ void swift::swift_slowDealloc(void *ptr, size_t bytes, size_t alignMask) {
135135
AlignedFree(ptr);
136136
}
137137
}
138+
139+
void swift::swift_slowDealloc(void *ptr, size_t bytes, size_t alignMask) {
140+
swift_slowDeallocImpl(ptr, alignMask);
141+
}
142+
143+
#if defined(__APPLE__) && defined(__MACH__) && SWIFT_STDLIB_HAS_DARWIN_LIBMALLOC
144+
// On Darwin, define our own, hidden operator new/delete implementations. We
145+
// don't want to pick up any overrides that come from other code, but we also
146+
// don't want to expose our overrides to any other code. We can't do this
147+
// directly in C++, as the compiler has an implicit prototype with default
148+
// visibility. However, if we implement them as C functions using the C++
149+
// mangled names, the compiler accepts them without complaint, and the linker
150+
// still links all internal uses with these overrides.
151+
152+
__attribute__((visibility(("hidden")))) extern "C" void *_Znwm(size_t size) {
153+
return swift_slowAlloc(size, MALLOC_ALIGN_MASK);
154+
}
155+
156+
__attribute__((visibility(("hidden")))) extern "C" void _ZdlPv(void *ptr) {
157+
swift_slowDeallocImpl(ptr, MALLOC_ALIGN_MASK);
158+
}
159+
160+
__attribute__((visibility(("hidden")))) extern "C" void *_Znam(size_t size) {
161+
return swift_slowAlloc(size, MALLOC_ALIGN_MASK);
162+
}
163+
164+
__attribute__((visibility(("hidden")))) extern "C" void _ZdaPv(void *ptr) {
165+
swift_slowDeallocImpl(ptr, MALLOC_ALIGN_MASK);
166+
}
167+
168+
#endif

test/Interpreter/convenience_init_peer_delegation.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
// REQUIRES: objc_interop
2929
// XFAIL: CPU=arm64e
3030

31+
// rdar://92102119
32+
// REQUIRES: swift_test_mode_optimize_none
33+
3134
import Darwin
3235

3336
class Base {

0 commit comments

Comments
 (0)