Skip to content

Commit 3153e26

Browse files
committed
Use an i32 argument instead of size
more int32
1 parent a445cf2 commit 3153e26

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

include/swift/Runtime/Metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ SWIFT_RUNTIME_EXPORT
10441044
void swift_initRawStructMetadata(StructMetadata *self,
10451045
StructLayoutFlags flags,
10461046
const TypeLayout *likeType,
1047-
size_t count);
1047+
int32_t count);
10481048

10491049
#pragma clang diagnostic pop
10501050

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,12 +2489,12 @@ FUNCTION(GenericInstantiateLayoutString,
24892489
// void swift_initRawStructMetadata(Metadata *structType,
24902490
// StructLayoutFlags flags,
24912491
// const TypeLayout *likeType,
2492-
// size_t count);
2492+
// int32_t count);
24932493
FUNCTION(InitRawStructMetadata,
24942494
swift_initRawStructMetadata,
24952495
C_CC, AlwaysAvailable,
24962496
RETURNS(VoidTy),
2497-
ARGS(TypeMetadataPtrTy, SizeTy, Int8PtrPtrTy->getPointerTo(0), SizeTy),
2497+
ARGS(TypeMetadataPtrTy, SizeTy, Int8PtrPtrTy->getPointerTo(0), Int32Ty),
24982498
ATTRS(NoUnwind),
24992499
EFFECT(MetaData))
25002500

lib/IRGen/GenMeta.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,7 +2984,7 @@ static void emitInitializeFieldOffsetVectorWithLayoutString(
29842984
}
29852985

29862986
static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType,
2987-
Size count, SILType T,
2987+
int32_t count, SILType T,
29882988
llvm::Value *metadata,
29892989
MetadataDependencyCollector *collector) {
29902990
auto &IGM = IGF.IGM;
@@ -3040,8 +3040,8 @@ static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType,
30403040
"vwtFlags");
30413041

30423042
// Count is only ever -1 if we're not an array like layout.
3043-
if (count != Size(-1)) {
3044-
stride = IGF.Builder.CreateMul(stride, IGM.getSize(count));
3043+
if (count != -1) {
3044+
stride = IGF.Builder.CreateMul(stride, IGM.getInt32(count));
30453045
size = stride;
30463046
}
30473047

@@ -3067,7 +3067,7 @@ static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType,
30673067
}
30683068

30693069
static void emitInitializeRawLayout(IRGenFunction &IGF, SILType likeType,
3070-
Size count, SILType T,
3070+
int32_t count, SILType T,
30713071
llvm::Value *metadata,
30723072
MetadataDependencyCollector *collector) {
30733073
// If our deployment target doesn't contain the new swift_initRawStructMetadata,
@@ -3090,7 +3090,7 @@ static void emitInitializeRawLayout(IRGenFunction &IGF, SILType likeType,
30903090
// Call swift_initRawStructMetadata().
30913091
IGF.Builder.CreateCall(IGM.getInitRawStructMetadataFunctionPointer(),
30923092
{metadata, IGM.getSize(Size(uintptr_t(flags))),
3093-
likeTypeLayout, IGM.getSize(count)});
3093+
likeTypeLayout, IGM.getInt32(count)});
30943094
}
30953095

30963096
static void emitInitializeValueMetadata(IRGenFunction &IGF,
@@ -3115,18 +3115,17 @@ static void emitInitializeValueMetadata(IRGenFunction &IGF,
31153115
// is the wrong thing for these types.
31163116
if (auto rawLayout = nominalDecl->getAttrs().getAttribute<RawLayoutAttr>()) {
31173117
SILType loweredLikeType;
3118-
Size count;
3118+
int32_t count = -1;
31193119

31203120
if (auto likeType = rawLayout->getResolvedScalarLikeType(sd)) {
31213121
loweredLikeType = IGM.getLoweredType(AbstractionPattern::getOpaque(),
31223122
*likeType);
3123-
count = Size(-1);
31243123
} else if (auto likeArray = rawLayout->getResolvedArrayLikeTypeAndCount(sd)) {
31253124
auto likeType = likeArray->first;
31263125
loweredLikeType = IGM.getLoweredType(AbstractionPattern::getOpaque(),
31273126
likeType);
31283127

3129-
count = Size(likeArray->second);
3128+
count = likeArray->second;
31303129
}
31313130

31323131
emitInitializeRawLayout(IGF, loweredLikeType, count, loweredTy, metadata,

stdlib/public/runtime/Metadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2910,7 +2910,7 @@ SWIFT_RUNTIME_EXPORT
29102910
void swift::swift_initRawStructMetadata(StructMetadata *structType,
29112911
StructLayoutFlags layoutFlags,
29122912
const TypeLayout *likeTypeLayout,
2913-
size_t count) {
2913+
int32_t count) {
29142914
auto vwtable = getMutableVWTableForInit(structType, layoutFlags);
29152915

29162916
// The existing vwt function entries are all fine to preserve, the only thing

0 commit comments

Comments
 (0)