From 1a455ac0bcf7a770ec03e11ca200715ce93e30c7 Mon Sep 17 00:00:00 2001 From: kumpera Date: Mon, 8 Mar 2010 17:45:06 +0000 Subject: [PATCH] 2010-03-08 Rodrigo Kumpera * method-to-ir.c: Revert r153222 as it doesn't belong here. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mono@153274 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- mono/mini/ChangeLog | 3 +++ mono/mini/method-to-ir.c | 68 ++++++++++++++++-------------------------------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index 52ba8f4e8..00a063f9c 100755 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,6 @@ +2010-03-08 Rodrigo Kumpera + + * method-to-ir.c: Revert r153222 as it doesn't belong here. Mon Mar 8 17:58:26 CET 2010 Paolo Molaro diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 9d98659a8..c6f816b0f 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -8774,59 +8774,37 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b EMIT_NEW_TEMPLOAD (cfg, ins, vtvar->inst_c0); } else { - gboolean use_slow_path = TRUE; if ((ip + 5 < end) && ip_in_bb (cfg, bblock, ip + 5) && ((ip [5] == CEE_CALL) || (ip [5] == CEE_CALLVIRT)) && - (cmethod = mini_get_method (cfg, method, read32 (ip + 6), NULL, generic_context))) { + (cmethod = mini_get_method (cfg, method, read32 (ip + 6), NULL, generic_context)) && + (cmethod->klass == mono_defaults.monotype_class->parent) && + (strcmp (cmethod->name, "GetTypeFromHandle") == 0)) { + MonoClass *tclass = mono_class_from_mono_type (handle); - if ((cmethod->klass == mono_defaults.monotype_class->parent) && (strcmp (cmethod->name, "GetTypeFromHandle") == 0)) { - MonoClass *tclass = mono_class_from_mono_type (handle); - - mono_class_init (tclass); - if (context_used) { - ins = emit_get_rgctx_klass (cfg, context_used, - tclass, MONO_RGCTX_INFO_REFLECTION_TYPE); - } else if (cfg->compile_aot) { - if (method->wrapper_type) { - if (mono_class_get (tclass->image, tclass->type_token) == tclass && !generic_context) { - /* Special case for static synchronized wrappers */ - EMIT_NEW_TYPE_FROM_HANDLE_CONST (cfg, ins, tclass->image, tclass->type_token, generic_context); - } else { - /* FIXME: n is not a normal token */ - cfg->disable_aot = TRUE; - EMIT_NEW_PCONST (cfg, ins, NULL); - } + mono_class_init (tclass); + if (context_used) { + ins = emit_get_rgctx_klass (cfg, context_used, + tclass, MONO_RGCTX_INFO_REFLECTION_TYPE); + } else if (cfg->compile_aot) { + if (method->wrapper_type) { + if (mono_class_get (tclass->image, tclass->type_token) == tclass && !generic_context) { + /* Special case for static synchronized wrappers */ + EMIT_NEW_TYPE_FROM_HANDLE_CONST (cfg, ins, tclass->image, tclass->type_token, generic_context); } else { - EMIT_NEW_TYPE_FROM_HANDLE_CONST (cfg, ins, image, n, generic_context); + /* FIXME: n is not a normal token */ + cfg->disable_aot = TRUE; + EMIT_NEW_PCONST (cfg, ins, NULL); } } else { - EMIT_NEW_PCONST (cfg, ins, mono_type_get_object (cfg->domain, handle)); - } - ins->type = STACK_OBJ; - ins->klass = cmethod->klass; - ip += 5; - use_slow_path = FALSE; - } else if (cmethod->klass->image == mono_defaults.corlib && - !strcmp ("Mono", cmethod->klass->name_space) && - !strcmp ("Runtime", cmethod->klass->name) && - !strcmp ("NewObject", cmethod->name)) { - - /*FIXME relax those restrictions if it's worth the trouble*/ - if (!context_used && !cfg->compile_aot && !(cfg->opt & MONO_OPT_SHARED)) { - MonoClass *klass = mono_class_from_mono_type (handle); - gpointer vtable = mono_class_vtable (cfg->domain, klass); - MonoInst *iargs [1]; - - EMIT_NEW_PCONST (cfg, iargs [0], vtable); - ins = mono_emit_jit_icall (cfg, mono_object_new_specific, iargs); - - ip += 5; - use_slow_path = FALSE; + EMIT_NEW_TYPE_FROM_HANDLE_CONST (cfg, ins, image, n, generic_context); } + } else { + EMIT_NEW_PCONST (cfg, ins, mono_type_get_object (cfg->domain, handle)); } - } - - if (use_slow_path) { + ins->type = STACK_OBJ; + ins->klass = cmethod->klass; + ip += 5; + } else { MonoInst *addr, *vtvar; vtvar = mono_compile_create_var (cfg, &handle_class->byval_arg, OP_LOCAL); -- 2.11.4.GIT