Skip to content

Commit 54a9b67

Browse files
jckarterDavide Italiano
authored andcommitted
Reserve the spare bits in closure context pointers.
Although this is a refcounted pointer (for escaping closures, at least), we'd like to eventually take advantage of the ability to bit pack arbitrary payloads into refcountable fields on 64-bit platforms. For nonescaping closures, the context ought to be a trivial arbitrary word as well, so we shouldn't be looking for spare bits to begin with.
1 parent 822ef7f commit 54a9b67

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/IRGen/GenFunc.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,11 @@ const TypeInfo *TypeConverter::convertFunctionType(SILFunctionType *T) {
573573
case SILFunctionType::Representation::Thick: {
574574
SpareBitVector spareBits;
575575
spareBits.append(IGM.getFunctionPointerSpareBits());
576-
spareBits.append(IGM.getHeapObjectSpareBits());
576+
// Although the context pointer of a closure (at least, an escaping one)
577+
// is a refcounted pointer, we'd like to reserve the right to pack small
578+
// contexts into the pointer value, so let's not take any spare bits from
579+
// it.
580+
spareBits.appendClearBits(IGM.getPointerSize().getValueInBits());
577581

578582
if (T->isNoEscape()) {
579583
// @noescape thick functions are trivial types.

0 commit comments

Comments
 (0)