Skip to content

Commit 1a76f8f

Browse files
committed
[sil] Move alloc_box flags to SharedUInt8.
1 parent 4a30957 commit 1a76f8f

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

include/swift/SIL/SILInstruction.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,8 +2456,7 @@ class AllocBoxInst final
24562456

24572457
TailAllocatedDebugVariable VarInfo;
24582458

2459-
unsigned HasDynamicLifetime : 1;
2460-
unsigned Reflection : 1;
2459+
USE_SHARED_UINT8;
24612460

24622461
AllocBoxInst(SILDebugLocation DebugLoc, CanSILBoxType BoxType,
24632462
ArrayRef<SILValue> TypeDependentOperands, SILFunction &F,
@@ -2475,13 +2474,20 @@ class AllocBoxInst final
24752474
return getType().castTo<SILBoxType>();
24762475
}
24772476

2478-
void setDynamicLifetime() { HasDynamicLifetime = true; }
2479-
bool hasDynamicLifetime() const { return HasDynamicLifetime; }
2477+
void setDynamicLifetime() {
2478+
sharedUInt8().AllocBoxInst.dynamicLifetime = true;
2479+
}
2480+
2481+
bool hasDynamicLifetime() const {
2482+
return sharedUInt8().AllocBoxInst.dynamicLifetime;
2483+
}
24802484

24812485
/// True if the box should be emitted with reflection metadata for its
24822486
/// contents.
2483-
bool emitReflectionMetadata() const { return Reflection; }
2484-
2487+
bool emitReflectionMetadata() const {
2488+
return sharedUInt8().AllocBoxInst.reflection;
2489+
}
2490+
24852491
// Return the type of the memory stored in the alloc_box.
24862492
SILType getAddressType() const;
24872493

include/swift/SIL/SILNode.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ class alignas(8) SILNode :
214214
usesMoveableValueDebugInfo : 1,
215215
hasInvalidatedVarInfo : 1);
216216

217+
SHARED_FIELD(AllocBoxInst, uint8_t
218+
dynamicLifetime : 1,
219+
reflection : 1);
220+
217221
SHARED_FIELD(AllocRefInstBase, uint8_t
218222
objC : 1,
219223
onStack : 1,

lib/SIL/IR/SILInstructions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,13 @@ bool AllocRefDynamicInst::isDynamicTypeDeinitAndSizeKnownEquivalentToBaseType()
375375
AllocBoxInst::AllocBoxInst(SILDebugLocation Loc, CanSILBoxType BoxType,
376376
ArrayRef<SILValue> TypeDependentOperands,
377377
SILFunction &F, Optional<SILDebugVariable> Var,
378-
bool hasDynamicLifetime,
379-
bool reflection)
378+
bool hasDynamicLifetime, bool reflection)
380379
: NullaryInstructionWithTypeDependentOperandsBase(
381380
Loc, TypeDependentOperands, SILType::getPrimitiveObjectType(BoxType)),
382-
VarInfo(Var, getTrailingObjects<char>()),
383-
HasDynamicLifetime(hasDynamicLifetime),
384-
Reflection(reflection) {}
381+
VarInfo(Var, getTrailingObjects<char>()) {
382+
sharedUInt8().AllocBoxInst.dynamicLifetime = hasDynamicLifetime;
383+
sharedUInt8().AllocBoxInst.reflection = reflection;
384+
}
385385

386386
AllocBoxInst *AllocBoxInst::create(SILDebugLocation Loc,
387387
CanSILBoxType BoxType,

0 commit comments

Comments
 (0)