Use an i32 argument instead of size

more int32

zzz
This commit is contained in:
Alejandro Alonso
2023-08-15 14:29:43 -07:00
parent a445cf29bf
commit c20ab10cef
4 changed files with 11 additions and 12 deletions

View File

@@ -1044,7 +1044,7 @@ SWIFT_RUNTIME_EXPORT
void swift_initRawStructMetadata(StructMetadata *self, void swift_initRawStructMetadata(StructMetadata *self,
StructLayoutFlags flags, StructLayoutFlags flags,
const TypeLayout *likeType, const TypeLayout *likeType,
size_t count); int32_t count);
#pragma clang diagnostic pop #pragma clang diagnostic pop

View File

@@ -2489,12 +2489,12 @@ FUNCTION(GenericInstantiateLayoutString,
// void swift_initRawStructMetadata(Metadata *structType, // void swift_initRawStructMetadata(Metadata *structType,
// StructLayoutFlags flags, // StructLayoutFlags flags,
// const TypeLayout *likeType, // const TypeLayout *likeType,
// size_t count); // int32_t count);
FUNCTION(InitRawStructMetadata, FUNCTION(InitRawStructMetadata,
swift_initRawStructMetadata, swift_initRawStructMetadata,
C_CC, AlwaysAvailable, C_CC, AlwaysAvailable,
RETURNS(VoidTy), RETURNS(VoidTy),
ARGS(TypeMetadataPtrTy, SizeTy, Int8PtrPtrTy->getPointerTo(0), SizeTy), ARGS(TypeMetadataPtrTy, SizeTy, Int8PtrPtrTy->getPointerTo(0), Int32Ty),
ATTRS(NoUnwind), ATTRS(NoUnwind),
EFFECT(MetaData)) EFFECT(MetaData))

View File

@@ -2984,7 +2984,7 @@ static void emitInitializeFieldOffsetVectorWithLayoutString(
} }
static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType, static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType,
Size count, SILType T, int32_t count, SILType T,
llvm::Value *metadata, llvm::Value *metadata,
MetadataDependencyCollector *collector) { MetadataDependencyCollector *collector) {
auto &IGM = IGF.IGM; auto &IGM = IGF.IGM;
@@ -3040,8 +3040,8 @@ static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType,
"vwtFlags"); "vwtFlags");
// Count is only ever -1 if we're not an array like layout. // Count is only ever -1 if we're not an array like layout.
if (count != Size(-1)) { if (count != -1) {
stride = IGF.Builder.CreateMul(stride, IGM.getSize(count)); stride = IGF.Builder.CreateMul(stride, IGM.getSize(Size(count)));
size = stride; size = stride;
} }
@@ -3067,7 +3067,7 @@ static void emitInitializeRawLayoutOld(IRGenFunction &IGF, SILType likeType,
} }
static void emitInitializeRawLayout(IRGenFunction &IGF, SILType likeType, static void emitInitializeRawLayout(IRGenFunction &IGF, SILType likeType,
Size count, SILType T, int32_t count, SILType T,
llvm::Value *metadata, llvm::Value *metadata,
MetadataDependencyCollector *collector) { MetadataDependencyCollector *collector) {
// If our deployment target doesn't contain the new swift_initRawStructMetadata, // If our deployment target doesn't contain the new swift_initRawStructMetadata,
@@ -3090,7 +3090,7 @@ static void emitInitializeRawLayout(IRGenFunction &IGF, SILType likeType,
// Call swift_initRawStructMetadata(). // Call swift_initRawStructMetadata().
IGF.Builder.CreateCall(IGM.getInitRawStructMetadataFunctionPointer(), IGF.Builder.CreateCall(IGM.getInitRawStructMetadataFunctionPointer(),
{metadata, IGM.getSize(Size(uintptr_t(flags))), {metadata, IGM.getSize(Size(uintptr_t(flags))),
likeTypeLayout, IGM.getSize(count)}); likeTypeLayout, IGM.getInt32(count)});
} }
static void emitInitializeValueMetadata(IRGenFunction &IGF, static void emitInitializeValueMetadata(IRGenFunction &IGF,
@@ -3115,18 +3115,17 @@ static void emitInitializeValueMetadata(IRGenFunction &IGF,
// is the wrong thing for these types. // is the wrong thing for these types.
if (auto rawLayout = nominalDecl->getAttrs().getAttribute<RawLayoutAttr>()) { if (auto rawLayout = nominalDecl->getAttrs().getAttribute<RawLayoutAttr>()) {
SILType loweredLikeType; SILType loweredLikeType;
Size count; int32_t count = -1;
if (auto likeType = rawLayout->getResolvedScalarLikeType(sd)) { if (auto likeType = rawLayout->getResolvedScalarLikeType(sd)) {
loweredLikeType = IGM.getLoweredType(AbstractionPattern::getOpaque(), loweredLikeType = IGM.getLoweredType(AbstractionPattern::getOpaque(),
*likeType); *likeType);
count = Size(-1);
} else if (auto likeArray = rawLayout->getResolvedArrayLikeTypeAndCount(sd)) { } else if (auto likeArray = rawLayout->getResolvedArrayLikeTypeAndCount(sd)) {
auto likeType = likeArray->first; auto likeType = likeArray->first;
loweredLikeType = IGM.getLoweredType(AbstractionPattern::getOpaque(), loweredLikeType = IGM.getLoweredType(AbstractionPattern::getOpaque(),
likeType); likeType);
count = Size(likeArray->second); count = likeArray->second;
} }
emitInitializeRawLayout(IGF, loweredLikeType, count, loweredTy, metadata, emitInitializeRawLayout(IGF, loweredLikeType, count, loweredTy, metadata,

View File

@@ -2910,7 +2910,7 @@ SWIFT_RUNTIME_EXPORT
void swift::swift_initRawStructMetadata(StructMetadata *structType, void swift::swift_initRawStructMetadata(StructMetadata *structType,
StructLayoutFlags layoutFlags, StructLayoutFlags layoutFlags,
const TypeLayout *likeTypeLayout, const TypeLayout *likeTypeLayout,
size_t count) { int32_t count) {
auto vwtable = getMutableVWTableForInit(structType, layoutFlags); auto vwtable = getMutableVWTableForInit(structType, layoutFlags);
// The existing vwt function entries are all fine to preserve, the only thing // The existing vwt function entries are all fine to preserve, the only thing