* mini-amd64.c (mono_arch_emit_prolog): Increase bb->max_offset by the
maximum epilog size for out of line bblocks if tracing is enabled.
svn path=/trunk/mono/; revision=104552
2008-05-30 Zoltan Varga <vargaz@gmail.com>
2008-05-30 Zoltan Varga <vargaz@gmail.com>
+ * mini-amd64.c (mono_arch_emit_prolog): Increase bb->max_offset by the
+ maximum epilog size for out of line bblocks if tracing is enabled.
+
* iltests.il.in: Merge tests/long-shift.regalloc.il into this file.
2008-05-28 Rodrigo Kumpera <rkumpera@novell.com>
* iltests.il.in: Merge tests/long-shift.regalloc.il into this file.
2008-05-28 Rodrigo Kumpera <rkumpera@novell.com>
+static int
+get_max_epilog_size (MonoCompile *cfg)
+{
+ int max_epilog_size = 16;
+
+ if (cfg->method->save_lmf)
+ max_epilog_size += 256;
+
+ if (mono_jit_trace_calls != NULL)
+ max_epilog_size += 50;
+
+ if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
+ max_epilog_size += 50;
+
+ max_epilog_size += (AMD64_NREG * 2);
+
+ return max_epilog_size;
+}
+
/*
* This macro is used for testing whenever the unwinder works correctly at every point
* where an async exception can happen.
/*
* This macro is used for testing whenever the unwinder works correctly at every point
* where an async exception can happen.
MonoBasicBlock *bb;
MonoMethodSignature *sig;
MonoInst *ins;
MonoBasicBlock *bb;
MonoMethodSignature *sig;
MonoInst *ins;
- int alloc_size, pos, max_offset, i, quad;
+ int alloc_size, pos, max_offset, i, quad, max_epilog_size;
guint8 *code;
CallInfo *cinfo;
gint32 lmf_offset = cfg->arch.lmf_offset;
guint8 *code;
CallInfo *cinfo;
gint32 lmf_offset = cfg->arch.lmf_offset;
/* compute max_offset in order to use short forward jumps */
max_offset = 0;
/* compute max_offset in order to use short forward jumps */
max_offset = 0;
+ max_epilog_size = get_max_epilog_size (cfg);
if (cfg->opt & MONO_OPT_BRANCH) {
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
bb->max_offset = max_offset;
if (cfg->opt & MONO_OPT_BRANCH) {
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
bb->max_offset = max_offset;
max_offset += ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
}
max_offset += ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
}
+
+ if (mono_jit_trace_calls && bb->out_of_line)
+ /* The tracing code can be quite large */
+ bb->max_offset += max_epilog_size;
MonoMethod *method = cfg->method;
int quad, pos, i;
guint8 *code;
MonoMethod *method = cfg->method;
int quad, pos, i;
guint8 *code;
- int max_epilog_size = 16;
CallInfo *cinfo;
gint32 lmf_offset = cfg->arch.lmf_offset;
CallInfo *cinfo;
gint32 lmf_offset = cfg->arch.lmf_offset;
- if (cfg->method->save_lmf)
- max_epilog_size += 256;
-
- if (mono_jit_trace_calls != NULL)
- max_epilog_size += 50;
-
- if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
- max_epilog_size += 50;
-
- max_epilog_size += (AMD64_NREG * 2);
+ max_epilog_size = get_max_epilog_size (cfg);
while (cfg->code_len + max_epilog_size > (cfg->code_size - 16)) {
cfg->code_size *= 2;
while (cfg->code_len + max_epilog_size > (cfg->code_size - 16)) {
cfg->code_size *= 2;