1.1 --- a/src/cpu/mips/vm/templateInterpreter_mips_64.cpp Fri Sep 01 10:28:22 2017 +0800 1.2 +++ b/src/cpu/mips/vm/templateInterpreter_mips_64.cpp Thu Sep 07 09:12:16 2017 +0800 1.3 @@ -90,29 +90,26 @@ 1.4 #ifdef ASSERT 1.5 { 1.6 Label L; 1.7 - __ addi(T1, FP, frame::interpreter_frame_monitor_block_top_offset * wordSize); 1.8 - __ sub(T1, T1, SP); // T1 = maximal sp for current fp 1.9 - __ bgez(T1, L); // check if frame is complete 1.10 - __ delayed()->nop(); 1.11 - __ stop("interpreter frame not set up"); 1.12 - __ bind(L); 1.13 + __ addi(T1, FP, frame::interpreter_frame_monitor_block_top_offset * wordSize); 1.14 + __ sub(T1, T1, SP); // T1 = maximal sp for current fp 1.15 + __ bgez(T1, L); // check if frame is complete 1.16 + __ delayed()->nop(); 1.17 + __ stop("interpreter frame not set up"); 1.18 + __ bind(L); 1.19 } 1.20 #endif // ASSERT 1.21 // Restore bcp under the assumption that the current frame is still 1.22 // interpreted 1.23 - // FIXME: please change the func restore_bcp 1.24 - // S0 is the conventional register for bcp 1.25 + // FIXME: please change the func restore_bcp 1.26 + // S0 is the conventional register for bcp 1.27 __ restore_bcp(); 1.28 1.29 // expression stack must be empty before entering the VM if an 1.30 // exception happened 1.31 __ empty_expression_stack(); 1.32 // throw exception 1.33 - //__ call_VM(noreg, 1.34 - // CAST_FROM_FN_PTR(address, 1.35 - // InterpreterRuntime::throw_StackOverflowError)); 1.36 - // FIXME: why do not pass parameter thread ? 1.37 - __ call_VM(NOREG, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_StackOverflowError)); 1.38 + // FIXME: why do not pass parameter thread ? 1.39 + __ call_VM(NOREG, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_StackOverflowError)); 1.40 return entry; 1.41 } 1.42 1.43 @@ -123,8 +120,8 @@ 1.44 // exception happened 1.45 __ empty_expression_stack(); 1.46 __ li(A1, (long)name); 1.47 - __ call_VM(noreg, CAST_FROM_FN_PTR(address, 1.48 - InterpreterRuntime::throw_ArrayIndexOutOfBoundsException), A1, A2); 1.49 + __ call_VM(noreg, CAST_FROM_FN_PTR(address, 1.50 + InterpreterRuntime::throw_ArrayIndexOutOfBoundsException), A1, A2); 1.51 return entry; 1.52 } 1.53 1.54 @@ -132,7 +129,7 @@ 1.55 address entry = __ pc(); 1.56 1.57 // object is at TOS 1.58 -//FIXME, I am not sure if the object is at TOS as x86 do now @jerome, 04/20,2007 1.59 + //FIXME, I am not sure if the object is at TOS as x86 do now @jerome, 04/20,2007 1.60 //__ pop(c_rarg1); 1.61 1.62 // expression stack must be empty before entering the VM if an 1.63 @@ -145,33 +142,33 @@ 1.64 1.65 address TemplateInterpreterGenerator::generate_exception_handler_common( 1.66 const char* name, const char* message, bool pass_oop) { 1.67 - assert(!pass_oop || message == NULL, "either oop or message but not both"); 1.68 - address entry = __ pc(); 1.69 + assert(!pass_oop || message == NULL, "either oop or message but not both"); 1.70 + address entry = __ pc(); 1.71 1.72 - // expression stack must be empty before entering the VM if an exception happened 1.73 - __ empty_expression_stack(); 1.74 - // setup parameters 1.75 - __ li(A1, (long)name); 1.76 - if (pass_oop) { 1.77 - __ call_VM(V0, 1.78 - CAST_FROM_FN_PTR(address, InterpreterRuntime::create_klass_exception), A1, FSR); 1.79 - } else { 1.80 - __ li(A2, (long)message); 1.81 - __ call_VM(V0, 1.82 - CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception), A1, A2); 1.83 - } 1.84 - // throw exception 1.85 - __ jmp(Interpreter::throw_exception_entry(), relocInfo::none); 1.86 - __ delayed()->nop(); 1.87 - return entry; 1.88 + // expression stack must be empty before entering the VM if an exception happened 1.89 + __ empty_expression_stack(); 1.90 + // setup parameters 1.91 + __ li(A1, (long)name); 1.92 + if (pass_oop) { 1.93 + __ call_VM(V0, 1.94 + CAST_FROM_FN_PTR(address, InterpreterRuntime::create_klass_exception), A1, FSR); 1.95 + } else { 1.96 + __ li(A2, (long)message); 1.97 + __ call_VM(V0, 1.98 + CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception), A1, A2); 1.99 + } 1.100 + // throw exception 1.101 + __ jmp(Interpreter::throw_exception_entry(), relocInfo::none); 1.102 + __ delayed()->nop(); 1.103 + return entry; 1.104 } 1.105 1.106 1.107 address TemplateInterpreterGenerator::generate_continuation_for(TosState state) { 1.108 address entry = __ pc(); 1.109 // NULL last_sp until next java call 1.110 - __ sd(R0,Address(FP, frame::interpreter_frame_last_sp_offset * wordSize)); 1.111 - __ dispatch_next(state); 1.112 + __ sd(R0,Address(FP, frame::interpreter_frame_last_sp_offset * wordSize)); 1.113 + __ dispatch_next(state); 1.114 return entry; 1.115 } 1.116 1.117 @@ -181,18 +178,16 @@ 1.118 address entry = __ pc(); 1.119 1.120 // Restore stack bottom in case i2c adjusted stack 1.121 -// __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.122 __ ld(SP, Address(FP, frame::interpreter_frame_last_sp_offset * wordSize)); 1.123 // and NULL it as marker that esp is now tos until next java call 1.124 -// __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.125 __ sd(R0, FP, frame::interpreter_frame_last_sp_offset * wordSize); 1.126 1.127 __ restore_bcp(); 1.128 __ restore_locals(); 1.129 - 1.130 + 1.131 // 2014/11/24 Fu 1.132 // mdp: T8 1.133 - // ret: FSR 1.134 + // ret: FSR 1.135 // tmp: T9 1.136 if (state == atos) { 1.137 Register mdp = T8; 1.138 @@ -206,13 +201,10 @@ 1.139 __ get_cache_and_index_at_bcp(cache, index, 1, index_size); 1.140 1.141 const Register flags = cache; 1.142 -// __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); 1.143 __ dsll(AT, index, Address::times_ptr); 1.144 __ daddu(AT, cache, AT); 1.145 __ lw(flags, AT, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); 1.146 -// __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask); 1.147 __ andi(flags, flags, ConstantPoolCacheEntry::parameter_size_mask); 1.148 -// __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale())); 1.149 __ dsll(AT, flags, Interpreter::stackElementScale()); 1.150 __ daddu(SP, SP, AT); 1.151 1.152 @@ -226,23 +218,22 @@ 1.153 int step) { 1.154 address entry = __ pc(); 1.155 // NULL last_sp until next java call 1.156 - //__ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD); 1.157 __ sd(R0, FP, frame::interpreter_frame_last_sp_offset * wordSize); 1.158 __ restore_bcp(); 1.159 __ restore_locals(); 1.160 // handle exceptions 1.161 { 1.162 Label L; 1.163 - const Register thread = TREG; 1.164 + const Register thread = TREG; 1.165 #ifndef OPT_THREAD 1.166 - __ get_thread(thread); 1.167 + __ get_thread(thread); 1.168 #endif 1.169 - __ lw(AT, thread, in_bytes(Thread::pending_exception_offset())); 1.170 - __ beq(AT, R0, L); 1.171 - __ delayed()->nop(); 1.172 - __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_pending_exception)); 1.173 - __ should_not_reach_here(); 1.174 - __ bind(L); 1.175 + __ lw(AT, thread, in_bytes(Thread::pending_exception_offset())); 1.176 + __ beq(AT, R0, L); 1.177 + __ delayed()->nop(); 1.178 + __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_pending_exception)); 1.179 + __ should_not_reach_here(); 1.180 + __ bind(L); 1.181 } 1.182 __ dispatch_next(state, step); 1.183 return entry; 1.184 @@ -250,36 +241,20 @@ 1.185 1.186 int AbstractInterpreter::BasicType_as_index(BasicType type) { 1.187 int i = 0; 1.188 -/* 1.189 switch (type) { 1.190 case T_BOOLEAN: i = 0; break; 1.191 case T_CHAR : i = 1; break; 1.192 case T_BYTE : i = 2; break; 1.193 case T_SHORT : i = 3; break; 1.194 - case T_INT : i = 4; break; 1.195 - case T_LONG : i = 5; break; 1.196 - case T_VOID : i = 6; break; 1.197 - case T_FLOAT : i = 7; break; 1.198 - case T_DOUBLE : i = 8; break; 1.199 - case T_OBJECT : i = 9; break; 1.200 - case T_ARRAY : i = 9; break; 1.201 + case T_INT : // fall through 1.202 + case T_LONG : // fall through 1.203 + case T_VOID : i = 4; break; 1.204 + case T_FLOAT : i = 5; break; 1.205 + case T_DOUBLE : i = 6; break; 1.206 + case T_OBJECT : // fall through 1.207 + case T_ARRAY : i = 7; break; 1.208 default : ShouldNotReachHere(); 1.209 } 1.210 -*/ 1.211 - switch (type) { 1.212 - case T_BOOLEAN: i = 0; break; 1.213 - case T_CHAR : i = 1; break; 1.214 - case T_BYTE : i = 2; break; 1.215 - case T_SHORT : i = 3; break; 1.216 - case T_INT : // fall through 1.217 - case T_LONG : // fall through 1.218 - case T_VOID : i = 4; break; 1.219 - case T_FLOAT : i = 5; break; 1.220 - case T_DOUBLE : i = 6; break; 1.221 - case T_OBJECT : // fall through 1.222 - case T_ARRAY : i = 7; break; 1.223 - default : ShouldNotReachHere(); 1.224 - } 1.225 assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, 1.226 "index out of bounds"); 1.227 return i; 1.228 @@ -290,29 +265,26 @@ 1.229 //FIXME, aoqi 1.230 address TemplateInterpreterGenerator::generate_result_handler_for( 1.231 BasicType type) { 1.232 - address entry = __ pc(); 1.233 - switch (type) { 1.234 - case T_BOOLEAN: __ c2bool(V0); break; 1.235 - case T_CHAR : __ andi(V0, V0, 0xFFFF); break; 1.236 - case T_BYTE : __ sign_extend_byte (V0); break; 1.237 - case T_SHORT : __ sign_extend_short(V0); break; 1.238 - case T_INT : /* nothing to do */ break; 1.239 - case T_FLOAT : /* nothing to do */ break; 1.240 - case T_DOUBLE : /* nothing to do */ break; 1.241 - case T_OBJECT : 1.242 - { 1.243 - // __ beq(V0, R0, L); // test if NULL handle 1.244 - // __ delayed()->nop(); // if not then 1.245 - // __ lw(V0, V0, 0); // unbox result 1.246 - __ ld(V0, FP, frame::interpreter_frame_oop_temp_offset * wordSize); 1.247 - __ verify_oop(V0); // and verify it 1.248 - } 1.249 - break; 1.250 - default : ShouldNotReachHere(); 1.251 - } 1.252 - __ jr(RA); // return from result handler 1.253 - __ delayed()->nop(); 1.254 - return entry; 1.255 + address entry = __ pc(); 1.256 + switch (type) { 1.257 + case T_BOOLEAN: __ c2bool(V0); break; 1.258 + case T_CHAR : __ andi(V0, V0, 0xFFFF); break; 1.259 + case T_BYTE : __ sign_extend_byte (V0); break; 1.260 + case T_SHORT : __ sign_extend_short(V0); break; 1.261 + case T_INT : /* nothing to do */ break; 1.262 + case T_FLOAT : /* nothing to do */ break; 1.263 + case T_DOUBLE : /* nothing to do */ break; 1.264 + case T_OBJECT : 1.265 + { 1.266 + __ ld(V0, FP, frame::interpreter_frame_oop_temp_offset * wordSize); 1.267 + __ verify_oop(V0); // and verify it 1.268 + } 1.269 + break; 1.270 + default : ShouldNotReachHere(); 1.271 + } 1.272 + __ jr(RA); // return from result handler 1.273 + __ delayed()->nop(); 1.274 + return entry; 1.275 } 1.276 1.277 address TemplateInterpreterGenerator::generate_safept_entry_for( 1.278 @@ -340,11 +312,11 @@ 1.279 void InterpreterGenerator::generate_counter_incr( 1.280 Label* overflow, 1.281 Label* profile_method, 1.282 - Label* profile_method_continue) { 1.283 + Label* profile_method_continue) { 1.284 Label done; 1.285 const Address invocation_counter(FSR, in_bytes(MethodCounters::invocation_counter_offset()) //Fu:20130814 Wang:Rmethod --> FSR 1.286 + in_bytes(InvocationCounter::counter_offset())); 1.287 - const Address backedge_counter (FSR, in_bytes(MethodCounters::backedge_counter_offset()) 1.288 + const Address backedge_counter (FSR, in_bytes(MethodCounters::backedge_counter_offset()) 1.289 + in_bytes(InvocationCounter::counter_offset())); 1.290 1.291 __ get_method_counters(Rmethod, FSR, done); 1.292 @@ -365,17 +337,8 @@ 1.293 1.294 __ dadd(T3, T3, FSR); // add both counters 1.295 1.296 - // profile_method is non-null only for interpreted method so 1.297 - // profile_method != NULL == !native_call 1.298 - 1.299 if (ProfileInterpreter && profile_method != NULL) { 1.300 // Test to see if we should create a method data oop 1.301 - /* 1.302 - __ lui(AT, Assembler::split_high( 1.303 - int(&InvocationCounter::InterpreterProfileLimit))); 1.304 - __ ld(AT, AT, Assembler::split_low( 1.305 - int(&InvocationCounter::InterpreterProfileLimit))); 1.306 - */ 1.307 __ li(AT, (long)&InvocationCounter::InterpreterProfileLimit); 1.308 __ lw(AT, AT, 0); 1.309 __ slt(AT, T3, AT); 1.310 @@ -386,8 +349,6 @@ 1.311 __ test_method_data_pointer(FSR, *profile_method); 1.312 } 1.313 1.314 - //__ lui(AT, Assembler::split_high(intptr_t(&InvocationCounter::InterpreterInvocationLimit))); 1.315 - //__ ld(AT, AT, Assembler::split_low(intptr_t(&InvocationCounter::InterpreterInvocationLimit))); 1.316 __ li(AT, (long)&InvocationCounter::InterpreterInvocationLimit); 1.317 __ lw(AT, AT, 0); 1.318 __ slt(AT, T3, AT); 1.319 @@ -398,45 +359,27 @@ 1.320 1.321 void InterpreterGenerator::generate_counter_overflow(Label* do_continue) { 1.322 1.323 - // Asm interpreter on entry 1.324 - // S7 - locals 1.325 - // S0 - bcp 1.326 - // Rmethod - method 1.327 - // FP - interpreter frame 1.328 + // Asm interpreter on entry 1.329 + // S7 - locals 1.330 + // S0 - bcp 1.331 + // Rmethod - method 1.332 + // FP - interpreter frame 1.333 1.334 - // On return (i.e. jump to entry_point) 1.335 - // Rmethod - method 1.336 - // RA - return address of interpreter caller 1.337 - // tos - the last parameter to Java method 1.338 - // SP - sender_sp 1.339 + // On return (i.e. jump to entry_point) 1.340 + // Rmethod - method 1.341 + // RA - return address of interpreter caller 1.342 + // tos - the last parameter to Java method 1.343 + // SP - sender_sp 1.344 1.345 - //const Address size_of_parameters(Rmethod,in_bytes( Method::size_of_parameters_offset())); 1.346 + //const Address size_of_parameters(Rmethod,in_bytes( Method::size_of_parameters_offset())); 1.347 1.348 - // the bcp is valid if and only if it's not null 1.349 - __ call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.350 - InterpreterRuntime::frequency_counter_overflow), R0); 1.351 - __ ld(Rmethod, FP, method_offset); 1.352 -/* 1.353 - // method has been compiled - remove activation frame 1.354 - // (leave return address on stack) and continue at 1.355 - // verified entry point (eax). (eax in some past life maybe, seems to use methodoop these days) 1.356 - // 1.357 - // Note: continuation at verified entry point works if the method that has been 1.358 - // compiled is the right one (in case of virtual calls); i.e., the inline 1.359 - // cache check must have happened before the invocation counter overflow 1.360 - // check. 1.361 - __ lhu(V0, size_of_parameters); 1.362 - __ move(SP, FP); 1.363 - __ lw(FP, SP, frame::interpreter_frame_sender_fp_offset * wordSize); 1.364 - __ lw(RA, SP, frame::interpreter_frame_return_addr_offset * wordSize); 1.365 - __ sll(V0, V0, 2); 1.366 - __ addi(V0, V0, - 1 * wordSize); 1.367 - __ sub(SP, LVP, V0); 1.368 -// __ lw(T0, LVP, 0); 1.369 -*/ 1.370 - // Preserve invariant that esi/edi contain bcp/locals of sender frame 1.371 - __ b_far(*do_continue); 1.372 - __ delayed()->nop(); 1.373 + // the bcp is valid if and only if it's not null 1.374 + __ call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.375 + InterpreterRuntime::frequency_counter_overflow), R0); 1.376 + __ ld(Rmethod, FP, method_offset); 1.377 + // Preserve invariant that esi/edi contain bcp/locals of sender frame 1.378 + __ b_far(*do_continue); 1.379 + __ delayed()->nop(); 1.380 } 1.381 1.382 // See if we've got enough room on the stack for locals plus overhead. 1.383 @@ -464,7 +407,7 @@ 1.384 // T2: number of additional locals this frame needs (what we must check) 1.385 1.386 // NOTE: since the additional locals are also always pushed (wasn't obvious in 1.387 - // generate_method_entry) so the guard should work for them too. 1.388 + // generate_method_entry) so the guard should work for them too. 1.389 // 1.390 1.391 // monitor entry size: see picture of stack set (generate_method_entry) and frame_i486.hpp 1.392 @@ -472,7 +415,7 @@ 1.393 1.394 // total overhead size: entry_size + (saved ebp thru expr stack bottom). 1.395 // be sure to change this if you add/subtract anything to/from the overhead area 1.396 - const int overhead_size = -(frame::interpreter_frame_initial_sp_offset*wordSize) 1.397 + const int overhead_size = -(frame::interpreter_frame_initial_sp_offset*wordSize) 1.398 + entry_size; 1.399 1.400 const int page_size = os::vm_page_size(); 1.401 @@ -498,9 +441,8 @@ 1.402 1.403 // locals + overhead, in bytes 1.404 //FIXME aoqi 1.405 - __ dsll(T3, T2, Interpreter::stackElementScale()); 1.406 - //__ dsll(T9, T9, Address::times_8); 1.407 - __ daddiu(T3, T3, overhead_size); // locals * 4 + overhead_size --> T3 1.408 + __ dsll(T3, T2, Interpreter::stackElementScale()); 1.409 + __ daddiu(T3, T3, overhead_size); // locals * 4 + overhead_size --> T3 1.410 1.411 #ifdef ASSERT 1.412 Label stack_base_okay, stack_size_okay; 1.413 @@ -520,9 +462,9 @@ 1.414 1.415 // Add stack base to locals and subtract stack size 1.416 __ ld(AT, thread, in_bytes(Thread::stack_base_offset())); // stack_base --> AT 1.417 - __ dadd(T3, T3, AT); // locals * 4 + overhead_size + stack_base--> T3 1.418 + __ dadd(T3, T3, AT); // locals * 4 + overhead_size + stack_base--> T3 1.419 __ ld(AT, thread, in_bytes(Thread::stack_size_offset())); // stack_size --> AT 1.420 - __ dsub(T3, T3, AT); // locals * 4 + overhead_size + stack_base - stack_size --> T3 1.421 + __ dsub(T3, T3, AT); // locals * 4 + overhead_size + stack_base - stack_size --> T3 1.422 1.423 1.424 // add in the redzone and yellow size 1.425 @@ -562,11 +504,12 @@ 1.426 } 1.427 #endif // ASSERT 1.428 // get synchronization object 1.429 - { Label done; 1.430 + { 1.431 + Label done; 1.432 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); 1.433 __ lw(T0, Rmethod, in_bytes(Method::access_flags_offset())); 1.434 __ andi(T2, T0, JVM_ACC_STATIC); 1.435 - __ ld(T0, LVP, Interpreter::local_offset_in_bytes(0)); 1.436 + __ ld(T0, LVP, Interpreter::local_offset_in_bytes(0)); 1.437 __ beq(T2, R0, done); 1.438 __ delayed()->nop(); 1.439 __ ld(T0, Rmethod, in_bytes(Method::const_offset())); 1.440 @@ -582,7 +525,7 @@ 1.441 __ sd(T0, SP, BasicObjectLock::obj_offset_in_bytes()); // store object 1.442 // FIXME: I do not know what lock_object will do and what it will need 1.443 __ move(c_rarg0, SP); // object address 1.444 - __ lock_object(c_rarg0); 1.445 + __ lock_object(c_rarg0); 1.446 } 1.447 1.448 // Generate a fixed interpreter frame. This is identical setup for 1.449 @@ -591,7 +534,7 @@ 1.450 1.451 // [ local var m-1 ] <--- sp 1.452 // ... 1.453 - // [ local var 0 ] 1.454 + // [ local var 0 ] 1.455 // [ argumnet word n-1 ] <--- T0(sender's sp) 1.456 // ... 1.457 // [ argument word 0 ] <--- S7 1.458 @@ -599,22 +542,22 @@ 1.459 // initialize fixed part of activation frame 1.460 // sender's sp in Rsender 1.461 int i = 0; 1.462 - __ sd(RA, SP, (-1) * wordSize); // save return address 1.463 - __ sd(FP, SP, (-2) * wordSize); // save sender's fp 1.464 + __ sd(RA, SP, (-1) * wordSize); // save return address 1.465 + __ sd(FP, SP, (-2) * wordSize); // save sender's fp 1.466 __ daddiu(FP, SP, (-2) * wordSize); 1.467 - __ sd(Rsender, FP, (-++i) * wordSize); // save sender's sp 1.468 - __ sd(R0, FP,(-++i)*wordSize); //save last_sp as null, FIXME aoqi 1.469 - __ sd(LVP, FP, (-++i) * wordSize); // save locals offset 1.470 + __ sd(Rsender, FP, (-++i) * wordSize); // save sender's sp 1.471 + __ sd(R0, FP,(-++i)*wordSize); //save last_sp as null, FIXME aoqi 1.472 + __ sd(LVP, FP, (-++i) * wordSize); // save locals offset 1.473 __ ld(BCP, Rmethod, in_bytes(Method::const_offset())); // get constMethodOop 1.474 __ daddiu(BCP, BCP, in_bytes(ConstMethod::codes_offset())); // get codebase 1.475 __ sd(Rmethod, FP, (-++i) * wordSize); // save Method* 1.476 #ifndef CORE 1.477 if (ProfileInterpreter) { 1.478 Label method_data_continue; 1.479 - __ ld(AT, Rmethod, in_bytes(Method::method_data_offset())); 1.480 - __ beq(AT, R0, method_data_continue); 1.481 - __ delayed()->nop(); 1.482 - __ daddi(AT, AT, in_bytes(MethodData::data_offset())); 1.483 + __ ld(AT, Rmethod, in_bytes(Method::method_data_offset())); 1.484 + __ beq(AT, R0, method_data_continue); 1.485 + __ delayed()->nop(); 1.486 + __ daddi(AT, AT, in_bytes(MethodData::data_offset())); 1.487 __ bind(method_data_continue); 1.488 __ sd(AT, FP, (-++i) * wordSize); 1.489 } else { 1.490 @@ -627,12 +570,12 @@ 1.491 __ ld(T2, T2, ConstantPool::cache_offset_in_bytes()); 1.492 __ sd(T2, FP, (-++i) * wordSize); // set constant pool cache 1.493 if (native_call) { 1.494 - __ sd(R0, FP, (-++i) * wordSize); // no bcp 1.495 + __ sd(R0, FP, (-++i) * wordSize); // no bcp 1.496 } else { 1.497 - __ sd(BCP, FP, (-++i) * wordSize); // set bcp 1.498 + __ sd(BCP, FP, (-++i) * wordSize); // set bcp 1.499 } 1.500 __ daddiu(SP, FP, (-++i) * wordSize); 1.501 - __ sd(SP, FP, (-i) * wordSize); // reserve word for pointer to expression stack bottom 1.502 + __ sd(SP, FP, (-i) * wordSize); // reserve word for pointer to expression stack bottom 1.503 } 1.504 1.505 // End of helpers 1.506 @@ -655,12 +598,12 @@ 1.507 // do fastpath for resolved accessor methods 1.508 if (UseFastAccessorMethods) { 1.509 Label slow_path; 1.510 - __ li(T2, SafepointSynchronize::address_of_state()); 1.511 + __ li(T2, SafepointSynchronize::address_of_state()); 1.512 __ lw(AT, T2, 0); 1.513 __ daddi(AT, AT, -(SafepointSynchronize::_not_synchronized)); 1.514 - __ bne(AT, R0, slow_path); 1.515 - __ delayed()->nop(); 1.516 - // Code: _aload_0, _(i|a)getfield, _(i|a)return or any rewrites thereof; 1.517 + __ bne(AT, R0, slow_path); 1.518 + __ delayed()->nop(); 1.519 + // Code: _aload_0, _(i|a)getfield, _(i|a)return or any rewrites thereof; 1.520 // parameter size = 1 1.521 // Note: We can only use this code if the getfield has been resolved 1.522 // and if we don't have a null-pointer exception => check for 1.523 @@ -675,7 +618,6 @@ 1.524 __ beq(T0, R0, slow_path); 1.525 __ delayed()->nop(); 1.526 __ ld(T2, Rmethod, in_bytes(Method::const_offset())); 1.527 -// __ movptr(rdi, Address(rdx, ConstMethod::constants_offset())); 1.528 __ ld(T2, T2, in_bytes(ConstMethod::constants_offset())); 1.529 // read first instruction word and extract bytecode @ 1 and index @ 2 1.530 __ ld(T3, Rmethod, in_bytes(Method::const_offset())); 1.531 @@ -690,26 +632,26 @@ 1.532 // T0: local 0 eax 1.533 // Rmethod: method ebx 1.534 // V0: receiver - do not destroy since it is needed for slow path! ecx 1.535 - // ecx: scratch use which register instead ? 1.536 - // T1: scratch use which register instead ? 1.537 - // T3: constant pool cache index edx 1.538 - // T2: constant pool cache edi 1.539 + // ecx: scratch use which register instead ? 1.540 + // T1: scratch use which register instead ? 1.541 + // T3: constant pool cache index edx 1.542 + // T2: constant pool cache edi 1.543 // esi: send's sp 1.544 // Rsender: send's sp 1.545 // check if getfield has been resolved and read constant pool cache entry 1.546 // check the validity of the cache entry by testing whether _indices field 1.547 // contains Bytecode::_getfield in b1 byte. 1.548 assert(in_words(ConstantPoolCacheEntry::size()) == 4, "adjust shift below"); 1.549 - // __ movl(esi, 1.550 - // Address(edi, 1.551 - // edx, 1.552 - // Address::times_4, ConstantPoolCache::base_offset() 1.553 - // + ConstantPoolCacheEntry::indices_offset())); 1.554 + // __ movl(esi, 1.555 + // Address(edi, 1.556 + // edx, 1.557 + // Address::times_4, ConstantPoolCache::base_offset() 1.558 + // + ConstantPoolCacheEntry::indices_offset())); 1.559 1.560 1.561 __ dsll(T8, T3, Address::times_8); 1.562 - __ move(T1, in_bytes(ConstantPoolCache::base_offset() 1.563 - + ConstantPoolCacheEntry::indices_offset())); 1.564 + __ move(T1, in_bytes(ConstantPoolCache::base_offset() 1.565 + + ConstantPoolCacheEntry::indices_offset())); 1.566 __ dadd(T1, T8, T1); 1.567 __ dadd(T1, T1, T2); 1.568 __ lw(T1, T1, 0); 1.569 @@ -719,32 +661,14 @@ 1.570 __ bne(T1, R0, slow_path); 1.571 __ delayed()->nop(); 1.572 1.573 - // __ shrl(esi, 2*BitsPerByte); 1.574 - // __ andl(esi, 0xFF); 1.575 - // __ cmpl(esi, Bytecodes::_getfield); 1.576 - // __ jcc(Assembler::notEqual, slow_path); 1.577 - 1.578 // Note: constant pool entry is not valid before bytecode is resolved 1.579 1.580 - // __ movl(esi, 1.581 - // Address(edi, 1.582 - // edx, 1.583 - // Address::times_4, ConstantPoolCache::base_offset() 1.584 - // + ConstantPoolCacheEntry::f2_offset())); 1.585 - __ move(T1, in_bytes(ConstantPoolCache::base_offset() 1.586 - + ConstantPoolCacheEntry::f2_offset())); 1.587 + __ move(T1, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::f2_offset())); 1.588 __ dadd(T1, T1, T8); 1.589 __ dadd(T1, T1, T2); 1.590 __ lw(AT, T1, 0); 1.591 - // __ movl(edx, 1.592 - // Address(edi, 1.593 - // edx, 1.594 - // Address::times_4, ConstantPoolCache::base_offset() 1.595 - // + ConstantPoolCacheEntry::flags_offset())); 1.596 1.597 - 1.598 - __ move(T1, in_bytes(ConstantPoolCache::base_offset() 1.599 - + ConstantPoolCacheEntry::flags_offset())); 1.600 + __ move(T1, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset())); 1.601 __ dadd(T1, T1, T8); 1.602 __ dadd(T1, T1, T2); 1.603 __ lw(T3, T1, 0); 1.604 @@ -783,7 +707,7 @@ 1.605 __ lhu(V0, T0, 0); 1.606 __ b(xreturn_path); 1.607 __ delayed()->nop(); 1.608 - 1.609 + 1.610 //atos 1.611 __ bind(notChar); 1.612 __ daddi(T1, T3, (-1) * atos); 1.613 @@ -809,8 +733,8 @@ 1.614 __ bind(xreturn_path); 1.615 1.616 // _ireturn/_areturn 1.617 - //FIXME 1.618 - __ move(SP, Rsender);//FIXME, set sender's fp to SP 1.619 + //FIXME 1.620 + __ move(SP, Rsender);//FIXME, set sender's fp to SP 1.621 __ jr(RA); 1.622 __ delayed()->nop(); 1.623 1.624 @@ -826,7 +750,7 @@ 1.625 1.626 // Method entry for java.lang.ref.Reference.get. 1.627 address InterpreterGenerator::generate_Reference_get_entry(void) { 1.628 -#ifndef SERIALGC 1.629 +#if INCLUDE_ALL_GCS 1.630 // Code: _aload_0, _getfield, _areturn 1.631 // parameter size = 1 1.632 // 1.633 @@ -862,15 +786,12 @@ 1.634 guarantee(referent_offset > 0, "referent offset not initialized"); 1.635 1.636 if (UseG1GC) { 1.637 + Unimplemented(); 1.638 Label slow_path; 1.639 // rbx: method 1.640 1.641 // Check if local 0 != NULL 1.642 // If the receiver is null then it is OK to jump to the slow path. 1.643 - /* __ movptr(rax, Address(rsp, wordSize)); 1.644 - 1.645 - __ testptr(rax, rax); 1.646 - __ jcc(Assembler::zero, slow_path);*/ 1.647 1.648 // rax: local 0 1.649 // rbx: method (but can be used as scratch now) 1.650 @@ -881,31 +802,10 @@ 1.651 // the referent field in an SATB buffer. 1.652 1.653 // Load the value of the referent field. 1.654 - //const Address field_address(rax, referent_offset); 1.655 -// __ load_heap_oop(rax, field_address); 1.656 1.657 - // Generate the G1 pre-barrier code to log the value of 1.658 - // the referent field in an SATB buffer. 1.659 -// __ g1_write_barrier_pre(noreg /* obj */, 1.660 -// rax /* pre_val */, 1.661 -// r15_thread /* thread */, 1.662 -// rbx /* tmp */, 1.663 - // true /* tosca_live */, 1.664 - // true /* expand_call */); 1.665 - 1.666 - // _areturn 1.667 - /* __ pop(rdi); // get return address 1.668 - __ mov(rsp, r13); // set sp to sender sp 1.669 - __ jmp(rdi); 1.670 - __ ret(0); 1.671 - 1.672 - // generate a vanilla interpreter entry as the slow path 1.673 - __ bind(slow_path); 1.674 - (void) generate_normal_entry(false); 1.675 -*/ 1.676 return entry; 1.677 } 1.678 -#endif // SERIALGC 1.679 +#endif // INCLUDE_ALL_GCS 1.680 1.681 // If G1 is not enabled then attempt to go through the accessor entry point 1.682 // Reference.get is an accessor 1.683 @@ -923,18 +823,17 @@ 1.684 1.685 #ifndef CORE 1.686 const Address invocation_counter(Rmethod,in_bytes(MethodCounters::invocation_counter_offset() + // Fu: 20130814 1.687 - InvocationCounter::counter_offset())); 1.688 + InvocationCounter::counter_offset())); 1.689 #endif 1.690 1.691 // get parameter size (always needed) 1.692 // the size in the java stack 1.693 - //__ lhu(V0, Rmethod, in_bytes(Method::size_of_parameters_offset())); 1.694 - __ ld(V0, Rmethod, in_bytes(Method::const_offset())); 1.695 + __ ld(V0, Rmethod, in_bytes(Method::const_offset())); 1.696 __ lhu(V0, V0, in_bytes(ConstMethod::size_of_parameters_offset())); // Fu: 20130814 1.697 1.698 // native calls don't need the stack size check since they have no expression stack 1.699 // and the arguments are already on the stack and we only add a handful of words 1.700 - // to the stack 1.701 + // to the stack 1.702 1.703 // Rmethod: Method* 1.704 // V0: size of parameters 1.705 @@ -951,20 +850,18 @@ 1.706 __ daddiu(LVP, LVP, (-1) * wordSize); 1.707 __ dadd(LVP, LVP, SP); 1.708 1.709 - //__ move(T0, SP); // remember sender sp for generate_fixed_frame 1.710 - 1.711 1.712 // add 2 zero-initialized slots for native calls 1.713 __ daddi(SP, SP, (-2) * wordSize); 1.714 - __ sd(R0, SP, 1 * wordSize); // slot for native oop temp offset (setup via runtime) 1.715 - __ sd(R0, SP, 0 * wordSize); // slot for static native result handler3 (setup via runtime) 1.716 + __ sd(R0, SP, 1 * wordSize); // slot for native oop temp offset (setup via runtime) 1.717 + __ sd(R0, SP, 0 * wordSize); // slot for static native result handler3 (setup via runtime) 1.718 1.719 // Layout of frame at this point 1.720 - // [ method holder mirror ] <--- sp 1.721 - // [ result type info ] 1.722 - // [ argument word n-1 ] <--- T0 1.723 + // [ method holder mirror ] <--- sp 1.724 + // [ result type info ] 1.725 + // [ argument word n-1 ] <--- T0 1.726 // ... 1.727 - // [ argument word 0 ] <--- LVP 1.728 + // [ argument word 0 ] <--- LVP 1.729 1.730 1.731 #ifndef CORE 1.732 @@ -985,8 +882,8 @@ 1.733 // [ return address ] <--- fp 1.734 // [ method holder mirror ] 1.735 // [ result type info ] 1.736 - // [ argumnet word n-1 ] <--- sender's sp 1.737 - // ... 1.738 + // [ argumnet word n-1 ] <--- sender's sp 1.739 + // ... 1.740 // [ argument word 0 ] <--- S7 1.741 1.742 1.743 @@ -1001,7 +898,8 @@ 1.744 __ stop("tried to execute native method as non-native"); 1.745 __ bind(L); 1.746 } 1.747 - { Label L; 1.748 + { 1.749 + Label L; 1.750 __ andi(AT, T0, JVM_ACC_ABSTRACT); 1.751 __ beq(AT, R0, L); 1.752 __ delayed()->nop(); 1.753 @@ -1028,6 +926,7 @@ 1.754 if (inc_counter) { 1.755 generate_counter_incr(&invocation_counter_overflow, NULL, NULL); 1.756 } 1.757 + 1.758 Label continue_after_compile; 1.759 __ bind(continue_after_compile); 1.760 #endif // CORE 1.761 @@ -1065,23 +964,24 @@ 1.762 // [ monitor entry ] <--- sp 1.763 // ... 1.764 // [ monitor entry ] 1.765 - // [ monitor block top ] ( the top monitor entry ) 1.766 + // [ monitor block top ] ( the top monitor entry ) 1.767 // [ byte code pointer (0) ] (if native, bcp = 0) 1.768 // [ constant pool cache ] 1.769 // [ Method* ] 1.770 - // [ locals offset ] 1.771 + // [ locals offset ] 1.772 // [ sender's sp ] 1.773 // [ sender's fp ] 1.774 // [ return address ] <--- fp 1.775 // [ method holder mirror ] 1.776 // [ result type info ] 1.777 // [ argumnet word n-1 ] <--- ( sender's sp ) 1.778 - // ... 1.779 + // ... 1.780 // [ argument word 0 ] <--- S7 1.781 1.782 // start execution 1.783 #ifdef ASSERT 1.784 - { Label L; 1.785 + { 1.786 + Label L; 1.787 __ ld(AT, FP, frame::interpreter_frame_monitor_block_top_offset * wordSize); 1.788 __ beq(AT, SP, L); 1.789 __ delayed()->nop(); 1.790 @@ -1096,20 +996,14 @@ 1.791 // work registers 1.792 const Register method = Rmethod; 1.793 //const Register thread = T2; 1.794 - const Register t = RT4; 1.795 + const Register t = RT4; 1.796 1.797 __ get_method(method); 1.798 __ verify_oop(method); 1.799 - { Label L, Lstatic; 1.800 - __ ld(t,method,in_bytes(Method::const_offset())); 1.801 + { 1.802 + Label L, Lstatic; 1.803 + __ ld(t,method,in_bytes(Method::const_offset())); 1.804 __ lhu(t, t, in_bytes(ConstMethod::size_of_parameters_offset())); // Fu: 20130814 1.805 - {//aoqi_test 1.806 - Label L; 1.807 - __ daddi(AT, t, -8); 1.808 - __ blez(AT, L); 1.809 - __ delayed()->nop(); 1.810 - __ bind(L); 1.811 - } 1.812 // MIPS n64 ABI: caller does not reserve space for the register auguments. 1.813 //FIXME, aoqi: A1? 1.814 // A0 and A1(if needed) 1.815 @@ -1127,14 +1021,14 @@ 1.816 __ bind(L); 1.817 } 1.818 __ move(AT, -(StackAlignmentInBytes)); 1.819 - __ andr(SP, SP, AT); 1.820 + __ andr(SP, SP, AT); 1.821 __ move(AT, SP); 1.822 - // [ ] <--- sp 1.823 + // [ ] <--- sp 1.824 // ... (size of parameters - 8 ) 1.825 - // [ monitor entry ] 1.826 + // [ monitor entry ] 1.827 // ... 1.828 // [ monitor entry ] 1.829 - // [ monitor block top ] ( the top monitor entry ) 1.830 + // [ monitor block top ] ( the top monitor entry ) 1.831 // [ byte code pointer (0) ] (if native, bcp = 0) 1.832 // [ constant pool cache ] 1.833 // [ Method* ] 1.834 @@ -1145,17 +1039,17 @@ 1.835 // [ method holder mirror ] 1.836 // [ result type info ] 1.837 // [ argumnet word n-1 ] <--- ( sender's sp ) 1.838 - // ... 1.839 + // ... 1.840 // [ argument word 0 ] <--- LVP 1.841 1.842 // get signature handler 1.843 - { 1.844 + { 1.845 Label L; 1.846 __ ld(T9, method, in_bytes(Method::signature_handler_offset())); 1.847 __ bne(T9, R0, L); 1.848 __ delayed()->nop(); 1.849 - __ call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.850 - InterpreterRuntime::prepare_native_call), method); 1.851 + __ call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.852 + InterpreterRuntime::prepare_native_call), method); 1.853 __ get_method(method); 1.854 __ ld(T9, method, in_bytes(Method::signature_handler_offset())); 1.855 __ bind(L); 1.856 @@ -1172,9 +1066,9 @@ 1.857 1.858 __ jalr(T9); 1.859 __ delayed()->nop(); 1.860 - __ get_method(method); // slow path call blows EBX on DevStudio 5.0 1.861 + __ get_method(method); // slow path call blows EBX on DevStudio 5.0 1.862 1.863 - /* 1.864 + /* 1.865 if native function is static, and its second parameter has type length of double word, 1.866 and first parameter has type length of word, we have to reserve one word 1.867 for the first parameter, according to mips o32 abi. 1.868 @@ -1191,10 +1085,10 @@ 1.869 #define FIRSTPARA_SHIFT_COUNT 5 1.870 #define SECONDPARA_SHIFT_COUNT 9 1.871 #define THIRDPARA_SHIFT_COUNT 13 1.872 -#define PARA_MASK 0xf 1.873 +#define PARA_MASK 0xf 1.874 1.875 // pass mirror handle if static call 1.876 - { 1.877 + { 1.878 Label L; 1.879 const int mirror_offset = in_bytes(Klass::java_mirror_offset()); 1.880 __ lw(t, method, in_bytes(Method::access_flags_offset())); 1.881 @@ -1212,9 +1106,6 @@ 1.882 // pass handle to mirror 1.883 __ sd(t, FP, frame::interpreter_frame_oop_temp_offset * wordSize); 1.884 __ daddi(t, FP, frame::interpreter_frame_oop_temp_offset * wordSize); 1.885 - // __ ld_ptr(t,Address(SP ,wordSize)); 1.886 - //FIXME, aoqi 1.887 - //__ st_ptr(t, Address(SP, wordSize)); 1.888 __ move(A1, t); 1.889 __ bind(L); 1.890 } 1.891 @@ -1233,10 +1124,10 @@ 1.892 // [ sender's sp ] | 1.893 // [ sender's fp ] | 1.894 // [ return address ] <--- fp | 1.895 - // [ method holder mirror ] <----------------------------| 1.896 + // [ method holder mirror ] <----------------------------| 1.897 // [ result type info ] 1.898 // [ argumnet word n-1 ] <--- ( sender's sp ) 1.899 - // ... 1.900 + // ... 1.901 // [ argument word 0 ] <--- S7 1.902 1.903 // get native function entry point 1.904 @@ -1264,8 +1155,6 @@ 1.905 __ get_thread(thread); 1.906 #endif 1.907 __ daddi(t, thread, in_bytes(JavaThread::jni_environment_offset())); 1.908 - //__ addi(SP, SP, (-1) * wordSize); 1.909 - //__ sw(t, SP, 0); 1.910 // stack,but I think it won't work when pass float,double etc @jerome,10/17,2006 1.911 __ move(A0, t); 1.912 // [ jni environment ] <--- sp 1.913 @@ -1283,32 +1172,25 @@ 1.914 // [ sender's sp ] | 1.915 // [ sender's fp ] | 1.916 // [ return address ] <--- fp | 1.917 - // [ method holder mirror ] <----------------------------| 1.918 + // [ method holder mirror ] <----------------------------| 1.919 // [ result type info ] 1.920 // [ argumnet word n-1 ] <--- ( sender's sp ) 1.921 - // ... 1.922 + // ... 1.923 // [ argument word 0 ] <--- S7 1.924 1.925 - /* 1.926 - // reset handle block 1.927 - __ lw(t, thread, in_bytes(JavaThread::active_handles_offset())); 1.928 - __ sw(R0, t, JNIHandleBlock::top_offset_in_bytes()); 1.929 - 1.930 - */ 1.931 // set_last_Java_frame_before_call 1.932 __ sd(FP, thread, in_bytes(JavaThread::last_Java_fp_offset())); 1.933 // Change state to native (we save the return address in the thread, since it might not 1.934 // be pushed on the stack when we do a a stack traversal). It is enough that the pc() 1.935 // points into the right code segment. It does not have to be the correct return pc. 1.936 __ li(t, __ pc()); 1.937 - // __ sw(t, thread, in_bytes(JavaThread::frame_anchor_offset() 1.938 - // + JavaFrameAnchor::last_Java_pc_offset())); 1.939 - __ sd(t, thread, in_bytes(JavaThread::last_Java_pc_offset())); 1.940 + __ sd(t, thread, in_bytes(JavaThread::last_Java_pc_offset())); 1.941 __ sd(SP, thread, in_bytes(JavaThread::last_Java_sp_offset())); 1.942 1.943 // change thread state 1.944 #ifdef ASSERT 1.945 - { Label L; 1.946 + { 1.947 + Label L; 1.948 __ lw(t, thread, in_bytes(JavaThread::thread_state_offset())); 1.949 __ daddi(t, t, (-1) * _thread_in_Java); 1.950 __ beq(t, R0, L); 1.951 @@ -1327,34 +1209,19 @@ 1.952 // result potentially in V2:V1 or F0:F1 1.953 1.954 1.955 - if (CheckJNICalls) { 1.956 - //FIXME 1.957 - // __ call(StubRoutines::gs2::verify_fpu_cntrl_wrd_entry(), 1.958 - // relocInfo::runtime_call_type); 1.959 - } 1.960 - 1.961 - // restore S0 to have legal interpreter frame, i.e., bci == 0 <=> S0 == code_base() 1.962 - //__ lw(BCP, method, in_bytes(Method::const_offset())); // get constMethodOop 1.963 - //__ addi(BCP, BCP, in_bytes(ConstMethod::codes_offset())); // get codebase 1.964 - 1.965 // via _last_native_pc and not via _last_jave_sp 1.966 // NOTE: the order of theses push(es) is known to frame::interpreter_frame_result. 1.967 // If the order changes or anything else is added to the stack the code in 1.968 // interpreter_frame_result will have to be changed. 1.969 //FIXME, should modify here 1.970 // save return value to keep the value from being destroyed by other calls 1.971 - //__ addi(SP, SP, (-4) * wordSize); 1.972 - //__ sw(V0, SP, 3 * wordSize); 1.973 - //__ sw(V1, SP, 2 * wordSize); 1.974 - //__ swc1(F0, SP, 1 * wordSize); 1.975 - //__ swc1(F1, SP, 0 * wordSize); 1.976 __ move(S1, V0); 1.977 __ move(S3, V1); 1.978 __ dmfc1(S4, F0); 1.979 __ dmfc1(S2, F1); 1.980 1.981 // change thread state 1.982 - __ get_thread(thread); 1.983 + __ get_thread(thread); 1.984 __ move(t, _thread_in_native_trans); 1.985 __ sw(t, thread, in_bytes(JavaThread::thread_state_offset())); 1.986 1.987 @@ -1378,15 +1245,12 @@ 1.988 __ beq(AT, R0, Continue); 1.989 __ delayed()->nop(); 1.990 __ bind(L); 1.991 - // __ addi(SP, SP, (-1) * wordSize); 1.992 __ move(A0, thread); 1.993 - __ call(CAST_FROM_FN_PTR(address, 1.994 - JavaThread::check_special_condition_for_native_trans), 1.995 - relocInfo::runtime_call_type); 1.996 + __ call(CAST_FROM_FN_PTR(address, 1.997 + JavaThread::check_special_condition_for_native_trans), 1.998 + relocInfo::runtime_call_type); 1.999 __ delayed()->nop(); 1.1000 - // __ addi(SP, SP, wordSize); 1.1001 1.1002 - // __ get_method(method); 1.1003 #ifndef OPT_THREAD 1.1004 __ get_thread(thread); 1.1005 #endif 1.1006 @@ -1401,87 +1265,78 @@ 1.1007 __ reset_last_Java_frame(thread, true, true); 1.1008 1.1009 // reset handle block 1.1010 - __ ld(t, thread, in_bytes(JavaThread::active_handles_offset())); 1.1011 + __ ld(t, thread, in_bytes(JavaThread::active_handles_offset())); 1.1012 __ sw(R0, t, JNIHandleBlock::top_offset_in_bytes()); 1.1013 1.1014 // If result was an oop then unbox and save it in the frame 1.1015 { Label L; 1.1016 Label no_oop, store_result; 1.1017 - //FIXME, addi only support 16-bit imeditate 1.1018 - __ ld(AT, FP, frame::interpreter_frame_result_handler_offset*wordSize); 1.1019 - // __ addi(AT,AT,-(int)AbstractInterpreter::result_handler(T_OBJECT)); 1.1020 - __ li(T0, AbstractInterpreter::result_handler(T_OBJECT)); 1.1021 - __ bne(AT, T0, no_oop); 1.1022 - __ delayed()->nop(); 1.1023 - //__ cmpl(Address(esp), NULL_WORD); 1.1024 - //FIXME, do we need pop here ? @jerome 1.1025 - //__ pop(ltos); 1.1026 - //__ testl(eax, eax); 1.1027 - //__ jcc(Assembler::zero, store_result); 1.1028 - __ move(V0, S1); 1.1029 - __ beq(V0, R0, store_result); 1.1030 - __ delayed()->nop(); 1.1031 + //FIXME, addi only support 16-bit imeditate 1.1032 + __ ld(AT, FP, frame::interpreter_frame_result_handler_offset*wordSize); 1.1033 + __ li(T0, AbstractInterpreter::result_handler(T_OBJECT)); 1.1034 + __ bne(AT, T0, no_oop); 1.1035 + __ delayed()->nop(); 1.1036 + __ move(V0, S1); 1.1037 + __ beq(V0, R0, store_result); 1.1038 + __ delayed()->nop(); 1.1039 // unbox 1.1040 - __ ld(V0, V0, 0); 1.1041 + __ ld(V0, V0, 0); 1.1042 __ bind(store_result); 1.1043 - __ sd(V0, FP, (frame::interpreter_frame_oop_temp_offset)*wordSize); 1.1044 + __ sd(V0, FP, (frame::interpreter_frame_oop_temp_offset)*wordSize); 1.1045 // keep stack depth as expected by pushing oop which will eventually be discarded 1.1046 __ bind(no_oop); 1.1047 } 1.1048 { 1.1049 Label no_reguard; 1.1050 __ lw(t, thread, in_bytes(JavaThread::stack_guard_state_offset())); 1.1051 - //__ bne(t, JavaThread::stack_guard_yellow_disabled, no_reguard); 1.1052 - __ move(AT,(int) JavaThread::stack_guard_yellow_disabled); 1.1053 + __ move(AT,(int) JavaThread::stack_guard_yellow_disabled); 1.1054 __ bne(t, AT, no_reguard); 1.1055 __ delayed()->nop(); 1.1056 - __ pushad(); 1.1057 - __ call(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages), 1.1058 - relocInfo::runtime_call_type); 1.1059 + __ pushad(); 1.1060 + __ call(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages), relocInfo::runtime_call_type); 1.1061 __ delayed()->nop(); 1.1062 - __ popad(); 1.1063 + __ popad(); 1.1064 //add for compressedoops 1.1065 __ reinit_heapbase(); 1.1066 __ bind(no_reguard); 1.1067 } 1.1068 - // restore esi to have legal interpreter frame, 1.1069 + // restore esi to have legal interpreter frame, 1.1070 // i.e., bci == 0 <=> esi == code_base() 1.1071 // Can't call_VM until bcp is within reasonable. 1.1072 __ get_method(method); // method is junk from thread_in_native to now. 1.1073 __ verify_oop(method); 1.1074 - // __ movl(esi, Address(method,Method::const_offset())); // get constMethodOop 1.1075 - __ ld(BCP, method, in_bytes(Method::const_offset())); 1.1076 - // __ leal(esi, Address(esi,ConstMethod::codes_offset())); // get codebase 1.1077 + __ ld(BCP, method, in_bytes(Method::const_offset())); 1.1078 __ lea(BCP, Address(BCP, in_bytes(ConstMethod::codes_offset()))); 1.1079 // handle exceptions (exception handling will handle unlocking!) 1.1080 - { 1.1081 + { 1.1082 Label L; 1.1083 __ lw(t, thread, in_bytes(Thread::pending_exception_offset())); 1.1084 __ beq(t, R0, L); 1.1085 __ delayed()->nop(); 1.1086 - // Note: At some point we may want to unify this with the code used in 1.1087 + // Note: At some point we may want to unify this with the code used in 1.1088 // call_VM_base(); 1.1089 // i.e., we should use the StubRoutines::forward_exception code. For now this 1.1090 // doesn't work here because the esp is not correctly set at this point. 1.1091 - __ MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, 1.1092 - InterpreterRuntime::throw_pending_exception)); 1.1093 + __ MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, 1.1094 + InterpreterRuntime::throw_pending_exception)); 1.1095 __ should_not_reach_here(); 1.1096 __ bind(L); 1.1097 } 1.1098 1.1099 // do unlocking if necessary 1.1100 - { Label L; 1.1101 + { 1.1102 + Label L; 1.1103 __ lw(t, method, in_bytes(Method::access_flags_offset())); 1.1104 __ andi(t, t, JVM_ACC_SYNCHRONIZED); 1.1105 __ beq(t, R0, L); 1.1106 // the code below should be shared with interpreter macro assembler implementation 1.1107 - { Label unlock; 1.1108 + { 1.1109 + Label unlock; 1.1110 // BasicObjectLock will be first in list, 1.1111 // since this is a synchronized method. However, need 1.1112 - // to check that the object has not been unlocked by 1.1113 - // an explicit monitorexit bytecode. 1.1114 - __ delayed()->daddi(c_rarg0, FP, frame::interpreter_frame_initial_sp_offset 1.1115 - * wordSize - (int)sizeof(BasicObjectLock)); 1.1116 + // to check that the object has not been unlocked by 1.1117 + // an explicit monitorexit bytecode. 1.1118 + __ delayed()->daddi(c_rarg0, FP, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock)); 1.1119 // address of first monitor 1.1120 1.1121 __ ld(t, c_rarg0, BasicObjectLock::obj_offset_in_bytes()); 1.1122 @@ -1489,15 +1344,15 @@ 1.1123 __ delayed()->nop(); 1.1124 1.1125 // Entry already unlocked, need to throw exception 1.1126 - __ MacroAssembler::call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.1127 - InterpreterRuntime::throw_illegal_monitor_state_exception)); 1.1128 + __ MacroAssembler::call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.1129 + InterpreterRuntime::throw_illegal_monitor_state_exception)); 1.1130 __ should_not_reach_here(); 1.1131 1.1132 - __ bind(unlock); 1.1133 - __ unlock_object(c_rarg0); 1.1134 + __ bind(unlock); 1.1135 + __ unlock_object(c_rarg0); 1.1136 } 1.1137 __ bind(L); 1.1138 - } 1.1139 + } 1.1140 1.1141 // jvmti/jvmpi support 1.1142 // Note: This must happen _after_ handling/throwing any exceptions since 1.1143 @@ -1506,7 +1361,7 @@ 1.1144 // not properly paired (was bug - gri 11/22/99). 1.1145 __ notify_method_exit(false, vtos, InterpreterMacroAssembler::NotifyJVMTI ); 1.1146 1.1147 - // restore potential result in V0:V1, 1.1148 + // restore potential result in V0:V1, 1.1149 // call result handler to restore potential result in ST0 & handle result 1.1150 //__ lw(V0, SP, 3 * wordSize); 1.1151 //__ lw(V1, SP, 2 * wordSize); 1.1152 @@ -1520,9 +1375,6 @@ 1.1153 __ ld(t, FP, (frame::interpreter_frame_result_handler_offset) * wordSize); 1.1154 __ jalr(t); 1.1155 __ delayed()->nop(); 1.1156 - //jerome_for_debug 1.1157 - //__ move(AT, (int)(&jerome4)); 1.1158 - //__ sw(FP, AT, 0); 1.1159 1.1160 1.1161 // remove activation 1.1162 @@ -1549,10 +1401,10 @@ 1.1163 // 1.1164 // Layout of frame just at the entry 1.1165 // 1.1166 -// [ argument word n-1 ] <--- sp 1.1167 +// [ argument word n-1 ] <--- sp 1.1168 // ... 1.1169 -// [ argument word 0 ] 1.1170 -// assume Method* in Rmethod before call this method. 1.1171 +// [ argument word 0 ] 1.1172 +// assume Method* in Rmethod before call this method. 1.1173 // prerequisites to the generated stub : the callee Method* in Rmethod 1.1174 // note you must save the caller bcp before call the generated stub 1.1175 // 1.1176 @@ -1561,7 +1413,7 @@ 1.1177 bool inc_counter = UseCompiler || CountCompiledCalls; 1.1178 1.1179 // Rmethod: Method* 1.1180 - // Rsender: sender 's sp 1.1181 + // Rsender: sender 's sp 1.1182 address entry_point = __ pc(); 1.1183 /* 1.1184 #ifndef CORE 1.1185 @@ -1573,28 +1425,28 @@ 1.1186 #endif 1.1187 */ 1.1188 #ifndef CORE 1.1189 - const Address invocation_counter(Rmethod, 1.1190 - in_bytes(MethodCounters::invocation_counter_offset() + InvocationCounter::counter_offset())); 1.1191 + const Address invocation_counter(Rmethod, 1.1192 + in_bytes(MethodCounters::invocation_counter_offset() + InvocationCounter::counter_offset())); 1.1193 #endif 1.1194 1.1195 // get parameter size (always needed) 1.1196 - __ ld(T3, Rmethod, in_bytes(Method::const_offset())); //T3 --> Rmethod._constMethod 1.1197 + __ ld(T3, Rmethod, in_bytes(Method::const_offset())); //T3 --> Rmethod._constMethod 1.1198 __ lhu(V0, T3, in_bytes(ConstMethod::size_of_parameters_offset())); 1.1199 1.1200 // Rmethod: Method* 1.1201 // V0: size of parameters 1.1202 - // Rsender: sender 's sp ,could be different frome sp+ wordSize if we call via c2i 1.1203 + // Rsender: sender 's sp ,could be different frome sp+ wordSize if we call via c2i 1.1204 // get size of locals in words to T2 1.1205 - __ lhu(T2, T3, in_bytes(ConstMethod::size_of_locals_offset())); 1.1206 + __ lhu(T2, T3, in_bytes(ConstMethod::size_of_locals_offset())); 1.1207 // T2 = no. of additional locals, locals include parameters 1.1208 - __ dsub(T2, T2, V0); 1.1209 + __ dsub(T2, T2, V0); 1.1210 1.1211 // see if we've got enough room on the stack for locals plus overhead. 1.1212 // Layout of frame at this point 1.1213 // 1.1214 // [ argument word n-1 ] <--- sp 1.1215 // ... 1.1216 - // [ argument word 0 ] 1.1217 + // [ argument word 0 ] 1.1218 generate_stack_overflow_check(); 1.1219 // after this function, the layout of frame does not change 1.1220 1.1221 @@ -1608,18 +1460,12 @@ 1.1222 // explicitly initialize locals 1.1223 { 1.1224 Label exit, loop; 1.1225 - // for test 1.1226 - // __ slt(AT, R0, T2); 1.1227 - // __ beq(AT, R0, exit); 1.1228 __ beq(T2, R0, exit); 1.1229 __ delayed()->nop(); 1.1230 __ bind(loop); 1.1231 - // if(TaggedStackInterpreter)__ daddi(SP, SP, -1 * wordSize); 1.1232 __ sd(R0, SP, -1 * wordSize); // initialize local variables 1.1233 __ daddiu(T2, T2, -1); // until everything initialized 1.1234 __ bne(T2, R0, loop); 1.1235 - // __ slt(AT, R0, T2); 1.1236 - // __ bne(AT, R0, loop); 1.1237 __ delayed(); 1.1238 __ daddiu(SP, SP, (-1) * wordSize); //fill delay slot 1.1239 __ bind(exit); 1.1240 @@ -1628,13 +1474,13 @@ 1.1241 #ifndef CORE 1.1242 if (inc_counter) __ lw(T3, invocation_counter); // (pre-)fetch invocation count 1.1243 #endif 1.1244 - // 1.1245 - // [ local var m-1 ] <--- sp 1.1246 + // 1.1247 + // [ local var m-1 ] <--- sp 1.1248 // ... 1.1249 - // [ local var 0 ] 1.1250 - // [ argument word n-1 ] <--- T0? 1.1251 + // [ local var 0 ] 1.1252 + // [ argument word n-1 ] <--- T0? 1.1253 // ... 1.1254 - // [ argument word 0 ] <--- LVP 1.1255 + // [ argument word 0 ] <--- LVP 1.1256 1.1257 // initialize fixed part of activation frame 1.1258 1.1259 @@ -1642,15 +1488,15 @@ 1.1260 1.1261 1.1262 // after this function, the layout of frame is as following 1.1263 - // 1.1264 + // 1.1265 // [ monitor block top ] <--- sp ( the top monitor entry ) 1.1266 // [ byte code pointer ] (if native, bcp = 0) 1.1267 // [ constant pool cache ] 1.1268 // [ Method* ] 1.1269 - // [ locals offset ] 1.1270 + // [ locals offset ] 1.1271 // [ sender's sp ] 1.1272 // [ sender's fp ] <--- fp 1.1273 - // [ return address ] 1.1274 + // [ return address ] 1.1275 // [ local var m-1 ] 1.1276 // ... 1.1277 // [ local var 0 ] 1.1278 @@ -1670,7 +1516,8 @@ 1.1279 __ stop("tried to execute native method as non-native"); 1.1280 __ bind(L); 1.1281 } 1.1282 - { Label L; 1.1283 + { 1.1284 + Label L; 1.1285 __ andi(T2, AT, JVM_ACC_ABSTRACT); 1.1286 __ beq(T2, R0, L); 1.1287 __ delayed()->nop(); 1.1288 @@ -1699,7 +1546,7 @@ 1.1289 // 2014/11/24 Fu 1.1290 // mdp : T8 1.1291 // tmp1: T9 1.1292 - // tmp2: T2 1.1293 + // tmp2: T2 1.1294 __ profile_parameters_type(T8, T9, T2); 1.1295 1.1296 // increment invocation count & check for overflow 1.1297 @@ -1707,8 +1554,9 @@ 1.1298 Label profile_method; 1.1299 Label profile_method_continue; 1.1300 if (inc_counter) { 1.1301 - generate_counter_incr(&invocation_counter_overflow, &profile_method, 1.1302 - &profile_method_continue); 1.1303 + generate_counter_incr(&invocation_counter_overflow, 1.1304 + &profile_method, 1.1305 + &profile_method_continue); 1.1306 if (ProfileInterpreter) { 1.1307 __ bind(profile_method_continue); 1.1308 } 1.1309 @@ -1749,14 +1597,14 @@ 1.1310 } 1.1311 1.1312 // layout of frame after lock_method 1.1313 - // [ monitor entry ] <--- sp 1.1314 + // [ monitor entry ] <--- sp 1.1315 // ... 1.1316 - // [ monitor entry ] 1.1317 + // [ monitor entry ] 1.1318 // [ monitor block top ] ( the top monitor entry ) 1.1319 // [ byte code pointer ] (if native, bcp = 0) 1.1320 // [ constant pool cache ] 1.1321 // [ Method* ] 1.1322 - // [ locals offset ] 1.1323 + // [ locals offset ] 1.1324 // [ sender's sp ] 1.1325 // [ sender's fp ] 1.1326 // [ return address ] <--- fp 1.1327 @@ -1770,7 +1618,8 @@ 1.1328 1.1329 // start execution 1.1330 #ifdef ASSERT 1.1331 - { Label L; 1.1332 + { 1.1333 + Label L; 1.1334 __ ld(AT, FP, frame::interpreter_frame_monitor_block_top_offset * wordSize); 1.1335 __ beq(AT, SP, L); 1.1336 __ delayed()->nop(); 1.1337 @@ -1790,8 +1639,8 @@ 1.1338 if (ProfileInterpreter) { 1.1339 // We have decided to profile this method in the interpreter 1.1340 __ bind(profile_method); 1.1341 - __ call_VM(noreg, CAST_FROM_FN_PTR(address, 1.1342 - InterpreterRuntime::profile_method)); 1.1343 + __ call_VM(noreg, CAST_FROM_FN_PTR(address, 1.1344 + InterpreterRuntime::profile_method)); 1.1345 __ set_method_data_pointer_for_bcp(); 1.1346 __ get_method(Rmethod); 1.1347 __ b(profile_method_continue); 1.1348 @@ -1799,7 +1648,7 @@ 1.1349 } 1.1350 // Handle overflow of counter and compile method 1.1351 __ bind(invocation_counter_overflow); 1.1352 - generate_counter_overflow(&continue_after_compile); 1.1353 + generate_counter_overflow(&continue_after_compile); 1.1354 } 1.1355 1.1356 #endif 1.1357 @@ -1841,14 +1690,14 @@ 1.1358 // local variables follow incoming parameters immediately; i.e. 1.1359 // the return address is moved to the end of the locals). 1.1360 // 1.1361 -// [ monitor entry ] <--- sp 1.1362 +// [ monitor entry ] <--- sp 1.1363 // ... 1.1364 -// [ monitor entry ] 1.1365 +// [ monitor entry ] 1.1366 // [ monitor block top ] ( the top monitor entry ) 1.1367 // [ byte code pointer ] (if native, bcp = 0) 1.1368 // [ constant pool cache ] 1.1369 // [ Method* ] 1.1370 -// [ locals offset ] 1.1371 +// [ locals offset ] 1.1372 // [ sender's sp ] 1.1373 // [ sender's fp ] 1.1374 // [ return address ] <--- fp 1.1375 @@ -1864,48 +1713,51 @@ 1.1376 // determine code generation flags 1.1377 bool synchronized = false; 1.1378 address entry_point = NULL; 1.1379 - switch (kind) { 1.1380 - case Interpreter::zerolocals : break; 1.1381 - case Interpreter::zerolocals_synchronized: synchronized = true; break; 1.1382 - case Interpreter::native : 1.1383 - entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); 1.1384 - break; 1.1385 - case Interpreter::native_synchronized : 1.1386 - entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); 1.1387 - break; 1.1388 - case Interpreter::empty : 1.1389 - entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); 1.1390 - break; 1.1391 - case Interpreter::accessor : 1.1392 - entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); 1.1393 - break; 1.1394 - case Interpreter::abstract : 1.1395 - entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); 1.1396 - break; 1.1397 + switch (kind) { 1.1398 + case Interpreter::zerolocals : 1.1399 + break; 1.1400 + case Interpreter::zerolocals_synchronized: 1.1401 + synchronized = true; 1.1402 + break; 1.1403 + case Interpreter::native : 1.1404 + entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); 1.1405 + break; 1.1406 + case Interpreter::native_synchronized : 1.1407 + entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); 1.1408 + break; 1.1409 + case Interpreter::empty : 1.1410 + entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); 1.1411 + break; 1.1412 + case Interpreter::accessor : 1.1413 + entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); 1.1414 + break; 1.1415 + case Interpreter::abstract : 1.1416 + entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); 1.1417 + break; 1.1418 1.1419 - case Interpreter::java_lang_math_sin : // fall thru 1.1420 - case Interpreter::java_lang_math_cos : // fall thru 1.1421 - case Interpreter::java_lang_math_tan : // fall thru 1.1422 - case Interpreter::java_lang_math_log : // fall thru 1.1423 - case Interpreter::java_lang_math_log10 : // fall thru 1.1424 - case Interpreter::java_lang_math_pow : // fall thru 1.1425 - case Interpreter::java_lang_math_exp : break; 1.1426 - case Interpreter::java_lang_math_abs : // fall thru 1.1427 - case Interpreter::java_lang_math_sqrt : 1.1428 - entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; 1.1429 - case Interpreter::java_lang_ref_reference_get: 1.1430 - entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; 1.1431 - default: 1.1432 - fatal(err_msg("unexpected method kind: %d", kind)); 1.1433 - break; 1.1434 - } 1.1435 - if (entry_point) return entry_point; 1.1436 + case Interpreter::java_lang_math_sin : // fall thru 1.1437 + case Interpreter::java_lang_math_cos : // fall thru 1.1438 + case Interpreter::java_lang_math_tan : // fall thru 1.1439 + case Interpreter::java_lang_math_log : // fall thru 1.1440 + case Interpreter::java_lang_math_log10 : // fall thru 1.1441 + case Interpreter::java_lang_math_pow : // fall thru 1.1442 + case Interpreter::java_lang_math_exp : break; 1.1443 + case Interpreter::java_lang_math_abs : // fall thru 1.1444 + case Interpreter::java_lang_math_sqrt : 1.1445 + entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; 1.1446 + case Interpreter::java_lang_ref_reference_get: 1.1447 + entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; 1.1448 + default: 1.1449 + fatal(err_msg("unexpected method kind: %d", kind)); 1.1450 + break; 1.1451 + } 1.1452 + if (entry_point) return entry_point; 1.1453 1.1454 - return ((InterpreterGenerator*)this)->generate_normal_entry(synchronized); 1.1455 + return ((InterpreterGenerator*)this)->generate_normal_entry(synchronized); 1.1456 } 1.1457 1.1458 // These should never be compiled since the interpreter will prefer 1.1459 -// // the compiled version to the intrinsic version. 1.1460 +// the compiled version to the intrinsic version. 1.1461 bool AbstractInterpreter::can_be_compiled(methodHandle m) { 1.1462 switch (method_kind(m)) { 1.1463 case Interpreter::java_lang_math_sin : // fall thru 1.1464 @@ -1926,17 +1778,17 @@ 1.1465 // How much stack a method activation needs in words. 1.1466 int AbstractInterpreter::size_top_interpreter_activation(Method* method) { 1.1467 1.1468 - const int entry_size = frame::interpreter_frame_monitor_size(); 1.1469 + const int entry_size = frame::interpreter_frame_monitor_size(); 1.1470 1.1471 - // total overhead size: entry_size + (saved ebp thru expr stack bottom). 1.1472 - // be sure to change this if you add/subtract anything to/from the overhead area 1.1473 - const int overhead_size = -(frame::interpreter_frame_initial_sp_offset) + entry_size; 1.1474 + // total overhead size: entry_size + (saved ebp thru expr stack bottom). 1.1475 + // be sure to change this if you add/subtract anything to/from the overhead area 1.1476 + const int overhead_size = -(frame::interpreter_frame_initial_sp_offset) + entry_size; 1.1477 1.1478 - const int stub_code = 6; // see generate_call_stub 1.1479 - // return overhead_size + method->max_locals() + method->max_stack() + stub_code; 1.1480 - const int method_stack = (method->max_locals() + method->max_stack()) * 1.1481 - Interpreter::stackElementWords; 1.1482 - return overhead_size + method_stack + stub_code; 1.1483 + const int stub_code = 6; // see generate_call_stub 1.1484 + // return overhead_size + method->max_locals() + method->max_stack() + stub_code; 1.1485 + const int method_stack = (method->max_locals() + method->max_stack()) * 1.1486 + Interpreter::stackElementWords; 1.1487 + return overhead_size + method_stack + stub_code; 1.1488 } 1.1489 1.1490 void AbstractInterpreter::layout_activation(Method* method, 1.1491 @@ -1958,10 +1810,9 @@ 1.1492 // It is also guaranteed to be walkable even though it is in a skeletal state 1.1493 1.1494 // fixed size of an interpreter frame: 1.1495 - // int max_locals = method->max_locals(); 1.1496 - 1.1497 - int max_locals = method->max_locals() * Interpreter::stackElementWords; 1.1498 - int extra_locals = (method->max_locals() - method->size_of_parameters()) * Interpreter::stackElementWords; 1.1499 + 1.1500 + int max_locals = method->max_locals() * Interpreter::stackElementWords; 1.1501 + int extra_locals = (method->max_locals() - method->size_of_parameters()) * Interpreter::stackElementWords; 1.1502 1.1503 #ifdef ASSERT 1.1504 if (!EnableInvokeDynamic) { 1.1505 @@ -1984,26 +1835,24 @@ 1.1506 } 1.1507 #endif 1.1508 1.1509 - interpreter_frame->interpreter_frame_set_locals(locals); 1.1510 - BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin(); 1.1511 - BasicObjectLock* monbot = montop - moncount; 1.1512 - interpreter_frame->interpreter_frame_set_monitor_end(montop - moncount); 1.1513 + interpreter_frame->interpreter_frame_set_locals(locals); 1.1514 + BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin(); 1.1515 + BasicObjectLock* monbot = montop - moncount; 1.1516 + interpreter_frame->interpreter_frame_set_monitor_end(montop - moncount); 1.1517 1.1518 -//set last sp; 1.1519 - intptr_t* esp = (intptr_t*) monbot - tempcount*Interpreter::stackElementWords - 1.1520 - popframe_extra_args; 1.1521 - interpreter_frame->interpreter_frame_set_last_sp(esp); 1.1522 - // All frames but the initial interpreter frame we fill in have a 1.1523 - // value for sender_sp that allows walking the stack but isn't 1.1524 - // truly correct. Correct the value here. 1.1525 - // 1.1526 - // int extra_locals = method->max_locals() - method->size_of_parameters(); 1.1527 - if (extra_locals != 0 && 1.1528 - interpreter_frame->sender_sp() == interpreter_frame->interpreter_frame_sender_sp() ) { 1.1529 + //set last sp; 1.1530 + intptr_t* esp = (intptr_t*) monbot - tempcount*Interpreter::stackElementWords - 1.1531 + popframe_extra_args; 1.1532 + interpreter_frame->interpreter_frame_set_last_sp(esp); 1.1533 + // All frames but the initial interpreter frame we fill in have a 1.1534 + // value for sender_sp that allows walking the stack but isn't 1.1535 + // truly correct. Correct the value here. 1.1536 + // 1.1537 + if (extra_locals != 0 && 1.1538 + interpreter_frame->sender_sp() == interpreter_frame->interpreter_frame_sender_sp() ) { 1.1539 interpreter_frame->set_interpreter_frame_sender_sp(caller->sp() + extra_locals); 1.1540 } 1.1541 - *interpreter_frame->interpreter_frame_cache_addr() = 1.1542 - method->constants()->cache(); 1.1543 + *interpreter_frame->interpreter_frame_cache_addr() = method->constants()->cache(); 1.1544 } 1.1545 1.1546 //----------------------------------------------------------------------------- 1.1547 @@ -2013,10 +1862,9 @@ 1.1548 // Entry point in previous activation (i.e., if the caller was 1.1549 // interpreted) 1.1550 Interpreter::_rethrow_exception_entry = __ pc(); 1.1551 - 1.1552 // Restore sp to interpreter_frame_last_sp even though we are going 1.1553 // to empty the expression stack for the exception processing. 1.1554 - __ sd(R0,FP, frame::interpreter_frame_last_sp_offset * wordSize); 1.1555 + __ sd(R0,FP, frame::interpreter_frame_last_sp_offset * wordSize); 1.1556 1.1557 // V0: exception 1.1558 // V1: return address/pc that threw exception 1.1559 @@ -2026,7 +1874,7 @@ 1.1560 //add for compressedoops 1.1561 __ reinit_heapbase(); 1.1562 // Entry point for exceptions thrown within interpreter code 1.1563 - Interpreter::_throw_exception_entry = __ pc(); 1.1564 + Interpreter::_throw_exception_entry = __ pc(); 1.1565 // expression stack is undefined here 1.1566 // V0: exception 1.1567 // BCP: exception bcp 1.1568 @@ -2095,8 +1943,8 @@ 1.1569 1.1570 // Compute size of arguments for saving when returning to deoptimized caller 1.1571 __ get_method(A1); 1.1572 - __ verify_oop(A1); 1.1573 - __ ld(A1,A1,in_bytes(Method::const_offset())); 1.1574 + __ verify_oop(A1); 1.1575 + __ ld(A1,A1,in_bytes(Method::const_offset())); 1.1576 __ lhu(A1, A1, in_bytes(ConstMethod::size_of_parameters_offset())); 1.1577 __ shl(A1, Interpreter::logStackElementSize); 1.1578 __ restore_locals(); 1.1579 @@ -2110,8 +1958,6 @@ 1.1580 #endif 1.1581 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::popframe_preserve_args), A0, A1, A2); 1.1582 1.1583 - 1.1584 - 1.1585 __ remove_activation(vtos, T9, false, false, false); 1.1586 1.1587 // Inform deoptimization that it is responsible for restoring these arguments 1.1588 @@ -2121,7 +1967,6 @@ 1.1589 __ move(AT, JavaThread::popframe_force_deopt_reexecution_bit); 1.1590 __ sw(AT, thread, in_bytes(JavaThread::popframe_condition_offset())); 1.1591 // Continue in deoptimization handler 1.1592 - ///__ jmp(edx); 1.1593 __ jr(T9); 1.1594 __ delayed()->nop(); 1.1595 1.1596 @@ -2129,11 +1974,10 @@ 1.1597 } 1.1598 #endif /* !CORE */ 1.1599 1.1600 - 1.1601 - __ remove_activation(vtos, T3, 1.1602 - /* throw_monitor_exception */ false, 1.1603 - /* install_monitor_exception */ false, 1.1604 - /* notify_jvmdi */ false); 1.1605 + __ remove_activation(vtos, T3, 1.1606 + /* throw_monitor_exception */ false, 1.1607 + /* install_monitor_exception */ false, 1.1608 + /* notify_jvmdi */ false); 1.1609 1.1610 // Clear the popframe condition flag 1.1611 // Finish with popframe handling 1.1612 @@ -2147,18 +1991,13 @@ 1.1613 // maintain this kind of invariant all the time we call a small 1.1614 // fixup routine to move the mutated arguments onto the top of our 1.1615 // expression stack if necessary. 1.1616 - //why x86 write this , i think it is no use ,@jerome 1.1617 - //__ movl(eax, esp); 1.1618 - //__ movl(ebx, Address(ebp, frame::interpreter_frame_last_sp_offset * wordSize)); 1.1619 __ move(T8, SP); 1.1620 __ ld(A2, FP, frame::interpreter_frame_last_sp_offset * wordSize); 1.1621 #ifndef OPT_THREAD 1.1622 __ get_thread(thread); 1.1623 #endif 1.1624 // PC must point into interpreter here 1.1625 - //__ set_last_Java_frame(ecx, noreg, ebp, __ pc()); 1.1626 __ set_last_Java_frame(thread, noreg, FP, __ pc()); 1.1627 - // __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), ecx, eax, ebx); 1.1628 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::popframe_move_outgoing_args), thread, T8, A2); 1.1629 __ reset_last_Java_frame(thread, true, true); 1.1630 // Restore the last_sp and null it out 1.1631 @@ -2167,7 +2006,7 @@ 1.1632 1.1633 1.1634 1.1635 - __ move(AT, JavaThread::popframe_inactive); 1.1636 + __ move(AT, JavaThread::popframe_inactive); 1.1637 __ sw(AT, thread, in_bytes(JavaThread::popframe_condition_offset())); 1.1638 1.1639 // Finish with popframe handling 1.1640 @@ -2181,13 +2020,11 @@ 1.1641 } 1.1642 #endif // !CORE 1.1643 // Clear the popframe condition flag 1.1644 - // __ get_thread(ecx); 1.1645 - // __ movl(Address(ecx, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive); 1.1646 #ifndef OPT_THREAD 1.1647 __ get_thread(thread); 1.1648 -#endif 1.1649 - __ move(AT, JavaThread::popframe_inactive); 1.1650 - __ sw(AT, thread, in_bytes(JavaThread::popframe_condition_offset())); 1.1651 +#endif 1.1652 + __ move(AT, JavaThread::popframe_inactive); 1.1653 + __ sw(AT, thread, in_bytes(JavaThread::popframe_condition_offset())); 1.1654 __ dispatch_next(vtos); 1.1655 // end of PopFrame support 1.1656 1.1657 @@ -2210,17 +2047,17 @@ 1.1658 // compute continuation point - the continuation point expects 1.1659 // the following registers set up: 1.1660 // 1.1661 - // T0: exception eax 1.1662 - // T1: return address/pc that threw exception edx 1.1663 - // SP: expression stack of caller esp 1.1664 - // FP: ebp of caller ebp 1.1665 + // T0: exception eax 1.1666 + // T1: return address/pc that threw exception edx 1.1667 + // SP: expression stack of caller esp 1.1668 + // FP: ebp of caller ebp 1.1669 __ daddi(SP, SP, (-2) * wordSize); 1.1670 - __ sd(T0, SP, wordSize); // save exception 1.1671 + __ sd(T0, SP, wordSize); // save exception 1.1672 __ sd(T3, SP, 0); // save return address 1.1673 __ move(A1, T3); 1.1674 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, A1); 1.1675 __ move(T9, V0); // save exception handler 1.1676 - __ ld(V0, SP, wordSize); // restore exception 1.1677 + __ ld(V0, SP, wordSize); // restore exception 1.1678 __ ld(V1, SP, 0); // restore return address 1.1679 __ daddi(SP, SP, 2 * wordSize); 1.1680 1.1681 @@ -2241,32 +2078,25 @@ 1.1682 __ empty_FPU_stack(); 1.1683 __ load_earlyret_value(state); 1.1684 1.1685 -//__ get_thread(ecx); 1.1686 #ifndef OPT_THREAD 1.1687 __ get_thread(TREG); 1.1688 #endif 1.1689 -// __ movl(TREG, Address(TREG, JavaThread::jvmti_thread_state_offset())); 1.1690 __ ld_ptr(T9, TREG, in_bytes(JavaThread::jvmti_thread_state_offset())); 1.1691 //const Address cond_addr(ecx, JvmtiThreadState::earlyret_state_offset()); 1.1692 const Address cond_addr(T9, in_bytes(JvmtiThreadState::earlyret_state_offset())); 1.1693 // Clear the earlyret state 1.1694 - // __ movl(cond_addr, JvmtiThreadState::earlyret_inactive); 1.1695 __ move(AT,JvmtiThreadState::earlyret_inactive); 1.1696 - __ sw(AT,cond_addr); 1.1697 + __ sw(AT,cond_addr); 1.1698 __ sync(); 1.1699 - //__ remove_activation(state, esi, 1.1700 1.1701 - 1.1702 1.1703 __ remove_activation(state, T0, 1.1704 - false, /* throw_monitor_exception */ 1.1705 - false, /* install_monitor_exception */ 1.1706 - true); /* notify_jvmdi */ 1.1707 + false, /* throw_monitor_exception */ 1.1708 + false, /* install_monitor_exception */ 1.1709 + true); /* notify_jvmdi */ 1.1710 __ sync(); 1.1711 - // __ jmp(esi); 1.1712 - //__ jmp(T0); 1.1713 - __ jr(T0); 1.1714 - __ delayed()->nop(); 1.1715 + __ jr(T0); 1.1716 + __ delayed()->nop(); 1.1717 return entry; 1.1718 } // end of ForceEarlyReturn support 1.1719 1.1720 @@ -2290,8 +2120,10 @@ 1.1721 dep = __ pc(); __ push(dtos); __ b(L); __ delayed()->nop(); 1.1722 lep = __ pc(); __ push(ltos); __ b(L); __ delayed()->nop(); 1.1723 aep =__ pc(); __ push(atos); __ b(L); __ delayed()->nop(); 1.1724 - bep = cep = sep = iep = __ pc(); __ push(itos); 1.1725 - vep = __ pc(); __ bind(L); // fall through 1.1726 + bep = cep = sep = 1.1727 + iep = __ pc(); __ push(itos); 1.1728 + vep = __ pc(); 1.1729 + __ bind(L); 1.1730 generate_and_dispatch(t); 1.1731 } 1.1732 1.1733 @@ -2324,15 +2156,6 @@ 1.1734 // when the expression stack have no more than 2 data, error occur. 1.1735 __ ld(A2, SP, 0); 1.1736 __ ld(A3, SP, 1 * wordSize); 1.1737 - { 1.1738 - //aoqi_test 1.1739 - /* 1.1740 - __ pushad(); 1.1741 - __ li(A0, (long)0); 1.1742 - __ call(CAST_FROM_FN_PTR(address, SharedRuntime::func_debug),relocInfo::runtime_call_type); 1.1743 - __ popad(); 1.1744 -*/ 1.1745 - } 1.1746 1.1747 // pass arguments & call tracer 1.1748 __ call_VM(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::trace_bytecode), RA, A2, A3); 1.1749 @@ -2356,26 +2179,26 @@ 1.1750 } 1.1751 1.1752 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) { 1.1753 - __ li(T8, (long)&BytecodeHistogram::_counters[t->bytecode()]); 1.1754 - __ lw(AT, T8, 0); 1.1755 - __ daddi(AT, AT, 1); 1.1756 - __ sw(AT, T8, 0); 1.1757 + __ li(T8, (long)&BytecodeHistogram::_counters[t->bytecode()]); 1.1758 + __ lw(AT, T8, 0); 1.1759 + __ daddi(AT, AT, 1); 1.1760 + __ sw(AT, T8, 0); 1.1761 } 1.1762 1.1763 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) { 1.1764 - __ li(T8, (long)&BytecodePairHistogram::_index); 1.1765 - __ lw(T9, T8, 0); 1.1766 - __ dsrl(T9, T9, BytecodePairHistogram::log2_number_of_codes); 1.1767 - __ li(T8, ((long)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes); 1.1768 - __ orr(T9, T9, T8); 1.1769 - __ li(T8, (long)&BytecodePairHistogram::_index); 1.1770 - __ sw(T9, T8, 0); 1.1771 - __ dsll(T9, T9, 2); 1.1772 - __ li(T8, (long)BytecodePairHistogram::_counters); 1.1773 - __ dadd(T8, T8, T9); 1.1774 - __ lw(AT, T8, 0); 1.1775 - __ daddi(AT, AT, 1); 1.1776 - __ sw(AT, T8, 0); 1.1777 + __ li(T8, (long)&BytecodePairHistogram::_index); 1.1778 + __ lw(T9, T8, 0); 1.1779 + __ dsrl(T9, T9, BytecodePairHistogram::log2_number_of_codes); 1.1780 + __ li(T8, ((long)t->bytecode()) << BytecodePairHistogram::log2_number_of_codes); 1.1781 + __ orr(T9, T9, T8); 1.1782 + __ li(T8, (long)&BytecodePairHistogram::_index); 1.1783 + __ sw(T9, T8, 0); 1.1784 + __ dsll(T9, T9, 2); 1.1785 + __ li(T8, (long)BytecodePairHistogram::_counters); 1.1786 + __ dadd(T8, T8, T9); 1.1787 + __ lw(AT, T8, 0); 1.1788 + __ daddi(AT, AT, 1); 1.1789 + __ sw(AT, T8, 0); 1.1790 } 1.1791 1.1792 1.1793 @@ -2384,25 +2207,25 @@ 1.1794 // The run-time runtime saves the right registers, depending on 1.1795 // the tosca in-state for the given template. 1.1796 1.1797 - address entry = Interpreter::trace_code(t->tos_in()); 1.1798 - assert(entry != NULL, "entry must have been generated"); 1.1799 - __ call(entry, relocInfo::none); 1.1800 - __ delayed()->nop(); 1.1801 - //add for compressedoops 1.1802 - __ reinit_heapbase(); 1.1803 + address entry = Interpreter::trace_code(t->tos_in()); 1.1804 + assert(entry != NULL, "entry must have been generated"); 1.1805 + __ call(entry, relocInfo::none); 1.1806 + __ delayed()->nop(); 1.1807 + //add for compressedoops 1.1808 + __ reinit_heapbase(); 1.1809 } 1.1810 1.1811 1.1812 void TemplateInterpreterGenerator::stop_interpreter_at() { 1.1813 Label L; 1.1814 - __ li(T8, long(&BytecodeCounter::_counter_value)); 1.1815 - __ lw(T8, T8, 0); 1.1816 - __ move(AT, StopInterpreterAt); 1.1817 - __ bne(T8, AT, L); 1.1818 - __ delayed()->nop(); 1.1819 - __ call(CAST_FROM_FN_PTR(address, os::breakpoint), relocInfo::runtime_call_type); 1.1820 - __ delayed()->nop(); 1.1821 - __ bind(L); 1.1822 + __ li(T8, long(&BytecodeCounter::_counter_value)); 1.1823 + __ lw(T8, T8, 0); 1.1824 + __ move(AT, StopInterpreterAt); 1.1825 + __ bne(T8, AT, L); 1.1826 + __ delayed()->nop(); 1.1827 + __ call(CAST_FROM_FN_PTR(address, os::breakpoint), relocInfo::runtime_call_type); 1.1828 + __ delayed()->nop(); 1.1829 + __ bind(L); 1.1830 } 1.1831 #endif // !PRODUCT 1.1832 #endif // ! CC_INTERP