}
}
+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.
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;
/* 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;
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;
- int max_epilog_size = 16;
+ int max_epilog_size;
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;