Skip to content
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
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ class CodeGen final : public CodeGenInterface
void genReserveFuncletProlog(BasicBlock* block);
void genReserveFuncletEpilog(BasicBlock* block);
void genFuncletProlog(BasicBlock* block);
void genFuncletEpilog();
void genFuncletEpilog(BasicBlock* block);
void genCaptureFuncletPrologEpilogInfo();

void genUpdateCurrentFunclet(BasicBlock* block);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
* Generates code for an EH funclet epilog.
*/

void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* /* block */)
{
#ifdef DEBUG
if (verbose)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
* See the description of frame shapes at genFuncletProlog().
*/

void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* /* block */)
{
#ifdef DEBUG
if (verbose)
Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,18 @@ void CodeGen::genGenerateCode(void** codePtr, uint32_t* nativeSizeOfCode)
}
#endif // defined(TARGET_WASM)
#endif // DEBUG

#if defined(TARGET_WASM)
// Also fail at this point for any method with funclets, since the Wasm we produce
// for such methods requires post-processing by the host before it can be validated.
// TODO-WASM: Remove this once the host can do the processing.
//
if ((JitConfig.JitWasmFunclets() == 0) && (m_compiler->compFuncCount() > 1))
{
JITDUMP("Failing R2R codegen because method has funclets.\n");
implReadyToRunUnsupported();
}
#endif
}

//----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ void CodeGen::genCodeForBlock(BasicBlock* block)
GetEmitter()->emitSetFirstColdIGCookie(block->bbEmitCookie);
}

genEmitStartBlock(block);

// Both stacks are always empty on entry to a basic block.
assert(genStackLevel == 0);
genAdjustStackLevel(block);
Expand All @@ -444,6 +442,8 @@ void CodeGen::genCodeForBlock(BasicBlock* block)
genReserveFuncletProlog(block);
}

genEmitStartBlock(block);

// Clear compCurStmt and compCurLifeTree.
m_compiler->compCurStmt = nullptr;
m_compiler->compCurLifeTree = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
* Generates code for an EH funclet epilog.
*/

void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* /* block */)
{
#ifdef DEBUG
if (verbose)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
*
* See the description of frame shapes at genFuncletProlog().
*/
void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* /* block */)
{
#ifdef DEBUG
if (verbose)
Expand Down
15 changes: 13 additions & 2 deletions src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,21 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
//------------------------------------------------------------------------
// genFuncletEpilog: codegen for funclet epilogs.
//
// For Wasm, funclet epilogs are empty
// Arguments:
// block - funclet epilog block
//
void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* block)
{
ScopedSetVariable<bool> _setGeneratingEpilog(&m_compiler->compGeneratingEpilog, true);

if (block->IsLast() || m_compiler->bbIsFuncletBeg(block->Next()))
{
instGen(INS_end);
}
else
{
instGen(INS_return);
}
}

//------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10865,7 +10865,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
* Note that we don't do anything with unwind codes, because AMD64 only cares about unwind codes for the prolog.
*/

void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* /* block */)
{
#ifdef DEBUG
if (verbose)
Expand Down Expand Up @@ -10992,7 +10992,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
* Generates code for an EH funclet epilog.
*/

void CodeGen::genFuncletEpilog()
void CodeGen::genFuncletEpilog(BasicBlock* /* block */)
{
#ifdef DEBUG
if (verbose)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@ void emitter::emitGeneratePrologEpilog()
case IGPT_FUNCLET_EPILOG:
INDEBUG(++funcletEpilogCnt);
emitBegFuncletEpilog(igPh);
codeGen->genFuncletEpilog();
codeGen->genFuncletEpilog(igPhBB);
emitEndFuncletEpilog();
break;

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,8 @@ CONFIG_INTEGER(JitWasmNyiToR2RUnsupported, "JitWasmNyiToR2RUnsupported", 0)
// Specify methods that will fail with R2R unsupported after codegen.
// Useful for bypassing methods that compile cleanly but have invalid Wasm codegen.
CONFIG_STRING(JitR2RUnsupportedRange, "JitR2RUnsupportedRange")
// Enable processing methods with funclets.
RELEASE_CONFIG_INTEGER(JitWasmFunclets, "JitWasmFunclets", 0)
#endif // defined(TARGET_WASM)

// Allow to enregister locals with struct type.
Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/jit/regallocwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ void WasmRegAlloc::CollectReference(GenTree* node)
PerFuncletData* const data = m_perFuncletData[m_currentFunclet];
VirtualRegReferences* refs = data->m_virtualRegRefs;

// We may make multiple consecutive collection calls for the same node.
// We may make multiple collection calls for the same node.
// We only want to collect it once.
//
if (data->m_lastVirtualRegRefsCount > 0)
Expand Down Expand Up @@ -777,6 +777,8 @@ void WasmRegAlloc::RequestTemporaryRegisterForMultiplyUsedNode(GenTree* node)
regNumber reg = AllocateTemporaryRegister(node->TypeGet());
assert((node->GetRegNum() == REG_NA) && "Trying to double-assign a temporary register");
node->SetRegNum(reg);

CollectReference(node);
}

//------------------------------------------------------------------------
Expand All @@ -799,7 +801,6 @@ void WasmRegAlloc::ConsumeTemporaryRegForOperand(GenTree* operand DEBUGARG(const

regNumber reg = ReleaseTemporaryRegister(genActualType(operand));
assert((reg == operand->GetRegNum()) && "Temporary reg being consumed out of order");
CollectReference(operand);

operand->gtLIRFlags &= ~LIR::Flags::MultiplyUsed;
JITDUMP("Consumed a temporary reg for [%06u]: %s\n", Compiler::dspTreeID(operand), reason);
Expand All @@ -819,6 +820,8 @@ void WasmRegAlloc::ConsumeTemporaryRegForOperand(GenTree* operand DEBUGARG(const
//
regNumber WasmRegAlloc::RequestInternalRegister(GenTree* node, var_types type)
{
JITDUMP("Requesting internal %s register for [%06u]\n", varTypeName(type), Compiler::dspTreeID(node));

regNumber reg = AllocateTemporaryRegister(type);
m_codeGen->internalRegisters.Add(node, reg);
CollectReference(node);
Expand Down
Loading