src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp

changeset 4106
7eca5de9e0b6
parent 4051
8a02ca5e5576
child 4860
46f6f063b272
     1.1 --- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Wed Sep 19 16:50:26 2012 -0700
     1.2 +++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Thu Sep 20 16:49:17 2012 +0200
     1.3 @@ -1204,3 +1204,58 @@
     1.4      __ load(addr, dst);
     1.5    }
     1.6  }
     1.7 +
     1.8 +void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {
     1.9 +  BasicType type = x->basic_type();
    1.10 +  LIRItem src(x->object(), this);
    1.11 +  LIRItem off(x->offset(), this);
    1.12 +  LIRItem value(x->value(), this);
    1.13 +
    1.14 +  src.load_item();
    1.15 +  value.load_item();
    1.16 +  off.load_nonconstant();
    1.17 +
    1.18 +  LIR_Opr dst = rlock_result(x, type);
    1.19 +  LIR_Opr data = value.result();
    1.20 +  bool is_obj = (type == T_ARRAY || type == T_OBJECT);
    1.21 +  LIR_Opr offset = off.result();
    1.22 +
    1.23 +  if (data != dst) {
    1.24 +    __ move(data, dst);
    1.25 +    data = dst;
    1.26 +  }
    1.27 +
    1.28 +  assert (!x->is_add() && (type == T_INT || (is_obj LP64_ONLY(&& UseCompressedOops))), "unexpected type");
    1.29 +  LIR_Address* addr;
    1.30 +  if (offset->is_constant()) {
    1.31 +
    1.32 +#ifdef _LP64
    1.33 +    jlong l = offset->as_jlong();
    1.34 +    assert((jlong)((jint)l) == l, "offset too large for constant");
    1.35 +    jint c = (jint)l;
    1.36 +#else
    1.37 +    jint c = offset->as_jint();
    1.38 +#endif
    1.39 +    addr = new LIR_Address(src.result(), c, type);
    1.40 +  } else {
    1.41 +    addr = new LIR_Address(src.result(), offset, type);
    1.42 +  }
    1.43 +
    1.44 +  LIR_Opr tmp = LIR_OprFact::illegalOpr;
    1.45 +  LIR_Opr ptr = LIR_OprFact::illegalOpr;
    1.46 +
    1.47 +  if (is_obj) {
    1.48 +    // Do the pre-write barrier, if any.
    1.49 +    // barriers on sparc don't work with a base + index address
    1.50 +    tmp = FrameMap::G3_opr;
    1.51 +    ptr = new_pointer_register();
    1.52 +    __ add(src.result(), off.result(), ptr);
    1.53 +    pre_barrier(ptr, LIR_OprFact::illegalOpr /* pre_val */,
    1.54 +                true /* do_load */, false /* patch */, NULL);
    1.55 +  }
    1.56 +  __ xchg(LIR_OprFact::address(addr), data, dst, tmp);
    1.57 +  if (is_obj) {
    1.58 +    // Seems to be a precise address
    1.59 +    post_barrier(ptr, data);
    1.60 +  }
    1.61 +}

mercurial