< prev index next >

src/hotspot/share/gc/z/c1/zBarrierSetC1.cpp

Print this page
@@ -88,26 +88,49 @@
  }
  #endif // PRODUCT
  
  class LIR_OpZLoadBarrierTest : public LIR_Op {
  private:
+ #ifdef RISCV
+   LIR_Opr _mask;
+ #endif
    LIR_Opr _opr;
  
  public:
-   LIR_OpZLoadBarrierTest(LIR_Opr opr) :
+   LIR_OpZLoadBarrierTest(
+ #ifdef RISCV
+                          LIR_Opr mask,
+ #endif
+                          LIR_Opr opr) :
        LIR_Op(),
+ #ifdef RISCV
+       _mask(mask),
+ #endif
        _opr(opr) {}
  
    virtual void visit(LIR_OpVisitState* state) {
+ #ifdef RISCV
+     state->do_output(_opr);
+     state->do_output(_mask);
+ #else
      state->do_input(_opr);
+ #endif
    }
  
    virtual void emit_code(LIR_Assembler* ce) {
-     ZBarrierSet::assembler()->generate_c1_load_barrier_test(ce, _opr);
+     ZBarrierSet::assembler()->generate_c1_load_barrier_test(ce,
+ #ifdef RISCV
+                                                             _mask,
+ #endif
+                                                             _opr);
    }
  
    virtual void print_instr(outputStream* out) const {
+ #ifdef RISCV
+     _mask->print(out);
+     out->print(" ");
+ #endif
      _opr->print(out);
      out->print(" ");
    }
  
  #ifndef PRODUCT

@@ -142,15 +165,25 @@
  #define __ access.gen()->lir()->
  #endif
  
  void ZBarrierSetC1::load_barrier(LIRAccess& access, LIR_Opr result) const {
    // Fast path
-   __ append(new LIR_OpZLoadBarrierTest(result));
+ #ifdef RISCV
+   LIR_Opr mask = access.gen()->new_pointer_register();
+ #endif
+   __ append(new LIR_OpZLoadBarrierTest(
+ #ifdef RISCV
+                                        mask,
+ #endif
+                                        result));
  
    // Slow path
    const address runtime_stub = load_barrier_on_oop_field_preloaded_runtime_stub(access.decorators());
    CodeStub* const stub = new ZLoadBarrierStubC1(access, result, runtime_stub);
+ #ifdef RISCV
+   __ cmp(lir_cond_notEqual, mask, LIR_OprFact::longConst(0));
+ #endif
    __ branch(lir_cond_notEqual, stub);
    __ branch_destination(stub->continuation());
  }
  
  LIR_Opr ZBarrierSetC1::resolve_address(LIRAccess& access, bool resolve_in_register) {
< prev index next >