Skip to content
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

JIT: Convert UNBOX helpers to BBJ_THROW #50360

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15970,6 +15970,9 @@ void Compiler::impImportBlockCode(BasicBlock* block)
}
op1 = gtNewHelperCallNode(helper, TYP_VOID, gtNewCallArgs(op2, op1));

// In this case helper call is a fallback to throw an exception.
op1->AsCall()->gtCallMoreFlags |= GTF_CALL_M_DOES_NOT_RETURN;

op1 = new (this, GT_COLON) GenTreeColon(TYP_VOID, gtNewNothingNode(), op1);
op1 = gtNewQmarkNode(TYP_VOID, condBox, op1);

Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18034,6 +18034,12 @@ void Compiler::fgExpandQmarkStmt(BasicBlock* block, Statement* stmt)
}
Statement* trueStmt = fgNewStmtFromTree(trueExpr, stmt->GetILOffsetX());
fgInsertStmtAtEnd(thenBlock, trueStmt);

// Convert the whole block to BBJ_THROW if trueExpr is a no-return call
if (trueExpr->IsCall() && trueExpr->AsCall()->IsNoReturn())
{
fgConvertBBToThrowBB(thenBlock);
}
}

// Assign the falseExpr into the dst or tmp, insert in elseBlock
Expand All @@ -18045,6 +18051,12 @@ void Compiler::fgExpandQmarkStmt(BasicBlock* block, Statement* stmt)
}
Statement* falseStmt = fgNewStmtFromTree(falseExpr, stmt->GetILOffsetX());
fgInsertStmtAtEnd(elseBlock, falseStmt);

// Convert the whole block to BBJ_THROW if falseExpr is a no-return call
if (falseExpr->IsCall() && falseExpr->AsCall()->IsNoReturn())
{
fgConvertBBToThrowBB(elseBlock);
}
}

#ifdef DEBUG
Expand Down