Fix and workarounds for Roslyn.

Fix a check in GenIR::simpleFieldAddress that was allowing bad field indices for StructGEP.

Add NYIs for struct type mismatches.

Treat verification errors as compilation failures.
This commit is contained in:
Eugene Rozenfeld 2015-04-16 16:59:15 -07:00
Родитель 6cce44d449
Коммит b86c667212
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -332,14 +332,17 @@ bool LLILCJit::readMethod(LLILCJitContext *JitContext) {
Function *Func = JitContext->CurrentModule->getFunction(FuncName);
bool IsOk = !verifyFunction(*Func, &dbgs());
assert(IsOk);
if (IsOk) {
if (DumpLevel >= SUMMARY) {
errs() << "Successfully read " << FuncName << '\n';
}
} else {
if (DumpLevel >= SUMMARY) {
errs() << "Read " << FuncName << " but failed verification\n";
errs() << "Failed to read " << FuncName << "[verification error]\n";
}
return false;
}
if (DumpLevel == VERBOSE) {

Просмотреть файл

@ -1761,6 +1761,9 @@ IRNode *GenIR::convertFromStackType(IRNode *Node, CorInfoType CorType,
}
case Type::TypeID::StructTyID:
if (Ty != ResultTy) {
throw NotYetImplementedException("mismatching struct types");
}
ASSERT(Ty == ResultTy);
// No conversions possible/necessary.
break;
@ -2561,7 +2564,7 @@ IRNode *GenIR::simpleFieldAddress(IRNode *BaseAddress,
// Double-check that the field index is sensible. Note
// in unverifiable IL we may not have proper referent types and
// so may see what appear to be unrelated field accesses.
if (BaseObjStructTy->getNumElements() >= FieldIndex) {
if (BaseObjStructTy->getNumElements() > FieldIndex) {
const DataLayout *DataLayout = JitContext->EE->getDataLayout();
const StructLayout *StructLayout =
DataLayout->getStructLayout(BaseObjStructTy);
@ -5565,6 +5568,11 @@ Type *GenIR::getStackMergeType(Type *Ty1, Type *Ty2) {
}
return getType(CORINFO_TYPE_CLASS, MergedClass);
}
if (Ty1->isStructTy() && Ty2->isStructTy()) {
throw NotYetImplementedException("mismatching PHI struct types");
}
ASSERT(UNREACHED);
return nullptr;
}