Tue Sep 11 16:15:53 CEST 2007 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Tue, 11 Sep 2007 13:52:40 +0000 (13:52 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Tue, 11 Sep 2007 13:52:40 +0000 (13:52 -0000)
* mini.: hook the new managed GC allocation feature into the JIT.

svn path=/trunk/mono/; revision=85636

mono/mini/ChangeLog
mono/mini/mini.c

index 27c7c5afbf9cab24a2fb07e9fb9702a610b317af..46b73998beb7c054c66f488a23eada6561f4aab2 100644 (file)
@@ -1,4 +1,8 @@
 
+Tue Sep 11 16:15:53 CEST 2007 Paolo Molaro <lupus@ximian.com>
+
+       * mini.: hook the new managed GC allocation feature into the JIT.
+
 Tue Sep 11 16:14:16 CEST 2007 Paolo Molaro <lupus@ximian.com>
 
        * mini.c: implementation for the new runtime tls opcode.
index 5a06157538079fde3bf36b163d3313e1b25d94de..f676500f69942ae7d7a9dc81a6927608fd428ee5 100644 (file)
@@ -56,6 +56,7 @@
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/monitor.h>
+#include <mono/metadata/gc-internal.h>
 #include <mono/metadata/security-manager.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/rawbuffer.h>
@@ -2924,8 +2925,13 @@ handle_alloc (MonoCompile *cfg, MonoBasicBlock *bblock, MonoClass *klass, gboole
                return mono_emit_jit_icall (cfg, bblock, mono_helper_newobj_mscorlib, iargs, ip);
        } else {
                MonoVTable *vtable = mono_class_vtable (cfg->domain, klass);
+               MonoMethod *managed_alloc = mono_gc_get_managed_allocator (vtable, for_box);
                gboolean pass_lw;
 
+               if (!cfg->compile_aot && managed_alloc) {
+                       NEW_VTABLECONST (cfg, iargs [0], vtable);
+                       return mono_emit_method_call_spilled (cfg, bblock, managed_alloc, mono_method_signature (managed_alloc), iargs, ip, NULL);
+               }
                alloc_ftn = mono_class_get_allocation_ftn (vtable, for_box, &pass_lw);
                if (pass_lw) {
                        guint32 lw = vtable->klass->instance_size;