Skip to content

Commit e3502e9

Browse files
committed
Runtime: Factor TargetFunctionTypeFlags a bit so that we can use it without a Runtime
1 parent 4fa882a commit e3502e9

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,8 @@ enum class FunctionMetadataConvention: uint8_t {
452452
};
453453

454454
/// Flags in a function type metadata record.
455-
template <typename Runtime>
455+
template <typename int_type>
456456
class TargetFunctionTypeFlags {
457-
using int_type = typename Runtime::StoredSize;
458457
enum : int_type {
459458
NumArgumentsMask = 0x00FFFFFFU,
460459
ConventionMask = 0x0F000000U,
@@ -471,16 +470,16 @@ class TargetFunctionTypeFlags {
471470
return TargetFunctionTypeFlags((Data & ~NumArgumentsMask) | numArguments);
472471
}
473472

474-
constexpr TargetFunctionTypeFlags<Runtime>
473+
constexpr TargetFunctionTypeFlags<int_type>
475474
withConvention(FunctionMetadataConvention c) const {
476475
return TargetFunctionTypeFlags((Data & ~ConventionMask)
477476
| (int_type(c) << ConventionShift));
478477
}
479478

480-
constexpr TargetFunctionTypeFlags<Runtime>
479+
constexpr TargetFunctionTypeFlags<int_type>
481480
withThrows(bool throws) const {
482-
return TargetFunctionTypeFlags<Runtime>((Data & ~ThrowsMask) |
483-
(throws ? ThrowsMask : 0));
481+
return TargetFunctionTypeFlags<int_type>((Data & ~ThrowsMask) |
482+
(throws ? ThrowsMask : 0));
484483
}
485484

486485
unsigned getNumArguments() const {
@@ -499,18 +498,18 @@ class TargetFunctionTypeFlags {
499498
return Data;
500499
}
501500

502-
static TargetFunctionTypeFlags<Runtime> fromIntValue(int_type Data) {
501+
static TargetFunctionTypeFlags<int_type> fromIntValue(int_type Data) {
503502
return TargetFunctionTypeFlags(Data);
504503
}
505504

506-
bool operator==(TargetFunctionTypeFlags<Runtime> other) const {
505+
bool operator==(TargetFunctionTypeFlags<int_type> other) const {
507506
return Data == other.Data;
508507
}
509-
bool operator!=(TargetFunctionTypeFlags<Runtime> other) const {
508+
bool operator!=(TargetFunctionTypeFlags<int_type> other) const {
510509
return Data != other.Data;
511510
}
512511
};
513-
using FunctionTypeFlags = TargetFunctionTypeFlags<InProcess>;
512+
using FunctionTypeFlags = TargetFunctionTypeFlags<size_t>;
514513

515514
/// Field types and flags as represented in a nominal type's field/case type
516515
/// vector.

include/swift/Runtime/Metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ struct TargetFunctionTypeMetadata : public TargetMetadata<Runtime> {
20462046
// TODO: Make this target agnostic
20472047
using Argument = FlaggedPointer<const TargetMetadata<Runtime> *, 0>;
20482048

2049-
TargetFunctionTypeFlags<Runtime> Flags;
2049+
TargetFunctionTypeFlags<StoredSize> Flags;
20502050

20512051
/// The type metadata for the result type.
20522052
ConstTargetMetadataPointer<Runtime, TargetMetadata> ResultType;

0 commit comments

Comments
 (0)