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
20 changes: 16 additions & 4 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,6 @@ void CodeGen::genCodeForCpObj(GenTreeBlk* cpObjNode)
if (cpObjNode->IsVolatile())
{
// issue a INS_BARRIER_RMB after a volatile CpObj operation
Comment thread
jakobbotsch marked this conversation as resolved.
// TODO-RISCV64: there is only BARRIER_FULL for RISCV64.
instGen_MemoryBarrier(BARRIER_FULL);
}

Expand Down Expand Up @@ -6257,7 +6256,7 @@ void CodeGen::genJumpToThrowHlpBlk_la(
// instGen_MemoryBarrier: Emit a MemoryBarrier instruction
//
// Arguments:
// barrierKind - kind of barrier to emit (Only supports the Full now!! This depends on the CPU).
// barrierKind - kind of barrier to emit
//
// Notes:
// All MemoryBarriers instructions can be removed by DOTNET_JitNoMemoryBarriers=1
Expand All @@ -6271,8 +6270,21 @@ void CodeGen::instGen_MemoryBarrier(BarrierKind barrierKind)
}
#endif // DEBUG

// TODO-RISCV64: Use the exact barrier type depending on the CPU.
GetEmitter()->emitIns_I(INS_fence, EA_4BYTE, INS_BARRIER_FULL);
insBarrier barrier;
switch (barrierKind)
{
case BARRIER_LOAD_ONLY:
barrier = INS_BARRIER_LOAD_ONLY;
break;
case BARRIER_STORE_ONLY:
barrier = INS_BARRIER_STORE_ONLY;
break;
default:
barrier = INS_BARRIER_FULL;
break;
}

GetEmitter()->emitIns_I(INS_fence, EA_4BYTE, barrier);
Comment thread
JamieMagee marked this conversation as resolved.
}

/*-----------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/jit/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ enum insOpts : unsigned

enum insBarrier : unsigned
{
INS_BARRIER_FULL = 0x33,
INS_BARRIER_FULL = 0x33, // fence rw, rw
INS_BARRIER_LOAD_ONLY = 0x23, // fence r, rw
INS_BARRIER_STORE_ONLY = 0x31, // fence rw, w
};
#elif defined(TARGET_WASM)
enum insOpts : unsigned
Expand Down
Loading