src/cpu/sparc/vm/sparc.ad
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/cpu/sparc/vm

src/cpu/sparc/vm/sparc.ad

Print this page
rev 6086 : 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
Summary: make compiled code bang the stack by the worst case size of the interpreter frame at deoptimization points.
Reviewed-by:


1129     st->print("SET    &constanttable,%s\t! constant table base", reg);
1130   }
1131 }
1132 #endif
1133 
1134 
1135 //=============================================================================
1136 
1137 #ifndef PRODUCT
1138 void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
1139   Compile* C = ra_->C;
1140 
1141   for (int i = 0; i < OptoPrologueNops; i++) {
1142     st->print_cr("NOP"); st->print("\t");
1143   }
1144 
1145   if( VerifyThread ) {
1146     st->print_cr("Verify_Thread"); st->print("\t");
1147   }
1148 
1149   size_t framesize = C->frame_slots() << LogBytesPerInt;

1150 
1151   // Calls to C2R adapters often do not accept exceptional returns.
1152   // We require that their callers must bang for them.  But be careful, because
1153   // some VM calls (such as call site linkage) can use several kilobytes of
1154   // stack.  But the stack safety zone should account for that.
1155   // See bugs 4446381, 4468289, 4497237.
1156   if (C->need_stack_bang(framesize)) {
1157     st->print_cr("! stack bang"); st->print("\t");
1158   }
1159 
1160   if (Assembler::is_simm13(-framesize)) {
1161     st->print   ("SAVE   R_SP,-%d,R_SP",framesize);
1162   } else {
1163     st->print_cr("SETHI  R_SP,hi%%(-%d),R_G3",framesize); st->print("\t");
1164     st->print_cr("ADD    R_G3,lo%%(-%d),R_G3",framesize); st->print("\t");
1165     st->print   ("SAVE   R_SP,R_G3,R_SP");
1166   }
1167 
1168 }
1169 #endif
1170 
1171 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
1172   Compile* C = ra_->C;
1173   MacroAssembler _masm(&cbuf);
1174 
1175   for (int i = 0; i < OptoPrologueNops; i++) {
1176     __ nop();
1177   }
1178 
1179   __ verify_thread();
1180 
1181   size_t framesize = C->frame_slots() << LogBytesPerInt;
1182   assert(framesize >= 16*wordSize, "must have room for reg. save area");
1183   assert(framesize%(2*wordSize) == 0, "must preserve 2*wordSize alignment");

