< prev index next >

src/cpu/ppc/vm/macroAssembler_ppc.cpp

Print this page
rev 7507 : 8066964: ppc64: argument and return type profiling, fix problem with popframe


 790   lfd(F16, offset, src);   offset += 8;
 791   lfd(F17, offset, src);   offset += 8;
 792   lfd(F18, offset, src);   offset += 8;
 793   lfd(F19, offset, src);   offset += 8;
 794   lfd(F20, offset, src);   offset += 8;
 795   lfd(F21, offset, src);   offset += 8;
 796   lfd(F22, offset, src);   offset += 8;
 797   lfd(F23, offset, src);   offset += 8;
 798   lfd(F24, offset, src);   offset += 8;
 799   lfd(F25, offset, src);   offset += 8;
 800   lfd(F26, offset, src);   offset += 8;
 801   lfd(F27, offset, src);   offset += 8;
 802   lfd(F28, offset, src);   offset += 8;
 803   lfd(F29, offset, src);   offset += 8;
 804   lfd(F30, offset, src);   offset += 8;
 805   lfd(F31, offset, src);
 806 }
 807 
 808 // For verify_oops.
 809 void MacroAssembler::save_volatile_gprs(Register dst, int offset) {

 810   std(R3,  offset, dst);   offset += 8;
 811   std(R4,  offset, dst);   offset += 8;
 812   std(R5,  offset, dst);   offset += 8;
 813   std(R6,  offset, dst);   offset += 8;
 814   std(R7,  offset, dst);   offset += 8;
 815   std(R8,  offset, dst);   offset += 8;
 816   std(R9,  offset, dst);   offset += 8;
 817   std(R10, offset, dst);   offset += 8;
 818   std(R11, offset, dst);   offset += 8;
 819   std(R12, offset, dst);
 820 }
 821 
 822 // For verify_oops.
 823 void MacroAssembler::restore_volatile_gprs(Register src, int offset) {

 824   ld(R3,  offset, src);   offset += 8;
 825   ld(R4,  offset, src);   offset += 8;
 826   ld(R5,  offset, src);   offset += 8;
 827   ld(R6,  offset, src);   offset += 8;
 828   ld(R7,  offset, src);   offset += 8;
 829   ld(R8,  offset, src);   offset += 8;
 830   ld(R9,  offset, src);   offset += 8;
 831   ld(R10, offset, src);   offset += 8;
 832   ld(R11, offset, src);   offset += 8;
 833   ld(R12, offset, src);
 834 }
 835 
 836 void MacroAssembler::save_LR_CR(Register tmp) {
 837   mfcr(tmp);
 838   std(tmp, _abi(cr), R1_SP);
 839   mflr(tmp);
 840   std(tmp, _abi(lr), R1_SP);
 841   // Tmp must contain lr on exit! (see return_addr and prolog in ppc64.ad)
 842 }
 843 


1170 void MacroAssembler::call_VM(Register oop_result, address entry_point, bool check_exceptions) {
1171   call_VM_base(oop_result, noreg, entry_point, check_exceptions);
1172 }
1173 
1174 void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1,
1175                              bool check_exceptions) {
1176   // R3_ARG1 is reserved for the thread.
1177   mr_if_needed(R4_ARG2, arg_1);
1178   call_VM(oop_result, entry_point, check_exceptions);
1179 }
1180 
1181 void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2,
1182                              bool check_exceptions) {
1183   // R3_ARG1 is reserved for the thread
1184   mr_if_needed(R4_ARG2, arg_1);
1185   assert(arg_2 != R4_ARG2, "smashed argument");
1186   mr_if_needed(R5_ARG3, arg_2);
1187   call_VM(oop_result, entry_point, check_exceptions);
1188 }
1189 










