IRGen/Runtime: Keep the payload offset inside both compiler- and runtime-generated box metadata.

A missing link in our polymorphic box projection story, and likely a perf improvement for the generic case as well.

Swift SVN r29835
This commit is contained in:
Joe Groff
2015-07-01 04:51:56 +00:00
parent bd9a3ce9ae
commit d7d3ff2b10
6 changed files with 56 additions and 14 deletions

View File

@@ -211,6 +211,18 @@ IRGenModule::IRGenModule(IRGenModuleDispatcher &dispatcher, SourceFile *SF,
});
FullHeapMetadataPtrTy = FullHeapMetadataStructTy->getPointerTo(DefaultAS);
// A full box metadata is non-type heap metadata for a heap allocation of a
// single value. The box tracks the offset to the value inside the box.
FullBoxMetadataStructTy =
createStructType(*this, "swift.full_boxmetadata", {
dtorPtrTy,
WitnessTablePtrTy,
TypeMetadataStructTy,
Int32Ty,
});
FullBoxMetadataPtrTy = FullBoxMetadataStructTy->getPointerTo(DefaultAS);
llvm::Type *refCountedElts[] = { TypeMetadataPtrTy, Int32Ty, Int32Ty };
RefCountedStructTy->setBody(refCountedElts);