# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# define DYNAMIC_LOADING
- extern int __data_start[];
+ extern int __data_start[] __attribute__((weak));
# define DATASTART ((ptr_t)(__data_start))
- extern int _end[];
-# define DATAEND (_end)
-# define CACHE_LINE_SIZE 256
-# define GETPAGESIZE() 4096
+ extern int _end[] __attribute__((weak));
+# define DATAEND (_end)
+# define CACHE_LINE_SIZE 256
+# define GETPAGESIZE() 4096
# endif
# endif
/*------------------------------------------------------*/
/* Allow space for the trace method stack area if needed*/
/*------------------------------------------------------*/
- if (mono_jit_trace_calls != NULL && mono_trace_eval (cfg->method))
+ if ((mono_jit_trace_calls != NULL && mono_trace_eval (cfg->method))
+ || (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE))
offset += S390_TRACE_STACK_SIZE;
/*------------------------------------------------------*/
{
guchar *code = p;
int save_mode = SAVE_NONE,
- saveOffset;
+ saveOffset,
+ offset;
MonoMethod *method = cfg->method;
int rtype = mono_type_get_underlying_type (mono_method_signature (method)->ret)->type;
+ offset = code - cfg->native_code;
+ /*-----------------------------------------*/
+ /* We need about 128 bytes of instructions */
+ /*-----------------------------------------*/
+ if (offset > (cfg->code_size - 128)) {
+ cfg->code_size *= 2;
+ cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
+ code = cfg->native_code + offset;
+ }
+
saveOffset = cfg->stack_usage - S390_TRACE_STACK_SIZE;
if (method->save_lmf)
saveOffset -= sizeof(MonoLMF);
if (mono_jit_trace_calls != NULL && mono_trace_eval (method)) {
tracing = 1;
cfg->code_size += 256;
- }
+ } else if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
+ cfg->code_size += 256;
if (method->save_lmf)
cfg->code_size += 200;
if (mono_jit_trace_calls != NULL)
max_epilog_size += 128;
-
- if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
+ else if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
max_epilog_size += 128;
while ((cfg->code_len + max_epilog_size) > (cfg->code_size - 16)) {
restoreLMF(code, cfg->frame_reg, cfg->stack_usage);
if (cfg->flags & MONO_CFG_HAS_ALLOCA) {
-// if (cfg->frame_reg != STK_BASE)
-// s390_lgr (code, STK_BASE, cfg->frame_reg);
s390_lg (code, STK_BASE, 0, STK_BASE, 0);
} else
code = backUpStackPtr(cfg, code);