1190 void MacroAssembler::call_VM_leaf(address entry_point) {
1191   call_VM_leaf_base(entry_point);
1192 }
1193 
1194 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1) {
1195   mr_if_needed(R3_ARG1, arg_1);
1196   call_VM_leaf(entry_point);
1197 }
1198 
1199 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register arg_2) {
1200   mr_if_needed(R3_ARG1, arg_1);
1201   assert(arg_2 != R3_ARG1, "smashed argument");
1202   mr_if_needed(R4_ARG2, arg_2);
1203   call_VM_leaf(entry_point);
1204 }
1205 
1206 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3) {
1207   mr_if_needed(R3_ARG1, arg_1);
1208   assert(arg_2 != R3_ARG1, "smashed argument");
1209   mr_if_needed(R4_ARG2, arg_2);


3042       cmpdi(CCR0, R0, 0);
3043       break;
3044     default:
3045       ShouldNotReachHere();
3046   }
3047   asm_assert(check_equal, msg, id);
3048 #endif // ASSERT
3049 }
3050 
3051 void MacroAssembler::verify_thread() {
3052   if (VerifyThread) {
3053     unimplemented("'VerifyThread' currently not implemented on PPC");
3054   }
3055 }
3056 
3057 // READ: oop. KILL: R0. Volatile floats perhaps.
3058 void MacroAssembler::verify_oop(Register oop, const char* msg) {
3059   if (!VerifyOops) {
3060     return;
3061   }
3062   // Will be preserved.
3063   Register tmp = R11;
3064   assert(oop != tmp, "precondition");
3065   unsigned int nbytes_save = 10*8; // 10 volatile gprs
3066   address/* FunctionDescriptor** */fd = StubRoutines::verify_oop_subroutine_entry_address();
3067   // save tmp
3068   mr(R0, tmp);
3069   // kill tmp
3070   save_LR_CR(tmp);


3071   push_frame_reg_args(nbytes_save, tmp);
3072   // restore tmp
3073   mr(tmp, R0);
3074   save_volatile_gprs(R1_SP, 112); // except R0
3075   // load FunctionDescriptor** / entry_address *
3076   load_const(tmp, fd);
3077   // load FunctionDescriptor* / entry_address
3078   ld(tmp, 0, tmp);
3079   mr(R4_ARG2, oop);
3080   load_const(R3_ARG1, (address)msg);
3081   // call destination for its side effect
3082   call_c(tmp);
3083   restore_volatile_gprs(R1_SP, 112); // except R0
3084   pop_frame();
3085   // save tmp
3086   mr(R0, tmp);
3087   // kill tmp
3088   restore_LR_CR(tmp);
3089   // restore tmp
3090   mr(tmp, R0);
3091 }
3092 
3093 const char* stop_types[] = {
3094   "stop",
3095   "untested",
3096   "unimplemented",
3097   "shouldnotreachhere"
3098 };
3099 
3100 static void stop_on_request(int tp, const char* msg) {
3101   tty->print("PPC assembly code requires stop: (%s) %s\n", stop_types[tp%/*stop_end*/4], msg);
3102   guarantee(false, err_msg("PPC assembly code requires stop: %s", msg));
3103 }
3104 
3105 // Call a C-function that prints output.
3106 void MacroAssembler::stop(int type, const char* msg, int id) {
3107 #ifndef PRODUCT
3108   block_comment(err_msg("stop: %s %s {", stop_types[type%stop_end], msg));
3109 #else
3110   block_comment("stop {");




 790   lfd(F16, offset, src);   offset += 8;
 791   lfd(F17, offset, src);   offset += 8;
 792   lfd(F18, offset, src);   offset += 8;
 793   lfd(F19, offset, src);   offset += 8;
 794   lfd(F20, offset, src);   offset += 8;
 795   lfd(F21, offset, src);   offset += 8;
 796   lfd(F22, offset, src);   offset += 8;
 797   lfd(F23, offset, src);   offset += 8;
 798   lfd(F24, offset, src);   offset += 8;
 799   lfd(F25, offset, src);   offset += 8;
 800   lfd(F26, offset, src);   offset += 8;
 801   lfd(F27, offset, src);   offset += 8;
 802   lfd(F28, offset, src);   offset += 8;
 803   lfd(F29, offset, src);   offset += 8;
 804   lfd(F30, offset, src);   offset += 8;
 805   lfd(F31, offset, src);
 806 }
 807 
 808 // For verify_oops.
 809 void MacroAssembler::save_volatile_gprs(Register dst, int offset) {
 810   std(R2,  offset, dst);   offset += 8;
 811   std(R3,  offset, dst);   offset += 8;
 812   std(R4,  offset, dst);   offset += 8;
 813   std(R5,  offset, dst);   offset += 8;
 814   std(R6,  offset, dst);   offset += 8;
 815   std(R7,  offset, dst);   offset += 8;
 816   std(R8,  offset, dst);   offset += 8;
 817   std(R9,  offset, dst);   offset += 8;
 818   std(R10, offset, dst);   offset += 8;
 819   std(R11, offset, dst);   offset += 8;
 820   std(R12, offset, dst);
 821 }
 822 
 823 // For verify_oops.
 824 void MacroAssembler::restore_volatile_gprs(Register src, int offset) {
 825   ld(R2,  offset, src);   offset += 8;
 826   ld(R3,  offset, src);   offset += 8;
 827   ld(R4,  offset, src);   offset += 8;
 828   ld(R5,  offset, src);   offset += 8;
 829   ld(R6,  offset, src);   offset += 8;
 830   ld(R7,  offset, src);   offset += 8;
 831   ld(R8,  offset, src);   offset += 8;
 832   ld(R9,  offset, src);   offset += 8;
 833   ld(R10, offset, src);   offset += 8;
 834   ld(R11, offset, src);   offset += 8;
 835   ld(R12, offset, src);
 836 }
 837 
 838 void MacroAssembler::save_LR_CR(Register tmp) {
 839   mfcr(tmp);
 840   std(tmp, _abi(cr), R1_SP);
 841   mflr(tmp);
 842   std(tmp, _abi(lr), R1_SP);
 843   // Tmp must contain lr on exit! (see return_addr and prolog in ppc64.ad)
 844 }
 845 


