// Goto the managed frame immediately prior to m2nfl static void si_unwind_from_m2n(StackIterator * si) { #ifdef VM_STATS VM_Statistics::get_vm_stats().num_unwind_native_frames_all++; #endif M2nFrame * current_m2n_frame = si->m2n_frame; assert(current_m2n_frame); si->m2n_frame = m2n_get_previous_frame(current_m2n_frame); TRACE2("si", "si_unwind_from_m2n, ip = " << (void*)current_m2n_frame->rip); // Is it a normal M2nFrame or one for suspended managed code? if (m2n_is_suspended_frame(current_m2n_frame)) { // Suspended managed code, rip is at instruction, // rsp & registers are in regs structure TRACE2("si", "si_unwind_from_m2n from suspended managed code, ip = " << (void*)current_m2n_frame->regs->rip); init_context_from_registers(si->jit_frame_context, *current_m2n_frame->regs, false); } else { // Normal M2nFrame, rip is past instruction, // rsp is implicitly address just beyond the frame, // callee saves registers in M2nFrame si->jit_frame_context.rsp = (uint64)((uint64*) m2n_get_frame_base(current_m2n_frame) + 1); si->jit_frame_context.p_rbp = ¤t_m2n_frame->rbp; si->jit_frame_context.p_rip = ¤t_m2n_frame->rip; #ifdef _WIN64 si->jit_frame_context.p_rdi = ¤t_m2n_frame->rdi; si->jit_frame_context.p_rsi = ¤t_m2n_frame->rsi; #endif si->jit_frame_context.p_rbx = ¤t_m2n_frame->rbx; si->jit_frame_context.p_r12 = ¤t_m2n_frame->r12; si->jit_frame_context.p_r13 = ¤t_m2n_frame->r13; si->jit_frame_context.p_r14 = ¤t_m2n_frame->r14; si->jit_frame_context.p_r15 = ¤t_m2n_frame->r15; si->jit_frame_context.is_ip_past = true; } }
Vector_Handle rth_multianewarrayhelper() { ASSERT_THROW_AREA; M2nFrame* m2nf = m2n_get_last_frame(); const unsigned max_dim = 255; int lens[max_dim]; #ifdef VM_STATS VM_Statistics::get_vm_stats().num_multianewarray++; #endif // +1(skip rip) uint64 * args = (uint64 *)m2n_get_frame_base(m2nf) + 1; Class * c = (Class *)args[0]; unsigned dims = (unsigned)(args[1] & 0xFFFFffff); assert(dims <= max_dim); // compute the base address of an array uint64* lens_base = (uint64*)(args+2); for(unsigned i = 0; i < dims; i++) { lens[i] = (int)lens_base[dims-i-1]; } return vm_rt_multianewarray_recursive(c, lens, dims); }