Skip to content

Fix an issue that was uncovered by the linux fix: resolves verifier bug in 32-bit code #9177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/IRGen/LoadableByAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,11 @@ void LargeValueVisitor::visitApply(ApplySite applySite) {
SILValue currOperand = operand.get();
SILType silType = currOperand->getType();
SILType newSilType = getNewSILType(genEnv, silType, pass.Mod);
if (silType != newSilType) {
if (silType != newSilType ||
std::find(pass.largeLoadableArgs.begin(), pass.largeLoadableArgs.end(),
currOperand) != pass.largeLoadableArgs.end() ||
std::find(pass.funcSigArgs.begin(), pass.funcSigArgs.end(),
currOperand) != pass.funcSigArgs.end()) {
pass.applies.push_back(applySite.getInstruction());
return;
}
Expand Down
29 changes: 18 additions & 11 deletions lib/SIL/SILVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2244,9 +2244,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {

void checkClassMethodInst(ClassMethodInst *CMI) {
auto overrideTy = TC.getConstantOverrideType(CMI->getMember());
requireSameType(CMI->getType(),
SILType::getPrimitiveObjectType(overrideTy),
"result type of class_method must match abstracted type of method");
if (CMI->getModule().getStage() != SILStage::Lowered) {
requireSameType(
CMI->getType(), SILType::getPrimitiveObjectType(overrideTy),
"result type of class_method must match abstracted type of method");
}
auto methodType = requireObjectType(SILFunctionType, CMI,
"result of class_method");
require(!methodType->getExtInfo().hasContext(),
Expand Down Expand Up @@ -2280,8 +2282,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {

void checkSuperMethodInst(SuperMethodInst *CMI) {
auto overrideTy = TC.getConstantOverrideType(CMI->getMember());
requireSameType(CMI->getType(), SILType::getPrimitiveObjectType(overrideTy),
"result type of super_method must match abstracted type of method");
if (CMI->getModule().getStage() != SILStage::Lowered) {
requireSameType(
CMI->getType(), SILType::getPrimitiveObjectType(overrideTy),
"result type of super_method must match abstracted type of method");
}
auto methodType = requireObjectType(SILFunctionType, CMI,
"result of super_method");
require(!methodType->getExtInfo().hasContext(),
Expand Down Expand Up @@ -4226,12 +4231,14 @@ void SILVTable::verify(const SILModule &M) const {
llvm::raw_svector_ostream os(baseName);
entry.Method.print(os);
}

SILVerifier(*entry.Implementation)
.requireABICompatibleFunctionTypes(
baseInfo.getSILType().castTo<SILFunctionType>(),
entry.Implementation->getLoweredFunctionType(),
"vtable entry for " + baseName + " must be ABI-compatible");

if (M.getStage() != SILStage::Lowered) {
SILVerifier(*entry.Implementation)
.requireABICompatibleFunctionTypes(
baseInfo.getSILType().castTo<SILFunctionType>(),
entry.Implementation->getLoweredFunctionType(),
"vtable entry for " + baseName + " must be ABI-compatible");
}
}
#endif
}
Expand Down