Use isa-masking to read the class object pointer from

instances of Swift subclasses of ObjC classes.

We were already doing this in the runtime.  This patch
unhides the runtime's mask word (swift_isaMask) and makes
IR-gen take advantage of it when it can.

Swift SVN r21592
This commit is contained in:
John McCall
2014-08-29 21:36:53 +00:00
parent d77d6bddd3
commit 590c25479d
11 changed files with 108 additions and 23 deletions

View File

@@ -380,6 +380,16 @@ llvm::Constant *IRGenModule::getObjCEmptyVTablePtr() {
return ObjCEmptyVTablePtr;
}
Address IRGenModule::getAddrOfObjCISAMask() {
// This symbol is only exported by the runtime if the platform uses
// isa masking.
assert(TargetInfo.hasISAMasking());
if (!ObjCISAMaskPtr) {
ObjCISAMaskPtr = Module.getOrInsertGlobal("swift_isaMask", IntPtrTy);
}
return Address(ObjCISAMaskPtr, getPointerAlignment());
}
llvm::Module *IRGenModule::getModule() const {
return ClangCodeGen->GetModule();
}