Quellcode durchsuchen

Load less stuff when resolving MethodInfo::Attributes.

	* MonoMethod.cs: Add new icall for ::Attributes.

	* icall.c: New icall to resolve ::Attributes so it can
	avoid loading the signature and work around methods with
	broken signatures.

	Fixes #649527
Rodrigo Kumpera vor 15 Jahren
Ursprung
Commit
0bc59aeab2

+ 4 - 1
mcs/class/corlib/System.Reflection/MonoMethod.cs

@@ -54,6 +54,9 @@ namespace System.Reflection {
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
 		static extern void get_method_info (IntPtr handle, out MonoMethodInfo info);
 		
+		[MethodImplAttribute(MethodImplOptions.InternalCall)]
+		static extern int get_method_attributes (IntPtr handle);
+		
 		internal static MonoMethodInfo GetMethodInfo (IntPtr handle)
 		{
 			MonoMethodInfo info;
@@ -73,7 +76,7 @@ namespace System.Reflection {
 
 		internal static MethodAttributes GetAttributes (IntPtr handle)
 		{
-			return GetMethodInfo (handle).attrs;
+			return (MethodAttributes)get_method_attributes (handle);
 		}
 
 		internal static CallingConventions GetCallingConvention (IntPtr handle)

+ 2 - 1
mono/metadata/icall-def.h

@@ -626,7 +626,8 @@ ICALL(MMETH_7, "get_IsGenericMethodDefinition", ves_icall_MonoMethod_get_IsGener
 ICALL(MMETH_8, "get_base_method", ves_icall_MonoMethod_get_base_method)
 ICALL(MMETH_9, "get_name", ves_icall_MonoMethod_get_name)
 
-ICALL_TYPE(MMETHI, "System.Reflection.MonoMethodInfo", MMETHI_1)
+ICALL_TYPE(MMETHI, "System.Reflection.MonoMethodInfo", MMETHI_4)
+ICALL(MMETHI_4, "get_method_attributes", vell_icall_get_method_attributes)
 ICALL(MMETHI_1, "get_method_info", ves_icall_get_method_info)
 ICALL(MMETHI_2, "get_parameter_info", ves_icall_get_parameter_info)
 ICALL(MMETHI_3, "get_retval_marshal", ves_icall_System_MonoMethodInfo_get_retval_marshal)

+ 6 - 0
mono/metadata/icall.c

@@ -1694,6 +1694,12 @@ ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionField *fie
 	return type_array_from_modifiers (field->field->parent->image, type, optional);
 }
 
+static int
+vell_icall_get_method_attributes (MonoMethod *method)
+{
+	return method->flags;
+}
+
 static void
 ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
 {