[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] r36842 - trunk/mono/mono/mini
From: "Martin Baulig" <martin () mono-cvs ! ximian ! com>
Date: 2004-11-30 13:18:07
Message-ID: 20041130131807.CF77294764 () mono-cvs ! ximian ! com
[Download RAW message or body]
Author: martin
Date: 2004-11-30 08:18:07 -0500 (Tue, 30 Nov 2004)
New Revision: 36842
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/jit-icalls.c
trunk/mono/mono/mini/mini.c
Log:
2004-11-30 Martin Baulig <martin@ximian.com>
* mini.c (mono_method_to_ir): In CEE_CALLVIRT, added support for
virtual generic methods. We call a special helper_compile_generic_method()
icall to retrieve the method from the vtable, inflate and compile
it and then do a CEE_CALLI. Thanks a lot to Paolo for this idea.
* jit-icalls.c (helper_compile_generic_method): New JIT icall.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2004-11-30 13:13:59 UTC (rev 36841)
+++ trunk/mono/mono/mini/ChangeLog 2004-11-30 13:18:07 UTC (rev 36842)
@@ -1,3 +1,12 @@
+2004-11-30 Martin Baulig <martin@ximian.com>
+
+ * mini.c (mono_method_to_ir): In CEE_CALLVIRT, added support for
+ virtual generic methods. We call a special helper_compile_generic_method()
+ icall to retrieve the method from the vtable, inflate and compile
+ it and then do a CEE_CALLI. Thanks a lot to Paolo for this idea.
+
+ * jit-icalls.c (helper_compile_generic_method): New JIT icall.
+
2004-11-30 Zoltan Varga <vargaz@freemail.hu>
* mini-sparc.c: Fix up vararg corner cases. Fixes #70019.
Modified: trunk/mono/mono/mini/jit-icalls.c
===================================================================
--- trunk/mono/mono/mini/jit-icalls.c 2004-11-30 13:13:59 UTC (rev 36841)
+++ trunk/mono/mono/mini/jit-icalls.c 2004-11-30 13:18:07 UTC (rev 36842)
@@ -554,3 +554,15 @@
}
#endif
+static gpointer
+helper_compile_generic_method (MonoObject *obj, MonoMethod *method, \
MonoGenericContext *context) +{
+ MonoMethod *vmethod, *inflated;
+ gpointer addr;
+
+ vmethod = mono_object_get_virtual_method (obj, method);
+ inflated = mono_class_inflate_generic_method (vmethod, context, NULL);
+ addr = mono_compile_method (inflated);
+
+ return addr;
+}
Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2004-11-30 13:13:59 UTC (rev 36841)
+++ trunk/mono/mono/mini/mini.c 2004-11-30 13:18:07 UTC (rev 36842)
@@ -121,6 +121,7 @@
static MonoMethodSignature *helper_sig_stelem_ref = NULL;
static MonoMethodSignature *helper_sig_stelem_ref_check = NULL;
static MonoMethodSignature *helper_sig_class_init_trampoline = NULL;
+static MonoMethodSignature *helper_sig_compile_generic_method = NULL;
static guint32 default_opt = MONO_OPT_PEEPHOLE;
@@ -3405,6 +3406,36 @@
if (*ip != CEE_CALLI && check_call_signature (cfg, fsig, sp))
goto unverified;
+ if (cmethod && virtual && cmethod->signature->generic_param_count) {
+ MonoInst *this_temp, *store;
+ MonoInst *iargs [3];
+
+ g_assert (cmethod->signature->is_inflated);
+
+ this_temp = mono_compile_create_var (cfg, type_from_stack_type (sp [0]), \
OP_LOCAL); + this_temp->cil_code = ip;
+ NEW_TEMPSTORE (cfg, store, this_temp->inst_c0, sp [0]);
+
+ store->cil_code = ip;
+ MONO_ADD_INS (bblock, store);
+
+ NEW_TEMPLOAD (cfg, iargs [0], this_temp->inst_c0);
+ NEW_PCONST (cfg, iargs [1], cmethod);
+ NEW_PCONST (cfg, iargs [2], ((MonoMethodInflated *) cmethod)->context);
+ temp = mono_emit_jit_icall (cfg, bblock, helper_compile_generic_method, iargs, \
ip); +
+ NEW_TEMPLOAD (cfg, addr, temp);
+ NEW_TEMPLOAD (cfg, sp [0], this_temp->inst_c0);
+
+ if ((temp = mono_emit_calli (cfg, bblock, fsig, sp, addr, ip)) != -1) {
+ NEW_TEMPLOAD (cfg, *sp, temp);
+ sp++;
+ }
+
+ ip += 5;
+ break;
+ }
+
if ((ins_flag & MONO_INST_TAILCALL) && cmethod && (*ip == CEE_CALL) && \
(mono_metadata_signature_equal (method->signature, cmethod->signature))) { int i;
/* FIXME: This assumes the two methods has the same number and type of arguments \
*/ @@ -6054,6 +6085,9 @@
/* void stelem_ref_check (MonoArray *, MonoObject *) */
helper_sig_stelem_ref_check = make_icall_sig ("void object object");
+ /* void *helper_compile_generic_method (MonoObject *, MonoMethod *, \
MonoGenericContext *) */ + helper_sig_compile_generic_method = make_icall_sig ("ptr \
object ptr ptr"); +
/* long amethod (long, long) */
helper_sig_long_long_long = make_icall_sig ("long long long");
@@ -8538,6 +8572,7 @@
mono_register_jit_icall (mono_ldftn, "mono_ldftn", helper_sig_compile, FALSE);
mono_register_jit_icall (mono_ldftn_nosync, "mono_ldftn_nosync", \
helper_sig_compile, FALSE); mono_register_jit_icall (mono_ldvirtfn, "mono_ldvirtfn", \
helper_sig_compile_virt, FALSE); + mono_register_jit_icall \
(helper_compile_generic_method, "compile_generic_method", \
helper_sig_compile_generic_method, FALSE); #endif
#define JIT_RUNTIME_WORKS
_______________________________________________
Mono-patches maillist - Mono-patches@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic