amd64_mov_reg_reg (code, AMD64_ARG_REG1, ins->sreg1, 8);
code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD,
(gpointer)"mono_arch_throw_exception", FALSE);
+ ins->flags |= MONO_INST_GC_CALLSITE;
+ ins->backend.pc_offset = code - cfg->native_code;
break;
}
case OP_RETHROW: {
amd64_mov_reg_reg (code, AMD64_ARG_REG1, ins->sreg1, 8);
code = emit_call (cfg, code, MONO_PATCH_INFO_INTERNAL_METHOD,
(gpointer)"mono_arch_rethrow_exception", FALSE);
+ ins->flags |= MONO_INST_GC_CALLSITE;
+ ins->backend.pc_offset = code - cfg->native_code;
break;
}
case OP_CALL_HANDLER:
#ifdef TARGET_AMD64
#ifdef HOST_WIN32
-static int callee_saved_regs [] = { AMD64_RBX, AMD64_R12, AMD64_R13, AMD64_R14, AMD64_R15, AMD64_RDI, AMD64_RSI };
+static int callee_saved_regs [] = { AMD64_RBP, AMD64_RBX, AMD64_R12, AMD64_R13, AMD64_R14, AMD64_R15, AMD64_RDI, AMD64_RSI };
#else
-static int callee_saved_regs [] = { AMD64_RBX, AMD64_R12, AMD64_R13, AMD64_R14, AMD64_R15 };
+static int callee_saved_regs [] = { AMD64_RBP, AMD64_RBX, AMD64_R12, AMD64_R13, AMD64_R14, AMD64_R15 };
#endif
#endif
guint32 res;
res = 0;
- for (i = 0; i < sizeof (callee_saved_regs) / sizeof (int); ++i)
- if (regmask & (1 << callee_saved_regs [i]))
+ for (i = 0; i < sizeof (callee_saved_regs) / sizeof (int); ++i) {
+ if (regmask & (1 << callee_saved_regs [i])) {
res |= (1 << i);
+ regmask -= (1 << callee_saved_regs [i]);
+ }
+ }
+ g_assert (regmask == 0);
return res;
#else
NOT_IMPLEMENTED;
continue;
}
- /* These frames are returned by mono_find_jit_info () two times */
- if (!frame.managed)
+ ji = frame.ji;
+
+ /* This happens with native-to-managed transitions */
+ if (!(MONO_CONTEXT_GET_IP (&ctx) >= ji->code_start && (guint8*)MONO_CONTEXT_GET_IP (&ctx) < (guint8*)ji->code_start + ji->code_size))
+ continue;
+
+#if 1
+ /* FIXME: Some wrappers do not declare variables with the proper GC type */
+ if (ji->method->wrapper_type)
continue;
+#endif
/* All the other frames are at a call site */
* - localloc-ed memory
*/
- ji = frame.ji;
emap = ji->gc_info;
if (!emap) {
scanned_precisely += (map->end_offset - map->start_offset) - (map->nslots * sizeof (mgreg_t));
/* Mark registers */
- precise_regmask = map->used_int_regs | (1 << map->frame_reg);
+ precise_regmask = map->used_int_regs;
if (map->has_pin_regs) {
int bitmap_width = ALIGN_TO (map->npin_regs, 8) / 8;
guint8 *pin_bitmap = &bitmaps [map->reg_pin_bitmap_offset + (bitmap_width * cindex)];
if (reg_locations [i] && (ref_bitmap [bindex / 8] & (1 << (bindex % 8)))) {
DEBUG (fi->regs [fi->nreg_locations] = i);
+
+ DEBUG (printf ("\treg %s saved at 0x%p is ref.\n", mono_arch_regname (i), reg_locations [i]));
fi->reg_locations [fi->nreg_locations] = (guint8*)reg_locations [i] - stack_start;
fi->nreg_locations ++;
}
*/
if (precise_regmask) {
for (i = 0; i < NREGS; ++i) {
- if (precise_regmask & (1 << i))
+ if (precise_regmask & (1 << i)) {
/*
* The method uses this register, and we have precise info for it.
* This means the location will be scanned precisely.
if (reg_locations [i])
DEBUG (printf ("\treg %s at location %p is precise.\n", mono_arch_regname (i), reg_locations [i]));
reg_locations [i] = NULL;
+ }
}
}