1172 void MacroAssembler::call_VM(Register oop_result, address entry_point, bool check_exceptions) {
1173   call_VM_base(oop_result, noreg, entry_point, check_exceptions);
1174 }
1175 
1176 void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1,
1177                              bool check_exceptions) {
1178   // R3_ARG1 is reserved for the thread.
1179   mr_if_needed(R4_ARG2, arg_1);
1180   call_VM(oop_result, entry_point, check_exceptions);
1181 }
1182 
1183 void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2,
1184                              bool check_exceptions) {
1185   // R3_ARG1 is reserved for the thread
1186   mr_if_needed(R4_ARG2, arg_1);
1187   assert(arg_2 != R4_ARG2, "smashed argument");
1188   mr_if_needed(R5_ARG3, arg_2);
1189   call_VM(oop_result, entry_point, check_exceptions);
1190 }
1191 
1192 void MacroAssembler::call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3,
1193                              bool check_exceptions) {
1194   // R3_ARG1 is reserved for the thread
1195   mr_if_needed(R4_ARG2, arg_1);
1196   assert(arg_2 != R4_ARG2, "smashed argument");
1197   mr_if_needed(R5_ARG3, arg_2);
1198   mr_if_needed(R6_ARG4, arg_3);
1199   call_VM(oop_result, entry_point, check_exceptions);
1200 }
1201 
1202 void MacroAssembler::call_VM_leaf(address entry_point) {
1203   call_VM_leaf_base(entry_point);
1204 }
1205 
1206 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1) {
1207   mr_if_needed(R3_ARG1, arg_1);
1208   call_VM_leaf(entry_point);
1209 }
1210 
1211 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register arg_2) {
1212   mr_if_needed(R3_ARG1, arg_1);
1213   assert(arg_2 != R3_ARG1, "smashed argument");
1214   mr_if_needed(R4_ARG2, arg_2);
1215   call_VM_leaf(entry_point);
1216 }
1217 
1218 void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3) {
1219   mr_if_needed(R3_ARG1, arg_1);
1220   assert(arg_2 != R3_ARG1, "smashed argument");
1221   mr_if_needed(R4_ARG2, arg_2);


3054       cmpdi(CCR0, R0, 0);
3055       break;
3056     default:
3057       ShouldNotReachHere();
3058   }
3059   asm_assert(check_equal, msg, id);
3060 #endif // ASSERT
3061 }
3062 
3063 void MacroAssembler::verify_thread() {
3064   if (VerifyThread) {
3065     unimplemented("'VerifyThread' currently not implemented on PPC");
3066   }
3067 }
3068 
3069 // READ: oop. KILL: R0. Volatile floats perhaps.
3070 void MacroAssembler::verify_oop(Register oop, const char* msg) {
3071   if (!VerifyOops) {
3072     return;
3073   }
3074 



3075   address/* FunctionDescriptor** */fd = StubRoutines::verify_oop_subroutine_entry_address();
3076   const Register tmp = R11; // Will be preserved.
3077   const int nbytes_save = 11*8; // Volatile gprs except R0.
3078   save_volatile_gprs(R1_SP, -nbytes_save); // except R0
3079 
3080   if (oop == tmp) mr(R4_ARG2, oop);
3081   save_LR_CR(tmp); // save in old frame
3082   push_frame_reg_args(nbytes_save, tmp);



3083   // load FunctionDescriptor** / entry_address *
3084   load_const_optimized(tmp, fd, R0);
3085   // load FunctionDescriptor* / entry_address
3086   ld(tmp, 0, tmp);
3087   if (oop != tmp) mr_if_needed(R4_ARG2, oop);
3088   load_const_optimized(R3_ARG1, (address)msg, R0);
3089   // Call destination for its side effect.
3090   call_c(tmp);
3091 
3092   pop_frame();



3093   restore_LR_CR(tmp);
3094   restore_volatile_gprs(R1_SP, -nbytes_save); // except R0

3095 }
3096 
3097 const char* stop_types[] = {
3098   "stop",
3099   "untested",
3100   "unimplemented",
3101   "shouldnotreachhere"
3102 };
3103 
3104 static void stop_on_request(int tp, const char* msg) {
3105   tty->print("PPC assembly code requires stop: (%s) %s\n", stop_types[tp%/*stop_end*/4], msg);
3106   guarantee(false, err_msg("PPC assembly code requires stop: %s", msg));
3107 }
3108 
3109 // Call a C-function that prints output.
3110 void MacroAssembler::stop(int type, const char* msg, int id) {
3111 #ifndef PRODUCT
3112   block_comment(err_msg("stop: %s %s {", stop_types[type%stop_end], msg));
3113 #else
3114   block_comment("stop {");


< prev index next >