Commit 980f0902 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC/s390: [wasm] Implement "atomic.fence" operator.

Port 4ca8b4dd

Original Commit Message:

    This adds decoding and compilation of the "atomic.fence" operator, which
    is intended to preserve the synchronization guarantees of higher-level
    languages.

    Unlike other atomic operators, it does not target a particular linear
    memory. It may occur in modules which declare no memory, or a non-shared
    memory, without causing a validation error.

    See proposal: https://github.com/WebAssembly/threads/pull/141
    See discussion: https://github.com/WebAssembly/threads/issues/140

R=mstarzinger@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:9452
LOG=N

Change-Id: Ib8ad24e65154d7555a47e537f81110be47f4d4de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1710620
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62850}
parent 0796d1da
......@@ -1195,6 +1195,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
break;
}
case kPPC_Sync: {
__ sync();
break;
}
case kPPC_And:
if (HasRegisterInput(instr, 1)) {
__ and_(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1),
......
......@@ -13,6 +13,7 @@ namespace compiler {
// Most opcodes specify a single instruction.
#define TARGET_ARCH_OPCODE_LIST(V) \
V(PPC_Peek) \
V(PPC_Sync) \
V(PPC_And) \
V(PPC_AndComplement) \
V(PPC_Or) \
......
......@@ -143,6 +143,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_Push:
case kPPC_PushFrame:
case kPPC_StoreToStackSlot:
case kPPC_Sync:
return kHasSideEffect;
case kPPC_AtomicStoreUint8:
......
......@@ -1853,6 +1853,11 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
g.UseRegister(left), g.UseRegister(right));
}
void InstructionSelector::VisitMemoryBarrier(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_Sync, g.NoOutput());
}
void InstructionSelector::VisitWord32AtomicLoad(Node* node) { VisitLoad(node); }
void InstructionSelector::VisitWord64AtomicLoad(Node* node) { VisitLoad(node); }
......
......@@ -2198,6 +2198,11 @@ void InstructionSelector::EmitPrepareArguments(
}
}
void InstructionSelector::VisitMemoryBarrier(Node* node) {
S390OperandGenerator g(this);
Emit(kArchNop, g.NoOutput());
}
bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment