Skip to content

Commit

Permalink
PPC/s390: [wasm] Implement "atomic.fence" operator.
Browse files Browse the repository at this point in the history
Port 4ca8b4d

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: WebAssembly/threads#141
    See discussion: WebAssembly/threads#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: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62850}
  • Loading branch information
Milad Farazmand authored and Commit Bot committed Jul 22, 2019
1 parent 0796d1d commit 980f090
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compiler/backend/ppc/code-generator-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions src/compiler/backend/ppc/instruction-codes-ppc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
1 change: 1 addition & 0 deletions src/compiler/backend/ppc/instruction-scheduler-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_Push:
case kPPC_PushFrame:
case kPPC_StoreToStackSlot:
case kPPC_Sync:
return kHasSideEffect;

case kPPC_AtomicStoreUint8:
Expand Down
5 changes: 5 additions & 0 deletions src/compiler/backend/ppc/instruction-selector-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
5 changes: 5 additions & 0 deletions src/compiler/backend/s390/instruction-selector-s390.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit 980f090

Please sign in to comment.