1.1 --- a/src/cpu/mips/vm/templateInterpreter_mips_64.cpp Thu Feb 21 10:14:02 2019 +0800 1.2 +++ b/src/cpu/mips/vm/templateInterpreter_mips_64.cpp Tue Mar 05 17:00:17 2019 +0800 1.3 @@ -1,6 +1,6 @@ 1.4 /* 1.5 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 - * Copyright (c) 2015, 2018, Loongson Technology. All rights reserved. 1.7 + * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. 1.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.9 * 1.10 * This code is free software; you can redistribute it and/or modify it 1.11 @@ -175,7 +175,7 @@ 1.12 1.13 // Restore stack bottom in case i2c adjusted stack 1.14 __ ld(SP, Address(FP, frame::interpreter_frame_last_sp_offset * wordSize)); 1.15 - // and NULL it as marker that esp is now tos until next java call 1.16 + // and NULL it as marker that sp is now tos until next java call 1.17 __ sd(R0, FP, frame::interpreter_frame_last_sp_offset * wordSize); 1.18 1.19 __ restore_bcp(); 1.20 @@ -410,7 +410,7 @@ 1.21 __ call_VM(NOREG, CAST_FROM_FN_PTR(address, 1.22 InterpreterRuntime::frequency_counter_overflow), R0); 1.23 __ ld(Rmethod, FP, method_offset); 1.24 - // Preserve invariant that esi/edi contain bcp/locals of sender frame 1.25 + // Preserve invariant that S0/S7 contain bcp/locals of sender frame 1.26 __ b_far(*do_continue); 1.27 __ delayed()->nop(); 1.28 } 1.29 @@ -424,11 +424,9 @@ 1.30 // too. 1.31 // 1.32 // Args: 1.33 -// rdx: number of additional locals this frame needs (what we must check) 1.34 -// rbx: Method* 1.35 +// T2: number of additional locals this frame needs (what we must check) 1.36 +// T0: Method* 1.37 // 1.38 -// Kills: 1.39 -// rax 1.40 void InterpreterGenerator::generate_stack_overflow_check(void) { 1.41 // see if we've got enough room on the stack for locals plus overhead. 1.42 // the expression stack grows down incrementally, so the normal guard 1.43 @@ -443,10 +441,9 @@ 1.44 // generate_method_entry) so the guard should work for them too. 1.45 // 1.46 1.47 - // monitor entry size: see picture of stack set (generate_method_entry) and frame_i486.hpp 1.48 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize; 1.49 1.50 - // total overhead size: entry_size + (saved ebp thru expr stack bottom). 1.51 + // total overhead size: entry_size + (saved fp thru expr stack bottom). 1.52 // be sure to change this if you add/subtract anything to/from the overhead area 1.53 const int overhead_size = -(frame::interpreter_frame_initial_sp_offset*wordSize) 1.54 + entry_size; 1.55 @@ -661,25 +658,17 @@ 1.56 __ dsll(T3, T3, exact_log2(in_words(ConstantPoolCacheEntry::size()))); 1.57 __ ld(T2, T2, ConstantPool::cache_offset_in_bytes()); 1.58 1.59 - // T0: local 0 eax 1.60 - // Rmethod: method ebx 1.61 - // V0: receiver - do not destroy since it is needed for slow path! ecx 1.62 - // ecx: scratch use which register instead ? 1.63 + // T0: local 0 1.64 + // Rmethod: method 1.65 + // V0: receiver - do not destroy since it is needed for slow path! 1.66 // T1: scratch use which register instead ? 1.67 - // T3: constant pool cache index edx 1.68 - // T2: constant pool cache edi 1.69 - // esi: send's sp 1.70 + // T3: constant pool cache index 1.71 + // T2: constant pool cache 1.72 // Rsender: send's sp 1.73 // check if getfield has been resolved and read constant pool cache entry 1.74 // check the validity of the cache entry by testing whether _indices field 1.75 // contains Bytecode::_getfield in b1 byte. 1.76 assert(in_words(ConstantPoolCacheEntry::size()) == 4, "adjust shift below"); 1.77 - // __ movl(esi, 1.78 - // Address(edi, 1.79 - // edx, 1.80 - // Address::times_4, ConstantPoolCache::base_offset() 1.81 - // + ConstantPoolCacheEntry::indices_offset())); 1.82 - 1.83 1.84 __ dsll(T8, T3, Address::times_8); 1.85 __ move(T1, in_bytes(ConstantPoolCache::base_offset() 1.86 @@ -706,13 +695,12 @@ 1.87 __ lw(T3, T1, 0); 1.88 1.89 Label notByte, notBool, notShort, notChar, notObj; 1.90 - // const Address field_address (eax, esi, Address::times_1); 1.91 1.92 // Need to differentiate between igetfield, agetfield, bgetfield etc. 1.93 // because they are different sizes. 1.94 // Use the type from the constant pool cache 1.95 __ srl(T3, T3, ConstantPoolCacheEntry::tos_state_shift); 1.96 - // Make sure we don't need to mask edx for tosBits after the above shift 1.97 + // Make sure we don't need to mask T3 for tosBits after the above shift 1.98 ConstantPoolCacheEntry::verify_tos_state_shift(); 1.99 // btos = 0 1.100 __ bne(T3, R0, notByte); 1.101 @@ -817,14 +805,9 @@ 1.102 // 1.103 // This code is based on generate_accessor_enty. 1.104 // 1.105 - // rbx: Method* (Rmethod) 1.106 + // Rmethod: Method* 1.107 1.108 - // r13: senderSP must preserve for slow path, set SP to it on fast path (Rsender) 1.109 - 1.110 - // rax: V0 1.111 - // rbx: Rmethod 1.112 - // r13: Rsender 1.113 - // rdi: T9 1.114 + // Rsender: senderSP must preserve for slow path, set SP to it on fast path (Rsender) 1.115 1.116 address entry = __ pc(); 1.117 1.118 @@ -925,7 +908,7 @@ 1.119 // [ result type info ] 1.120 // [ argument word n-1 ] <--- T0 1.121 // ... 1.122 - // [ argument word 0 ] <--- LVP 1.123 + // [ argument word 0 ] <--- LVP 1.124 1.125 1.126 #ifndef CORE 1.127 @@ -939,7 +922,7 @@ 1.128 // [ monitor block top ] <--- sp ( the top monitor entry ) 1.129 // [ byte code pointer (0) ] (if native, bcp = 0) 1.130 // [ constant pool cache ] 1.131 - // [ Method* ] 1.132 + // [ Method* ] 1.133 // [ locals offset ] 1.134 // [ sender's sp ] 1.135 // [ sender's fp ] 1.136 @@ -1031,8 +1014,8 @@ 1.137 // [ monitor block top ] ( the top monitor entry ) 1.138 // [ byte code pointer (0) ] (if native, bcp = 0) 1.139 // [ constant pool cache ] 1.140 - // [ Method* ] 1.141 - // [ locals offset ] 1.142 + // [ Method* ] 1.143 + // [ locals offset ] 1.144 // [ sender's sp ] 1.145 // [ sender's fp ] 1.146 // [ return address ] <--- fp 1.147 @@ -1086,7 +1069,7 @@ 1.148 __ move(AT, -(StackAlignmentInBytes)); 1.149 __ andr(SP, SP, AT); 1.150 __ move(AT, SP); 1.151 - // [ ] <--- sp 1.152 + // [ ] <--- sp 1.153 // ... (size of parameters - 8 ) 1.154 // [ monitor entry ] 1.155 // ... 1.156 @@ -1094,7 +1077,7 @@ 1.157 // [ monitor block top ] ( the top monitor entry ) 1.158 // [ byte code pointer (0) ] (if native, bcp = 0) 1.159 // [ constant pool cache ] 1.160 - // [ Method* ] 1.161 + // [ Method* ] 1.162 // [ locals offset ] 1.163 // [ sender's sp ] 1.164 // [ sender's fp ] 1.165 @@ -1129,16 +1112,16 @@ 1.166 1.167 __ jalr(T9); 1.168 __ delayed()->nop(); 1.169 - __ get_method(method); // slow path call blows EBX on DevStudio 5.0 1.170 + __ get_method(method); 1.171 1.172 - /* 1.173 - if native function is static, and its second parameter has type length of double word, 1.174 - and first parameter has type length of word, we have to reserve one word 1.175 - for the first parameter, according to mips o32 abi. 1.176 - if native function is not static, and its third parameter has type length of double word, 1.177 - and second parameter has type length of word, we have to reserve one word for the second 1.178 - parameter. 1.179 - */ 1.180 + // 1.181 + // if native function is static, and its second parameter has type length of double word, 1.182 + // and first parameter has type length of word, we have to reserve one word 1.183 + // for the first parameter, according to mips o32 abi. 1.184 + // if native function is not static, and its third parameter has type length of double word, 1.185 + // and second parameter has type length of word, we have to reserve one word for the second 1.186 + // parameter. 1.187 + // 1.188 1.189 1.190 // result handler is in V0 1.191 @@ -1182,7 +1165,7 @@ 1.192 // [ monitor block top ] ( the top monitor entry ) | 1.193 // [ byte code pointer (0) ] (if native, bcp = 0) | 1.194 // [ constant pool cache ] | 1.195 - // [ Method* ] | 1.196 + // [ Method* ] | 1.197 // [ locals offset ] | 1.198 // [ sender's sp ] | 1.199 // [ sender's fp ] | 1.200 @@ -1205,12 +1188,6 @@ 1.201 __ ld(T9, method, in_bytes(Method::native_function_offset())); 1.202 __ bind(L); 1.203 } 1.204 - /* 1.205 - __ pushad(); 1.206 - __ move(A0, T9); 1.207 - __ call(CAST_FROM_FN_PTR(address, SharedRuntime::func_debug),relocInfo::runtime_call_type); 1.208 - __ popad(); 1.209 - */ 1.210 1.211 // pass JNIEnv 1.212 // native function in T9 1.213 @@ -1229,7 +1206,7 @@ 1.214 // [ monitor block top ] ( the top monitor entry ) | 1.215 // [ byte code pointer (0) ] (if native, bcp = 0) | 1.216 // [ constant pool cache ] | 1.217 - // [ Method* ] | 1.218 + // [ Method* ] | 1.219 // [ locals offset ] | 1.220 // [ sender's sp ] | 1.221 // [ sender's fp ] | 1.222 @@ -1292,7 +1269,7 @@ 1.223 1.224 // Don't use call_VM as it will see a possible pending exception and forward it 1.225 // and never return here preventing us from clearing _last_native_pc down below. 1.226 - // Also can't use call_VM_leaf either as it will check to see if esi & edi are 1.227 + // Also can't use call_VM_leaf either as it will check to see if BCP & LVP are 1.228 // preserved and correspond to the bcp/locals pointers. So we do a runtime call 1.229 // by hand. 1.230 // 1.231 @@ -1306,9 +1283,8 @@ 1.232 __ delayed()->nop(); 1.233 __ bind(L); 1.234 __ move(A0, thread); 1.235 - __ call(CAST_FROM_FN_PTR(address, 1.236 - JavaThread::check_special_condition_for_native_trans), 1.237 - relocInfo::runtime_call_type); 1.238 + __ call(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans), 1.239 + relocInfo::runtime_call_type); 1.240 __ delayed()->nop(); 1.241 1.242 #ifndef OPT_THREAD 1.243 @@ -1365,8 +1341,8 @@ 1.244 __ reinit_heapbase(); 1.245 __ bind(no_reguard); 1.246 } 1.247 - // restore esi to have legal interpreter frame, 1.248 - // i.e., bci == 0 <=> esi == code_base() 1.249 + // restore BCP to have legal interpreter frame, 1.250 + // i.e., bci == 0 <=> BCP == code_base() 1.251 // Can't call_VM until bcp is within reasonable. 1.252 __ get_method(method); // method is junk from thread_in_native to now. 1.253 __ verify_oop(method); 1.254 @@ -1381,9 +1357,10 @@ 1.255 // Note: At some point we may want to unify this with the code used in 1.256 // call_VM_base(); 1.257 // i.e., we should use the StubRoutines::forward_exception code. For now this 1.258 - // doesn't work here because the esp is not correctly set at this point. 1.259 - __ MacroAssembler::call_VM(noreg, CAST_FROM_FN_PTR(address, 1.260 - InterpreterRuntime::throw_pending_exception)); 1.261 + // doesn't work here because the sp is not correctly set at this point. 1.262 + __ MacroAssembler::call_VM(noreg, 1.263 + CAST_FROM_FN_PTR(address, 1.264 + InterpreterRuntime::throw_pending_exception)); 1.265 __ should_not_reach_here(); 1.266 __ bind(L); 1.267 } 1.268 @@ -1525,9 +1502,9 @@ 1.269 } 1.270 1.271 // 1.272 - // [ local var m-1 ] <--- sp 1.273 + // [ local var m-1 ] <--- sp 1.274 // ... 1.275 - // [ local var 0 ] 1.276 + // [ local var 0 ] 1.277 // [ argument word n-1 ] <--- T0? 1.278 // ... 1.279 // [ argument word 0 ] <--- LVP 1.280 @@ -1542,8 +1519,8 @@ 1.281 // [ monitor block top ] <--- sp ( the top monitor entry ) 1.282 // [ byte code pointer ] (if native, bcp = 0) 1.283 // [ constant pool cache ] 1.284 - // [ Method* ] 1.285 - // [ locals offset ] 1.286 + // [ Method* ] 1.287 + // [ locals offset ] 1.288 // [ sender's sp ] 1.289 // [ sender's fp ] <--- fp 1.290 // [ return address ] 1.291 @@ -1647,14 +1624,14 @@ 1.292 } 1.293 1.294 // layout of frame after lock_method 1.295 - // [ monitor entry ] <--- sp 1.296 + // [ monitor entry ] <--- sp 1.297 // ... 1.298 - // [ monitor entry ] 1.299 + // [ monitor entry ] 1.300 // [ monitor block top ] ( the top monitor entry ) 1.301 // [ byte code pointer ] (if native, bcp = 0) 1.302 // [ constant pool cache ] 1.303 - // [ Method* ] 1.304 - // [ locals offset ] 1.305 + // [ Method* ] 1.306 + // [ locals offset ] 1.307 // [ sender's sp ] 1.308 // [ sender's fp ] 1.309 // [ return address ] <--- fp 1.310 @@ -1724,28 +1701,28 @@ 1.311 // 1.312 // Stack layout immediately at entry 1.313 // 1.314 -// [ parameter n-1 ] <--- sp 1.315 +// [ parameter n-1 ] <--- sp 1.316 // ... 1.317 -// [ parameter 0 ] 1.318 -// [ expression stack ] (caller's java expression stack) 1.319 +// [ parameter 0 ] 1.320 +// [ expression stack ] (caller's java expression stack) 1.321 1.322 // Assuming that we don't go to one of the trivial specialized entries 1.323 // the stack will look like below when we are ready to execute the 1.324 // first bytecode (or call the native routine). The register usage 1.325 // will be as the template based interpreter expects (see 1.326 -// interpreter_amd64.hpp). 1.327 +// interpreter_mips_64.hpp). 1.328 // 1.329 // local variables follow incoming parameters immediately; i.e. 1.330 // the return address is moved to the end of the locals). 1.331 // 1.332 -// [ monitor entry ] <--- sp 1.333 +// [ monitor entry ] <--- sp 1.334 // ... 1.335 -// [ monitor entry ] 1.336 +// [ monitor entry ] 1.337 // [ monitor block top ] ( the top monitor entry ) 1.338 // [ byte code pointer ] (if native, bcp = 0) 1.339 // [ constant pool cache ] 1.340 -// [ Method* ] 1.341 -// [ locals offset ] 1.342 +// [ Method* ] 1.343 +// [ locals offset ] 1.344 // [ sender's sp ] 1.345 // [ sender's fp ] 1.346 // [ return address ] <--- fp 1.347 @@ -1828,7 +1805,7 @@ 1.348 1.349 const int entry_size = frame::interpreter_frame_monitor_size(); 1.350 1.351 - // total overhead size: entry_size + (saved ebp thru expr stack bottom). 1.352 + // total overhead size: entry_size + (saved fp thru expr stack bottom). 1.353 // be sure to change this if you add/subtract anything to/from the overhead area 1.354 const int overhead_size = -(frame::interpreter_frame_initial_sp_offset) + entry_size; 1.355 1.356 @@ -1889,9 +1866,9 @@ 1.357 interpreter_frame->interpreter_frame_set_monitor_end(montop - moncount); 1.358 1.359 //set last sp; 1.360 - intptr_t* esp = (intptr_t*) monbot - tempcount*Interpreter::stackElementWords - 1.361 + intptr_t* sp = (intptr_t*) monbot - tempcount*Interpreter::stackElementWords - 1.362 popframe_extra_args; 1.363 - interpreter_frame->interpreter_frame_set_last_sp(esp); 1.364 + interpreter_frame->interpreter_frame_set_last_sp(sp); 1.365 // All frames but the initial interpreter frame we fill in have a 1.366 // value for sender_sp that allows walking the stack but isn't 1.367 // truly correct. Correct the value here. 1.368 @@ -1916,7 +1893,7 @@ 1.369 1.370 // V0: exception 1.371 // V1: return address/pc that threw exception 1.372 - __ restore_bcp(); // esi points to call/send 1.373 + __ restore_bcp(); // BCP points to call/send 1.374 __ restore_locals(); 1.375 1.376 //add for compressedoops 1.377 @@ -2091,14 +2068,14 @@ 1.378 __ get_vm_result(T0, thread); 1.379 __ verify_oop(T0); 1.380 1.381 - // Inbetween activations - previous activation type unknown yet 1.382 + // In between activations - previous activation type unknown yet 1.383 // compute continuation point - the continuation point expects 1.384 // the following registers set up: 1.385 // 1.386 - // T0: exception eax 1.387 - // T1: return address/pc that threw exception edx 1.388 - // SP: expression stack of caller esp 1.389 - // FP: ebp of caller ebp 1.390 + // T0: exception 1.391 + // T1: return address/pc that threw exception 1.392 + // SP: expression stack of caller 1.393 + // FP: fp of caller 1.394 __ daddi(SP, SP, (-2) * wordSize); 1.395 __ sd(T0, SP, wordSize); // save exception 1.396 __ sd(T3, SP, 0); // save return address