Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/graalRuntime_x86.cpp @ 7911:983f7bdb85ff
removed redundant graal_ prefix from Graal specific functions and variable in native code
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 01 Mar 2013 19:51:45 +1000 |
parents | 707e9cca11de |
children | c6c72de0537e |
comparison
equal
deleted
inserted
replaced
7910:748cb57f53cb | 7911:983f7bdb85ff |
---|---|
636 | 636 |
637 // Save registers, if required. | 637 // Save registers, if required. |
638 OopMapSet* oop_maps = new OopMapSet(); | 638 OopMapSet* oop_maps = new OopMapSet(); |
639 OopMap* oop_map = NULL; | 639 OopMap* oop_map = NULL; |
640 switch (id) { | 640 switch (id) { |
641 case graal_handle_exception_nofpu_id: | 641 case handle_exception_nofpu_id: |
642 // At this point all registers MAY be live. | 642 // At this point all registers MAY be live. |
643 oop_map = save_live_registers(sasm, 1 /*thread*/, id == graal_handle_exception_nofpu_id); | 643 oop_map = save_live_registers(sasm, 1 /*thread*/, id == handle_exception_nofpu_id); |
644 break; | 644 break; |
645 default: ShouldNotReachHere(); | 645 default: ShouldNotReachHere(); |
646 } | 646 } |
647 | 647 |
648 #ifdef TIERED | 648 #ifdef TIERED |
710 | 710 |
711 // patch the return address, this stub will directly return to the exception handler | 711 // patch the return address, this stub will directly return to the exception handler |
712 __ movptr(Address(rbp, 1*BytesPerWord), rax); | 712 __ movptr(Address(rbp, 1*BytesPerWord), rax); |
713 | 713 |
714 switch (id) { | 714 switch (id) { |
715 case graal_handle_exception_nofpu_id: | 715 case handle_exception_nofpu_id: |
716 // Restore the registers that were saved at the beginning. | 716 // Restore the registers that were saved at the beginning. |
717 restore_live_registers(sasm, id == graal_handle_exception_nofpu_id); | 717 restore_live_registers(sasm, id == handle_exception_nofpu_id); |
718 break; | 718 break; |
719 default: ShouldNotReachHere(); | 719 default: ShouldNotReachHere(); |
720 } | 720 } |
721 | 721 |
722 return oop_maps; | 722 return oop_maps; |
822 | 822 |
823 // stub code & info for the different stubs | 823 // stub code & info for the different stubs |
824 OopMapSet* oop_maps = NULL; | 824 OopMapSet* oop_maps = NULL; |
825 switch (id) { | 825 switch (id) { |
826 | 826 |
827 case graal_new_instance_id: | 827 case new_instance_id: |
828 { | 828 { |
829 Register klass = rdx; // Incoming | 829 Register klass = rdx; // Incoming |
830 Register obj = rax; // Result | 830 Register obj = rax; // Result |
831 __ set_info("new_instance", dont_gc_arguments); | 831 __ set_info("new_instance", dont_gc_arguments); |
832 __ enter(); | 832 __ enter(); |
842 // rax,: new instance | 842 // rax,: new instance |
843 } | 843 } |
844 | 844 |
845 break; | 845 break; |
846 | 846 |
847 case graal_new_array_id: | 847 case new_array_id: |
848 { | 848 { |
849 Register length = rbx; // Incoming | 849 Register length = rbx; // Incoming |
850 Register klass = rdx; // Incoming | 850 Register klass = rdx; // Incoming |
851 Register obj = rax; // Result | 851 Register obj = rax; // Result |
852 | 852 |
867 | 867 |
868 // rax,: new array | 868 // rax,: new array |
869 } | 869 } |
870 break; | 870 break; |
871 | 871 |
872 case graal_new_multi_array_id: | 872 case new_multi_array_id: |
873 { GraalStubFrame f(sasm, "new_multi_array", dont_gc_arguments); | 873 { GraalStubFrame f(sasm, "new_multi_array", dont_gc_arguments); |
874 // rax,: klass | 874 // rax,: klass |
875 // rbx,: rank | 875 // rbx,: rank |
876 // rcx: address of 1st dimension | 876 // rcx: address of 1st dimension |
877 OopMap* map = save_live_registers(sasm, 4); | 877 OopMap* map = save_live_registers(sasm, 4); |
884 // rax,: new multi array | 884 // rax,: new multi array |
885 __ verify_oop(rax); | 885 __ verify_oop(rax); |
886 } | 886 } |
887 break; | 887 break; |
888 | 888 |
889 case graal_register_finalizer_id: | 889 case register_finalizer_id: |
890 { | 890 { |
891 __ set_info("register_finalizer", dont_gc_arguments); | 891 __ set_info("register_finalizer", dont_gc_arguments); |
892 | 892 |
893 // This is called via call_runtime so the arguments | 893 // This is called via call_runtime so the arguments |
894 // will be place in C abi locations | 894 // will be place in C abi locations |
925 __ leave(); | 925 __ leave(); |
926 __ ret(0); | 926 __ ret(0); |
927 } | 927 } |
928 break; | 928 break; |
929 | 929 |
930 case graal_handle_exception_nofpu_id: | 930 case handle_exception_nofpu_id: |
931 { GraalStubFrame f(sasm, "handle_exception", dont_gc_arguments); | 931 { GraalStubFrame f(sasm, "handle_exception", dont_gc_arguments); |
932 oop_maps = generate_handle_exception(id, sasm); | 932 oop_maps = generate_handle_exception(id, sasm); |
933 } | 933 } |
934 break; | 934 break; |
935 | 935 |
936 case graal_slow_subtype_check_id: | 936 case slow_subtype_check_id: |
937 { | 937 { |
938 // Typical calling sequence: | 938 // Typical calling sequence: |
939 // __ push(klass_RInfo); // object klass or other subclass | 939 // __ push(klass_RInfo); // object klass or other subclass |
940 // __ push(sup_k_RInfo); // array element klass or other superclass | 940 // __ push(sup_k_RInfo); // array element klass or other superclass |
941 // __ call(slow_subtype_check); | 941 // __ call(slow_subtype_check); |
988 __ pop(rdi); | 988 __ pop(rdi); |
989 __ ret(0); | 989 __ ret(0); |
990 } | 990 } |
991 break; | 991 break; |
992 | 992 |
993 case graal_unwind_exception_call_id: { | 993 case unwind_exception_call_id: { |
994 // remove the frame from the stack | 994 // remove the frame from the stack |
995 __ movptr(rsp, rbp); | 995 __ movptr(rsp, rbp); |
996 __ pop(rbp); | 996 __ pop(rbp); |
997 // exception_oop is passed using ordinary java calling conventions | 997 // exception_oop is passed using ordinary java calling conventions |
998 __ movptr(rax, j_rarg0); | 998 __ movptr(rax, j_rarg0); |
1002 __ jcc(Assembler::notZero, nonNullExceptionOop); | 1002 __ jcc(Assembler::notZero, nonNullExceptionOop); |
1003 { | 1003 { |
1004 __ enter(); | 1004 __ enter(); |
1005 oop_maps = new OopMapSet(); | 1005 oop_maps = new OopMapSet(); |
1006 OopMap* oop_map = save_live_registers(sasm, 0); | 1006 OopMap* oop_map = save_live_registers(sasm, 0); |
1007 int call_offset = __ call_RT(rax, noreg, (address)graal_create_null_exception, 0); | 1007 int call_offset = __ call_RT(rax, noreg, (address)create_null_exception, 0); |
1008 oop_maps->add_gc_map(call_offset, oop_map); | 1008 oop_maps->add_gc_map(call_offset, oop_map); |
1009 __ leave(); | 1009 __ leave(); |
1010 } | 1010 } |
1011 __ bind(nonNullExceptionOop); | 1011 __ bind(nonNullExceptionOop); |
1012 | 1012 |
1016 generate_unwind_exception(sasm); | 1016 generate_unwind_exception(sasm); |
1017 __ should_not_reach_here(); | 1017 __ should_not_reach_here(); |
1018 break; | 1018 break; |
1019 } | 1019 } |
1020 | 1020 |
1021 case graal_OSR_migration_end_id: { | 1021 case OSR_migration_end_id: { |
1022 __ enter(); | 1022 __ enter(); |
1023 save_live_registers(sasm, 0); | 1023 save_live_registers(sasm, 0); |
1024 __ movptr(c_rarg0, j_rarg0); | 1024 __ movptr(c_rarg0, j_rarg0); |
1025 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end))); | 1025 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end))); |
1026 restore_live_registers(sasm); | 1026 restore_live_registers(sasm); |
1027 __ leave(); | 1027 __ leave(); |
1028 __ ret(0); | 1028 __ ret(0); |
1029 break; | 1029 break; |
1030 } | 1030 } |
1031 | 1031 |
1032 case graal_set_deopt_info_id: { | 1032 case set_deopt_info_id: { |
1033 __ movptr(Address(r15_thread, JavaThread::graal_deopt_info_offset()), rscratch1); | 1033 __ movptr(Address(r15_thread, JavaThread::graal_deopt_info_offset()), rscratch1); |
1034 __ ret(0); | 1034 __ ret(0); |
1035 break; | 1035 break; |
1036 } | 1036 } |
1037 | 1037 |
1038 case graal_create_null_pointer_exception_id: { | 1038 case create_null_pointer_exception_id: { |
1039 __ enter(); | 1039 __ enter(); |
1040 oop_maps = new OopMapSet(); | 1040 oop_maps = new OopMapSet(); |
1041 OopMap* oop_map = save_live_registers(sasm, 0); | 1041 OopMap* oop_map = save_live_registers(sasm, 0); |
1042 int call_offset = __ call_RT(rax, noreg, (address)graal_create_null_exception, 0); | 1042 int call_offset = __ call_RT(rax, noreg, (address)create_null_exception, 0); |
1043 oop_maps->add_gc_map(call_offset, oop_map); | 1043 oop_maps->add_gc_map(call_offset, oop_map); |
1044 __ leave(); | 1044 __ leave(); |
1045 __ ret(0); | 1045 __ ret(0); |
1046 break; | 1046 break; |
1047 } | 1047 } |
1048 | 1048 |
1049 case graal_create_out_of_bounds_exception_id: { | 1049 case create_out_of_bounds_exception_id: { |
1050 __ enter(); | 1050 __ enter(); |
1051 oop_maps = new OopMapSet(); | 1051 oop_maps = new OopMapSet(); |
1052 OopMap* oop_map = save_live_registers(sasm, 0); | 1052 OopMap* oop_map = save_live_registers(sasm, 0); |
1053 int call_offset = __ call_RT(rax, noreg, (address)graal_create_out_of_bounds_exception, j_rarg0); | 1053 int call_offset = __ call_RT(rax, noreg, (address)create_out_of_bounds_exception, j_rarg0); |
1054 oop_maps->add_gc_map(call_offset, oop_map); | 1054 oop_maps->add_gc_map(call_offset, oop_map); |
1055 __ leave(); | 1055 __ leave(); |
1056 __ ret(0); | 1056 __ ret(0); |
1057 break; | 1057 break; |
1058 } | 1058 } |
1059 | 1059 |
1060 case graal_vm_error_id: { | 1060 case vm_error_id: { |
1061 __ enter(); | 1061 __ enter(); |
1062 oop_maps = new OopMapSet(); | 1062 oop_maps = new OopMapSet(); |
1063 OopMap* oop_map = save_live_registers(sasm, 0); | 1063 OopMap* oop_map = save_live_registers(sasm, 0); |
1064 int call_offset = __ call_RT(noreg, noreg, (address)graal_vm_error, j_rarg0, j_rarg1, j_rarg2); | 1064 int call_offset = __ call_RT(noreg, noreg, (address)vm_error, j_rarg0, j_rarg1, j_rarg2); |
1065 oop_maps->add_gc_map(call_offset, oop_map); | 1065 oop_maps->add_gc_map(call_offset, oop_map); |
1066 restore_live_registers(sasm); | 1066 restore_live_registers(sasm); |
1067 __ leave(); | 1067 __ leave(); |
1068 __ ret(0); | 1068 __ ret(0); |
1069 break; | 1069 break; |
1070 } | 1070 } |
1071 | 1071 |
1072 case graal_log_printf_id: { | 1072 case log_printf_id: { |
1073 __ enter(); | 1073 __ enter(); |
1074 oop_maps = new OopMapSet(); | 1074 oop_maps = new OopMapSet(); |
1075 OopMap* oop_map = save_live_registers(sasm, 0); | 1075 OopMap* oop_map = save_live_registers(sasm, 0); |
1076 int call_offset = __ call_RT(noreg, noreg, (address)graal_log_printf, j_rarg0, j_rarg1, j_rarg2, j_rarg3); | 1076 int call_offset = __ call_RT(noreg, noreg, (address)log_printf, j_rarg0, j_rarg1, j_rarg2, j_rarg3); |
1077 oop_maps->add_gc_map(call_offset, oop_map); | 1077 oop_maps->add_gc_map(call_offset, oop_map); |
1078 restore_live_registers(sasm); | 1078 restore_live_registers(sasm); |
1079 __ leave(); | 1079 __ leave(); |
1080 __ ret(0); | 1080 __ ret(0); |
1081 break; | 1081 break; |
1082 } | 1082 } |
1083 | 1083 |
1084 case graal_log_primitive_id: { | 1084 case log_primitive_id: { |
1085 __ enter(); | 1085 __ enter(); |
1086 oop_maps = new OopMapSet(); | 1086 oop_maps = new OopMapSet(); |
1087 OopMap* oop_map = save_live_registers(sasm, 0); | 1087 OopMap* oop_map = save_live_registers(sasm, 0); |
1088 int call_offset = __ call_RT(noreg, noreg, (address)graal_log_primitive, j_rarg0, j_rarg1, j_rarg2); | 1088 int call_offset = __ call_RT(noreg, noreg, (address)log_primitive, j_rarg0, j_rarg1, j_rarg2); |
1089 oop_maps->add_gc_map(call_offset, oop_map); | 1089 oop_maps->add_gc_map(call_offset, oop_map); |
1090 restore_live_registers(sasm); | 1090 restore_live_registers(sasm); |
1091 __ leave(); | 1091 __ leave(); |
1092 __ ret(0); | 1092 __ ret(0); |
1093 break; | 1093 break; |
1094 } | 1094 } |
1095 | 1095 |
1096 case graal_log_object_id: { | 1096 case log_object_id: { |
1097 __ enter(); | 1097 __ enter(); |
1098 oop_maps = new OopMapSet(); | 1098 oop_maps = new OopMapSet(); |
1099 OopMap* oop_map = save_live_registers(sasm, 0); | 1099 OopMap* oop_map = save_live_registers(sasm, 0); |
1100 int call_offset = __ call_RT(noreg, noreg, (address)graal_log_object, j_rarg0, j_rarg1); | 1100 int call_offset = __ call_RT(noreg, noreg, (address)log_object, j_rarg0, j_rarg1); |
1101 oop_maps->add_gc_map(call_offset, oop_map); | 1101 oop_maps->add_gc_map(call_offset, oop_map); |
1102 restore_live_registers(sasm); | 1102 restore_live_registers(sasm); |
1103 __ leave(); | 1103 __ leave(); |
1104 __ ret(0); | 1104 __ ret(0); |
1105 break; | 1105 break; |
1106 } | 1106 } |
1107 | 1107 |
1108 case graal_verify_oop_id: { | 1108 case verify_oop_id: { |
1109 // We use enter & leave so that a better stack trace is produced in the hs_err file | 1109 // We use enter & leave so that a better stack trace is produced in the hs_err file |
1110 __ enter(); | 1110 __ enter(); |
1111 __ verify_oop(r13, "Graal verify oop"); | 1111 __ verify_oop(r13, "Graal verify oop"); |
1112 __ leave(); | 1112 __ leave(); |
1113 __ ret(0); | 1113 __ ret(0); |
1114 break; | 1114 break; |
1115 } | 1115 } |
1116 | 1116 |
1117 case graal_arithmetic_frem_id: { | 1117 case arithmetic_frem_id: { |
1118 __ subptr(rsp, 8); | 1118 __ subptr(rsp, 8); |
1119 __ movflt(Address(rsp, 0), xmm1); | 1119 __ movflt(Address(rsp, 0), xmm1); |
1120 __ fld_s(Address(rsp, 0)); | 1120 __ fld_s(Address(rsp, 0)); |
1121 __ movflt(Address(rsp, 0), xmm0); | 1121 __ movflt(Address(rsp, 0), xmm0); |
1122 __ fld_s(Address(rsp, 0)); | 1122 __ fld_s(Address(rsp, 0)); |
1133 __ movflt(xmm0, Address(rsp, 0)); | 1133 __ movflt(xmm0, Address(rsp, 0)); |
1134 __ addptr(rsp, 8); | 1134 __ addptr(rsp, 8); |
1135 __ ret(0); | 1135 __ ret(0); |
1136 break; | 1136 break; |
1137 } | 1137 } |
1138 case graal_arithmetic_drem_id: { | 1138 case arithmetic_drem_id: { |
1139 __ subptr(rsp, 8); | 1139 __ subptr(rsp, 8); |
1140 __ movdbl(Address(rsp, 0), xmm1); | 1140 __ movdbl(Address(rsp, 0), xmm1); |
1141 __ fld_d(Address(rsp, 0)); | 1141 __ fld_d(Address(rsp, 0)); |
1142 __ movdbl(Address(rsp, 0), xmm0); | 1142 __ movdbl(Address(rsp, 0), xmm0); |
1143 __ fld_d(Address(rsp, 0)); | 1143 __ fld_d(Address(rsp, 0)); |
1154 __ movdbl(xmm0, Address(rsp, 0)); | 1154 __ movdbl(xmm0, Address(rsp, 0)); |
1155 __ addptr(rsp, 8); | 1155 __ addptr(rsp, 8); |
1156 __ ret(0); | 1156 __ ret(0); |
1157 break; | 1157 break; |
1158 } | 1158 } |
1159 case graal_monitorenter_id: { | 1159 case monitorenter_id: { |
1160 Register obj = j_rarg0; | 1160 Register obj = j_rarg0; |
1161 Register lock = j_rarg1; | 1161 Register lock = j_rarg1; |
1162 { | 1162 { |
1163 GraalStubFrame f(sasm, "graal_monitorenter", dont_gc_arguments); | 1163 GraalStubFrame f(sasm, "monitorenter", dont_gc_arguments); |
1164 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); | 1164 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
1165 | 1165 |
1166 // Called with store_parameter and not C abi | 1166 // Called with store_parameter and not C abi |
1167 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_monitorenter), obj, lock); | 1167 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), obj, lock); |
1168 | 1168 |
1169 oop_maps = new OopMapSet(); | 1169 oop_maps = new OopMapSet(); |
1170 oop_maps->add_gc_map(call_offset, map); | 1170 oop_maps->add_gc_map(call_offset, map); |
1171 restore_live_registers(sasm, save_fpu_registers); | 1171 restore_live_registers(sasm, save_fpu_registers); |
1172 } | 1172 } |
1173 __ ret(0); | 1173 __ ret(0); |
1174 break; | 1174 break; |
1175 } | 1175 } |
1176 case graal_monitorexit_id: { | 1176 case monitorexit_id: { |
1177 Register obj = j_rarg0; | 1177 Register obj = j_rarg0; |
1178 Register lock = j_rarg1; | 1178 Register lock = j_rarg1; |
1179 { | 1179 { |
1180 GraalStubFrame f(sasm, "graal_monitorexit", dont_gc_arguments); | 1180 GraalStubFrame f(sasm, "monitorexit", dont_gc_arguments); |
1181 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); | 1181 OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); |
1182 | 1182 |
1183 // note: really a leaf routine but must setup last java sp | 1183 // note: really a leaf routine but must setup last java sp |
1184 // => use call_RT for now (speed can be improved by | 1184 // => use call_RT for now (speed can be improved by |
1185 // doing last java sp setup manually) | 1185 // doing last java sp setup manually) |
1186 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_monitorexit), obj, lock); | 1186 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), obj, lock); |
1187 | 1187 |
1188 oop_maps = new OopMapSet(); | 1188 oop_maps = new OopMapSet(); |
1189 oop_maps->add_gc_map(call_offset, map); | 1189 oop_maps->add_gc_map(call_offset, map); |
1190 restore_live_registers(sasm, save_fpu_registers); | 1190 restore_live_registers(sasm, save_fpu_registers); |
1191 } | 1191 } |
1192 __ ret(0); | 1192 __ ret(0); |
1193 break; | 1193 break; |
1194 } | 1194 } |
1195 | 1195 |
1196 case graal_identity_hash_code_id: { | 1196 case identity_hash_code_id: { |
1197 Register obj = j_rarg0; // Incoming | 1197 Register obj = j_rarg0; // Incoming |
1198 __ set_info("identity_hash_code", dont_gc_arguments); | 1198 __ set_info("identity_hash_code", dont_gc_arguments); |
1199 __ enter(); | 1199 __ enter(); |
1200 OopMap* map = save_live_registers(sasm, 1); | 1200 OopMap* map = save_live_registers(sasm, 1); |
1201 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_identity_hash_code), obj); | 1201 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, identity_hash_code), obj); |
1202 oop_maps = new OopMapSet(); | 1202 oop_maps = new OopMapSet(); |
1203 oop_maps->add_gc_map(call_offset, map); | 1203 oop_maps->add_gc_map(call_offset, map); |
1204 restore_live_registers_except_rax(sasm); | 1204 restore_live_registers_except_rax(sasm); |
1205 __ leave(); | 1205 __ leave(); |
1206 __ ret(0); | 1206 __ ret(0); |
1207 break; | 1207 break; |
1208 } | 1208 } |
1209 case graal_thread_is_interrupted_id: { | 1209 case thread_is_interrupted_id: { |
1210 Register thread = j_rarg0; | 1210 Register thread = j_rarg0; |
1211 Register clear_interrupted = j_rarg1; | 1211 Register clear_interrupted = j_rarg1; |
1212 | 1212 |
1213 __ set_info("identity_hash_code", dont_gc_arguments); | 1213 __ set_info("identity_hash_code", dont_gc_arguments); |
1214 __ enter(); | 1214 __ enter(); |
1215 OopMap* map = save_live_registers(sasm, 1); | 1215 OopMap* map = save_live_registers(sasm, 1); |
1216 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_thread_is_interrupted), thread, clear_interrupted); | 1216 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, thread_is_interrupted), thread, clear_interrupted); |
1217 oop_maps = new OopMapSet(); | 1217 oop_maps = new OopMapSet(); |
1218 oop_maps->add_gc_map(call_offset, map); | 1218 oop_maps->add_gc_map(call_offset, map); |
1219 restore_live_registers_except_rax(sasm); | 1219 restore_live_registers_except_rax(sasm); |
1220 __ leave(); | 1220 __ leave(); |
1221 __ ret(0); | 1221 __ ret(0); |