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
25 changes: 16 additions & 9 deletions src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,6 @@ void CodeGen::genEmitStartBlock(BasicBlock* block)
{
instGen(INS_end);
WasmInterval* interval = wasmControlFlowStack->Pop();

if (!interval->IsLoop() && !block->HasFlag(BBF_HAS_LABEL))
{
block->SetFlags(BBF_HAS_LABEL);
genDefineTempLabel(block);
}
}

// Push control flow for intervals that start here or earlier, and emit
Expand All @@ -185,10 +179,23 @@ void CodeGen::genEmitStartBlock(BasicBlock* block)
wasmCursor++;
wasmControlFlowStack->Push(interval);

if (interval->IsLoop() && !block->HasFlag(BBF_HAS_LABEL))
if (interval->IsLoop())
{
block->SetFlags(BBF_HAS_LABEL);
genDefineTempLabel(block);
if (!block->HasFlag(BBF_HAS_LABEL))
{
block->SetFlags(BBF_HAS_LABEL);
genDefineTempLabel(block);
}
}
else
{
BasicBlock* const endBlock = compiler->fgIndexToBlockMap[interval->End()];

if (!endBlock->HasFlag(BBF_HAS_LABEL))
{
endBlock->SetFlags(BBF_HAS_LABEL);
genDefineTempLabel(endBlock);
}
}

if (wasmCursor >= compiler->fgWasmIntervals->size())
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5242,6 +5242,7 @@ class Compiler

#ifdef TARGET_WASM
jitstd::vector<WasmInterval*>* fgWasmIntervals = nullptr;
BasicBlock** fgIndexToBlockMap = nullptr;
#endif

FlowGraphDfsTree* m_dfsTree = nullptr;
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/fgwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,10 @@ PhaseStatus Compiler::fgWasmControlFlow()
}
}

// Publish the index to block map for use during codegen.
//
fgIndexToBlockMap = initialLayout;

JITDUMPEXEC(fgDumpWasmControlFlow());
JITDUMPEXEC(fgDumpWasmControlFlowDot());

Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2492,10 +2492,13 @@ PhaseStatus Compiler::fgAddInternal()

CORINFO_JUST_MY_CODE_HANDLE* pDbgHandle = nullptr;
CORINFO_JUST_MY_CODE_HANDLE dbgHandle = nullptr;

#if !defined(TARGET_WASM)
if (opts.compDbgCode && !opts.jitFlags->IsSet(JitFlags::JIT_FLAG_IL_STUB))
{
dbgHandle = info.compCompHnd->getJustMyCodeHandle(info.compMethodHnd, &pDbgHandle);
}
#endif

noway_assert(!dbgHandle || !pDbgHandle);

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4526,12 +4526,12 @@ GenTree* Lowering::OptimizeConstCompare(GenTree* cmp)
//
GenTree* Lowering::LowerCompare(GenTree* cmp)
{
#ifndef TARGET_64BIT
#if LOWER_DECOMPOSE_LONGS
if (cmp->gtGetOp1()->TypeIs(TYP_LONG))
{
return DecomposeLongCompare(cmp);
}
#endif
#endif // LOWER_DECOMPOSE_LONGS

if (cmp->gtGetOp2()->IsIntegralConst() && !comp->opts.MinOpts())
{
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/jit/scopeinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,15 @@ void CodeGen::siBeginBlock(BasicBlock* block)
//
void CodeGen::siOpenScopesForNonTrackedVars(const BasicBlock* block, unsigned int lastBlockILEndOffset)
{
#if defined(TARGET_WASM)
// TODO-WASM: Wasm structured control flow
// requirements are incompatible with debug codegen's
// desire to keep blocks in increasing IL offset
// order. Figure out the proper scope manipulations.
//
return;
#endif // defined(TARGET_WASM)

unsigned int beginOffs = block->bbCodeOffs;

// There aren't any tracked locals.
Expand Down
Loading