Fix delegate and IMT processing - devirtualization and generics test now pass
authorNeale Ferguson <neale@sinenomine.net>
Tue, 19 May 2015 01:47:59 +0000 (21:47 -0400)
committerNeale Ferguson <neale@sinenomine.net>
Tue, 19 May 2015 01:49:10 +0000 (21:49 -0400)
mono/mini/exceptions-s390x.c
mono/mini/mini-s390x.c

index ac1d0f2c921c6c8003529246f76a8a271ba77795..f5689e9624b96ef22cc277e7849a921caf01ede3 100644 (file)
@@ -418,7 +418,7 @@ mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot)
        if (info)
                *info = NULL;
 
-       return (mono_arch_get_throw_exception_generic (SZ_THROW, info, FALSE, FALSE, aot));
+       return (mono_arch_get_throw_exception_generic (SZ_THROW, info, FALSE, TRUE, aot));
 }
 
 /*========================= End of Function ========================*/
index 5fa10b9901430817b229f45457e23c1b4a3e4466..0df2e1a0b3619672b1a9df62d3dbf7ee563e6113 100644 (file)
@@ -1943,7 +1943,10 @@ mono_arch_allocate_vars (MonoCompile *cfg)
        cfg->arch.bkchain_reg = -1;
 
        if (frame_reg != STK_BASE) 
-               cfg->used_int_regs |= 1 << frame_reg;           
+               cfg->used_int_regs |= (1 << frame_reg);         
+
+       if (cfg->uses_rgctx_reg)
+               cfg->used_int_regs |= (1 << MONO_ARCH_IMT_REG);
 
        sig     = mono_method_signature (cfg->method);
        
@@ -5762,32 +5765,35 @@ gpointer
 mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method, 
                                            int offset, gboolean load_imt_reg)
 {
-       guint8 *code, *start;
-       int size = 20;
-
-       start = code = mono_global_codeman_reserve (size);
-
-       /*
-        * Replace the "this" argument with the target
-        */
-       s390_lgr  (code, s390_r1, s390_r2);
-       s390_lg   (code, s390_r2, s390_r1, 0, MONO_STRUCT_OFFSET(MonoDelegate, target));        
-       
-       /*
-        * Load the IMT register, if needed
-        */
-       if (load_imt_reg) {
-               s390_lg  (code, MONO_ARCH_IMT_REG, s390_r2, 0, MONO_STRUCT_OFFSET(MonoDelegate, method));
-       }
-
-       /*
-        * Load the vTable
-        */
-       s390_lg  (code, s390_r1, s390_r2, 0, MONO_STRUCT_OFFSET(MonoObject, vtable));
-       s390_agfi(code, s390_r1, offset);
-       s390_br  (code, s390_r1);
-
-       return(start);
+       guint8 *code, *start;
+       int size = 40;
+
+       start = code = mono_global_codeman_reserve (size);
+
+       /*
+       * Replace the "this" argument with the target
+       */
+       s390_lgr  (code, s390_r1, s390_r2);
+       s390_lg   (code, s390_r2, 0, s390_r1, MONO_STRUCT_OFFSET(MonoDelegate, target));        
+
+       /*
+       * Load the IMT register, if needed
+       */
+       if (load_imt_reg) {
+               s390_lg  (code, MONO_ARCH_IMT_REG, 0, s390_r1, MONO_STRUCT_OFFSET(MonoDelegate, method));
+       }
+
+       /*
+       * Load the vTable
+       */
+       s390_lg  (code, s390_r1, 0, s390_r2, MONO_STRUCT_OFFSET(MonoObject, vtable));
+       if (offset != 0) {
+               s390_agfi(code, s390_r1, offset);
+       }
+       s390_lg  (code, s390_r1, 0, s390_r1, 0);
+       s390_br  (code, s390_r1);
+
+       return(start);
 }
 
 /*========================= End of Function ========================*/