diff options
author | Bernhard Urban <bernhard.urban@xamarin.com> | 2017-02-27 19:55:53 +0300 |
---|---|---|
committer | Bernhard Urban <bernhard.urban@xamarin.com> | 2017-03-01 00:59:28 +0300 |
commit | 1e7d4e140148498a797e96fb91733fe7fe302285 (patch) | |
tree | a887ebdda098e35b4cda8676489926dc765c22da | |
parent | 02782549c3f8387cc4cb85ee407bc6808bbbcbda (diff) |
[interpreter] properly inflate method on generic virtual call
-rw-r--r-- | mono/mini/interpreter/interp.c | 13 | ||||
-rw-r--r-- | mono/mini/objects.cs | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/mono/mini/interpreter/interp.c b/mono/mini/interpreter/interp.c index b0d5c379cb8..b3cc2297693 100644 --- a/mono/mini/interpreter/interp.c +++ b/mono/mini/interpreter/interp.c @@ -314,7 +314,20 @@ get_virtual_method (MonoDomain *domain, RuntimeMethod *runtime_method, MonoObjec /* TODO: interface offset lookup is slow, go through IMT instead */ slot += mono_class_interface_offset (obj->vtable->klass, m->klass); } + MonoMethod *virtual_method = obj->vtable->klass->vtable [slot]; + if (m->is_inflated && mono_method_get_context (m)->method_inst) { + MonoGenericContext context = { NULL, NULL }; + + if (mono_class_is_ginst (virtual_method->klass)) + context.class_inst = mono_class_get_generic_class (virtual_method->klass)->context.class_inst; + else if (mono_class_is_gtd (virtual_method->klass)) + context.class_inst = mono_class_get_generic_container (virtual_method->klass)->context.class_inst; + context.method_inst = mono_method_get_context (m)->method_inst; + + virtual_method = mono_class_inflate_generic_method_checked (virtual_method, &context, &error); + mono_error_cleanup (&error); /* FIXME: don't swallow the error */ + } RuntimeMethod *virtual_runtime_method = mono_interp_get_runtime_method (domain, virtual_method, &error); mono_error_cleanup (&error); /* FIXME: don't swallow the error */ return virtual_runtime_method; diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs index 005e276fbb1..cf45fb89d19 100644 --- a/mono/mini/objects.cs +++ b/mono/mini/objects.cs @@ -1768,7 +1768,6 @@ ncells ) { } } - [Category ("!INTERPRETER")] public static int test_0_delegate_to_virtual_generic_on_ifaces () { IComparer2 c = new AClass (); |