Skip to content

Commit 58804f7

Browse files
authored
Merge pull request swiftlang#38622 from gottesmm/pr-6947135ffaebc2f84fcc96a081d32e9829585992
[exclusivity] Split out of Exclusivity.cpp FunctionReplacement and the Global TLSContext.
2 parents a87d131 + 3e64d03 commit 58804f7

File tree

9 files changed

+424
-292
lines changed

9 files changed

+424
-292
lines changed

include/swift/Runtime/Exclusivity.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,6 @@ SWIFT_RUNTIME_EXPORT
4040
void swift_beginAccess(void *pointer, ValueBuffer *buffer,
4141
ExclusivityFlags flags, void *pc);
4242

43-
/// Loads the replacement function pointer from \p ReplFnPtr and returns the
44-
/// replacement function if it should be called.
45-
/// Returns null if the original function (which is passed in \p CurrFn) should
46-
/// be called.
47-
#ifdef __APPLE__
48-
__attribute__((weak_import))
49-
#endif
50-
SWIFT_RUNTIME_EXPORT
51-
char *swift_getFunctionReplacement(char **ReplFnPtr, char *CurrFn);
52-
53-
/// Returns the original function of a replaced function, which is loaded from
54-
/// \p OrigFnPtr.
55-
/// This function is called from a replacement function to call the original
56-
/// function.
57-
#ifdef __APPLE__
58-
__attribute__((weak_import))
59-
#endif
60-
SWIFT_RUNTIME_EXPORT
61-
char *swift_getOrigOfReplaceable(char **OrigFnPtr);
6243

6344
/// Stop dynamically tracking an access.
6445
SWIFT_RUNTIME_EXPORT
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//===--- FunctionReplacement.h --------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef SWIFT_RUNTIME_FUNCTIONREPLACEMENT_H
14+
#define SWIFT_RUNTIME_FUNCTIONREPLACEMENT_H
15+
16+
#include "swift/Runtime/Config.h"
17+
18+
namespace swift {
19+
20+
/// Loads the replacement function pointer from \p ReplFnPtr and returns the
21+
/// replacement function if it should be called.
22+
/// Returns null if the original function (which is passed in \p CurrFn) should
23+
/// be called.
24+
#ifdef __APPLE__
25+
__attribute__((weak_import))
26+
#endif
27+
SWIFT_RUNTIME_EXPORT char *
28+
swift_getFunctionReplacement(char **ReplFnPtr, char *CurrFn);
29+
30+
/// Returns the original function of a replaced function, which is loaded from
31+
/// \p OrigFnPtr.
32+
/// This function is called from a replacement function to call the original
33+
/// function.
34+
#ifdef __APPLE__
35+
__attribute__((weak_import))
36+
#endif
37+
SWIFT_RUNTIME_EXPORT char *
38+
swift_getOrigOfReplaceable(char **OrigFnPtr);
39+
40+
} // namespace swift
41+
42+
#endif

stdlib/public/runtime/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ set(swift_runtime_sources
4545
ExistentialContainer.cpp
4646
Float16Support.cpp
4747
FoundationSupport.cpp
48+
FunctionReplacement.cpp
4849
Heap.cpp
4950
HeapObject.cpp
5051
ImageInspectionCommon.cpp
@@ -65,7 +66,8 @@ set(swift_runtime_sources
6566
RefCount.cpp
6667
ReflectionMirror.cpp
6768
RuntimeInvocationsTracking.cpp
68-
SwiftDtoa.cpp)
69+
SwiftDtoa.cpp
70+
SwiftTLSContext.cpp)
6971

7072
# Acknowledge that the following sources are known.
7173
set(LLVM_OPTIONAL_SOURCES

0 commit comments

Comments
 (0)