comparison src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @ 6143:8b0a4867acf0

7174218: remove AtomicLongCSImpl intrinsics Reviewed-by: kvn, twisti Contributed-by: Krystal Mok <sajia@taobao.com>
author twisti
date Tue, 12 Jun 2012 14:31:44 -0700
parents 6759698e3140
children e2fe93124108
comparison
equal deleted inserted replaced
6142:121e5708ae96 6143:8b0a4867acf0
642 Unimplemented(); 642 Unimplemented();
643 } 643 }
644 } 644 }
645 645
646 646
647 void LIRGenerator::do_AttemptUpdate(Intrinsic* x) {
648 assert(x->number_of_arguments() == 3, "wrong type");
649 LIRItem obj (x->argument_at(0), this); // AtomicLong object
650 LIRItem cmp_value (x->argument_at(1), this); // value to compare with field
651 LIRItem new_value (x->argument_at(2), this); // replace field with new_value if it matches cmp_value
652
653 obj.load_item();
654 cmp_value.load_item();
655 new_value.load_item();
656
657 // generate compare-and-swap and produce zero condition if swap occurs
658 int value_offset = sun_misc_AtomicLongCSImpl::value_offset();
659 LIR_Opr addr = FrameMap::O7_opr;
660 __ add(obj.result(), LIR_OprFact::intConst(value_offset), addr);
661 LIR_Opr t1 = FrameMap::G1_opr; // temp for 64-bit value
662 LIR_Opr t2 = FrameMap::G3_opr; // temp for 64-bit value
663 __ cas_long(addr, cmp_value.result(), new_value.result(), t1, t2);
664
665 // generate conditional move of boolean result
666 LIR_Opr result = rlock_result(x);
667 __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result, T_LONG);
668 }
669
670
671 void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { 647 void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) {
672 assert(x->number_of_arguments() == 4, "wrong type"); 648 assert(x->number_of_arguments() == 4, "wrong type");
673 LIRItem obj (x->argument_at(0), this); // object 649 LIRItem obj (x->argument_at(0), this); // object
674 LIRItem offset(x->argument_at(1), this); // offset of field 650 LIRItem offset(x->argument_at(1), this); // offset of field
675 LIRItem cmp (x->argument_at(2), this); // value to compare with field 651 LIRItem cmp (x->argument_at(2), this); // value to compare with field