1184 
1185   // Calls to C2R adapters often do not accept exceptional returns.
1186   // We require that their callers must bang for them.  But be careful, because
1187   // some VM calls (such as call site linkage) can use several kilobytes of
1188   // stack.  But the stack safety zone should account for that.
1189   // See bugs 4446381, 4468289, 4497237.
1190   if (C->need_stack_bang(framesize)) {
1191     __ generate_stack_overflow_check(framesize);
1192   }
1193 
1194   if (Assembler::is_simm13(-framesize)) {
1195     __ save(SP, -framesize, SP);
1196   } else {
1197     __ sethi(-framesize & ~0x3ff, G3);
1198     __ add(G3, -framesize & 0x3ff, G3);
1199     __ save(SP, G3, SP);
1200   }
1201   C->set_frame_complete( __ offset() );
1202 
1203   if (!UseRDPCForConstantTableBase && C->has_mach_constant_base_node()) {
1204     // NOTE: We set the table base offset here because users might be
1205     // emitted before MachConstantBaseNode.
1206     Compile::ConstantTable& constant_table = C->constant_table();
1207     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
1208   }
1209 }
1210 
1211 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {


2487              ($src$$reg << 0);
2488     cbuf.insts()->emit_int32(op);
2489   %}
2490 
2491   enc_class Set13( immI13 src, iRegI rd ) %{
2492     emit3_simm13( cbuf, Assembler::arith_op, $rd$$reg, Assembler::or_op3, 0, $src$$constant );
2493   %}
2494 
2495   enc_class SetHi22( immI src, iRegI rd ) %{
2496     emit2_22( cbuf, Assembler::branch_op, $rd$$reg, Assembler::sethi_op2, $src$$constant );
2497   %}
2498 
2499   enc_class Set32( immI src, iRegI rd ) %{
2500     MacroAssembler _masm(&cbuf);
2501     __ set($src$$constant, reg_to_register_object($rd$$reg));
2502   %}
2503 
2504   enc_class call_epilog %{
2505     if( VerifyStackAtCalls ) {
2506       MacroAssembler _masm(&cbuf);
2507       int framesize = ra_->C->frame_slots() << LogBytesPerInt;
2508       Register temp_reg = G3;
2509       __ add(SP, framesize, temp_reg);
2510       __ cmp(temp_reg, FP);
2511       __ breakpoint_trap(Assembler::notEqual, Assembler::ptr_cc);
2512     }
2513   %}
2514 
2515   // Long values come back from native calls in O0:O1 in the 32-bit VM, copy the value
2516   // to G1 so the register allocator will not have to deal with the misaligned register
2517   // pair.
2518   enc_class adjust_long_from_native_call %{
2519 #ifndef _LP64
2520     if (returns_long()) {
2521       //    sllx  O0,32,O0
2522       emit3_simm13( cbuf, Assembler::arith_op, R_O0_enc, Assembler::sllx_op3, R_O0_enc, 0x1020 );
2523       //    srl   O1,0,O1
2524       emit3_simm13( cbuf, Assembler::arith_op, R_O1_enc, Assembler::srl_op3, R_O1_enc, 0x0000 );
2525       //    or    O0,O1,G1
2526       emit3       ( cbuf, Assembler::arith_op, R_G1_enc, Assembler:: or_op3, R_O0_enc, 0, R_O1_enc );
2527     }




1129     st->print("SET    &constanttable,%s\t! constant table base", reg);
1130   }
1131 }
1132 #endif
1133 
1134 
1135 //=============================================================================
1136 
1137 #ifndef PRODUCT
1138 void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
1139   Compile* C = ra_->C;
1140 
1141   for (int i = 0; i < OptoPrologueNops; i++) {
1142     st->print_cr("NOP"); st->print("\t");
1143   }
1144 
1145   if( VerifyThread ) {
1146     st->print_cr("Verify_Thread"); st->print("\t");
1147   }
1148 
1149   size_t framesize = C->frame_size_in_bytes();
1150   int bangsize = C->bang_size_in_bytes();
1151 
1152   // Calls to C2R adapters often do not accept exceptional returns.
1153   // We require that their callers must bang for them.  But be careful, because
1154   // some VM calls (such as call site linkage) can use several kilobytes of
1155   // stack.  But the stack safety zone should account for that.
1156   // See bugs 4446381, 4468289, 4497237.
1157   if (C->need_stack_bang(bangsize)) {
1158     st->print_cr("! stack bang (%d bytes)", bangsize); st->print("\t");
1159   }
1160 
1161   if (Assembler::is_simm13(-framesize)) {
1162     st->print   ("SAVE   R_SP,-%d,R_SP",framesize);
1163   } else {
1164     st->print_cr("SETHI  R_SP,hi%%(-%d),R_G3",framesize); st->print("\t");
1165     st->print_cr("ADD    R_G3,lo%%(-%d),R_G3",framesize); st->print("\t");
1166     st->print   ("SAVE   R_SP,R_G3,R_SP");
1167   }
1168 
1169 }
1170 #endif
1171 
1172 void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
1173   Compile* C = ra_->C;
1174   MacroAssembler _masm(&cbuf);
1175 
1176   for (int i = 0; i < OptoPrologueNops; i++) {
1177     __ nop();
1178   }
1179 
1180   __ verify_thread();
1181 
1182   size_t framesize = C->frame_size_in_bytes();
1183   assert(framesize >= 16*wordSize, "must have room for reg. save area");
1184   assert(framesize%(2*wordSize) == 0, "must preserve 2*wordSize alignment");
1185   int bangsize = C->bang_size_in_bytes();
1186 
1187   // Calls to C2R adapters often do not accept exceptional returns.
1188   // We require that their callers must bang for them.  But be careful, because
1189   // some VM calls (such as call site linkage) can use several kilobytes of
1190   // stack.  But the stack safety zone should account for that.
1191   // See bugs 4446381, 4468289, 4497237.
1192   if (C->need_stack_bang(bangsize)) {
1193     __ generate_stack_overflow_check(bangsize);
1194   }
1195 
1196   if (Assembler::is_simm13(-framesize)) {
1197     __ save(SP, -framesize, SP);
1198   } else {
1199     __ sethi(-framesize & ~0x3ff, G3);
1200     __ add(G3, -framesize & 0x3ff, G3);
1201     __ save(SP, G3, SP);
1202   }
1203   C->set_frame_complete( __ offset() );
1204 
1205   if (!UseRDPCForConstantTableBase && C->has_mach_constant_base_node()) {
1206     // NOTE: We set the table base offset here because users might be
1207     // emitted before MachConstantBaseNode.
1208     Compile::ConstantTable& constant_table = C->constant_table();
1209     constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
1210   }
1211 }
1212 
1213 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {


2489              ($src$$reg << 0);
2490     cbuf.insts()->emit_int32(op);
2491   %}
2492 
2493   enc_class Set13( immI13 src, iRegI rd ) %{
2494     emit3_simm13( cbuf, Assembler::arith_op, $rd$$reg, Assembler::or_op3, 0, $src$$constant );
2495   %}
2496 
2497   enc_class SetHi22( immI src, iRegI rd ) %{
2498     emit2_22( cbuf, Assembler::branch_op, $rd$$reg, Assembler::sethi_op2, $src$$constant );
2499   %}
2500 
2501   enc_class Set32( immI src, iRegI rd ) %{
2502     MacroAssembler _masm(&cbuf);
2503     __ set($src$$constant, reg_to_register_object($rd$$reg));
2504   %}
2505 
2506   enc_class call_epilog %{
2507     if( VerifyStackAtCalls ) {
2508       MacroAssembler _masm(&cbuf);
2509       int framesize = ra_->C->frame_size_in_bytes();
2510       Register temp_reg = G3;
2511       __ add(SP, framesize, temp_reg);
2512       __ cmp(temp_reg, FP);
2513       __ breakpoint_trap(Assembler::notEqual, Assembler::ptr_cc);
2514     }
2515   %}
2516 
2517   // Long values come back from native calls in O0:O1 in the 32-bit VM, copy the value
2518   // to G1 so the register allocator will not have to deal with the misaligned register
2519   // pair.
2520   enc_class adjust_long_from_native_call %{
2521 #ifndef _LP64
2522     if (returns_long()) {
2523       //    sllx  O0,32,O0
2524       emit3_simm13( cbuf, Assembler::arith_op, R_O0_enc, Assembler::sllx_op3, R_O0_enc, 0x1020 );
2525       //    srl   O1,0,O1
2526       emit3_simm13( cbuf, Assembler::arith_op, R_O1_enc, Assembler::srl_op3, R_O1_enc, 0x0000 );
2527       //    or    O0,O1,G1
2528       emit3       ( cbuf, Assembler::arith_op, R_G1_enc, Assembler:: or_op3, R_O0_enc, 0, R_O1_enc );
2529     }


src/cpu/sparc/vm/sparc.ad
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File