src/cpu/mips/vm/c1_Runtime1_mips.cpp

Thu, 05 Sep 2019 13:10:50 +0800

author
huangjia
date
Thu, 05 Sep 2019 13:10:50 +0800
changeset 9645
ac996ba07f9d
parent 9459
814e9e335067
permissions
-rw-r--r--

#9815 Backport of #9802 Code cleanup
Reviewed-by: aoqi

aoqi@1 1 /*
aoqi@1 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@9459 3 * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved.
aoqi@1 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@1 5 *
aoqi@1 6 * This code is free software; you can redistribute it and/or modify it
aoqi@1 7 * under the terms of the GNU General Public License version 2 only, as
aoqi@1 8 * published by the Free Software Foundation.
aoqi@1 9 *
aoqi@1 10 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@1 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@1 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@1 13 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@1 14 * accompanied this code).
aoqi@1 15 *
aoqi@1 16 * You should have received a copy of the GNU General Public License version
aoqi@1 17 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@1 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@1 19 *
aoqi@1 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@1 21 * or visit www.oracle.com if you need additional information or have any
aoqi@1 22 * questions.
aoqi@1 23 *
aoqi@1 24 */
aoqi@1 25
aoqi@1 26 #include "precompiled.hpp"
aoqi@1 27 #include "asm/assembler.hpp"
aoqi@1 28 #include "c1/c1_Defs.hpp"
aoqi@1 29 #include "c1/c1_MacroAssembler.hpp"
aoqi@1 30 #include "c1/c1_Runtime1.hpp"
aoqi@1 31 #include "interpreter/interpreter.hpp"
aoqi@1 32 #include "nativeInst_mips.hpp"
aoqi@1 33 #include "oops/compiledICHolder.hpp"
aoqi@1 34 #include "oops/oop.inline.hpp"
aoqi@1 35 #include "prims/jvmtiExport.hpp"
aoqi@1 36 #include "register_mips.hpp"
aoqi@1 37 #include "runtime/sharedRuntime.hpp"
aoqi@1 38 #include "runtime/signature.hpp"
aoqi@1 39 #include "runtime/vframeArray.hpp"
aoqi@6880 40 #include "utilities/macros.hpp"
aoqi@1 41 #include "vmreg_mips.inline.hpp"
aoqi@6880 42 #if INCLUDE_ALL_GCS
aoqi@6880 43 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
aoqi@6880 44 #endif
aoqi@1 45
aoqi@1 46
aoqi@1 47 // Implementation of StubAssembler
aoqi@1 48 // this method will preserve the stack space for arguments as indicated by args_size
aoqi@1 49 // for stack alignment consideration, you cannot call this with argument in stack.
aoqi@1 50 // if you need >3 arguments, you must implement this method yourself.
fujie@9153 51 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
aoqi@6880 52 // setup registers
aoqi@6880 53 const Register thread = TREG; // is callee-saved register (Visual C++ calling conventions)
fujie@9153 54 assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
fujie@9153 55 assert(oop_result1 != thread && metadata_result != thread, "registers must be different");
aoqi@6880 56 assert(args_size >= 0, "illegal args_size");
fujie@9153 57 bool align_stack = false;
fujie@9153 58 #ifdef _LP64
fujie@9153 59 // At a method handle call, the stack may not be properly aligned
fujie@9153 60 // when returning with an exception.
fujie@9153 61 align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id);
fujie@9153 62 #endif
aoqi@1 63
aoqi@6880 64 set_num_rt_args(1 + args_size);
aoqi@1 65
aoqi@1 66
aoqi@6880 67 // push java thread (becomes first argument of C function)
aoqi@6880 68 get_thread(thread);
aoqi@6880 69 move(A0, thread);
aoqi@1 70
fujie@9153 71 if(!align_stack) {
fujie@9153 72 set_last_Java_frame(thread, NOREG, FP, NULL);
fujie@9153 73 } else {
fujie@9153 74 address the_pc = pc();
fujie@9153 75 set_last_Java_frame(thread, NOREG, FP, the_pc);
fujie@9153 76 move(AT, -(StackAlignmentInBytes));
fujie@9153 77 andr(SP, SP, AT);
fujie@9153 78 }
aoqi@1 79
aoqi@6880 80 relocate(relocInfo::internal_pc_type);
aoqi@6880 81 {
aoqi@1 82 #ifndef _LP64
aoqi@6880 83 int save_pc = (int)pc() + 12 + NativeCall::return_address_offset;
aoqi@6880 84 lui(AT, Assembler::split_high(save_pc));
aoqi@6880 85 addiu(AT, AT, Assembler::split_low(save_pc));
aoqi@1 86 #else
aoqi@6880 87 uintptr_t save_pc = (uintptr_t)pc() + NativeMovConstReg::instruction_size + 1 * BytesPerInstWord + NativeCall::return_address_offset_long;
aoqi@6880 88 li48(AT, save_pc);
aoqi@1 89 #endif
aoqi@6880 90 }
aoqi@6880 91 st_ptr(AT, thread, in_bytes(JavaThread::last_Java_pc_offset()));
aoqi@1 92
aoqi@6880 93 // do the call
aoqi@6880 94 #ifndef _LP64
aoqi@6880 95 lui(T9, Assembler::split_high((int)entry));
aoqi@6880 96 addiu(T9, T9, Assembler::split_low((int)entry));
aoqi@6880 97 #else
aoqi@6880 98 li48(T9, (intptr_t)entry);
aoqi@1 99 #endif
aoqi@6880 100 jalr(T9);
aoqi@6880 101 delayed()->nop();
fujie@9161 102
fujie@9161 103 int call_offset = offset();
aoqi@6880 104
aoqi@6880 105 // verify callee-saved register
aoqi@6880 106 #ifdef ASSERT
aoqi@6880 107 guarantee(thread != V0, "change this code");
aoqi@6880 108 push(V0);
aoqi@6880 109 {
aoqi@6880 110 Label L;
aoqi@6880 111 get_thread(V0);
aoqi@6880 112 beq(thread, V0, L);
aoqi@6880 113 delayed()->nop();
aoqi@6880 114 int3();
aoqi@9459 115 stop("StubAssembler::call_RT: TREG not callee saved?");
aoqi@6880 116 bind(L);
aoqi@6880 117 }
aoqi@6880 118 super_pop(V0);
aoqi@1 119 #endif
aoqi@6880 120 // discard thread and arguments
aoqi@9228 121 ld_ptr(SP, thread, in_bytes(JavaThread::last_Java_sp_offset()));
fujie@9171 122 reset_last_Java_frame(thread, true);
aoqi@6880 123 // check for pending exceptions
aoqi@6880 124 {
aoqi@6880 125 Label L;
aoqi@6880 126 ld_ptr(AT, thread, in_bytes(Thread::pending_exception_offset()));
aoqi@6880 127 beq(AT, R0, L);
aoqi@6880 128 delayed()->nop();
aoqi@6880 129 // exception pending => remove activation and forward to exception handler
aoqi@6880 130 // make sure that the vm_results are cleared
aoqi@6880 131 if (oop_result1->is_valid()) {
aoqi@6880 132 st_ptr(R0, thread, in_bytes(JavaThread::vm_result_offset()));
aoqi@6880 133 }
fujie@9153 134 if (metadata_result->is_valid()) {
aoqi@6880 135 st_ptr(R0, thread, in_bytes(JavaThread::vm_result_2_offset()));
aoqi@6880 136 }
aoqi@6880 137 // the leave() in x86 just pops ebp and remains the return address on the top
aoqi@6880 138 // of stack
aoqi@6880 139 // the return address will be needed by forward_exception_entry()
aoqi@6880 140 if (frame_size() == no_frame_size) {
aoqi@6880 141 addiu(SP, FP, wordSize);
aoqi@6880 142 ld_ptr(FP, SP, (-1) * wordSize);
aoqi@6880 143 jmp(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type);
aoqi@6880 144 delayed()->nop();
aoqi@6880 145 } else if (_stub_id == Runtime1::forward_exception_id) {
aoqi@6880 146 should_not_reach_here();
aoqi@6880 147 } else {
aoqi@8865 148 jmp(Runtime1::entry_for(Runtime1::forward_exception_id), relocInfo::runtime_call_type);
aoqi@6880 149 delayed()->nop();
aoqi@6880 150 }
aoqi@6880 151 bind(L);
aoqi@6880 152 }
aoqi@6880 153 // get oop results if there are any and reset the values in the thread
aoqi@6880 154 if (oop_result1->is_valid()) {
aoqi@6880 155 ld_ptr(oop_result1, thread, in_bytes(JavaThread::vm_result_offset()));
aoqi@6880 156 st_ptr(R0, thread, in_bytes(JavaThread::vm_result_offset()));
aoqi@6880 157 verify_oop(oop_result1);
aoqi@6880 158 }
fujie@9153 159 if (metadata_result->is_valid()) {
fujie@9153 160 ld_ptr(metadata_result, thread, in_bytes(JavaThread::vm_result_2_offset()));
aoqi@6880 161 st_ptr(R0, thread, in_bytes(JavaThread::vm_result_2_offset()));
fujie@9153 162 verify_oop(metadata_result);
aoqi@6880 163 }
aoqi@6880 164 return call_offset;
aoqi@1 165 }
aoqi@1 166
aoqi@1 167
fujie@9153 168 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) {
aoqi@6880 169 if (arg1 != A1) move(A1, arg1);
fujie@9153 170 return call_RT(oop_result1, metadata_result, entry, 1);
aoqi@1 171 }
aoqi@1 172
aoqi@1 173
fujie@9153 174 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) {
aoqi@6880 175 if (arg1!=A1) move(A1, arg1);
aoqi@6880 176 if (arg2!=A2) move(A2, arg2); assert(arg2 != A1, "smashed argument");
fujie@9153 177 return call_RT(oop_result1, metadata_result, entry, 2);
aoqi@1 178 }
aoqi@1 179
aoqi@1 180
fujie@9153 181 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
aoqi@6880 182 if (arg1!=A1) move(A1, arg1);
aoqi@6880 183 if (arg2!=A2) move(A2, arg2); assert(arg2 != A1, "smashed argument");
aoqi@6880 184 if (arg3!=A3) move(A3, arg3); assert(arg3 != A1 && arg3 != A2, "smashed argument");
fujie@9153 185 return call_RT(oop_result1, metadata_result, entry, 3);
aoqi@1 186 }
aoqi@1 187
aoqi@1 188
aoqi@1 189 // Implementation of StubFrame
aoqi@1 190
aoqi@1 191 class StubFrame: public StackObj {
aoqi@6880 192 private:
aoqi@6880 193 StubAssembler* _sasm;
aoqi@1 194
aoqi@6880 195 public:
aoqi@6880 196 StubFrame(StubAssembler* sasm, const char* name, bool must_gc_arguments);
aoqi@6880 197 void load_argument(int offset_in_words, Register reg);
aoqi@6880 198
aoqi@6880 199 ~StubFrame();
aoqi@1 200 };
aoqi@1 201
aoqi@1 202
aoqi@1 203 #define __ _sasm->
aoqi@1 204
aoqi@1 205 StubFrame::StubFrame(StubAssembler* sasm, const char* name, bool must_gc_arguments) {
aoqi@6880 206 _sasm = sasm;
aoqi@6880 207 __ set_info(name, must_gc_arguments);
aoqi@6880 208 __ enter();
aoqi@1 209 }
aoqi@1 210
aoqi@1 211
aoqi@1 212 //FIXME, I have no idea the frame architecture of mips
aoqi@1 213 // load parameters that were stored with LIR_Assembler::store_parameter
aoqi@6880 214 // Note: offsets for store_parameter and load_argument must match
aoqi@1 215 void StubFrame::load_argument(int offset_in_words, Register reg) {
aoqi@9459 216 //fp, + 0: link
aoqi@6880 217 // + 1: return address
aoqi@6880 218 // + 2: argument with offset 0
aoqi@6880 219 // + 3: argument with offset 1
aoqi@6880 220 // + 4: ...
aoqi@6880 221 __ ld_ptr(reg, Address(FP, (offset_in_words + 2) * BytesPerWord));
aoqi@1 222 }
aoqi@6880 223
aoqi@6880 224
aoqi@1 225 StubFrame::~StubFrame() {
aoqi@6880 226 __ leave();
aoqi@6880 227 __ jr(RA);
aoqi@6880 228 __ delayed()->nop();
aoqi@1 229 }
aoqi@1 230
aoqi@1 231 #undef __
aoqi@1 232
aoqi@1 233
aoqi@1 234 // Implementation of Runtime1
aoqi@1 235
aoqi@1 236 #define __ sasm->
aoqi@1 237
aoqi@1 238 const int float_regs_as_doubles_size_in_words = 16;
aoqi@1 239
aoqi@6880 240 //FIXME,
aoqi@1 241 // Stack layout for saving/restoring all the registers needed during a runtime
aoqi@1 242 // call (this includes deoptimization)
aoqi@1 243 // Note: note that users of this frame may well have arguments to some runtime
aoqi@1 244 // while these values are on the stack. These positions neglect those arguments
aoqi@1 245 // but the code in save_live_registers will take the argument count into
aoqi@1 246 // account.
aoqi@1 247 //
aoqi@1 248 #ifdef _LP64
aoqi@1 249 #define SLOT2(x) x,
aoqi@1 250 #define SLOT_PER_WORD 2
aoqi@1 251 #else
aoqi@1 252 #define SLOT2(x)
aoqi@1 253 #define SLOT_PER_WORD 1
aoqi@1 254 #endif // _LP64
aoqi@1 255
aoqi@1 256 enum reg_save_layout {
aoqi@1 257 #ifndef _LP64
aoqi@1 258 T0_off = 0,
aoqi@1 259 S0_off = T0_off + SLOT_PER_WORD * 8,
aoqi@1 260 #else
aoqi@1 261 A4_off = 0,
aoqi@1 262 S0_off = A4_off + SLOT_PER_WORD * 8,
aoqi@1 263 #endif
aoqi@1 264 FP_off = S0_off + SLOT_PER_WORD * 8, SLOT2(FPH_off)
aoqi@1 265 T8_off, SLOT2(T8H_off)
aoqi@1 266 T9_off, SLOT2(T9H_off)
aoqi@1 267 SP_off, SLOT2(SPH_off)
aoqi@1 268 V0_off, SLOT2(V0H_off)
aoqi@1 269 V1_off, SLOT2(V1H_off)
aoqi@1 270 A0_off, SLOT2(A0H_off)
aoqi@1 271 A1_off, SLOT2(A1H_off)
aoqi@1 272 A2_off, SLOT2(A2H_off)
aoqi@1 273 A3_off, SLOT2(A3H_off)
aoqi@1 274
aoqi@1 275 // Float registers
aoqi@9459 276 // FIXME: Jin: In MIPS64, F0~23 are all caller-saved registers
aoqi@1 277 F0_off, SLOT2( F0H_off)
aoqi@1 278 F1_off, SLOT2( F1H_off)
aoqi@1 279 F2_off, SLOT2( F2H_off)
aoqi@1 280 F3_off, SLOT2( F3H_off)
aoqi@1 281 F4_off, SLOT2( F4H_off)
aoqi@1 282 F5_off, SLOT2( F5H_off)
aoqi@1 283 F6_off, SLOT2( F6H_off)
aoqi@1 284 F7_off, SLOT2( F7H_off)
aoqi@1 285 F8_off, SLOT2( F8H_off)
aoqi@1 286 F9_off, SLOT2( F9H_off)
aoqi@1 287 F10_off, SLOT2( F10H_off)
aoqi@1 288 F11_off, SLOT2( F11H_off)
aoqi@1 289 F12_off, SLOT2( F12H_off)
aoqi@1 290 F13_off, SLOT2( F13H_off)
aoqi@1 291 F14_off, SLOT2( F14H_off)
aoqi@1 292 F15_off, SLOT2( F15H_off)
aoqi@1 293 F16_off, SLOT2( F16H_off)
aoqi@1 294 F17_off, SLOT2( F17H_off)
aoqi@1 295 F18_off, SLOT2( F18H_off)
aoqi@1 296 F19_off, SLOT2( F19H_off)
aoqi@1 297
aoqi@1 298 GP_off, SLOT2( GPH_off)
aoqi@1 299 //temp_2_off,
aoqi@1 300 temp_1_off, SLOT2(temp_1H_off)
aoqi@1 301 saved_fp_off, SLOT2(saved_fpH_off)
aoqi@1 302 return_off, SLOT2(returnH_off)
aoqi@1 303
aoqi@1 304 reg_save_frame_size,
aoqi@1 305
aoqi@1 306 // illegal instruction handler
aoqi@1 307 continue_dest_off = temp_1_off,
aoqi@1 308
aoqi@1 309 // deoptimization equates
aoqi@1 310 //deopt_type = temp_2_off, // slot for type of deopt in progress
aoqi@1 311 ret_type = temp_1_off // slot for return type
aoqi@1 312 };
aoqi@1 313
aoqi@6880 314
aoqi@6880 315
aoqi@1 316 // Save off registers which might be killed by calls into the runtime.
aoqi@1 317 // Tries to smart of about FP registers. In particular we separate
aoqi@1 318 // saving and describing the FPU registers for deoptimization since we
aoqi@1 319 // have to save the FPU registers twice if we describe them and on P4
aoqi@1 320 // saving FPU registers which don't contain anything appears
aoqi@1 321 // expensive. The deopt blob is the only thing which needs to
aoqi@1 322 // describe FPU registers. In all other cases it should be sufficient
aoqi@1 323 // to simply save their current value.
aoqi@1 324 static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args,
aoqi@6880 325 bool save_fpu_registers = true, bool describe_fpu_registers = false) {
aoqi@1 326
aoqi@8865 327 LP64_ONLY(num_rt_args = 0);
aoqi@8865 328 LP64_ONLY(assert((reg_save_frame_size * VMRegImpl::stack_slot_size) % 16 == 0, "must be 16 byte aligned");)
aoqi@8865 329 int frame_size_in_slots = reg_save_frame_size + num_rt_args * wordSize / VMRegImpl::slots_per_word; // args + thread
aoqi@8865 330 sasm->set_frame_size(frame_size_in_slots / VMRegImpl::slots_per_word);
aoqi@1 331
aoqi@1 332 // record saved value locations in an OopMap
aoqi@6880 333 // locations are offsets from sp after runtime call; num_rt_args is number of arguments
aoqi@1 334 // in call, including thread
aoqi@1 335 OopMap* map = new OopMap(reg_save_frame_size, 0);
aoqi@6880 336
aoqi@1 337 map->set_callee_saved(VMRegImpl::stack2reg(V0_off + num_rt_args), V0->as_VMReg());
aoqi@1 338 map->set_callee_saved(VMRegImpl::stack2reg(V1_off + num_rt_args), V1->as_VMReg());
aoqi@1 339 #ifdef _LP64
aoqi@1 340 map->set_callee_saved(VMRegImpl::stack2reg(V0H_off + num_rt_args), V0->as_VMReg()->next());
aoqi@1 341 map->set_callee_saved(VMRegImpl::stack2reg(V1H_off + num_rt_args), V1->as_VMReg()->next());
aoqi@1 342 #endif
aoqi@1 343
aoqi@1 344 int i = 0;
aoqi@1 345 #ifndef _LP64
aoqi@1 346 for (Register r = T0; r != T7->successor(); r = r->successor() ) {
aoqi@1 347 map->set_callee_saved(VMRegImpl::stack2reg(T0_off + num_rt_args + i++), r->as_VMReg());
aoqi@1 348 }
aoqi@1 349 #else
aoqi@1 350 for (Register r = A4; r != T3->successor(); r = r->successor() ) {
aoqi@1 351 map->set_callee_saved(VMRegImpl::stack2reg(A4_off + num_rt_args + i++), r->as_VMReg());
aoqi@1 352 map->set_callee_saved(VMRegImpl::stack2reg(A4_off + num_rt_args + i++), r->as_VMReg()->next());
aoqi@1 353 }
aoqi@1 354 #endif
aoqi@1 355
aoqi@1 356 i = 0;
aoqi@1 357 for (Register r = S0; r != S7->successor(); r = r->successor() ) {
aoqi@1 358 map->set_callee_saved(VMRegImpl::stack2reg(S0_off + num_rt_args + i++), r->as_VMReg());
aoqi@1 359 #ifdef _LP64
aoqi@1 360 map->set_callee_saved(VMRegImpl::stack2reg(S0_off + num_rt_args + i++), r->as_VMReg()->next());
aoqi@1 361 #endif
aoqi@1 362 }
aoqi@1 363
aoqi@1 364 map->set_callee_saved(VMRegImpl::stack2reg(FP_off + num_rt_args), FP->as_VMReg());
aoqi@1 365 map->set_callee_saved(VMRegImpl::stack2reg(GP_off + num_rt_args), GP->as_VMReg());
aoqi@1 366 map->set_callee_saved(VMRegImpl::stack2reg(T8_off + num_rt_args), T8->as_VMReg());
aoqi@1 367 map->set_callee_saved(VMRegImpl::stack2reg(T9_off + num_rt_args), T9->as_VMReg());
aoqi@1 368 map->set_callee_saved(VMRegImpl::stack2reg(A0_off + num_rt_args), A0->as_VMReg());
aoqi@1 369 map->set_callee_saved(VMRegImpl::stack2reg(A1_off + num_rt_args), A1->as_VMReg());
aoqi@1 370 map->set_callee_saved(VMRegImpl::stack2reg(A2_off + num_rt_args), A2->as_VMReg());
aoqi@1 371 map->set_callee_saved(VMRegImpl::stack2reg(A3_off + num_rt_args), A3->as_VMReg());
aoqi@1 372
aoqi@1 373 map->set_callee_saved(VMRegImpl::stack2reg(F0_off + num_rt_args), F0->as_VMReg());
aoqi@1 374 map->set_callee_saved(VMRegImpl::stack2reg(F1_off + num_rt_args), F1->as_VMReg());
aoqi@1 375 map->set_callee_saved(VMRegImpl::stack2reg(F2_off + num_rt_args), F2->as_VMReg());
aoqi@1 376 map->set_callee_saved(VMRegImpl::stack2reg(F3_off + num_rt_args), F1->as_VMReg());
aoqi@1 377 map->set_callee_saved(VMRegImpl::stack2reg(F4_off + num_rt_args), F4->as_VMReg());
aoqi@1 378 map->set_callee_saved(VMRegImpl::stack2reg(F5_off + num_rt_args), F4->as_VMReg());
aoqi@1 379 map->set_callee_saved(VMRegImpl::stack2reg(F6_off + num_rt_args), F4->as_VMReg());
aoqi@1 380 map->set_callee_saved(VMRegImpl::stack2reg(F7_off + num_rt_args), F4->as_VMReg());
aoqi@1 381 map->set_callee_saved(VMRegImpl::stack2reg(F8_off + num_rt_args), F4->as_VMReg());
aoqi@1 382 map->set_callee_saved(VMRegImpl::stack2reg(F9_off + num_rt_args), F4->as_VMReg());
aoqi@1 383 map->set_callee_saved(VMRegImpl::stack2reg(F10_off + num_rt_args), F4->as_VMReg());
aoqi@1 384 map->set_callee_saved(VMRegImpl::stack2reg(F11_off + num_rt_args), F4->as_VMReg());
aoqi@1 385 map->set_callee_saved(VMRegImpl::stack2reg(F12_off + num_rt_args), F12->as_VMReg());
aoqi@1 386 map->set_callee_saved(VMRegImpl::stack2reg(F13_off + num_rt_args), F13->as_VMReg());
aoqi@1 387 map->set_callee_saved(VMRegImpl::stack2reg(F14_off + num_rt_args), F14->as_VMReg());
aoqi@1 388 map->set_callee_saved(VMRegImpl::stack2reg(F15_off + num_rt_args), F15->as_VMReg());
aoqi@1 389 map->set_callee_saved(VMRegImpl::stack2reg(F16_off + num_rt_args), F16->as_VMReg());
aoqi@1 390 map->set_callee_saved(VMRegImpl::stack2reg(F17_off + num_rt_args), F17->as_VMReg());
aoqi@1 391 map->set_callee_saved(VMRegImpl::stack2reg(F18_off + num_rt_args), F18->as_VMReg());
aoqi@1 392 map->set_callee_saved(VMRegImpl::stack2reg(F19_off + num_rt_args), F19->as_VMReg());
aoqi@1 393
aoqi@1 394 #ifdef _LP64
aoqi@1 395 map->set_callee_saved(VMRegImpl::stack2reg(FPH_off + num_rt_args), FP->as_VMReg()->next());
aoqi@1 396 map->set_callee_saved(VMRegImpl::stack2reg(GPH_off + num_rt_args), GP->as_VMReg()->next());
aoqi@1 397 map->set_callee_saved(VMRegImpl::stack2reg(T8H_off + num_rt_args), T8->as_VMReg()->next());
aoqi@1 398 map->set_callee_saved(VMRegImpl::stack2reg(T9H_off + num_rt_args), T9->as_VMReg()->next());
aoqi@1 399 map->set_callee_saved(VMRegImpl::stack2reg(A0H_off + num_rt_args), A0->as_VMReg()->next());
aoqi@1 400 map->set_callee_saved(VMRegImpl::stack2reg(A1H_off + num_rt_args), A1->as_VMReg()->next());
aoqi@1 401 map->set_callee_saved(VMRegImpl::stack2reg(A2H_off + num_rt_args), A2->as_VMReg()->next());
aoqi@1 402 map->set_callee_saved(VMRegImpl::stack2reg(A3H_off + num_rt_args), A3->as_VMReg()->next());
aoqi@1 403 #endif
aoqi@1 404 return map;
aoqi@1 405 }
aoqi@1 406
aoqi@8865 407 static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args,
aoqi@8865 408 bool save_fpu_registers = true,
aoqi@1 409 bool describe_fpu_registers = false) {
aoqi@1 410 //const int reg_save_frame_size = return_off + 1 + num_rt_args;
aoqi@1 411 __ block_comment("save_live_registers");
aoqi@1 412
aoqi@6880 413 // save all register state - int, fpu
aoqi@1 414 __ addi(SP, SP, -(reg_save_frame_size / SLOT_PER_WORD - 2)* wordSize);
aoqi@6880 415
aoqi@1 416 #ifndef _LP64
aoqi@1 417 for (Register r = T0; r != T7->successor(); r = r->successor() ) {
aoqi@1 418 __ sw(r, SP, (r->encoding() - T0->encoding() + T0_off / SLOT_PER_WORD) * wordSize);
aoqi@1 419 #else
aoqi@1 420 for (Register r = A4; r != T3->successor(); r = r->successor() ) {
aoqi@1 421 __ sd(r, SP, (r->encoding() - A4->encoding() + A4_off / SLOT_PER_WORD) * wordSize);
aoqi@1 422 #endif
aoqi@1 423 }
aoqi@1 424 for (Register r = S0; r != S7->successor(); r = r->successor() ) {
aoqi@1 425 __ st_ptr(r, SP, (r->encoding() - S0->encoding() + S0_off / SLOT_PER_WORD) * wordSize);
aoqi@1 426 }
aoqi@1 427 __ st_ptr(FP, SP, FP_off * wordSize / SLOT_PER_WORD);
aoqi@1 428 __ st_ptr(GP, SP, GP_off * wordSize / SLOT_PER_WORD);
aoqi@1 429 __ st_ptr(T8, SP, T8_off * wordSize / SLOT_PER_WORD);
aoqi@1 430 __ st_ptr(T9, SP, T9_off * wordSize / SLOT_PER_WORD);
aoqi@1 431 __ st_ptr(A0, SP, A0_off * wordSize / SLOT_PER_WORD);
aoqi@1 432 __ st_ptr(A1, SP, A1_off * wordSize / SLOT_PER_WORD);
aoqi@1 433 __ st_ptr(A2, SP, A2_off * wordSize / SLOT_PER_WORD);
aoqi@1 434 __ st_ptr(A3, SP, A3_off * wordSize / SLOT_PER_WORD);
aoqi@1 435 __ st_ptr(V0, SP, V0_off * wordSize / SLOT_PER_WORD);
aoqi@6880 436 __ st_ptr(V1, SP, V1_off * wordSize / SLOT_PER_WORD);
aoqi@1 437
aoqi@6880 438 __ sdc1(F0, SP, F0_off * wordSize / SLOT_PER_WORD);
aoqi@6880 439 __ sdc1(F1, SP, F1_off * wordSize / SLOT_PER_WORD);
aoqi@6880 440 __ sdc1(F2, SP, F2_off * wordSize / SLOT_PER_WORD);
aoqi@6880 441 __ sdc1(F3, SP, F3_off * wordSize / SLOT_PER_WORD);
aoqi@6880 442 __ sdc1(F4, SP, F4_off * wordSize / SLOT_PER_WORD);
aoqi@6880 443 __ sdc1(F5, SP, F5_off * wordSize / SLOT_PER_WORD);
aoqi@6880 444 __ sdc1(F6, SP, F6_off * wordSize / SLOT_PER_WORD);
aoqi@6880 445 __ sdc1(F7, SP, F7_off * wordSize / SLOT_PER_WORD);
aoqi@6880 446 __ sdc1(F8, SP, F8_off * wordSize / SLOT_PER_WORD);
aoqi@6880 447 __ sdc1(F9, SP, F9_off * wordSize / SLOT_PER_WORD);
aoqi@6880 448 __ sdc1(F10, SP, F10_off * wordSize / SLOT_PER_WORD);
aoqi@6880 449 __ sdc1(F11, SP, F11_off * wordSize / SLOT_PER_WORD);
aoqi@6880 450 __ sdc1(F12, SP, F12_off * wordSize / SLOT_PER_WORD);
aoqi@6880 451 __ sdc1(F13, SP, F13_off * wordSize / SLOT_PER_WORD);
aoqi@6880 452 __ sdc1(F14, SP, F14_off * wordSize / SLOT_PER_WORD);
aoqi@6880 453 __ sdc1(F15, SP, F15_off * wordSize / SLOT_PER_WORD);
aoqi@6880 454 __ sdc1(F16, SP, F16_off * wordSize / SLOT_PER_WORD);
aoqi@6880 455 __ sdc1(F17, SP, F17_off * wordSize / SLOT_PER_WORD);
aoqi@6880 456 __ sdc1(F18, SP, F18_off * wordSize / SLOT_PER_WORD);
aoqi@6880 457 __ sdc1(F19, SP, F19_off * wordSize / SLOT_PER_WORD);
aoqi@1 458
aoqi@1 459 return generate_oop_map(sasm, num_rt_args, save_fpu_registers, describe_fpu_registers);
aoqi@1 460 }
aoqi@1 461
aoqi@1 462 static void restore_fpu(StubAssembler* sasm, bool restore_fpu_registers = true) {
aoqi@1 463 //static void restore_live_registers(MacroAssembler* sasm) {
aoqi@1 464 #ifndef _LP64
aoqi@1 465 for (Register r = T0; r != T7->successor(); r = r->successor() ) {
aoqi@1 466 __ lw(r, SP, (r->encoding() - T0->encoding() + T0_off / SLOT_PER_WORD) * wordSize);
aoqi@1 467 #else
aoqi@1 468 for (Register r = A4; r != T3->successor(); r = r->successor() ) {
aoqi@1 469 __ ld(r, SP, (r->encoding() - A4->encoding() + A4_off / SLOT_PER_WORD) * wordSize);
aoqi@1 470 #endif
aoqi@1 471 }
aoqi@1 472 for (Register r = S0; r != S7->successor(); r = r->successor() ) {
aoqi@1 473 __ ld_ptr(r, SP, (r->encoding() - S0->encoding() + S0_off / SLOT_PER_WORD) * wordSize);
aoqi@1 474 }
aoqi@1 475 __ ld_ptr(FP, SP, FP_off * wordSize / SLOT_PER_WORD);
aoqi@1 476 __ ld_ptr(GP, SP, GP_off * wordSize / SLOT_PER_WORD);
aoqi@1 477
aoqi@1 478 __ ld_ptr(T8, SP, T8_off * wordSize / SLOT_PER_WORD);
aoqi@1 479 __ ld_ptr(T9, SP, T9_off * wordSize / SLOT_PER_WORD);
aoqi@1 480 __ ld_ptr(A0, SP, A0_off * wordSize / SLOT_PER_WORD);
aoqi@1 481 __ ld_ptr(A1, SP, A1_off * wordSize / SLOT_PER_WORD);
aoqi@1 482 __ ld_ptr(A2, SP, A2_off * wordSize / SLOT_PER_WORD);
aoqi@1 483 __ ld_ptr(A3, SP, A3_off * wordSize / SLOT_PER_WORD);
aoqi@1 484
aoqi@1 485 __ ld_ptr(V0, SP, V0_off * wordSize / SLOT_PER_WORD);
aoqi@6880 486 __ ld_ptr(V1, SP, V1_off * wordSize / SLOT_PER_WORD);
aoqi@1 487
aoqi@1 488 __ ldc1(F0, SP, F0_off * wordSize / SLOT_PER_WORD);
aoqi@1 489 __ ldc1(F1, SP, F1_off * wordSize / SLOT_PER_WORD);
aoqi@1 490 __ ldc1(F2, SP, F2_off * wordSize / SLOT_PER_WORD);
aoqi@1 491 __ ldc1(F3, SP, F3_off * wordSize / SLOT_PER_WORD);
aoqi@1 492 __ ldc1(F4, SP, F4_off * wordSize / SLOT_PER_WORD);
aoqi@1 493 __ ldc1(F5, SP, F5_off * wordSize / SLOT_PER_WORD);
aoqi@1 494 __ ldc1(F6, SP, F6_off * wordSize / SLOT_PER_WORD);
aoqi@1 495 __ ldc1(F7, SP, F7_off * wordSize / SLOT_PER_WORD);
aoqi@1 496 __ ldc1(F8, SP, F8_off * wordSize / SLOT_PER_WORD);
aoqi@1 497 __ ldc1(F9, SP, F9_off * wordSize / SLOT_PER_WORD);
aoqi@1 498 __ ldc1(F10, SP, F10_off * wordSize / SLOT_PER_WORD);
aoqi@1 499 __ ldc1(F11, SP, F11_off * wordSize / SLOT_PER_WORD);
aoqi@1 500 __ ldc1(F12, SP, F12_off * wordSize / SLOT_PER_WORD);
aoqi@1 501 __ ldc1(F13, SP, F13_off * wordSize / SLOT_PER_WORD);
aoqi@1 502 __ ldc1(F14, SP, F14_off * wordSize / SLOT_PER_WORD);
aoqi@1 503 __ ldc1(F15, SP, F15_off * wordSize / SLOT_PER_WORD);
aoqi@1 504 __ ldc1(F16, SP, F16_off * wordSize / SLOT_PER_WORD);
aoqi@1 505 __ ldc1(F17, SP, F17_off * wordSize / SLOT_PER_WORD);
aoqi@1 506 __ ldc1(F18, SP, F18_off * wordSize / SLOT_PER_WORD);
aoqi@1 507 __ ldc1(F19, SP, F19_off * wordSize / SLOT_PER_WORD);
aoqi@1 508
aoqi@1 509 __ addiu(SP, SP, (reg_save_frame_size / SLOT_PER_WORD - 2) * wordSize);
aoqi@1 510 }
aoqi@1 511
aoqi@1 512 static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
aoqi@1 513 __ block_comment("restore_live_registers");
aoqi@1 514 restore_fpu(sasm, restore_fpu_registers);
aoqi@1 515 }
aoqi@1 516
aoqi@6880 517 static void restore_live_registers_except_V0(StubAssembler* sasm, bool restore_fpu_registers = true) {
aoqi@1 518 //static void restore_live_registers(MacroAssembler* sasm) {
aoqi@1 519 //FIXME , maybe V1 need to be saved too
aoqi@1 520 __ block_comment("restore_live_registers except V0");
aoqi@1 521 #ifndef _LP64
aoqi@1 522 for (Register r = T0; r != T7->successor(); r = r->successor() ) {
aoqi@6880 523 __ lw(r, SP, (r->encoding() - T0->encoding() + T0_off / SLOT_PER_WORD) * wordSize);
aoqi@1 524 #else
aoqi@1 525 for (Register r = A4; r != T3->successor(); r = r->successor() ) {
aoqi@6880 526 __ ld(r, SP, (r->encoding() - A4->encoding() + A4_off / SLOT_PER_WORD) * wordSize);
aoqi@1 527 #endif
aoqi@1 528 }
aoqi@1 529 for (Register r = S0; r != S7->successor(); r = r->successor() ) {
aoqi@6880 530 __ ld_ptr(r, SP, (r->encoding() - S0->encoding() + S0_off / SLOT_PER_WORD) * wordSize);
aoqi@1 531 }
aoqi@1 532 __ ld_ptr(FP, SP, FP_off * wordSize / SLOT_PER_WORD);
aoqi@1 533 __ ld_ptr(GP, SP, GP_off * wordSize / SLOT_PER_WORD);
aoqi@1 534
aoqi@1 535 __ ld_ptr(T8, SP, T8_off * wordSize / SLOT_PER_WORD);
aoqi@1 536 __ ld_ptr(T9, SP, T9_off * wordSize / SLOT_PER_WORD);
aoqi@1 537 __ ld_ptr(A0, SP, A0_off * wordSize / SLOT_PER_WORD);
aoqi@1 538 __ ld_ptr(A1, SP, A1_off * wordSize / SLOT_PER_WORD);
aoqi@1 539 __ ld_ptr(A2, SP, A2_off * wordSize / SLOT_PER_WORD);
aoqi@1 540 __ ld_ptr(A3, SP, A3_off * wordSize / SLOT_PER_WORD);
aoqi@1 541
aoqi@1 542 #if 1
aoqi@1 543 __ ldc1(F0, SP, F0_off * wordSize / SLOT_PER_WORD);
aoqi@1 544 __ ldc1(F1, SP, F1_off * wordSize / SLOT_PER_WORD);
aoqi@1 545 __ ldc1(F2, SP, F2_off * wordSize / SLOT_PER_WORD);
aoqi@1 546 __ ldc1(F3, SP, F3_off * wordSize / SLOT_PER_WORD);
aoqi@1 547 __ ldc1(F4, SP, F4_off * wordSize / SLOT_PER_WORD);
aoqi@1 548 __ ldc1(F5, SP, F5_off * wordSize / SLOT_PER_WORD);
aoqi@1 549 __ ldc1(F6, SP, F6_off * wordSize / SLOT_PER_WORD);
aoqi@1 550 __ ldc1(F7, SP, F7_off * wordSize / SLOT_PER_WORD);
aoqi@1 551 __ ldc1(F8, SP, F8_off * wordSize / SLOT_PER_WORD);
aoqi@1 552 __ ldc1(F9, SP, F9_off * wordSize / SLOT_PER_WORD);
aoqi@1 553 __ ldc1(F10, SP, F10_off * wordSize / SLOT_PER_WORD);
aoqi@1 554 __ ldc1(F11, SP, F11_off * wordSize / SLOT_PER_WORD);
aoqi@1 555 __ ldc1(F12, SP, F12_off * wordSize / SLOT_PER_WORD);
aoqi@1 556 __ ldc1(F13, SP, F13_off * wordSize / SLOT_PER_WORD);
aoqi@1 557 __ ldc1(F14, SP, F14_off * wordSize / SLOT_PER_WORD);
aoqi@1 558 __ ldc1(F15, SP, F15_off * wordSize / SLOT_PER_WORD);
aoqi@1 559 __ ldc1(F16, SP, F16_off * wordSize / SLOT_PER_WORD);
aoqi@1 560 __ ldc1(F17, SP, F17_off * wordSize / SLOT_PER_WORD);
aoqi@1 561 __ ldc1(F18, SP, F18_off * wordSize / SLOT_PER_WORD);
aoqi@1 562 __ ldc1(F19, SP, F19_off * wordSize / SLOT_PER_WORD);
aoqi@1 563 #endif
aoqi@1 564
aoqi@6880 565 __ ld_ptr(V1, SP, V1_off * wordSize / SLOT_PER_WORD);
aoqi@1 566
aoqi@1 567 __ addiu(SP, SP, (reg_save_frame_size / SLOT_PER_WORD - 2) * wordSize);
aoqi@1 568 }
aoqi@1 569
aoqi@1 570 void Runtime1::initialize_pd() {
aoqi@1 571 // nothing to do
aoqi@1 572 }
aoqi@1 573
aoqi@1 574 // target: the entry point of the method that creates and posts the exception oop
aoqi@1 575 // has_argument: true if the exception needs an argument (passed on stack because registers must be preserved)
aoqi@1 576 OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) {
aoqi@6880 577 // preserve all registers
aoqi@6880 578 OopMap* oop_map = save_live_registers(sasm, 0);
aoqi@1 579
aoqi@6880 580 // now all registers are saved and can be used freely
aoqi@6880 581 // verify that no old value is used accidentally
aoqi@6880 582 //all reigster are saved , I think mips do not need this
aoqi@1 583
aoqi@6880 584 // registers used by this stub
aoqi@6880 585 const Register temp_reg = T3;
aoqi@6880 586 // load argument for exception that is passed as an argument into the stub
aoqi@6880 587 if (has_argument) {
aoqi@6880 588 __ ld_ptr(temp_reg, Address(FP, 2*BytesPerWord));
aoqi@6880 589 }
aoqi@6880 590 int call_offset;
aoqi@6880 591 if (has_argument)
aoqi@6880 592 call_offset = __ call_RT(noreg, noreg, target, temp_reg);
aoqi@1 593 else
aoqi@6880 594 call_offset = __ call_RT(noreg, noreg, target);
aoqi@1 595
aoqi@6880 596 OopMapSet* oop_maps = new OopMapSet();
aoqi@6880 597 oop_maps->add_gc_map(call_offset, oop_map);
aoqi@1 598
aoqi@6880 599 __ stop("should not reach here");
aoqi@6880 600
aoqi@6880 601 return oop_maps;
aoqi@1 602 }
aoqi@1 603
aoqi@1 604 OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler *sasm) {
aoqi@8865 605 __ block_comment("generate_handle_exception");
aoqi@8865 606
aoqi@8865 607 // incoming parameters
aoqi@6880 608 const Register exception_oop = V0;
aoqi@6880 609 const Register exception_pc = V1;
aoqi@6880 610 // other registers used in this stub
aoqi@8865 611 const Register thread = TREG;
aoqi@8865 612 #ifndef OPT_THREAD
aoqi@8865 613 __ get_thread(thread);
aoqi@8865 614 #endif
aoqi@1 615 // Save registers, if required.
aoqi@8865 616 OopMapSet* oop_maps = new OopMapSet();
aoqi@8865 617 OopMap* oop_map = NULL;
aoqi@8865 618 switch (id) {
aoqi@8865 619 case forward_exception_id:
aoqi@8865 620 // We're handling an exception in the context of a compiled frame.
aoqi@8865 621 // The registers have been saved in the standard places. Perform
aoqi@8865 622 // an exception lookup in the caller and dispatch to the handler
aoqi@8865 623 // if found. Otherwise unwind and dispatch to the callers
aoqi@8865 624 // exception handler.
aoqi@8865 625 oop_map = generate_oop_map(sasm, 1 /*thread*/);
aoqi@6880 626
aoqi@9459 627 // load and clear pending exception oop into V0
aoqi@8865 628 __ ld_ptr(exception_oop, Address(thread, Thread::pending_exception_offset()));
aoqi@8865 629 __ st_ptr(R0, Address(thread, Thread::pending_exception_offset()));
aoqi@6880 630
aoqi@9459 631 // load issuing PC (the return address for this stub) into V1
aoqi@8865 632 __ ld_ptr(exception_pc, Address(FP, 1*BytesPerWord));
aoqi@6880 633
aoqi@8865 634 // make sure that the vm_results are cleared (may be unnecessary)
aoqi@8865 635 __ st_ptr(R0, Address(thread, JavaThread::vm_result_offset()));
aoqi@8865 636 __ st_ptr(R0, Address(thread, JavaThread::vm_result_2_offset()));
aoqi@8865 637 break;
aoqi@8865 638 case handle_exception_nofpu_id:
aoqi@8865 639 case handle_exception_id:
aoqi@8865 640 // At this point all registers MAY be live.
aoqi@8865 641 oop_map = save_live_registers(sasm, 1 /*thread*/, id != handle_exception_nofpu_id);
aoqi@8865 642 break;
aoqi@8865 643 case handle_exception_from_callee_id: {
aoqi@9459 644 // At this point all registers except exception oop (V0) and
aoqi@9459 645 // exception pc (V1) are dead.
aoqi@8865 646 const int frame_size = 2 /*BP, return address*/ NOT_LP64(+ 1 /*thread*/);
aoqi@8865 647 oop_map = new OopMap(frame_size * VMRegImpl::slots_per_word, 0);
aoqi@8865 648 sasm->set_frame_size(frame_size);
aoqi@8865 649 break;
aoqi@8865 650 }
aoqi@8865 651 default: ShouldNotReachHere();
aoqi@8865 652 }
aoqi@1 653
aoqi@1 654 #ifdef TIERED
aoqi@6880 655 // C2 can leave the fpu stack dirty
aoqi@6880 656 __ empty_FPU_stack();
aoqi@1 657 #endif // TIERED
aoqi@1 658
aoqi@6880 659 // verify that only V0 and V1 is valid at this time
aoqi@6880 660 // verify that V0 contains a valid exception
aoqi@6880 661 __ verify_not_null_oop(exception_oop);
aoqi@1 662
aoqi@6880 663 // load address of JavaThread object for thread-local data
aoqi@6880 664 __ get_thread(thread);
aoqi@1 665
aoqi@1 666 #ifdef ASSERT
aoqi@6880 667 // check that fields in JavaThread for exception oop and issuing pc are
aoqi@6880 668 // empty before writing to them
aoqi@6880 669 Label oop_empty;
aoqi@6880 670 __ ld_ptr(AT, Address(thread, in_bytes(JavaThread::exception_oop_offset())));
aoqi@6880 671 __ beq(AT, R0, oop_empty);
aoqi@6880 672 __ delayed()->nop();
aoqi@6880 673 __ stop("exception oop already set");
aoqi@6880 674 __ bind(oop_empty);
fujie@9207 675
aoqi@6880 676 Label pc_empty;
aoqi@6880 677 __ ld_ptr(AT, Address(thread, in_bytes(JavaThread::exception_pc_offset())));
aoqi@6880 678 __ beq(AT, R0, pc_empty);
aoqi@6880 679 __ delayed()->nop();
aoqi@6880 680 __ stop("exception pc already set");
aoqi@6880 681 __ bind(pc_empty);
aoqi@1 682 #endif
aoqi@1 683
aoqi@6880 684 // save exception oop and issuing pc into JavaThread
aoqi@6880 685 // (exception handler will load it from here)
aoqi@6880 686 __ st_ptr(exception_oop, Address(thread, in_bytes(JavaThread::exception_oop_offset())));
aoqi@6880 687 __ st_ptr(exception_pc, Address(thread, in_bytes(JavaThread::exception_pc_offset())));
aoqi@1 688
aoqi@8865 689 // patch throwing pc into return address (has bci & oop map)
aoqi@8865 690 __ st_ptr(exception_pc, Address(FP, 1*BytesPerWord));
aoqi@1 691
aoqi@6880 692 // compute the exception handler.
aoqi@6880 693 // the exception oop and the throwing pc are read from the fields in JavaThread
fujie@9161 694 __ block_comment(";; will call_RT exception_handler_for_pc");
aoqi@8865 695 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
aoqi@6880 696 oop_maps->add_gc_map(call_offset, oop_map);
fujie@9161 697 __ block_comment(";; end of call_RT exception_handler_for_pc");
fujie@9207 698
aoqi@6880 699 // V0: handler address or NULL if no handler exists
aoqi@6880 700 // will be the deopt blob if nmethod was deoptimized while we looked up
aoqi@6880 701 // handler regardless of whether handler existed in the nmethod.
aoqi@1 702
aoqi@6880 703 // only V0 is valid at this time, all other registers have been destroyed by the
aoqi@6880 704 // runtime call
aoqi@1 705
aoqi@6880 706 // patch the return address -> the stub will directly return to the exception handler
aoqi@8865 707 __ st_ptr(V0, Address(FP, 1 * BytesPerWord));
aoqi@1 708
aoqi@8865 709 switch (id) {
aoqi@8865 710 case forward_exception_id:
aoqi@8865 711 case handle_exception_nofpu_id:
aoqi@8865 712 case handle_exception_id:
aoqi@8865 713 // Restore the registers that were saved at the beginning.
aoqi@8865 714 restore_live_registers(sasm, id != handle_exception_nofpu_id);
aoqi@8865 715 break;
aoqi@8865 716 case handle_exception_from_callee_id:
aoqi@8865 717 // WIN64_ONLY: No need to add frame::arg_reg_save_area_bytes to SP
aoqi@8865 718 // since we do a leave anyway.
aoqi@1 719
aoqi@8865 720 // Pop the return address since we are possibly changing SP (restoring from BP).
fujie@9207 721 __ move(SP, FP);
fujie@9207 722 __ pop(FP);
fujie@9207 723 __ pop(RA);
aoqi@8865 724 __ jr(RA); // jump to exception handler
aoqi@8865 725 __ delayed()->nop();
aoqi@8865 726 break;
aoqi@8865 727 default: ShouldNotReachHere();
aoqi@8865 728 }
aoqi@1 729
aoqi@8865 730 return oop_maps;
aoqi@8865 731 }
aoqi@1 732
aoqi@1 733 void Runtime1::generate_unwind_exception(StubAssembler *sasm) {
aoqi@6880 734 // incoming parameters
aoqi@6880 735 const Register exception_oop = V0;
aoqi@8865 736 // callee-saved copy of exception_oop during runtime call
aoqi@8865 737 const Register exception_oop_callee_saved = S0;
aoqi@6880 738 // other registers used in this stub
aoqi@6880 739 const Register exception_pc = V1;
aoqi@6880 740 const Register handler_addr = T3;
aoqi@8865 741 const Register thread = TREG;
aoqi@1 742
aoqi@1 743 #ifdef ASSERT
aoqi@6880 744 // check that fields in JavaThread for exception oop and issuing pc are empty
aoqi@6880 745 __ get_thread(thread);
aoqi@6880 746 Label oop_empty;
aoqi@6880 747 __ ld_ptr(AT, thread, in_bytes(JavaThread::exception_oop_offset()));
aoqi@6880 748 __ beq(AT, R0, oop_empty);
aoqi@6880 749 __ delayed()->nop();
aoqi@6880 750 __ stop("exception oop must be empty");
aoqi@6880 751 __ bind(oop_empty);
aoqi@1 752
aoqi@6880 753 Label pc_empty;
aoqi@6880 754 __ ld_ptr(AT, thread, in_bytes(JavaThread::exception_pc_offset()));
aoqi@8865 755 __ beq(AT, R0, pc_empty);
aoqi@6880 756 __ delayed()->nop();
aoqi@6880 757 __ stop("exception pc must be empty");
aoqi@6880 758 __ bind(pc_empty);
aoqi@1 759 #endif
aoqi@6880 760 // clear the FPU stack in case any FPU results are left behind
aoqi@6880 761 __ empty_FPU_stack();
aoqi@1 762
aoqi@8865 763 // save exception_oop in callee-saved register to preserve it during runtime calls
aoqi@8865 764 __ verify_not_null_oop(exception_oop);
aoqi@8865 765 __ move(exception_oop_callee_saved, exception_oop);
aoqi@8865 766
aoqi@8865 767 #ifndef OPT_THREAD
aoqi@8865 768 __ get_thread(thread);
aoqi@8865 769 #endif
fujie@9207 770 // Get return address (is in RA after leave).
aoqi@8865 771
fujie@9207 772 __ move(exception_pc, RA);
fujie@9207 773 __ push(RA);
aoqi@1 774
aoqi@6880 775 // search the exception handler address of the caller (using the return address)
aoqi@8865 776 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), thread, exception_pc);
aoqi@8865 777 // V0: exception handler address of the caller
aoqi@1 778
aoqi@6880 779 // move result of call into correct register
aoqi@6880 780 __ move(handler_addr, V0);
aoqi@1 781
aoqi@8865 782 // Restore exception oop to V0 (required convention of exception handler).
aoqi@8865 783 __ move(exception_oop, exception_oop_callee_saved);
aoqi@8865 784
aoqi@8865 785 // verify that there is really a valid exception in V0
aoqi@6880 786 __ verify_oop(exception_oop);
aoqi@1 787
aoqi@6880 788 // get throwing pc (= return address).
aoqi@8865 789 // V1 has been destroyed by the call, so it must be set again
aoqi@6880 790 // the pop is also necessary to simulate the effect of a ret(0)
aoqi@6880 791 __ super_pop(exception_pc);
aoqi@1 792
aoqi@6880 793 // continue at exception handler (return address removed)
aoqi@6880 794 // note: do *not* remove arguments when unwinding the
aoqi@6880 795 // activation since the caller assumes having
aoqi@6880 796 // all arguments on the stack when entering the
aoqi@6880 797 // runtime to determine the exception handler
aoqi@6880 798 // (GC happens at call site with arguments!)
aoqi@8865 799 // V0: exception oop
aoqi@8865 800 // V1: throwing pc
aoqi@8865 801 // T3: exception handler
aoqi@6880 802 __ jr(handler_addr);
aoqi@6880 803 __ delayed()->nop();
aoqi@1 804 }
aoqi@1 805
aoqi@1 806 OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
aoqi@1 807
aoqi@6880 808 // use the maximum number of runtime-arguments here because it is difficult to
aoqi@6880 809 // distinguish each RT-Call.
aoqi@6880 810 // Note: This number affects also the RT-Call in generate_handle_exception because
aoqi@6880 811 // the oop-map is shared for all calls.
aoqi@1 812
aoqi@6880 813 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
aoqi@6880 814 assert(deopt_blob != NULL, "deoptimization blob must have been created");
aoqi@6880 815 // assert(deopt_with_exception_entry_for_patch != NULL,
aoqi@6880 816 // "deoptimization blob must have been created");
aoqi@6880 817
aoqi@6880 818 //OopMap* oop_map = save_live_registers(sasm, num_rt_args);
aoqi@6880 819 OopMap* oop_map = save_live_registers(sasm, 0);
aoqi@6880 820 const Register thread = T8;
aoqi@6880 821 // push java thread (becomes first argument of C function)
aoqi@6880 822 __ get_thread(thread);
aoqi@6880 823 __ move(A0, thread);
aoqi@1 824
aoqi@1 825
aoqi@9459 826
aoqi@9459 827 // NOTE: this frame should be compiled frame, but at this point, the pc in frame-anchor
aoqi@9459 828 // is contained in interpreter. It should be wrong, and should be cleared but is not.
aoqi@9459 829 // even if we cleared the wrong pc in anchor, the default way to get caller pc in class frame
aoqi@9459 830 // is not right. It depends on that the caller pc is stored in *(sp - 1) but it's not the case
aoqi@9459 831
aoqi@6880 832 __ set_last_Java_frame(thread, NOREG, FP, NULL);
aoqi@6880 833 NOT_LP64(__ addiu(SP, SP, (-1) * wordSize));
aoqi@6880 834 __ move(AT, -(StackAlignmentInBytes));
aoqi@6880 835 __ andr(SP, SP, AT);
aoqi@6880 836 __ relocate(relocInfo::internal_pc_type);
aoqi@6880 837 {
aoqi@1 838 #ifndef _LP64
aoqi@6880 839 int save_pc = (int)__ pc() + 12 + NativeCall::return_address_offset;
aoqi@6880 840 __ lui(AT, Assembler::split_high(save_pc));
aoqi@6880 841 __ addiu(AT, AT, Assembler::split_low(save_pc));
aoqi@1 842 #else
aoqi@6880 843 uintptr_t save_pc = (uintptr_t)__ pc() + NativeMovConstReg::instruction_size + 1 * BytesPerInstWord + NativeCall::return_address_offset_long;
aoqi@6880 844 __ li48(AT, save_pc);
aoqi@1 845 #endif
aoqi@6880 846 }
aoqi@6880 847 __ st_ptr(AT, thread, in_bytes(JavaThread::last_Java_pc_offset()));
aoqi@1 848
aoqi@6880 849 // do the call
aoqi@1 850 #ifndef _LP64
aoqi@6880 851 __ lui(T9, Assembler::split_high((int)target));
aoqi@6880 852 __ addiu(T9, T9, Assembler::split_low((int)target));
aoqi@1 853 #else
aoqi@6880 854 __ li48(T9, (intptr_t)target);
aoqi@1 855 #endif
aoqi@6880 856 __ jalr(T9);
aoqi@6880 857 __ delayed()->nop();
aoqi@6880 858 OopMapSet* oop_maps = new OopMapSet();
aoqi@6880 859 oop_maps->add_gc_map(__ offset(), oop_map);
aoqi@1 860
aoqi@6880 861 __ get_thread(thread);
aoqi@1 862
aoqi@6880 863 __ ld_ptr (SP, thread, in_bytes(JavaThread::last_Java_sp_offset()));
fujie@9171 864 __ reset_last_Java_frame(thread, true);
aoqi@6880 865 // discard thread arg
aoqi@6880 866 // check for pending exceptions
aoqi@6880 867 {
aoqi@6880 868 Label L, skip;
aoqi@6880 869 //Label no_deopt;
aoqi@6880 870 __ ld_ptr(AT, thread, in_bytes(Thread::pending_exception_offset()));
aoqi@6880 871 __ beq(AT, R0, L);
aoqi@6880 872 __ delayed()->nop();
aoqi@6880 873 // exception pending => remove activation and forward to exception handler
aoqi@1 874
aoqi@8865 875 __ bne(V0, R0, skip);
aoqi@6880 876 __ delayed()->nop();
aoqi@6880 877 __ jmp(Runtime1::entry_for(Runtime1::forward_exception_id),
aoqi@6880 878 relocInfo::runtime_call_type);
aoqi@6880 879 __ delayed()->nop();
aoqi@6880 880 __ bind(skip);
aoqi@1 881
aoqi@6880 882 // the deopt blob expects exceptions in the special fields of
aoqi@6880 883 // JavaThread, so copy and clear pending exception.
aoqi@1 884
aoqi@6880 885 // load and clear pending exception
aoqi@6880 886 __ ld_ptr(V0, Address(thread,in_bytes(Thread::pending_exception_offset())));
aoqi@6880 887 __ st_ptr(R0, Address(thread, in_bytes(Thread::pending_exception_offset())));
aoqi@1 888
aoqi@6880 889 // check that there is really a valid exception
aoqi@6880 890 __ verify_not_null_oop(V0);
aoqi@6880 891
aoqi@6880 892 // load throwing pc: this is the return address of the stub
aoqi@6880 893 __ ld_ptr(V1, Address(SP, return_off * BytesPerWord));
aoqi@1 894
aoqi@1 895
aoqi@1 896 #ifdef ASSERT
aoqi@6880 897 // check that fields in JavaThread for exception oop and issuing pc are empty
aoqi@6880 898 Label oop_empty;
aoqi@6880 899 __ ld_ptr(AT, Address(thread, in_bytes(JavaThread::exception_oop_offset())));
aoqi@6880 900 __ beq(AT,R0,oop_empty);
aoqi@6880 901 __ delayed()->nop();
aoqi@6880 902 __ stop("exception oop must be empty");
aoqi@6880 903 __ bind(oop_empty);
aoqi@1 904
aoqi@6880 905 Label pc_empty;
aoqi@6880 906 __ ld_ptr(AT, Address(thread, in_bytes(JavaThread::exception_pc_offset())));
aoqi@6880 907 __ beq(AT,R0,pc_empty);
aoqi@6880 908 __ delayed()->nop();
aoqi@6880 909 __ stop("exception pc must be empty");
aoqi@6880 910 __ bind(pc_empty);
aoqi@1 911 #endif
aoqi@1 912
aoqi@6880 913 // store exception oop and throwing pc to JavaThread
aoqi@6880 914 __ st_ptr(V0,Address(thread, in_bytes(JavaThread::exception_oop_offset())));
aoqi@6880 915 __ st_ptr(V1,Address(thread, in_bytes(JavaThread::exception_pc_offset())));
aoqi@1 916
aoqi@6880 917 restore_live_registers(sasm);
aoqi@1 918
aoqi@6880 919 __ leave();
aoqi@1 920
aoqi@6880 921 // Forward the exception directly to deopt blob. We can blow no
aoqi@6880 922 // registers and must leave throwing pc on the stack. A patch may
aoqi@6880 923 // have values live in registers so the entry point with the
aoqi@6880 924 // exception in tls.
aoqi@6880 925 __ jmp(deopt_blob->unpack_with_exception_in_tls(), relocInfo::runtime_call_type);
aoqi@6880 926 __ delayed()->nop();
aoqi@1 927
aoqi@6880 928 __ bind(L);
aoqi@6880 929 }
aoqi@1 930
aoqi@6880 931 // Runtime will return true if the nmethod has been deoptimized during
aoqi@6880 932 // the patching process. In that case we must do a deopt reexecute instead.
aoqi@1 933
aoqi@6880 934 Label reexecuteEntry, cont;
aoqi@1 935
aoqi@6880 936 __ beq(V0, R0, cont); // have we deoptimized?
aoqi@6880 937 __ delayed()->nop();
aoqi@1 938
aoqi@6880 939 // Will reexecute. Proper return address is already on the stack we just restore
aoqi@6880 940 // registers, pop all of our frame but the return address and jump to the deopt blob
aoqi@6880 941 restore_live_registers(sasm);
aoqi@1 942
aoqi@6880 943 __ leave();
aoqi@6880 944 __ jmp(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type);
aoqi@6880 945 __ delayed()->nop();
aoqi@1 946
aoqi@6880 947 __ bind(cont);
aoqi@6880 948 restore_live_registers(sasm);
aoqi@1 949
aoqi@6880 950 __ leave();
aoqi@6880 951 __ jr(RA);
aoqi@6880 952 __ delayed()->nop();
aoqi@6880 953
aoqi@6880 954 return oop_maps;
aoqi@1 955 }
aoqi@1 956
aoqi@1 957
aoqi@1 958 OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
aoqi@6880 959 // for better readability
aoqi@6880 960 const bool must_gc_arguments = true;
aoqi@6880 961 const bool dont_gc_arguments = false;
aoqi@1 962
aoqi@1 963
aoqi@6880 964 // default value; overwritten for some optimized stubs that are called
aoqi@6880 965 // from methods that do not use the fpu
aoqi@6880 966 bool save_fpu_registers = true;
aoqi@1 967
aoqi@1 968
aoqi@6880 969 // stub code & info for the different stubs
aoqi@6880 970 OopMapSet* oop_maps = NULL;
aoqi@1 971
aoqi@1 972 switch (id) {
aoqi@1 973 case forward_exception_id:
aoqi@1 974 {
aoqi@8865 975 oop_maps = generate_handle_exception(id, sasm);
aoqi@8865 976 __ leave();
aoqi@8865 977 __ jr(RA);
aoqi@8865 978 __ delayed()->nop();
aoqi@1 979 }
aoqi@1 980 break;
aoqi@1 981
aoqi@1 982 case new_instance_id:
aoqi@1 983 case fast_new_instance_id:
aoqi@1 984 case fast_new_instance_init_check_id:
aoqi@1 985 {
aoqi@1 986 Register klass = A4; // Incoming
aoqi@1 987 Register obj = V0; // Result
aoqi@1 988
aoqi@1 989 if (id == new_instance_id) {
aoqi@1 990 __ set_info("new_instance", dont_gc_arguments);
aoqi@1 991 } else if (id == fast_new_instance_id) {
aoqi@1 992 __ set_info("fast new_instance", dont_gc_arguments);
aoqi@1 993 } else {
aoqi@1 994 assert(id == fast_new_instance_init_check_id, "bad StubID");
aoqi@1 995 __ set_info("fast new_instance init check", dont_gc_arguments);
aoqi@1 996 }
aoqi@1 997
aoqi@6880 998 if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id)
aoqi@1 999 && UseTLAB && FastTLABRefill) {
aoqi@1 1000 Label slow_path;
aoqi@1 1001 Register obj_size = T0;
aoqi@1 1002 Register t1 = T2;
aoqi@1 1003 Register t2 = T3;
aoqi@1 1004 assert_different_registers(klass, obj, obj_size, t1, t2);
aoqi@1 1005 if (id == fast_new_instance_init_check_id) {
aoqi@1 1006 // make sure the klass is initialized
aoqi@8865 1007 __ ld_ptr(AT, Address(klass, in_bytes(InstanceKlass::init_state_offset())));
aoqi@1 1008 __ move(t1, InstanceKlass::fully_initialized);
aoqi@1 1009 __ bne(AT, t1, slow_path);
aoqi@1 1010 __ delayed()->nop();
aoqi@1 1011 }
aoqi@1 1012 #ifdef ASSERT
aoqi@1 1013 // assert object can be fast path allocated
aoqi@1 1014 {
aoqi@1 1015 Label ok, not_ok;
aoqi@1 1016 __ lw(obj_size, klass, in_bytes(Klass::layout_helper_offset()));
aoqi@1 1017 __ blez(obj_size, not_ok);
aoqi@1 1018 __ delayed()->nop();
aoqi@1 1019 __ andi(t1 , obj_size, Klass::_lh_instance_slow_path_bit);
aoqi@1 1020 __ beq(t1, R0, ok);
aoqi@1 1021 __ delayed()->nop();
aoqi@1 1022 __ bind(not_ok);
aoqi@1 1023 __ stop("assert(can be fast path allocated)");
aoqi@1 1024 __ should_not_reach_here();
aoqi@1 1025 __ bind(ok);
aoqi@1 1026 }
aoqi@1 1027 #endif // ASSERT
aoqi@1 1028 // if we got here then the TLAB allocation failed, so try
aoqi@1 1029 // refilling the TLAB or allocating directly from eden.
aoqi@6880 1030
aoqi@1 1031 Label retry_tlab, try_eden;
aoqi@9459 1032 __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy A4 (klass)
aoqi@6880 1033
aoqi@1 1034 __ bind(retry_tlab);
aoqi@6880 1035
aoqi@1 1036 // get the instance size
aoqi@1 1037 __ lw(obj_size, klass, in_bytes(Klass::layout_helper_offset()));
aoqi@1 1038 __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path);
aoqi@1 1039 __ initialize_object(obj, klass, obj_size, 0, t1, t2);
aoqi@1 1040 __ verify_oop(obj);
aoqi@1 1041 __ jr(RA);
aoqi@1 1042 __ delayed()->nop();
aoqi@6880 1043
wangxue@9205 1044 #ifndef OPT_THREAD
wangxue@9205 1045 const Register thread = T8;
wangxue@9205 1046 __ get_thread(thread);
wangxue@9205 1047 #else
wangxue@9205 1048 const Register thread = TREG;
wangxue@9205 1049 #endif
wangxue@9205 1050
aoqi@1 1051 __ bind(try_eden);
aoqi@1 1052
aoqi@6880 1053 // get the instance size
aoqi@1 1054 __ lw(obj_size, klass, in_bytes(Klass::layout_helper_offset()));
aoqi@1 1055 __ eden_allocate(obj, obj_size, 0, t1, t2, slow_path);
wangxue@9205 1056 __ incr_allocated_bytes(thread, obj_size, 0);
wangxue@9205 1057
aoqi@1 1058 __ initialize_object(obj, klass, obj_size, 0, t1, t2);
aoqi@1 1059 __ verify_oop(obj);
aoqi@1 1060 __ jr(RA);
aoqi@1 1061 __ delayed()->nop();
aoqi@6880 1062
aoqi@1 1063 __ bind(slow_path);
aoqi@1 1064 }
aoqi@1 1065 __ enter();
aoqi@1 1066 OopMap* map = save_live_registers(sasm, 0);
aoqi@1 1067 int call_offset = __ call_RT(obj, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);
aoqi@1 1068 oop_maps = new OopMapSet();
aoqi@1 1069 oop_maps->add_gc_map(call_offset, map);
aoqi@1 1070 restore_live_registers_except_V0(sasm);
aoqi@1 1071 __ verify_oop(obj);
aoqi@1 1072 __ leave();
aoqi@1 1073 __ jr(RA);
aoqi@1 1074 __ delayed()->nop();
aoqi@6880 1075
aoqi@1 1076 // V0: new instance
aoqi@1 1077 }
aoqi@1 1078 break;
aoqi@1 1079
aoqi@1 1080
aoqi@1 1081 #ifdef TIERED
aoqi@1 1082 //FIXME, I hava no idea which register to use
aoqi@1 1083 case counter_overflow_id:
aoqi@1 1084 {
aoqi@1 1085 #ifndef _LP64
aoqi@1 1086 Register bci = T5;
aoqi@1 1087 #else
aoqi@1 1088 Register bci = A5;
aoqi@1 1089 #endif
aoqi@8865 1090 Register method = AT;
aoqi@1 1091 __ enter();
aoqi@1 1092 OopMap* map = save_live_registers(sasm, 0);
aoqi@1 1093 // Retrieve bci
aoqi@9459 1094 __ lw(bci, Address(FP, 2*BytesPerWord));
aoqi@8865 1095 __ ld(method, Address(FP, 3*BytesPerWord));
aoqi@8865 1096 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), bci, method);
aoqi@1 1097 oop_maps = new OopMapSet();
aoqi@1 1098 oop_maps->add_gc_map(call_offset, map);
aoqi@1 1099 restore_live_registers(sasm);
aoqi@1 1100 __ leave();
aoqi@6880 1101 __ jr(RA);
aoqi@6880 1102 __ delayed()->nop();
aoqi@1 1103 }
aoqi@1 1104 break;
aoqi@1 1105 #endif // TIERED
aoqi@1 1106
aoqi@1 1107
aoqi@1 1108
aoqi@1 1109 case new_type_array_id:
aoqi@1 1110 case new_object_array_id:
aoqi@6880 1111 {
aoqi@6880 1112 // i use T2 as length register, T4 as klass register, V0 as result register.
aoqi@1 1113 // MUST accord with NewTypeArrayStub::emit_code, NewObjectArrayStub::emit_code
aoqi@1 1114 Register length = T2; // Incoming
aoqi@1 1115 #ifndef _LP64
aoqi@1 1116 Register klass = T4; // Incoming
aoqi@1 1117 #else
aoqi@1 1118 Register klass = A4; // Incoming
aoqi@1 1119 #endif
aoqi@1 1120 Register obj = V0; // Result
aoqi@6880 1121
aoqi@1 1122 if (id == new_type_array_id) {
aoqi@1 1123 __ set_info("new_type_array", dont_gc_arguments);
aoqi@1 1124 } else {
aoqi@1 1125 __ set_info("new_object_array", dont_gc_arguments);
aoqi@1 1126 }
aoqi@6880 1127
aoqi@1 1128 if (UseTLAB && FastTLABRefill) {
aoqi@1 1129 Register arr_size = T0;
aoqi@6880 1130 Register t1 = T1;
aoqi@1 1131 Register t2 = T3;
aoqi@1 1132 Label slow_path;
aoqi@1 1133 assert_different_registers(length, klass, obj, arr_size, t1, t2);
aoqi@6880 1134
aoqi@1 1135 // check that array length is small enough for fast path
aoqi@1 1136 __ move(AT, C1_MacroAssembler::max_array_allocation_length);
aoqi@1 1137 __ sltu(AT, AT, length);
aoqi@1 1138 __ bne(AT, R0, slow_path);
aoqi@1 1139 __ delayed()->nop();
aoqi@1 1140
aoqi@1 1141 // if we got here then the TLAB allocation failed, so try
aoqi@1 1142 // refilling the TLAB or allocating directly from eden.
aoqi@1 1143 Label retry_tlab, try_eden;
aoqi@6880 1144 //T0,T1,T5,T8 have changed!
aoqi@1 1145 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves T2 & T4
aoqi@6880 1146
aoqi@1 1147 __ bind(retry_tlab);
aoqi@6880 1148
aoqi@1 1149 // get the allocation size: (length << (layout_helper & 0x1F)) + header_size
aoqi@6880 1150 __ lw(t1, klass, in_bytes(Klass::layout_helper_offset()));
aoqi@1 1151 __ andi(AT, t1, 0x1f);
aoqi@1 1152 __ sllv(arr_size, length, AT);
aoqi@1 1153 __ srl(t1, t1, Klass::_lh_header_size_shift);
aoqi@1 1154 __ andi(t1, t1, Klass::_lh_header_size_mask);
aoqi@1 1155 __ add(arr_size, t1, arr_size);
aoqi@1 1156 __ addi(arr_size, arr_size, MinObjAlignmentInBytesMask); // align up
aoqi@1 1157 __ move(AT, ~MinObjAlignmentInBytesMask);
aoqi@1 1158 __ andr(arr_size, arr_size, AT);
aoqi@6880 1159
aoqi@6880 1160
aoqi@1 1161 __ tlab_allocate(obj, arr_size, 0, t1, t2, slow_path); // preserves arr_size
aoqi@1 1162 __ initialize_header(obj, klass, length,t1,t2);
aoqi@6880 1163 __ lbu(t1, Address(klass, in_bytes(Klass::layout_helper_offset())
aoqi@1 1164 + (Klass::_lh_header_size_shift / BitsPerByte)));
aoqi@1 1165 assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise");
aoqi@1 1166 assert(Klass::_lh_header_size_mask <= 0xFF, "bytewise");
aoqi@1 1167 __ andi(t1, t1, Klass::_lh_header_size_mask);
aoqi@1 1168 __ sub(arr_size, arr_size, t1); // body length
aoqi@1 1169 __ add(t1, t1, obj); // body start
aoqi@1 1170 __ initialize_body(t1, arr_size, 0, t2);
aoqi@1 1171 __ verify_oop(obj);
aoqi@1 1172 __ jr(RA);
aoqi@1 1173 __ delayed()->nop();
aoqi@6880 1174
wangxue@9205 1175 #ifndef OPT_THREAD
wangxue@9205 1176 const Register thread = T8;
wangxue@9205 1177 __ get_thread(thread);
wangxue@9205 1178 #else
wangxue@9205 1179 const Register thread = TREG;
wangxue@9205 1180 #endif
wangxue@9205 1181
aoqi@1 1182 __ bind(try_eden);
aoqi@1 1183 // get the allocation size: (length << (layout_helper & 0x1F)) + header_size
aoqi@6880 1184 __ lw(t1, klass, in_bytes(Klass::layout_helper_offset()));
aoqi@1 1185 __ andi(AT, t1, 0x1f);
aoqi@1 1186 __ sllv(arr_size, length, AT);
aoqi@1 1187 __ srl(t1, t1, Klass::_lh_header_size_shift);
aoqi@1 1188 __ andi(t1, t1, Klass::_lh_header_size_mask);
aoqi@1 1189 __ add(arr_size, t1, arr_size);
aoqi@1 1190 __ addi(arr_size, arr_size, MinObjAlignmentInBytesMask); // align up
aoqi@1 1191 __ move(AT, ~MinObjAlignmentInBytesMask);
aoqi@1 1192 __ andr(arr_size, arr_size, AT);
aoqi@1 1193 __ eden_allocate(obj, arr_size, 0, t1, t2, slow_path); // preserves arr_size
wangxue@9205 1194 __ incr_allocated_bytes(thread, arr_size, 0);
wangxue@9205 1195
aoqi@1 1196 __ initialize_header(obj, klass, length,t1,t2);
aoqi@1 1197 __ lbu(t1, Address(klass, in_bytes(Klass::layout_helper_offset())
aoqi@1 1198 + (Klass::_lh_header_size_shift / BitsPerByte)));
aoqi@1 1199 __ andi(t1, t1, Klass::_lh_header_size_mask);
aoqi@1 1200 __ sub(arr_size, arr_size, t1); // body length
aoqi@1 1201 __ add(t1, t1, obj); // body start
aoqi@6880 1202
aoqi@1 1203 __ initialize_body(t1, arr_size, 0, t2);
aoqi@1 1204 __ verify_oop(obj);
aoqi@1 1205 __ jr(RA);
aoqi@1 1206 __ delayed()->nop();
aoqi@1 1207 __ bind(slow_path);
aoqi@1 1208 }
aoqi@6880 1209
aoqi@6880 1210
aoqi@1 1211 __ enter();
aoqi@1 1212 OopMap* map = save_live_registers(sasm, 0);
aoqi@1 1213 int call_offset;
aoqi@1 1214 if (id == new_type_array_id) {
aoqi@6880 1215 call_offset = __ call_RT(obj, noreg,
aoqi@1 1216 CAST_FROM_FN_PTR(address, new_type_array), klass, length);
aoqi@1 1217 } else {
aoqi@6880 1218 call_offset = __ call_RT(obj, noreg,
aoqi@1 1219 CAST_FROM_FN_PTR(address, new_object_array), klass, length);
aoqi@1 1220 }
aoqi@6880 1221
aoqi@1 1222 oop_maps = new OopMapSet();
aoqi@1 1223 oop_maps->add_gc_map(call_offset, map);
aoqi@1 1224 restore_live_registers_except_V0(sasm);
aoqi@1 1225 __ verify_oop(obj);
aoqi@6880 1226 __ leave();
aoqi@1 1227 __ jr(RA);
aoqi@1 1228 __ delayed()->nop();
aoqi@1 1229 }
aoqi@1 1230 break;
aoqi@1 1231
aoqi@1 1232 case new_multi_array_id:
aoqi@6880 1233 {
aoqi@6880 1234 StubFrame f(sasm, "new_multi_array", dont_gc_arguments);
aoqi@6880 1235 //refer to c1_LIRGenerate_mips.cpp:do_NewmultiArray
aoqi@6880 1236 // V0: klass
aoqi@6880 1237 // T2: rank
aoqi@6880 1238 // T0: address of 1st dimension
aoqi@6880 1239 //__ call_RT(V0, noreg, CAST_FROM_FN_PTR(address, new_multi_array), A1, A2, A3);
aoqi@6880 1240 //OopMap* map = save_live_registers(sasm, 4);
aoqi@6880 1241 OopMap* map = save_live_registers(sasm, 0);
aoqi@6880 1242 int call_offset = __ call_RT(V0, noreg, CAST_FROM_FN_PTR(address, new_multi_array),
aoqi@6880 1243 V0,T2,T0);
aoqi@6880 1244 oop_maps = new OopMapSet();
aoqi@6880 1245 oop_maps->add_gc_map(call_offset, map);
aoqi@6880 1246 //FIXME
aoqi@6880 1247 restore_live_registers_except_V0(sasm);
aoqi@6880 1248 // V0: new multi array
aoqi@6880 1249 __ verify_oop(V0);
aoqi@1 1250 }
aoqi@1 1251 break;
aoqi@1 1252
aoqi@6880 1253
aoqi@1 1254 case register_finalizer_id:
aoqi@1 1255 {
aoqi@6880 1256 __ set_info("register_finalizer", dont_gc_arguments);
aoqi@1 1257
aoqi@6880 1258 // The object is passed on the stack and we haven't pushed a
aoqi@6880 1259 // frame yet so it's one work away from top of stack.
aoqi@1 1260 //reference to LIRGenerator::do_RegisterFinalizer, call_runtime
aoqi@6880 1261 __ move(V0, A0);
aoqi@6880 1262 __ verify_oop(V0);
aoqi@6880 1263 // load the klass and check the has finalizer flag
aoqi@6880 1264 Label register_finalizer;
aoqi@1 1265 #ifndef _LP64
aoqi@6880 1266 Register t = T5;
aoqi@1 1267 #else
aoqi@6880 1268 Register t = A5;
aoqi@1 1269 #endif
aoqi@6880 1270 //__ ld_ptr(t, Address(V0, oopDesc::klass_offset_in_bytes()));
aoqi@6880 1271 __ load_klass(t, V0);
aoqi@6880 1272 __ lw(t, Address(t, Klass::access_flags_offset()));
aoqi@6880 1273 __ move(AT, JVM_ACC_HAS_FINALIZER);
aoqi@6880 1274 __ andr(AT, AT, t);
aoqi@1 1275
aoqi@6880 1276 __ bne(AT, R0, register_finalizer);
aoqi@6880 1277 __ delayed()->nop();
aoqi@6880 1278 __ jr(RA);
aoqi@6880 1279 __ delayed()->nop();
aoqi@6880 1280 __ bind(register_finalizer);
aoqi@6880 1281 __ enter();
aoqi@6880 1282 OopMap* map = save_live_registers(sasm, 0 /*num_rt_args */);
aoqi@6880 1283
aoqi@6880 1284 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address,
aoqi@6880 1285 SharedRuntime::register_finalizer), V0);
aoqi@6880 1286 oop_maps = new OopMapSet();
aoqi@1 1287 oop_maps->add_gc_map(call_offset, map);
aoqi@1 1288
aoqi@6880 1289 // Now restore all the live registers
aoqi@6880 1290 restore_live_registers(sasm);
aoqi@1 1291
aoqi@6880 1292 __ leave();
aoqi@6880 1293 __ jr(RA);
aoqi@6880 1294 __ delayed()->nop();
aoqi@1 1295 }
aoqi@1 1296 break;
aoqi@1 1297
aoqi@6880 1298 // case range_check_failed_id:
aoqi@6880 1299 case throw_range_check_failed_id:
aoqi@8865 1300 {
aoqi@8865 1301 StubFrame f(sasm, "range_check_failed", dont_gc_arguments);
aoqi@6880 1302 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address,
aoqi@1 1303 throw_range_check_exception),true);
aoqi@1 1304 }
aoqi@1 1305 break;
aoqi@1 1306
aoqi@1 1307 case throw_index_exception_id:
aoqi@6880 1308 {
aoqi@6880 1309 // i use A1 as the index register, for this will be the first argument, see call_RT
aoqi@6880 1310 StubFrame f(sasm, "index_range_check_failed", dont_gc_arguments);
aoqi@6880 1311 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address,
aoqi@6880 1312 throw_index_exception), true);
aoqi@1 1313 }
aoqi@1 1314 break;
aoqi@1 1315
aoqi@6880 1316 case throw_div0_exception_id:
aoqi@1 1317 { StubFrame f(sasm, "throw_div0_exception", dont_gc_arguments);
aoqi@6880 1318 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address,
aoqi@6880 1319 throw_div0_exception), false);
aoqi@1 1320 }
aoqi@1 1321 break;
aoqi@1 1322
aoqi@6880 1323 case throw_null_pointer_exception_id:
aoqi@8865 1324 {
aoqi@8865 1325 StubFrame f(sasm, "throw_null_pointer_exception", dont_gc_arguments);
aoqi@6880 1326 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address,
aoqi@6880 1327 throw_null_pointer_exception),false);
aoqi@1 1328 }
aoqi@1 1329 break;
aoqi@1 1330
aoqi@8865 1331 case handle_exception_nofpu_id:
aoqi@6880 1332 save_fpu_registers = false;
aoqi@6880 1333 // fall through
aoqi@6880 1334 case handle_exception_id:
aoqi@6880 1335 {
aoqi@6880 1336 StubFrame f(sasm, "handle_exception", dont_gc_arguments);
aoqi@6880 1337 //OopMap* oop_map = save_live_registers(sasm, 1, save_fpu_registers);
aoqi@6880 1338 oop_maps = generate_handle_exception(id, sasm);
aoqi@6880 1339 }
aoqi@6880 1340 break;
aoqi@8865 1341 case handle_exception_from_callee_id:
aoqi@8865 1342 {
aoqi@8865 1343 StubFrame f(sasm, "handle_exception_from_callee", dont_gc_arguments);
aoqi@8865 1344 oop_maps = generate_handle_exception(id, sasm);
aoqi@8865 1345 }
aoqi@8865 1346 break;
aoqi@6880 1347 case unwind_exception_id:
aoqi@6880 1348 {
aoqi@6880 1349 __ set_info("unwind_exception", dont_gc_arguments);
aoqi@6880 1350 generate_unwind_exception(sasm);
aoqi@6880 1351 }
aoqi@6880 1352 break;
aoqi@1 1353
aoqi@1 1354
aoqi@6880 1355 case throw_array_store_exception_id:
aoqi@8865 1356 {
aoqi@8865 1357 StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments);
aoqi@6880 1358 // tos + 0: link
aoqi@6880 1359 // + 1: return address
aoqi@6880 1360 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address,
wangxue@9248 1361 throw_array_store_exception), true);
aoqi@6880 1362 }
aoqi@6880 1363 break;
aoqi@1 1364
aoqi@6880 1365 case throw_class_cast_exception_id:
aoqi@8865 1366 {
aoqi@8865 1367 StubFrame f(sasm, "throw_class_cast_exception", dont_gc_arguments);
aoqi@6880 1368 oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address,
aoqi@8865 1369 throw_class_cast_exception), true);
aoqi@6880 1370 }
aoqi@6880 1371 break;
aoqi@1 1372
aoqi@6880 1373 case throw_incompatible_class_change_error_id:
aoqi@6880 1374 {
aoqi@8865 1375 StubFrame f(sasm, "throw_incompatible_class_cast_exception", dont_gc_arguments);
aoqi@8865 1376 oop_maps = generate_exception_throw(sasm,
aoqi@8865 1377 CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false);
aoqi@6880 1378 }
aoqi@6880 1379 break;
aoqi@1 1380
aoqi@6880 1381 case slow_subtype_check_id:
aoqi@6880 1382 {
aoqi@6880 1383 //actually , We do not use it
aoqi@6880 1384 // A0:klass_RInfo sub
aoqi@6880 1385 // A1:k->encoding() super
aoqi@6880 1386 __ set_info("slow_subtype_check", dont_gc_arguments);
aoqi@6880 1387 __ st_ptr(T0, SP, (-1) * wordSize);
aoqi@6880 1388 __ st_ptr(T1, SP, (-2) * wordSize);
aoqi@6880 1389 __ addiu(SP, SP, (-2) * wordSize);
aoqi@1 1390
fujie@9132 1391 Label miss;
fujie@9132 1392 __ check_klass_subtype_slow_path(A0, A1, T0, T1, NULL, &miss);
aoqi@1 1393
aoqi@6880 1394 __ addiu(V0, R0, 1);
aoqi@6880 1395 __ addiu(SP, SP, 2 * wordSize);
aoqi@6880 1396 __ ld_ptr(T0, SP, (-1) * wordSize);
aoqi@6880 1397 __ ld_ptr(T1, SP, (-2) * wordSize);
aoqi@6880 1398 __ jr(RA);
aoqi@6880 1399 __ delayed()->nop();
aoqi@1 1400
aoqi@1 1401
aoqi@6880 1402 __ bind(miss);
aoqi@6880 1403 __ move(V0, R0);
aoqi@6880 1404 __ addiu(SP, SP, 2 * wordSize);
aoqi@6880 1405 __ ld_ptr(T0, SP, (-1) * wordSize);
aoqi@6880 1406 __ ld_ptr(T1, SP, (-2) * wordSize);
aoqi@6880 1407 __ jr(RA);
aoqi@6880 1408 __ delayed()->nop();
aoqi@6880 1409 }
aoqi@6880 1410 break;
aoqi@1 1411
aoqi@1 1412 case monitorenter_nofpu_id:
aoqi@1 1413 save_fpu_registers = false;// fall through
aoqi@1 1414
aoqi@6880 1415 case monitorenter_id:
aoqi@1 1416 {
aoqi@6880 1417 StubFrame f(sasm, "monitorenter", dont_gc_arguments);
aoqi@6880 1418 OopMap* map = save_live_registers(sasm, 0, save_fpu_registers);
aoqi@1 1419
aoqi@6880 1420 f.load_argument(1, V0); // V0: object
aoqi@1 1421 #ifndef _LP64
aoqi@6880 1422 f.load_argument(0, T6); // T6: lock address
aoqi@6880 1423 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address,
aoqi@6880 1424 monitorenter), V0, T6);
aoqi@1 1425 #else
aoqi@6880 1426 f.load_argument(0, A6); // A6: lock address
aoqi@6880 1427 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address,
aoqi@6880 1428 monitorenter), V0, A6);
aoqi@1 1429 #endif
aoqi@1 1430
aoqi@6880 1431 oop_maps = new OopMapSet();
aoqi@6880 1432 oop_maps->add_gc_map(call_offset, map);
aoqi@6880 1433 restore_live_registers(sasm, save_fpu_registers);
aoqi@6880 1434 }
aoqi@6880 1435 break;
aoqi@1 1436
aoqi@6880 1437 case monitorexit_nofpu_id:
aoqi@6880 1438 save_fpu_registers = false;
aoqi@6880 1439 // fall through
aoqi@6880 1440 case monitorexit_id:
aoqi@6880 1441 {
aoqi@1 1442 StubFrame f(sasm, "monitorexit", dont_gc_arguments);
aoqi@1 1443 OopMap* map = save_live_registers(sasm, 0, save_fpu_registers);
aoqi@6880 1444
aoqi@1 1445 #ifndef _LP64
aoqi@9459 1446 f.load_argument(0, T6); // T6: lock address
aoqi@1 1447 #else
aoqi@1 1448 f.load_argument(0, A6); // A6: lock address
aoqi@1 1449 #endif
aoqi@1 1450 // note: really a leaf routine but must setup last java sp
aoqi@1 1451 // => use call_RT for now (speed can be improved by
aoqi@1 1452 // doing last java sp setup manually)
aoqi@1 1453 #ifndef _LP64
aoqi@6880 1454 int call_offset = __ call_RT(noreg, noreg,
aoqi@6880 1455 CAST_FROM_FN_PTR(address, monitorexit), T6);
aoqi@1 1456 #else
aoqi@6880 1457 int call_offset = __ call_RT(noreg, noreg,
aoqi@6880 1458 CAST_FROM_FN_PTR(address, monitorexit), A6);
aoqi@1 1459 #endif
aoqi@1 1460 oop_maps = new OopMapSet();
aoqi@1 1461 oop_maps->add_gc_map(call_offset, map);
aoqi@1 1462 restore_live_registers(sasm, save_fpu_registers);
aoqi@6880 1463
aoqi@1 1464 }
aoqi@1 1465 break;
aoqi@6880 1466 // case init_check_patching_id:
aoqi@6880 1467 case access_field_patching_id:
aoqi@6880 1468 {
aoqi@1 1469 StubFrame f(sasm, "access_field_patching", dont_gc_arguments);
aoqi@1 1470 // we should set up register map
aoqi@1 1471 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching));
aoqi@1 1472
aoqi@1 1473 }
aoqi@1 1474 break;
aoqi@1 1475
aoqi@6880 1476 case load_klass_patching_id:
aoqi@6880 1477 {
aoqi@6880 1478 StubFrame f(sasm, "load_klass_patching", dont_gc_arguments);
aoqi@6880 1479 // we should set up register map
aoqi@6880 1480 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address,
aoqi@6880 1481 move_klass_patching));
aoqi@6880 1482 }
aoqi@6880 1483 break;
aoqi@8865 1484 case load_mirror_patching_id:
aoqi@8865 1485 {
aoqi@8865 1486 StubFrame f(sasm, "load_mirror_patching" , dont_gc_arguments);
aoqi@8865 1487 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching));
aoqi@8865 1488 }
aoqi@6880 1489 break;
aoqi@8865 1490
aoqi@8865 1491 case load_appendix_patching_id:
aoqi@8865 1492 {
aoqi@8865 1493 StubFrame f(sasm, "load_appendix_patching", dont_gc_arguments);
aoqi@8865 1494 // we should set up register map
aoqi@8865 1495 oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching));
aoqi@8865 1496 }
aoqi@8865 1497 break;
aoqi@8865 1498
aoqi@6880 1499 case dtrace_object_alloc_id:
aoqi@6880 1500 {
aoqi@6880 1501 // V0:object
aoqi@6880 1502 StubFrame f(sasm, "dtrace_object_alloc", dont_gc_arguments);
aoqi@6880 1503 // we can't gc here so skip the oopmap but make sure that all
aoqi@6880 1504 // the live registers get saved.
aoqi@6880 1505 save_live_registers(sasm, 0);
aoqi@1 1506
aoqi@6880 1507 __ push_reg(V0);
aoqi@8865 1508 __ move(A0, V0);
aoqi@6880 1509 __ call(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
aoqi@6880 1510 relocInfo::runtime_call_type);
fujie@9134 1511 __ delayed()->nop();
aoqi@6880 1512 __ super_pop(V0);
aoqi@1 1513
aoqi@6880 1514 restore_live_registers(sasm);
aoqi@6880 1515 }
aoqi@6880 1516 break;
aoqi@8865 1517
aoqi@6880 1518 case fpu2long_stub_id:
aoqi@6880 1519 {
aoqi@8865 1520 //FIXME, I hava no idea how to port this
aoqi@8865 1521 //tty->print_cr("fpu2long_stub_id unimplemented yet!");
aoqi@6880 1522 }
aoqi@8865 1523 break;
aoqi@8865 1524
aoqi@8865 1525 case deoptimize_id:
aoqi@8865 1526 {
aoqi@8865 1527 StubFrame f(sasm, "deoptimize", dont_gc_arguments);
aoqi@8865 1528 const int num_rt_args = 1; // thread
aoqi@8865 1529 OopMap* oop_map = save_live_registers(sasm, num_rt_args);
aoqi@8865 1530 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
aoqi@8865 1531 oop_maps = new OopMapSet();
aoqi@8865 1532 oop_maps->add_gc_map(call_offset, oop_map);
aoqi@8865 1533 restore_live_registers(sasm);
aoqi@8865 1534 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
aoqi@8865 1535 assert(deopt_blob != NULL, "deoptimization blob must have been created");
aoqi@8865 1536 __ leave();
aoqi@8865 1537 __ jmp(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type);
zhaixiang@9135 1538 __ delayed()->nop();
aoqi@8865 1539 }
aoqi@8865 1540 break;
aoqi@8865 1541
aoqi@8865 1542 case predicate_failed_trap_id:
aoqi@8865 1543 {
aoqi@8865 1544 StubFrame f(sasm, "predicate_failed_trap", dont_gc_arguments);
aoqi@8865 1545
aoqi@8865 1546 OopMap* map = save_live_registers(sasm, 1);
aoqi@8865 1547
aoqi@8865 1548 int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
aoqi@8865 1549 oop_maps = new OopMapSet();
aoqi@8865 1550 oop_maps->add_gc_map(call_offset, map);
aoqi@8865 1551 restore_live_registers(sasm);
aoqi@8865 1552 __ leave();
aoqi@8865 1553 DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
aoqi@8865 1554 assert(deopt_blob != NULL, "deoptimization blob must have been created");
aoqi@8865 1555
aoqi@8865 1556 __ jmp(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type);
zhaixiang@9135 1557 __ delayed()->nop();
aoqi@8865 1558 }
aoqi@8865 1559 break;
aoqi@8865 1560
aoqi@6880 1561 default:
aoqi@8865 1562 {
aoqi@8865 1563 StubFrame f(sasm, "unimplemented entry", dont_gc_arguments);
aoqi@6880 1564 __ move(A1, (int)id);
aoqi@6880 1565 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), A1);
aoqi@6880 1566 __ should_not_reach_here();
aoqi@6880 1567 }
aoqi@6880 1568 break;
aoqi@6880 1569 }
aoqi@6880 1570 return oop_maps;
aoqi@1 1571 }
aoqi@1 1572
aoqi@1 1573 #undef __
aoqi@1 1574
aoqi@1 1575 const char *Runtime1::pd_name_for_address(address entry) {
aoqi@1 1576 return "<unknown function>";
aoqi@1 1577 }

mercurial