Mercurial > hg > graal-jvmci-8
diff src/share/vm/c1/c1_CodeStubs.hpp @ 6615:09aad8452938
7190310: Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
Summary: In C2 add software membar after load from Reference.referent field to prevent commoning of loads across safepoint since GC can change its value. In C1 always generate Reference.get() intrinsic.
Reviewed-by: roland, twisti, dholmes, johnc
author | kvn |
---|---|
date | Mon, 20 Aug 2012 09:58:58 -0700 |
parents | e1162778c1c8 |
children | da91efe96a93 |
line wrap: on
line diff
--- a/src/share/vm/c1/c1_CodeStubs.hpp Mon Aug 20 09:07:21 2012 -0700 +++ b/src/share/vm/c1/c1_CodeStubs.hpp Mon Aug 20 09:58:58 2012 -0700 @@ -574,71 +574,6 @@ #endif // PRODUCT }; -// This G1 barrier code stub is used in Unsafe.getObject. -// It generates a sequence of guards around the SATB -// barrier code that are used to detect when we have -// the referent field of a Reference object. -// The first check is assumed to have been generated -// in the code generated for Unsafe.getObject(). - -class G1UnsafeGetObjSATBBarrierStub: public CodeStub { - private: - LIR_Opr _val; - LIR_Opr _src; - - LIR_Opr _tmp; - LIR_Opr _thread; - - bool _gen_src_check; - - public: - // A G1 barrier that is guarded by generated guards that determine whether - // val (which is the result of Unsafe.getObject() should be recorded in an - // SATB log buffer. We could be reading the referent field of a Reference object - // using Unsafe.getObject() and we need to record the referent. - // - // * val is the operand returned by the unsafe.getObject routine. - // * src is the base object - // * tmp is a temp used to load the klass of src, and then reference type - // * thread is the thread object. - - G1UnsafeGetObjSATBBarrierStub(LIR_Opr val, LIR_Opr src, - LIR_Opr tmp, LIR_Opr thread, - bool gen_src_check) : - _val(val), _src(src), - _tmp(tmp), _thread(thread), - _gen_src_check(gen_src_check) - { - assert(_val->is_register(), "should have already been loaded"); - assert(_src->is_register(), "should have already been loaded"); - - assert(_tmp->is_register(), "should be a temporary register"); - } - - LIR_Opr val() const { return _val; } - LIR_Opr src() const { return _src; } - - LIR_Opr tmp() const { return _tmp; } - LIR_Opr thread() const { return _thread; } - - bool gen_src_check() const { return _gen_src_check; } - - virtual void emit_code(LIR_Assembler* e); - - virtual void visit(LIR_OpVisitState* visitor) { - visitor->do_slow_case(); - visitor->do_input(_val); - visitor->do_input(_src); - visitor->do_input(_thread); - - visitor->do_temp(_tmp); - } - -#ifndef PRODUCT - virtual void print_name(outputStream* out) const { out->print("G1UnsafeGetObjSATBBarrierStub"); } -#endif // PRODUCT -}; - class G1PostBarrierStub: public CodeStub { private: LIR_Opr _addr;