Mercurial > hg > jdk9-shenandoah > hotspot
changeset 9625:c7cafe8a2ba0
Fix Shenandoah-improved CAS-obj intrinsic in C2.
author | rkennke |
---|---|
date | Thu, 24 Sep 2015 12:49:23 +0200 |
parents | 790069ea3727 |
children | fd59c4412e00 |
files | src/share/vm/opto/library_call.cpp |
diffstat | 1 files changed, 16 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/opto/library_call.cpp Tue Sep 22 23:47:24 2015 +0200 +++ b/src/share/vm/opto/library_call.cpp Thu Sep 24 12:49:23 2015 +0200 @@ -2697,6 +2697,7 @@ // For now, we handle only those cases that actually exist: ints, // longs, and Object. Adding others should be straightforward. Node* load_store; + Node* result; switch(type) { case T_INT: if (kind == LS_xadd) { @@ -2708,6 +2709,7 @@ } else { ShouldNotReachHere(); } + result = load_store; break; case T_LONG: if (kind == LS_xadd) { @@ -2719,6 +2721,7 @@ } else { ShouldNotReachHere(); } + result = load_store; break; case T_OBJECT: // Transformation of a value which could be NULL pointer (CastPP #NULL) @@ -2765,6 +2768,7 @@ load_store = _gvn.transform(new CompareAndSwapNNode(control(), mem, adr, newval_enc, oldval_enc)); } + result = load_store; } else #endif { @@ -2773,11 +2777,13 @@ } else { assert(kind == LS_cmpxchg, "wrong LoadStore operation"); load_store = _gvn.transform(new CompareAndSwapPNode(control(), mem, adr, newval, oldval)); + result = load_store; if (UseShenandoahGC) { - set_control(load_store); // if (! success) - IfNode* iff = create_and_map_if(control(), load_store, PROB_UNKNOWN, COUNT_UNKNOWN); + Node* cmp_true = _gvn.transform(new CmpINode(load_store, intcon(1))); + Node* tst_true = _gvn.transform(new BoolNode(cmp_true, BoolTest::eq)); + IfNode* iff = create_and_map_if(control(), tst_true, PROB_LIKELY_MAG(2), COUNT_UNKNOWN); Node* iftrue = _gvn.transform(new IfTrueNode(iff)); Node* iffalse = _gvn.transform(new IfFalseNode(iff)); @@ -2821,20 +2827,20 @@ NULL, adr, newval, current); - Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms + 0)); + Node* retval = _gvn.transform(new ProjNode(call, TypeFunc::Parms + 0)); region->init_req(_shenandoah_path, control()); - phi ->init_req(_shenandoah_path, result); + phi ->init_req(_shenandoah_path, retval); set_control(_gvn.transform(region)); record_for_igvn(region); phi = _gvn.transform(phi); - load_store = phi; + result = phi; } } } - post_barrier(control(), load_store, base, adr, alias_idx, newval, T_OBJECT, true); + post_barrier(control(), result, base, adr, alias_idx, newval, T_OBJECT, true); break; default: fatal(err_msg_res("unexpected type %d: %s", type, type2name(type))); @@ -2850,7 +2856,7 @@ if (type == T_OBJECT && kind == LS_xchg) { #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { - load_store = _gvn.transform(new DecodeNNode(load_store, load_store->get_ptr_type())); + result = _gvn.transform(new DecodeNNode(result, result->get_ptr_type())); } #endif if (can_move_pre_barrier()) { @@ -2859,7 +2865,7 @@ // gets inserted between them. pre_barrier(false /* do_load */, control(), NULL, NULL, max_juint, NULL, NULL, - load_store /* pre_val */, + result /* pre_val */, T_OBJECT); } } @@ -2868,8 +2874,8 @@ insert_mem_bar(Op_MemBarCPUOrder); insert_mem_bar(Op_MemBarAcquire); - assert(type2size[load_store->bottom_type()->basic_type()] == type2size[rtype], "result type should match"); - set_result(load_store); + assert(type2size[result->bottom_type()->basic_type()] == type2size[rtype], "result type should match"); + set_result(result); return true; }