gcconfig.h - Add weak attribute to avoid __data_start undefined messages on dlopen
authorNeale Ferguson <neale@sinenomine.net>
Thu, 9 May 2013 19:42:58 +0000 (15:42 -0400)
committerNeale Ferguson <neale@sinenomine.net>
Thu, 9 May 2013 19:42:58 +0000 (15:42 -0400)
mini-s390x.c - Add profiling support to prolog/epilog instrumentation

libgc/include/private/gcconfig.h
mono/mini/mini-s390x.c

index 88e783800de9faf427837c7bd93a1b3bd15f99cd..c264b164a4135978cf8ad27b091173828562d5a9 100644 (file)
 #       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
 
index 5d946f2716d67c163c810f4e9ce74845093870d6..43677fc3ec9af85edfff546a6ef25c921c73a99e 100644 (file)
@@ -2233,7 +2233,8 @@ printf("%s %4d cookine %x\n",__FUNCTION__,__LINE__,cfg->sig_cookie);
        /*------------------------------------------------------*/
        /* 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;
 
        /*------------------------------------------------------*/
@@ -2765,10 +2766,21 @@ mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolea
 {
        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);
@@ -5158,7 +5170,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
        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;
@@ -5463,8 +5476,7 @@ mono_arch_emit_epilog (MonoCompile *cfg)
        
        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)) {
@@ -5484,8 +5496,6 @@ mono_arch_emit_epilog (MonoCompile *cfg)
                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);