void InterpreterStubs::generate_current_thread_to_primordial() { Segment seg(this, code_segment, "Current thread to primordial"); bind_global("current_thread_to_primordial"); comment("Set up global pointer, as we can be called from C code"); ldr_gp_base(gp); bind_global("current_thread_to_primordial_fast"); // We're never going to return to this thread, so it doesn't matter if // it doesn't look like a stopped Java thread anymore. get_primordial_sp(sp); comment("restore permanent registers (including return address)"); ldr(lr, imm_index(sp, BytesPerWord, post_indexed)); ldmfd(sp, range(r3, r11), writeback); jmpx(lr); if (GenerateDebugAssembly) { bind_local("interpreter_bkpt"); get_gp_bytecode_counter(tmp3); add(tmp3, tmp3, imm(1)); set_gp_bytecode_counter(tmp3); mov(pc, reg(tmp0)); } #if ENABLE_XSCALE_WMMX_TIMER_TICK && !ENABLE_TIMER_THREAD // set timer_tick from WMMX wCASF register comment("wmmx_set_timer_tick to set timer_tick from WMMX register"); bind_global("wmmx_set_timer_tick"); // tmrc(r2, wCASF); define_long(0xEE132110); mvn(r3, imm(4) ); andr(r2, r2, reg(r3) ); // tmcr(wCASF, r2); define_long(0xEE032110); jmpx(lr); // clear timer_tick from WMMX wCASF register comment("wmmx_set_timer_tick to clear timer_tick from WMMX register"); bind_global("wmmx_clear_timer_tick"); define_long(0xEE100060); // wcmpgtub(wR0, wR0, wR0); jmpx(lr); #endif // ENABLE_XSCALE_WMMX_TIMER_TICK && !ENABLE_TIMER_THREAD }
address AbstractInterpreterGenerator::generate_slow_signature_handler() { address entry = __ pc(); __ andr(esp, esp, -16); __ mov(c_rarg3, esp); // rmethod // rlocals // c_rarg3: first stack arg - wordSize // adjust sp __ sub(sp, c_rarg3, 18 * wordSize); __ str(lr, Address(__ pre(sp, -2 * wordSize))); __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::slow_signature_handler), rmethod, rlocals, c_rarg3); // r0: result handler // Stack layout: // rsp: return address <- sp // 1 garbage // 8 integer args (if static first is unused) // 1 float/double identifiers // 8 double args // stack args <- esp // garbage // expression stack bottom // bcp (NULL) // ... // Restore LR __ ldr(lr, Address(__ post(sp, 2 * wordSize))); // Do FP first so we can use c_rarg3 as temp __ ldrw(c_rarg3, Address(sp, 9 * wordSize)); // float/double identifiers for (int i = 0; i < Argument::n_float_register_parameters_c; i++) { const FloatRegister r = as_FloatRegister(i); Label d, done; __ tbnz(c_rarg3, i, d); __ ldrs(r, Address(sp, (10 + i) * wordSize)); __ b(done); __ bind(d); __ ldrd(r, Address(sp, (10 + i) * wordSize)); __ bind(done); } // c_rarg0 contains the result from the call of // InterpreterRuntime::slow_signature_handler so we don't touch it // here. It will be loaded with the JNIEnv* later. __ ldr(c_rarg1, Address(sp, 1 * wordSize)); for (int i = c_rarg2->encoding(); i <= c_rarg7->encoding(); i += 2) { Register rm = as_Register(i), rn = as_Register(i+1); __ ldp(rm, rn, Address(sp, i * wordSize)); } __ add(sp, sp, 18 * wordSize); __ ret(lr); return entry; }
void InterpreterStubs::generate_interpreter_fill_in_tags() { Segment seg(this, code_segment, "Interpreter fill in tags"); Register param_size = tmp0; // must be preserved Register callinfo = tmp1; { bind_local("interpreter_fill_in_tags"); comment("%s: size of parameters", reg_name(tmp0)); comment("%s: call info from call size", reg_name(tmp1)); comment(""); comment("Must preserve lr, %s (method), and %s (parameter size)", reg_name(r0), reg_name(tmp0)); Label loop_entry; // tos_val = r0 must be preserved Register arg_index = tmp2; Register one_reg = tmp3; Register tag_address = JavaStackDirection < 0 ? tmp4 : jsp; mov_imm(one_reg, 1 << CallInfo::format1_tag_start); sub(arg_index, param_size, one, set_CC); report_fatal("shouldn't be called on no arguments", lt); if (JavaStackDirection < 0) { comment("Tag address of last argument"); add(tag_address, jsp, imm(BytesPerWord)); } else { comment("jsp points to tag address of last argument"); } bind(loop_entry); comment("test the bit in the call info"); tst(callinfo, reg_shift(one_reg, lsl, arg_index)); mov(tos_tag, imm(obj_tag), ne); mov(tos_tag, imm(int_tag), eq); if (JavaStackDirection < 0) { str(tos_tag, add_index(tag_address, arg_index, lsl, 3)); } else { str(tos_tag, sub_index(tag_address, arg_index, lsl, 3)); } sub(arg_index, arg_index, one, set_CC); b(loop_entry, ge); mov(pc, reg(locals)); } { Register bit_offset = tmp1; // callinfo not needed Register one_reg = tmp2; Register tag_address = tmp3; Register x1 = tmp4; Register x2 = tmp5; Register index = tos_tag; Label loop; bind_local("interpreter_fill_in_extended_tags"); comment("Total number of tags"); if (HARDWARE_LITTLE_ENDIAN) { ldrh(bit_offset, imm_index3(lr, -2 * BytesPerWord)); } else { ldrh(bit_offset, imm_index3(lr, -2 * BytesPerWord + 2)); } comment("Tag address of first argument"); if (JavaStackDirection < 0) { add(tag_address, jsp, imm_shift(param_size, lsl, 3)); } else { sub(tag_address, jsp, imm_shift(param_size, lsl, 3)); } // tag_address points to the last address of the previous stack add_imm(tag_address, tag_address, JavaFrame::arg_offset_from_sp(-1) + BytesPerWord); comment("Index of last argument"); sub(index, param_size, one); comment("Bit number of first argument"); sub(bit_offset, bit_offset, reg(param_size)); mov(bit_offset, imm_shift(bit_offset, lsl, 2)); add(bit_offset, bit_offset, imm(32 + 32 + 16)); comment("A useful constant"); mov(one_reg, one); bind(loop); comment("Get the bit offset for this argument"); add(x1, bit_offset, imm_shift(index, lsl, 2)); comment("Get the appropriate word"); mov(x2, imm_shift(x1, lsr, 5)); ldr(x2, sub_index(lr, x2, lsl, 2)); comment("Pick out the nybble"); andr(x1, x1, imm(31)); mov(x2, reg_shift(x2, lsr, x1)); andr(x2, x2, imm(15), set_CC); comment("Convert the nybble into a stack type"); sub(x2, x2, one, ne); mov(x2, reg_shift(one_reg, lsl, x2), ne); if (JavaStackDirection < 0) { str(x2, sub_index(tag_address, index, lsl, 3)); } else { str(x2, add_index(tag_address, index, lsl, 3)); } comment("Update the info"); sub(index, index, one, set_CC); b(loop, ge); mov(pc, reg(locals)); } }