comparison src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @ 6275:957c266d8bc5

Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Aug 2012 10:39:19 +0200
parents e2fe93124108
children da91efe96a93
comparison
equal deleted inserted replaced
5891:fd8832ae511d 6275:957c266d8bc5
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
736 } 712 }
737 case vmIntrinsics::_dlog10: // fall through 713 case vmIntrinsics::_dlog10: // fall through
738 case vmIntrinsics::_dlog: // fall through 714 case vmIntrinsics::_dlog: // fall through
739 case vmIntrinsics::_dsin: // fall through 715 case vmIntrinsics::_dsin: // fall through
740 case vmIntrinsics::_dtan: // fall through 716 case vmIntrinsics::_dtan: // fall through
741 case vmIntrinsics::_dcos: { 717 case vmIntrinsics::_dcos: // fall through
718 case vmIntrinsics::_dexp: {
742 assert(x->number_of_arguments() == 1, "wrong type"); 719 assert(x->number_of_arguments() == 1, "wrong type");
743 720
744 address runtime_entry = NULL; 721 address runtime_entry = NULL;
745 switch (x->id()) { 722 switch (x->id()) {
746 case vmIntrinsics::_dsin: 723 case vmIntrinsics::_dsin:
756 runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog); 733 runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);
757 break; 734 break;
758 case vmIntrinsics::_dlog10: 735 case vmIntrinsics::_dlog10:
759 runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10); 736 runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);
760 break; 737 break;
738 case vmIntrinsics::_dexp:
739 runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);
740 break;
761 default: 741 default:
762 ShouldNotReachHere(); 742 ShouldNotReachHere();
763 } 743 }
764 744
765 LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL); 745 LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL);
766 set_result(x, result); 746 set_result(x, result);
747 break;
748 }
749 case vmIntrinsics::_dpow: {
750 assert(x->number_of_arguments() == 2, "wrong type");
751 address runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dpow);
752 LIR_Opr result = call_runtime(x->argument_at(0), x->argument_at(1), runtime_entry, x->type(), NULL);
753 set_result(x, result);
754 break;
767 } 755 }
768 } 756 }
769 } 757 }
770 758
771 759
975 // Evaluate state_for early since it may emit code. 963 // Evaluate state_for early since it may emit code.
976 CodeEmitInfo* patching_info = NULL; 964 CodeEmitInfo* patching_info = NULL;
977 if (!x->klass()->is_loaded() || PatchALot) { 965 if (!x->klass()->is_loaded() || PatchALot) {
978 patching_info = state_for(x, x->state_before()); 966 patching_info = state_for(x, x->state_before());
979 967
980 // cannot re-use same xhandlers for multiple CodeEmitInfos, so 968 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
981 // clone all handlers. This is handled transparently in other 969 // clone all handlers (NOTE: Usually this is handled transparently
982 // places by the CodeEmitInfo cloning logic but is handled 970 // by the CodeEmitInfo cloning logic in CodeStub constructors but
983 // specially here because a stub isn't being used. 971 // is done explicitly here because a stub isn't being used).
984 x->set_exception_handlers(new XHandlers(x->exception_handlers())); 972 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
985 } 973 }
986 CodeEmitInfo* info = state_for(x, x->state()); 974 CodeEmitInfo* info = state_for(x, x->state());
987 975
988 i = dims->length(); 976 i = dims->length();