Просмотр исходного кода

2007-10-29 Zoltan Varga <[email protected]>

	* icall.c (ves_icall_System_Delegate_CreateDelegate_internal): Avoid
	creating a jump trampoline for dynamic methods.

svn path=/trunk/mono/; revision=88402
Zoltan Varga 18 лет назад
Родитель
Сommit
eea2d9cb43
2 измененных файлов с 10 добавлено и 1 удалено
  1. 5 0
      mono/metadata/ChangeLog
  2. 5 1
      mono/metadata/icall.c

+ 5 - 0
mono/metadata/ChangeLog

@@ -1,3 +1,8 @@
+2007-10-29  Zoltan Varga  <[email protected]>
+
+	* icall.c (ves_icall_System_Delegate_CreateDelegate_internal): Avoid
+	creating a jump trampoline for dynamic methods.
+
 2007-10-29 Rodrigo Kumpera <[email protected]>
 
 	* reflection.c (mono_image_create_token): Correctly encode methods and constructors of

+ 5 - 1
mono/metadata/icall.c

@@ -5369,7 +5369,11 @@ ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, Mon
 
 	delegate = mono_object_new (mono_object_domain (type), delegate_class);
 
-	func = mono_create_ftnptr (mono_domain_get (), mono_runtime_create_jump_trampoline (mono_domain_get (), info->method, TRUE));
+	if (info->method->dynamic)
+		/* Creating a trampoline would leak memory */
+		func = mono_compile_method (info->method);
+	else
+		func = mono_create_ftnptr (mono_domain_get (), mono_runtime_create_jump_trampoline (mono_domain_get (), info->method, TRUE));
 
 	mono_delegate_ctor (delegate, target, func);