Tue, 16 May 2017 11:53:48 -0400
#5401 Fix compiler/7116216/StackOverflow.java for MIPS.
1.1 --- a/src/cpu/mips/vm/mips_64.ad Thu May 18 01:29:35 2017 +0800 1.2 +++ b/src/cpu/mips/vm/mips_64.ad Tue May 16 11:53:48 2017 -0400 1.3 @@ -1630,12 +1630,10 @@ 1.4 int framesize = C->frame_size_in_bytes(); 1.5 int bangsize = C->bang_size_in_bytes(); 1.6 1.7 -// __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false); 1.8 - 1.9 assert((framesize & (StackAlignmentInBytes-1)) == 0, "frame size not aligned"); 1.10 1.11 - if (C->need_stack_bang(framesize)) { 1.12 - __ generate_stack_overflow_check(framesize); 1.13 + if (C->need_stack_bang(bangsize)) { 1.14 + __ generate_stack_overflow_check(bangsize); 1.15 } 1.16 1.17 if (UseLoongsonISA) { 1.18 @@ -1661,7 +1659,6 @@ 1.19 1.20 1.21 uint MachPrologNode::size(PhaseRegAlloc *ra_) const { 1.22 -//fprintf(stderr, "\nPrologNode::size(ra_)= %d \n", MachNode::size(ra_));//fujie debug 1.23 return MachNode::size(ra_); // too many variables; just compute it the hard way 1.24 } 1.25
2.1 --- a/src/cpu/mips/vm/stubGenerator_mips_64.cpp Thu May 18 01:29:35 2017 +0800 2.2 +++ b/src/cpu/mips/vm/stubGenerator_mips_64.cpp Tue May 16 11:53:48 2017 -0400 2.3 @@ -1896,10 +1896,6 @@ 2.4 // Note that we only have to preserve callee-saved registers since 2.5 // the compilers are responsible for supplying a continuation point 2.6 // if they expect all registers to be preserved. 2.7 -//#define aoqi_test 2.8 -#ifdef aoqi_test 2.9 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.10 -#endif 2.11 enum layout { 2.12 thread_off, // last_java_sp 2.13 S7_off, // callee saved register sp + 1 2.14 @@ -1921,49 +1917,10 @@ 2.15 // CodeBuffer* code = new CodeBuffer(insts_size, locs_size, 0, 0, 0, false, 2.16 // NULL, NULL, NULL, false, NULL, name, false); 2.17 CodeBuffer code (name , insts_size, locs_size); 2.18 -#ifdef aoqi_test 2.19 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.20 -#endif 2.21 OopMapSet* oop_maps = new OopMapSet(); 2.22 -#ifdef aoqi_test 2.23 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.24 -#endif 2.25 MacroAssembler* masm = new MacroAssembler(&code); 2.26 -#ifdef aoqi_test 2.27 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.28 -#endif 2.29 2.30 address start = __ pc(); 2.31 - //__ stop("generate_throw_exception"); 2.32 - /* 2.33 - __ move(AT, (int)&jerome1 ); 2.34 - __ sw(SP, AT, 0); 2.35 - __ move(AT, (int)&jerome2 ); 2.36 - __ sw(FP, AT, 0); 2.37 - __ move(AT, (int)&jerome3 ); 2.38 - __ sw(RA, AT, 0); 2.39 - __ move(AT, (int)&jerome4 ); 2.40 - __ sw(R0, AT, 0); 2.41 - __ move(AT, (int)&jerome5 ); 2.42 - __ sw(R0, AT, 0); 2.43 - __ move(AT, (int)&jerome6 ); 2.44 - __ sw(R0, AT, 0); 2.45 - __ move(AT, (int)&jerome7 ); 2.46 - __ sw(R0, AT, 0); 2.47 - __ move(AT, (int)&jerome10 ); 2.48 - __ sw(R0, AT, 0); 2.49 - 2.50 - __ pushad(); 2.51 - 2.52 - //__ enter(); 2.53 - __ call(CAST_FROM_FN_PTR(address, SharedRuntime::print_call_statistics), 2.54 - relocInfo::runtime_call_type); 2.55 - __ delayed()->nop(); 2.56 - 2.57 - //__ leave(); 2.58 - __ popad(); 2.59 - 2.60 - */ 2.61 2.62 // This is an inlined and slightly modified version of call_VM 2.63 // which has the ability to fetch the return PC out of 2.64 @@ -1975,9 +1932,6 @@ 2.65 #else 2.66 Register java_thread = TREG; 2.67 #endif 2.68 -#ifdef aoqi_test 2.69 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.70 -#endif 2.71 if (restore_saved_exception_pc) { 2.72 __ ld(RA, java_thread, in_bytes(JavaThread::saved_exception_pc_offset())); // eax 2.73 } 2.74 @@ -2002,6 +1956,10 @@ 2.75 2.76 // Set up last_Java_sp and last_Java_fp 2.77 __ set_last_Java_frame(java_thread, SP, FP, NULL); 2.78 + // Align stack 2.79 + __ set64(AT, -(StackAlignmentInBytes)); 2.80 + __ andr(SP, SP, AT); 2.81 + 2.82 __ relocate(relocInfo::internal_pc_type); 2.83 { 2.84 intptr_t save_pc = (intptr_t)__ pc() + NativeMovConstReg::instruction_size + 28; 2.85 @@ -2053,186 +2011,53 @@ 2.86 #endif //ASSERT 2.87 __ jmp(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type); 2.88 __ delayed()->nop(); 2.89 -#ifdef aoqi_test 2.90 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.91 -#endif 2.92 RuntimeStub* stub = RuntimeStub::new_runtime_stub(name, &code,frame_complete, 2.93 framesize, oop_maps, false); 2.94 -#ifdef aoqi_test 2.95 -tty->print_cr("%s:%d name:%s", __func__, __LINE__, name); 2.96 -#endif 2.97 return stub->entry_point(); 2.98 } 2.99 2.100 - // Initialization 2.101 - void generate_initial() { 2.102 -/* 2.103 - // Generates all stubs and initializes the entry points 2.104 - 2.105 - // This platform-specific stub is needed by generate_call_stub() 2.106 - StubRoutines::mips::_mxcsr_std = generate_fp_mask("mxcsr_std", 0x0000000000001F80); 2.107 - 2.108 - // entry points that exist in all platforms Note: This is code 2.109 - // that could be shared among different platforms - however the 2.110 - // benefit seems to be smaller than the disadvantage of having a 2.111 - // much more complicated generator structure. See also comment in 2.112 - // stubRoutines.hpp. 2.113 - 2.114 - StubRoutines::_forward_exception_entry = generate_forward_exception(); 2.115 - 2.116 - StubRoutines::_call_stub_entry = 2.117 - generate_call_stub(StubRoutines::_call_stub_return_address); 2.118 - 2.119 - // is referenced by megamorphic call 2.120 - StubRoutines::_catch_exception_entry = generate_catch_exception(); 2.121 - 2.122 - // atomic calls 2.123 - StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); 2.124 - StubRoutines::_atomic_xchg_ptr_entry = generate_atomic_xchg_ptr(); 2.125 - StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg(); 2.126 - StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long(); 2.127 - StubRoutines::_atomic_add_entry = generate_atomic_add(); 2.128 - StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr(); 2.129 - StubRoutines::_fence_entry = generate_orderaccess_fence(); 2.130 - 2.131 - StubRoutines::_handler_for_unsafe_access_entry = 2.132 - generate_handler_for_unsafe_access(); 2.133 - 2.134 +// Initialization 2.135 +void generate_initial() { 2.136 + // Generates all stubs and initializes the entry points 2.137 + 2.138 + //------------------------------------------------------------- 2.139 + //----------------------------------------------------------- 2.140 + // entry points that exist in all platforms 2.141 + // Note: This is code that could be shared among different platforms - however the benefit seems to be smaller 2.142 + // than the disadvantage of having a much more complicated generator structure. 2.143 + // See also comment in stubRoutines.hpp. 2.144 + StubRoutines::_forward_exception_entry = generate_forward_exception(); 2.145 + StubRoutines::_call_stub_entry = generate_call_stub(StubRoutines::_call_stub_return_address); 2.146 + // is referenced by megamorphic call 2.147 + StubRoutines::_catch_exception_entry = generate_catch_exception(); 2.148 + 2.149 + StubRoutines::_handler_for_unsafe_access_entry = generate_handler_for_unsafe_access(); 2.150 + 2.151 + StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", 2.152 + CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false); 2.153 // platform dependent 2.154 - StubRoutines::mips::_get_previous_fp_entry = generate_get_previous_fp(); 2.155 - 2.156 - StubRoutines::mips::_verify_mxcsr_entry = generate_verify_mxcsr(); 2.157 -*/ 2.158 - // Generates all stubs and initializes the entry points 2.159 - 2.160 - //------------------------------------------------------------- 2.161 - //----------------------------------------------------------- 2.162 - // entry points that exist in all platforms 2.163 - // Note: This is code that could be shared among different platforms - however the benefit seems to be smaller 2.164 - // than the disadvantage of having a much more complicated generator structure. 2.165 - // See also comment in stubRoutines.hpp. 2.166 - StubRoutines::_forward_exception_entry = generate_forward_exception(); 2.167 - StubRoutines::_call_stub_entry = generate_call_stub(StubRoutines::_call_stub_return_address); 2.168 - // is referenced by megamorphic call 2.169 - StubRoutines::_catch_exception_entry = generate_catch_exception(); 2.170 - 2.171 - StubRoutines::_handler_for_unsafe_access_entry = generate_handler_for_unsafe_access(); 2.172 - 2.173 - // platform dependent 2.174 - StubRoutines::gs2::_get_previous_fp_entry = generate_get_previous_fp(); 2.175 - } 2.176 + StubRoutines::gs2::_get_previous_fp_entry = generate_get_previous_fp(); 2.177 +} 2.178 2.179 void generate_all() { 2.180 -#ifdef aoqi_test 2.181 -tty->print_cr("%s:%d", __func__, __LINE__); 2.182 -#endif 2.183 // Generates all stubs and initializes the entry points 2.184 2.185 // These entry points require SharedInfo::stack0 to be set up in 2.186 // non-core builds and need to be relocatable, so they each 2.187 // fabricate a RuntimeStub internally. 2.188 - /* 2.189 - StubRoutines::_throw_AbstractMethodError_entry = 2.190 - generate_throw_exception("AbstractMethodError throw_exception", 2.191 - CAST_FROM_FN_PTR(address, 2.192 - SharedRuntime:: 2.193 - throw_AbstractMethodError), 2.194 - false); 2.195 + StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", 2.196 + CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError), false); 2.197 + StubRoutines::_throw_NullPointerException_at_call_entry = generate_throw_exception("NullPointerException at call throw_exception", 2.198 + CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false); 2.199 2.200 - StubRoutines::_throw_IncompatibleClassChangeError_entry = 2.201 - generate_throw_exception("IncompatibleClassChangeError throw_exception", 2.202 - CAST_FROM_FN_PTR(address, 2.203 - SharedRuntime:: 2.204 - throw_IncompatibleClassChangeError), 2.205 - false); 2.206 - 2.207 - StubRoutines::_throw_ArithmeticException_entry = 2.208 - generate_throw_exception("ArithmeticException throw_exception", 2.209 - CAST_FROM_FN_PTR(address, 2.210 - SharedRuntime:: 2.211 - throw_ArithmeticException), 2.212 - true); 2.213 - 2.214 - StubRoutines::_throw_NullPointerException_entry = 2.215 - generate_throw_exception("NullPointerException throw_exception", 2.216 - CAST_FROM_FN_PTR(address, 2.217 - SharedRuntime:: 2.218 - throw_NullPointerException), 2.219 - true); 2.220 - 2.221 - StubRoutines::_throw_NullPointerException_at_call_entry = 2.222 - generate_throw_exception("NullPointerException at call throw_exception", 2.223 - CAST_FROM_FN_PTR(address, 2.224 - SharedRuntime:: 2.225 - throw_NullPointerException_at_call), 2.226 - false); 2.227 - 2.228 - StubRoutines::_throw_StackOverflowError_entry = 2.229 - generate_throw_exception("StackOverflowError throw_exception", 2.230 - CAST_FROM_FN_PTR(address, 2.231 - SharedRuntime:: 2.232 - throw_StackOverflowError), 2.233 - false); 2.234 - 2.235 - // entry points that are platform specific 2.236 - StubRoutines::mips::_f2i_fixup = generate_f2i_fixup(); 2.237 - StubRoutines::mips::_f2l_fixup = generate_f2l_fixup(); 2.238 - StubRoutines::mips::_d2i_fixup = generate_d2i_fixup(); 2.239 - StubRoutines::mips::_d2l_fixup = generate_d2l_fixup(); 2.240 - 2.241 - StubRoutines::mips::_float_sign_mask = generate_fp_mask("float_sign_mask", 0x7FFFFFFF7FFFFFFF); 2.242 - StubRoutines::mips::_float_sign_flip = generate_fp_mask("float_sign_flip", 0x8000000080000000); 2.243 - StubRoutines::mips::_double_sign_mask = generate_fp_mask("double_sign_mask", 0x7FFFFFFFFFFFFFFF); 2.244 - StubRoutines::mips::_double_sign_flip = generate_fp_mask("double_sign_flip", 0x8000000000000000); 2.245 - 2.246 + //------------------------------------------------------------------ 2.247 + // entry points that are platform specific 2.248 + 2.249 // support for verify_oop (must happen after universe_init) 2.250 - StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); 2.251 - 2.252 - // arraycopy stubs used by compilers 2.253 - generate_arraycopy_stubs(); 2.254 - */ 2.255 -#ifdef aoqi_test 2.256 -tty->print_cr("%s:%d", __func__, __LINE__); 2.257 -#endif 2.258 - StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError), false); 2.259 -#ifdef aoqi_test 2.260 -tty->print_cr("%s:%d", __func__, __LINE__); 2.261 -#endif 2.262 -// StubRoutines::_throw_ArithmeticException_entry = generate_throw_exception("ArithmeticException throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_ArithmeticException), true); 2.263 -#ifdef aoqi_test 2.264 -tty->print_cr("%s:%d", __func__, __LINE__); 2.265 -#endif 2.266 -// StubRoutines::_throw_NullPointerException_entry = generate_throw_exception("NullPointerException throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException), true); 2.267 -#ifdef aoqi_test 2.268 -tty->print_cr("%s:%d", __func__, __LINE__); 2.269 -#endif 2.270 - StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false); 2.271 -#ifdef aoqi_test 2.272 -tty->print_cr("%s:%d", __func__, __LINE__); 2.273 -#endif 2.274 - StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false); 2.275 -#ifdef aoqi_test 2.276 -tty->print_cr("%s:%d", __func__, __LINE__); 2.277 -#endif 2.278 - 2.279 - //------------------------------------------------------ 2.280 - //------------------------------------------------------------------ 2.281 - // entry points that are platform specific 2.282 - 2.283 - // support for verify_oop (must happen after universe_init) 2.284 -#ifdef aoqi_test 2.285 -tty->print_cr("%s:%d", __func__, __LINE__); 2.286 -#endif 2.287 - StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); 2.288 -#ifdef aoqi_test 2.289 -tty->print_cr("%s:%d", __func__, __LINE__); 2.290 -#endif 2.291 + StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); 2.292 #ifndef CORE 2.293 // arraycopy stubs used by compilers 2.294 - generate_arraycopy_stubs(); 2.295 -#ifdef aoqi_test 2.296 -tty->print_cr("%s:%d", __func__, __LINE__); 2.297 -#endif 2.298 + generate_arraycopy_stubs(); 2.299 #endif 2.300 2.301 // Safefetch stubs. 2.302 @@ -2242,7 +2067,7 @@ 2.303 generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry, 2.304 &StubRoutines::_safefetchN_fault_pc, 2.305 &StubRoutines::_safefetchN_continuation_pc); 2.306 - } 2.307 +} 2.308 2.309 public: 2.310 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { 2.311 @@ -2253,21 +2078,7 @@ 2.312 } 2.313 } 2.314 }; // end class declaration 2.315 -/* 2.316 -address StubGenerator::disjoint_byte_copy_entry = NULL; 2.317 -address StubGenerator::disjoint_short_copy_entry = NULL; 2.318 -address StubGenerator::disjoint_int_copy_entry = NULL; 2.319 -address StubGenerator::disjoint_long_copy_entry = NULL; 2.320 -address StubGenerator::disjoint_oop_copy_entry = NULL; 2.321 2.322 -address StubGenerator::byte_copy_entry = NULL; 2.323 -address StubGenerator::short_copy_entry = NULL; 2.324 -address StubGenerator::int_copy_entry = NULL; 2.325 -address StubGenerator::long_copy_entry = NULL; 2.326 -address StubGenerator::oop_copy_entry = NULL; 2.327 - 2.328 -address StubGenerator::checkcast_copy_entry = NULL; 2.329 -*/ 2.330 void StubGenerator_generate(CodeBuffer* code, bool all) { 2.331 StubGenerator g(code, all); 2.332 }
3.1 --- a/src/cpu/mips/vm/templateInterpreter_mips_64.cpp Thu May 18 01:29:35 2017 +0800 3.2 +++ b/src/cpu/mips/vm/templateInterpreter_mips_64.cpp Tue May 16 11:53:48 2017 -0400 3.3 @@ -533,8 +533,12 @@ 3.4 __ slt(AT, T3, SP); 3.5 __ bne(AT, R0, after_frame_check); 3.6 __ delayed()->nop(); 3.7 - // x86 version pop saved bcp and return address here, FIXME 3.8 - __ jmp(Interpreter::throw_StackOverflowError_entry(), relocInfo::runtime_call_type); 3.9 + 3.10 + // Note: the restored frame is not necessarily interpreted. 3.11 + // Use the shared runtime version of the StackOverflowError. 3.12 + __ move(SP, Rsender); 3.13 + assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "stub not yet generated"); 3.14 + __ jmp(StubRoutines::throw_StackOverflowError_entry(), relocInfo::runtime_call_type); 3.15 __ delayed()->nop(); 3.16 3.17 // all done with frame size check