Skip to content

Commit 5a40933

Browse files
[Runtime] Fix AbsoluteFuncPtr to allow template parameter inference
`AbsoluteFunctionPointer` was not able to be passed to a function that takes a `TargetCompactFunctionPointer` because the template parameters `Nullable` and `Offset` were not parameterized by `AbsoluteFunctionPointer`. 29c350e introduced the first such function `InProcessReaderWriter::resolveFunctionPointer` and it revealed this issue.
1 parent c8fe36d commit 5a40933

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/swift/ABI/CompactFunctionPointer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace swift {
2626
/// integer.
2727
/// As a trade-off compared to relative pointers, this has load-time overhead in PIC
2828
/// and is only available on 32-bit targets.
29-
template <typename T>
29+
template <typename T, bool Nullable = false, typename Offset = int32_t>
3030
class AbsoluteFunctionPointer {
3131
T *Pointer;
3232
static_assert(sizeof(T *) == sizeof(int32_t),

include/swift/ABI/TargetLayout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ struct InProcess {
104104

105105
template <typename T, bool Nullable = true, typename Offset = int32_t>
106106
#if SWIFT_COMPACT_ABSOLUTE_FUNCTION_POINTER
107-
using CompactFunctionPointer = AbsoluteFunctionPointer<T>;
107+
using CompactFunctionPointer = AbsoluteFunctionPointer<T, Nullable, Offset>;
108108
#else
109109
using CompactFunctionPointer =
110110
swift::RelativeDirectPointer<T, Nullable, Offset>;

0 commit comments

Comments
 (0)