comparison src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @ 928:d0acbc302e14

6795465: Crash in assembler_sparc.cpp with client compiler on solaris-sparc Reviewed-by: twisti, cfang
author never
date Mon, 17 Aug 2009 14:45:02 -0700
parents bd02caa94611
children cdb8b7c37ac1
comparison
equal deleted inserted replaced
927:662f330d7275 928:d0acbc302e14
747 } 747 }
748 748
749 749
750 void LIRGenerator::do_ArrayCopy(Intrinsic* x) { 750 void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
751 assert(x->number_of_arguments() == 5, "wrong type"); 751 assert(x->number_of_arguments() == 5, "wrong type");
752
753 // Make all state_for calls early since they can emit code
754 CodeEmitInfo* info = state_for(x, x->state());
755
752 // Note: spill caller save before setting the item 756 // Note: spill caller save before setting the item
753 LIRItem src (x->argument_at(0), this); 757 LIRItem src (x->argument_at(0), this);
754 LIRItem src_pos (x->argument_at(1), this); 758 LIRItem src_pos (x->argument_at(1), this);
755 LIRItem dst (x->argument_at(2), this); 759 LIRItem dst (x->argument_at(2), this);
756 LIRItem dst_pos (x->argument_at(3), this); 760 LIRItem dst_pos (x->argument_at(3), this);
765 769
766 int flags; 770 int flags;
767 ciArrayKlass* expected_type; 771 ciArrayKlass* expected_type;
768 arraycopy_helper(x, &flags, &expected_type); 772 arraycopy_helper(x, &flags, &expected_type);
769 773
770 CodeEmitInfo* info = state_for(x, x->state());
771 __ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), 774 __ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(),
772 length.result(), rlock_callee_saved(T_INT), 775 length.result(), rlock_callee_saved(T_INT),
773 expected_type, flags, info); 776 expected_type, flags, info);
774 set_no_result(x); 777 set_no_result(x);
775 } 778 }
876 __ move(reg, result); 879 __ move(reg, result);
877 } 880 }
878 881
879 882
880 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) { 883 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
884 // Evaluate state_for early since it may emit code
885 CodeEmitInfo* info = state_for(x, x->state());
886
881 LIRItem length(x->length(), this); 887 LIRItem length(x->length(), this);
882 length.load_item(); 888 length.load_item();
883 889
884 LIR_Opr reg = result_register_for(x->type()); 890 LIR_Opr reg = result_register_for(x->type());
885 LIR_Opr tmp1 = FrameMap::G1_oop_opr; 891 LIR_Opr tmp1 = FrameMap::G1_oop_opr;
890 LIR_Opr len = length.result(); 896 LIR_Opr len = length.result();
891 BasicType elem_type = x->elt_type(); 897 BasicType elem_type = x->elt_type();
892 898
893 __ oop2reg(ciTypeArrayKlass::make(elem_type)->encoding(), klass_reg); 899 __ oop2reg(ciTypeArrayKlass::make(elem_type)->encoding(), klass_reg);
894 900
895 CodeEmitInfo* info = state_for(x, x->state());
896 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info); 901 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);
897 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path); 902 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);
898 903
899 LIR_Opr result = rlock_result(x); 904 LIR_Opr result = rlock_result(x);
900 __ move(reg, result); 905 __ move(reg, result);
901 } 906 }
902 907
903 908
904 void LIRGenerator::do_NewObjectArray(NewObjectArray* x) { 909 void LIRGenerator::do_NewObjectArray(NewObjectArray* x) {
905 LIRItem length(x->length(), this); 910 // Evaluate state_for early since it may emit code.
911 CodeEmitInfo* info = state_for(x, x->state());
906 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction 912 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction
907 // and therefore provide the state before the parameters have been consumed 913 // and therefore provide the state before the parameters have been consumed
908 CodeEmitInfo* patching_info = NULL; 914 CodeEmitInfo* patching_info = NULL;
909 if (!x->klass()->is_loaded() || PatchALot) { 915 if (!x->klass()->is_loaded() || PatchALot) {
910 patching_info = state_for(x, x->state_before()); 916 patching_info = state_for(x, x->state_before());
911 } 917 }
912 918
919 LIRItem length(x->length(), this);
913 length.load_item(); 920 length.load_item();
914 921
915 const LIR_Opr reg = result_register_for(x->type()); 922 const LIR_Opr reg = result_register_for(x->type());
916 LIR_Opr tmp1 = FrameMap::G1_oop_opr; 923 LIR_Opr tmp1 = FrameMap::G1_oop_opr;
917 LIR_Opr tmp2 = FrameMap::G3_oop_opr; 924 LIR_Opr tmp2 = FrameMap::G3_oop_opr;
918 LIR_Opr tmp3 = FrameMap::G4_oop_opr; 925 LIR_Opr tmp3 = FrameMap::G4_oop_opr;
919 LIR_Opr tmp4 = FrameMap::O1_oop_opr; 926 LIR_Opr tmp4 = FrameMap::O1_oop_opr;
920 LIR_Opr klass_reg = FrameMap::G5_oop_opr; 927 LIR_Opr klass_reg = FrameMap::G5_oop_opr;
921 LIR_Opr len = length.result(); 928 LIR_Opr len = length.result();
922 CodeEmitInfo* info = state_for(x, x->state());
923 929
924 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info); 930 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
925 ciObject* obj = (ciObject*) ciObjArrayKlass::make(x->klass()); 931 ciObject* obj = (ciObject*) ciObjArrayKlass::make(x->klass());
926 if (obj == ciEnv::unloaded_ciobjarrayklass()) { 932 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
927 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error"); 933 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
941 while (i-- > 0) { 947 while (i-- > 0) {
942 LIRItem* size = new LIRItem(dims->at(i), this); 948 LIRItem* size = new LIRItem(dims->at(i), this);
943 items->at_put(i, size); 949 items->at_put(i, size);
944 } 950 }
945 951
946 // need to get the info before, as the items may become invalid through item_free 952 // Evaluate state_for early since it may emit code.
953 CodeEmitInfo* info = state_for(x, x->state());
947 CodeEmitInfo* patching_info = NULL; 954 CodeEmitInfo* patching_info = NULL;
948 if (!x->klass()->is_loaded() || PatchALot) { 955 if (!x->klass()->is_loaded() || PatchALot) {
949 patching_info = state_for(x, x->state_before()); 956 patching_info = state_for(x, x->state_before());
950 957
951 // cannot re-use same xhandlers for multiple CodeEmitInfos, so 958 // cannot re-use same xhandlers for multiple CodeEmitInfos, so
952 // clone all handlers 959 // clone all handlers.
953 x->set_exception_handlers(new XHandlers(x->exception_handlers())); 960 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
954 } 961 }
955 962
956 i = dims->length(); 963 i = dims->length();
957 while (i-- > 0) { 964 while (i-- > 0) {
958 LIRItem* size = items->at(i); 965 LIRItem* size = items->at(i);
959 // if a patching_info was generated above then debug information for the state before
960 // the call is going to be emitted. The LIRGenerator calls above may have left some values
961 // in registers and that's been recorded in the CodeEmitInfo. In that case the items
962 // for those values can't simply be freed if they are registers because the values
963 // might be destroyed by store_stack_parameter. So in the case of patching, delay the
964 // freeing of the items that already were in registers
965 size->load_item(); 966 size->load_item();
966 store_stack_parameter (size->result(), 967 store_stack_parameter (size->result(),
967 in_ByteSize(STACK_BIAS + 968 in_ByteSize(STACK_BIAS +
968 frame::memory_parameter_word_sp_offset * wordSize + 969 frame::memory_parameter_word_sp_offset * wordSize +
969 i * sizeof(jint))); 970 i * sizeof(jint)));
970 } 971 }
971 972
972 // This instruction can be deoptimized in the slow path : use 973 // This instruction can be deoptimized in the slow path : use
973 // O0 as result register. 974 // O0 as result register.
974 const LIR_Opr reg = result_register_for(x->type()); 975 const LIR_Opr reg = result_register_for(x->type());
975 CodeEmitInfo* info = state_for(x, x->state());
976
977 jobject2reg_with_patching(reg, x->klass(), patching_info); 976 jobject2reg_with_patching(reg, x->klass(), patching_info);
978 LIR_Opr rank = FrameMap::O1_opr; 977 LIR_Opr rank = FrameMap::O1_opr;
979 __ move(LIR_OprFact::intConst(x->rank()), rank); 978 __ move(LIR_OprFact::intConst(x->rank()), rank);
980 LIR_Opr varargs = FrameMap::as_pointer_opr(O2); 979 LIR_Opr varargs = FrameMap::as_pointer_opr(O2);
981 int offset_from_sp = (frame::memory_parameter_word_sp_offset * wordSize) + STACK_BIAS; 980 int offset_from_sp = (frame::memory_parameter_word_sp_offset * wordSize) + STACK_BIAS;