Author: zoltan
Date: 2007-12-07 10:47:37 -0500 (Fri, 07 Dec 2007)
New Revision: 90946
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/mini-amd64.c
trunk/mono/mono/mini/mini-trampolines.c
trunk/mono/mono/mini/mini-x86.c
trunk/mono/mono/mini/mini.h
trunk/mono/mono/mini/tramp-amd64.c
trunk/mono/mono/mini/tramp-x86.c
Log:
2007-12-07 Zoltan Varga <[EMAIL PROTECTED]>
* mini.h mini-amd64.c mini-x86.c: Get rid of the mono_arch_find_vtable
()
function.
* tramp-x86.c tramp-amd64.c mini-trampolines.c: Pass the vtable
argument to
mono_generic_class_init_trampoline () the same as it is done with the
other
trampolines.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2007-12-07 15:46:46 UTC (rev 90945)
+++ trunk/mono/mono/mini/ChangeLog 2007-12-07 15:47:37 UTC (rev 90946)
@@ -1,5 +1,12 @@
2007-12-07 Zoltan Varga <[EMAIL PROTECTED]>
+ * mini.h mini-amd64.c mini-x86.c: Get rid of the mono_arch_find_vtable
()
+ function.
+
+ * tramp-x86.c tramp-amd64.c mini-trampolines.c: Pass the vtable
argument to
+ mono_generic_class_init_trampoline () the same as it is done with the
other
+ trampolines.
+
* mini-arm.h mini-arm.c tramp-arm.c inssel-arm.brg cpu-arm.md
aot-runtime.c aot-compiler.c: Implement AOT support.
Modified: trunk/mono/mono/mini/mini-amd64.c
===================================================================
--- trunk/mono/mono/mini/mini-amd64.c 2007-12-07 15:46:46 UTC (rev 90945)
+++ trunk/mono/mono/mini/mini-amd64.c 2007-12-07 15:47:37 UTC (rev 90946)
@@ -5772,12 +5772,6 @@
}
#endif
-MonoVTable*
-mono_arch_find_vtable (gpointer *regs, guint8 *code)
-{
- return (MonoVTable*) regs [MONO_ARCH_VTABLE_REG];
-}
-
MonoInst*
mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod,
MonoMethodSignature *fsig, MonoInst **args)
{
Modified: trunk/mono/mono/mini/mini-trampolines.c
===================================================================
--- trunk/mono/mono/mini/mini-trampolines.c 2007-12-07 15:46:46 UTC (rev
90945)
+++ trunk/mono/mono/mini/mini-trampolines.c 2007-12-07 15:47:37 UTC (rev
90946)
@@ -296,22 +296,16 @@
* mono_generic_class_init_trampoline:
*
* This method calls mono_runtime_class_init () to run the static constructor
- * for the type, then patches the caller code so it is not called again.
+ * for the type.
*/
void
-mono_generic_class_init_trampoline (gssize *regs, guint8 *code, gpointer
dummy, guint8 *tramp)
+mono_generic_class_init_trampoline (gssize *regs, guint8 *code, MonoVTable
*vtable, guint8 *tramp)
{
-#ifdef MONO_ARCH_VTABLE_REG
- MonoVTable *vtable = mono_arch_find_vtable ((gpointer*)regs, code);
+ g_print ("generic class init for class %s.%s\n",
vtable->klass->name_space, vtable->klass->name);
- //g_print ("generic class init for class %s.%s\n",
vtable->klass->name_space, vtable->klass->name);
-
mono_runtime_class_init (vtable);
//g_print ("done initing generic\n");
-#else
- g_assert_not_reached ();
-#endif
}
#ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
Modified: trunk/mono/mono/mini/mini-x86.c
===================================================================
--- trunk/mono/mono/mini/mini-x86.c 2007-12-07 15:46:46 UTC (rev 90945)
+++ trunk/mono/mono/mini/mini-x86.c 2007-12-07 15:47:37 UTC (rev 90946)
@@ -4371,12 +4371,6 @@
}
#endif
-MonoVTable*
-mono_arch_find_vtable (gpointer *regs, guint8 *code)
-{
- return (MonoVTable*) regs [MONO_ARCH_VTABLE_REG];
-}
-
MonoInst*
mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod,
MonoMethodSignature *fsig, MonoInst **args)
{
Modified: trunk/mono/mono/mini/mini.h
===================================================================
--- trunk/mono/mono/mini/mini.h 2007-12-07 15:46:46 UTC (rev 90945)
+++ trunk/mono/mono/mini/mini.h 2007-12-07 15:47:37 UTC (rev 90946)
@@ -964,7 +964,7 @@
gpointer mono_aot_plt_trampoline (gssize *regs, guint8 *code, guint8
*token_info,
guint8* tramp) MONO_INTERNAL;
void mono_class_init_trampoline (gssize *regs, guint8 *code,
MonoVTable *vtable, guint8 *tramp) MONO_INTERNAL;
-void mono_generic_class_init_trampoline (gssize *regs, guint8
*code, gpointer dummy, guint8 *tramp) MONO_INTERNAL;
+void mono_generic_class_init_trampoline (gssize *regs, guint8
*code, MonoVTable *vtable, guint8 *tramp) MONO_INTERNAL;
gconstpointer mono_get_trampoline_func (MonoTrampolineType tramp_type);
gpointer mini_get_vtable_trampoline (void) MONO_INTERNAL;
gpointer mono_debugger_create_notification_function (void)
MONO_INTERNAL;
@@ -1063,7 +1063,6 @@
void mono_arch_emit_imt_argument (MonoCompile *cfg,
MonoCallInst *call) MONO_INTERNAL;
MonoMethod* mono_arch_find_imt_method (gpointer *regs, guint8 *code)
MONO_INTERNAL;
MonoObject* mono_arch_find_this_argument (gpointer *regs, MonoMethod
*method) MONO_INTERNAL;
-MonoVTable* mono_arch_find_vtable (gpointer *regs, guint8 *code)
MONO_INTERNAL;
gpointer mono_arch_build_imt_thunk (MonoVTable *vtable,
MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count) MONO_INTERNAL;
/* Exception handling */
Modified: trunk/mono/mono/mini/tramp-amd64.c
===================================================================
--- trunk/mono/mono/mini/tramp-amd64.c 2007-12-07 15:46:46 UTC (rev 90945)
+++ trunk/mono/mono/mini/tramp-amd64.c 2007-12-07 15:47:37 UTC (rev 90946)
@@ -202,18 +202,16 @@
amd64_mov_reg_reg (code, AMD64_RBP, AMD64_RSP, 8);
amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, framesize);
- if (tramp_type != MONO_TRAMPOLINE_GENERIC_CLASS_INIT) {
- offset += 8;
- tramp_offset = - offset;
+ offset += 8;
+ tramp_offset = - offset;
- offset += 8;
- method_offset = - offset;
+ offset += 8;
+ method_offset = - offset;
- /* Compute the trampoline address from the return address */
- /* 5 = length of amd64_call_membase () */
- amd64_alu_reg_imm (code, X86_SUB, AMD64_R11, 5);
- amd64_mov_membase_reg (code, AMD64_RBP, tramp_offset,
AMD64_R11, 8);
- }
+ /* Compute the trampoline address from the return address */
+ /* 5 = length of amd64_call_membase () */
+ amd64_alu_reg_imm (code, X86_SUB, AMD64_R11, 5);
+ amd64_mov_membase_reg (code, AMD64_RBP, tramp_offset, AMD64_R11, 8);
/* Save all registers */
@@ -243,6 +241,8 @@
amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 6, 8);
mono_amd64_patch (br [1], code);
amd64_mov_membase_reg (code, AMD64_RBP, method_offset,
AMD64_R11, 8);
+ } else {
+ amd64_mov_membase_reg (code, AMD64_RBP, method_offset,
MONO_ARCH_VTABLE_REG, 8);
}
/* Save LMF begin */
@@ -263,11 +263,9 @@
amd64_mov_reg_reg (code, AMD64_R11, AMD64_RSP, 8);
amd64_alu_reg_imm (code, X86_ADD, AMD64_R11, framesize + 16);
amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset + G_STRUCT_OFFSET
(MonoLMF, rsp), AMD64_R11, 8);
- if (tramp_type != MONO_TRAMPOLINE_GENERIC_CLASS_INIT) {
- /* Save method */
- amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP,
method_offset, 8);
- amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset +
G_STRUCT_OFFSET (MonoLMF, method), AMD64_R11, 8);
- }
+ /* Save method */
+ amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, method_offset, 8);
+ amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset + G_STRUCT_OFFSET
(MonoLMF, method), AMD64_R11, 8);
/* Save callee saved regs */
#ifdef PLATFORM_WIN32
amd64_mov_membase_reg (code, AMD64_RBP, lmf_offset + G_STRUCT_OFFSET
(MonoLMF, rdi), AMD64_RDI, 8);
@@ -302,11 +300,8 @@
else
amd64_mov_reg_imm (code, AMD64_ARG_REG2, 0);
- /* Arg3 is the method ptr / dummy */
- if (tramp_type == MONO_TRAMPOLINE_GENERIC_CLASS_INIT)
- amd64_mov_reg_imm (code, AMD64_ARG_REG3, 0);
- else
- amd64_mov_reg_membase (code, AMD64_ARG_REG3, AMD64_RBP,
method_offset, 8);
+ /* Arg3 is the method/vtable ptr */
+ amd64_mov_reg_membase (code, AMD64_ARG_REG3, AMD64_RBP, method_offset,
8);
/* Arg4 is the trampoline address */
if (tramp_type == MONO_TRAMPOLINE_GENERIC_CLASS_INIT)
Modified: trunk/mono/mono/mini/tramp-x86.c
===================================================================
--- trunk/mono/mono/mini/tramp-x86.c 2007-12-07 15:46:46 UTC (rev 90945)
+++ trunk/mono/mono/mini/tramp-x86.c 2007-12-07 15:47:37 UTC (rev 90946)
@@ -192,13 +192,10 @@
*/
/* If this is a generic class init the argument is not on the
- * stack yet but in MONO_ARCH_VTABLE_REG and is accessed by
- * the callee via the register array. As a dummy argument we
- * pass it NULL, which we push here, and then everything that
- * follows works the same way.
+ * stack yet but in MONO_ARCH_VTABLE_REG.
*/
if (tramp_type == MONO_TRAMPOLINE_GENERIC_CLASS_INIT)
- x86_push_imm (buf, 0);
+ x86_push_reg (buf, MONO_ARCH_VTABLE_REG);
/* Put all registers into an array on the stack
* If this code is changed, make sure to update the offset value in
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches