Explorar o código

[corlib] Control SRE using its own define

Marek Safar %!s(int64=7) %!d(string=hai) anos
pai
achega
6bcccccb82
Modificáronse 60 ficheiros con 449 adicións e 370 borrados
  1. 2 0
      mcs/build/profiles/monotouch.make
  2. 1 0
      mcs/build/profiles/orbis.make
  3. 1 0
      mcs/build/profiles/testing_aot_full.make
  4. 1 0
      mcs/build/profiles/wasm.make
  5. 1 0
      mcs/build/profiles/winaot.make
  6. 10 4
      mcs/class/System.Core/Makefile
  7. 4 0
      mcs/class/corlib/Makefile
  8. 28 22
      mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
  9. 2 2
      mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.pns.cs
  10. 27 22
      mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
  11. 2 2
      mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.pns.cs
  12. 1 1
      mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs
  13. 28 22
      mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
  14. 2 2
      mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.pns.cs
  15. 1 1
      mcs/class/corlib/System.Reflection.Emit/DerivedTypes.cs
  16. 1 1
      mcs/class/corlib/System.Reflection.Emit/DynamicILInfo.cs
  17. 4 3
      mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs
  18. 2 2
      mcs/class/corlib/System.Reflection.Emit/DynamicMethod.notsupported.cs
  19. 28 24
      mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
  20. 2 2
      mcs/class/corlib/System.Reflection.Emit/EnumBuilder.pns.cs
  21. 28 22
      mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
  22. 2 2
      mcs/class/corlib/System.Reflection.Emit/EventBuilder.pns.cs
  23. 1 1
      mcs/class/corlib/System.Reflection.Emit/EventOnTypeBuilderInst.cs
  24. 1 1
      mcs/class/corlib/System.Reflection.Emit/EventToken.cs
  25. 28 22
      mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
  26. 2 2
      mcs/class/corlib/System.Reflection.Emit/FieldBuilder.pns.cs
  27. 1 1
      mcs/class/corlib/System.Reflection.Emit/FieldOnTypeBuilderInst.cs
  28. 1 1
      mcs/class/corlib/System.Reflection.Emit/FieldToken.cs
  29. 1 1
      mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs
  30. 2 2
      mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs
  31. 28 25
      mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
  32. 2 2
      mcs/class/corlib/System.Reflection.Emit/ILGenerator.pns.cs
  33. 27 27
      mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
  34. 27 22
      mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
  35. 2 2
      mcs/class/corlib/System.Reflection.Emit/MethodBuilder.pns.cs
  36. 1 1
      mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs
  37. 1 1
      mcs/class/corlib/System.Reflection.Emit/MethodRental.cs
  38. 1 1
      mcs/class/corlib/System.Reflection.Emit/MethodToken.cs
  39. 28 22
      mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
  40. 2 2
      mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.pns.cs
  41. 1 1
      mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
  42. 30 24
      mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs
  43. 2 2
      mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.pns.cs
  44. 1 1
      mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs
  45. 28 22
      mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
  46. 2 2
      mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.pns.cs
  47. 1 1
      mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs
  48. 1 1
      mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs
  49. 1 1
      mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
  50. 2 2
      mcs/class/corlib/System.Reflection.Emit/SignatureHelper.pns.cs
  51. 1 1
      mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs
  52. 1 1
      mcs/class/corlib/System.Reflection.Emit/StringToken.cs
  53. 28 23
      mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
  54. 2 2
      mcs/class/corlib/System.Reflection.Emit/TypeBuilder.pns.cs
  55. 1 1
      mcs/class/corlib/System.Reflection.Emit/TypeBuilderInstantiation.cs
  56. 1 1
      mcs/class/corlib/System.Reflection.Emit/TypeToken.cs
  57. 1 1
      mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
  58. 7 9
      mcs/class/corlib/System.Reflection/MonoParameterInfo.cs
  59. 3 3
      mcs/class/corlib/System/AppDomain.cs
  60. 1 1
      mcs/class/referencesource/mscorlib/system/reflection/emit/symboltype.cs

+ 2 - 0
mcs/build/profiles/monotouch.make

@@ -2,3 +2,5 @@ include $(topdir)/build/profiles/monotouch_runtime.make
 
 PROFILE_MCS_FLAGS += \
 	-d:FULL_AOT_RUNTIME
+
+NO_SRE=1

+ 1 - 0
mcs/build/profiles/orbis.make

@@ -39,6 +39,7 @@ MOBILE_PROFILE = yes
 NO_VTS_TEST = yes
 NO_CONSOLE = yes
 PROFILE_DISABLE_BTLS = yes
+NO_SRE=1
 
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,

+ 1 - 0
mcs/build/profiles/testing_aot_full.make

@@ -36,6 +36,7 @@ AOT_FRIENDLY_PROFILE = yes
 MOBILE_PROFILE = yes
 NO_VTS_TEST = yes
 NO_CONSOLE = yes
+NO_SRE=1
 
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,

+ 1 - 0
mcs/build/profiles/wasm.make

@@ -39,3 +39,4 @@ ALWAYS_AOT = yes
 MOBILE_PROFILE = yes
 NO_VTS_TEST = yes
 NO_CONSOLE = yes
+NO_SRE=1

+ 1 - 0
mcs/build/profiles/winaot.make

@@ -37,6 +37,7 @@ AOT_FRIENDLY_PROFILE = yes
 ALWAYS_AOT = yes
 MOBILE_PROFILE = yes
 NO_VTS_TEST = yes
+NO_SRE=1
 
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,

+ 10 - 4
mcs/class/System.Core/Makefile

@@ -31,11 +31,17 @@ ifneq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += -d:NET_3_5
 endif
 
-ifdef AOT_FRIENDLY_PROFILE
-extra_test_flags := -exclude:NotWorkingLinqInterpreter
-LIB_MCS_FLAGS += -d:NO_FEATURE_STATIC_DELEGATE,FEATURE_MAKE_RUN_METHODS
+MOBILE_NATIVE_INTERP :=
+
+ifdef MOBILE_NATIVE_INTERP
+LIB_MCS_FLAGS += -d:FEATURE_COMPILE,FEATURE_COMPILE_TO_METHODBUILDER
 else
-LIB_MCS_FLAGS += -d:FEATURE_COMPILE,FEATURE_COMPILE_TO_METHODBUILDER,FEATURE_PDB_GENERATOR
+	ifdef AOT_FRIENDLY_PROFILE
+	extra_test_flags := -exclude:NotWorkingLinqInterpreter
+	LIB_MCS_FLAGS += -d:NO_FEATURE_STATIC_DELEGATE,FEATURE_MAKE_RUN_METHODS
+	else
+	LIB_MCS_FLAGS += -d:FEATURE_COMPILE,FEATURE_COMPILE_TO_METHODBUILDER,FEATURE_PDB_GENERATOR
+	endif
 endif
 
 ifeq (monotouch_runtime, $(PROFILE))

+ 4 - 0
mcs/class/corlib/Makefile

@@ -86,6 +86,10 @@ RESOURCE_FILES = \
 
 REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ENCODINGNLS,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT,HAS_CORLIB_CONTRACTS
 
+ifndef NO_SRE
+LIB_MCS_FLAGS += -d:MONO_FEATURE_SRE
+endif
+
 ifndef MOBILE_PROFILE
 REFERENCE_SOURCES_FLAGS += -d:FEATURE_MACL
 endif

+ 28 - 22
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs

@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Resources;
@@ -207,11 +207,37 @@ namespace System.Reflection.Emit
 	}
 
 
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_AssemblyBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class AssemblyBuilder :  _AssemblyBuilder
+	{
+		void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _AssemblyBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _AssemblyBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _AssemblyBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class AssemblyBuilder : Assembly, _AssemblyBuilder {
+	public sealed partial class AssemblyBuilder : Assembly
+	{
 #pragma warning disable 169, 414, 649
 		#region Sync with object-internals.h
 		private UIntPtr dynamic_assembly; /* GC-tracked */
@@ -1063,26 +1089,6 @@ namespace System.Reflection.Emit
 			return new TypeBuilderInstantiation (gtd, typeArguments);
 		}
 
-		void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _AssemblyBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _AssemblyBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _AssemblyBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-
 		public override Type GetType (string name, bool throwOnError, bool ignoreCase)
 		{
 			if (name == null)

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -66,4 +66,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 27 - 22
mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs

@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Collections.Generic;
 using System.Reflection;
@@ -43,11 +43,36 @@ using System.Diagnostics.SymbolStore;
 
 namespace System.Reflection.Emit {
 
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_ConstructorBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class ConstructorBuilder : _ConstructorBuilder
+	{
+		void _ConstructorBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ConstructorBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ConstructorBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ConstructorBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class ConstructorBuilder : ConstructorInfo, _ConstructorBuilder {
+	public sealed partial class ConstructorBuilder : ConstructorInfo {
 	
 #pragma warning disable 169, 414
 		private RuntimeMethodHandle mhandle;
@@ -420,26 +445,6 @@ namespace System.Reflection.Emit {
 		{
 			return new NotSupportedException ("The type is not yet created.");
 		}
-
-		void _ConstructorBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ConstructorBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ConstructorBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ConstructorBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
 	}
 }
 #endif

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -89,4 +89,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs

@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Globalization;
 using System.Reflection;

+ 28 - 22
mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs

@@ -31,7 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -39,11 +39,37 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_CustomAttributeBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class CustomAttributeBuilder : _CustomAttributeBuilder
+	{
+		void _CustomAttributeBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _CustomAttributeBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _CustomAttributeBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _CustomAttributeBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public class CustomAttributeBuilder : _CustomAttributeBuilder {
+	public partial class CustomAttributeBuilder {
 		ConstructorInfo ctor;
 		byte[] data;
 		object [] args;
@@ -539,26 +565,6 @@ namespace System.Reflection.Emit {
 			return info;
 		}
 
-		void _CustomAttributeBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _CustomAttributeBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _CustomAttributeBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _CustomAttributeBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-
 		static ParameterInfo [] GetParameters (ConstructorInfo ctor)
 		{
 			ConstructorBuilder cb = ctor as ConstructorBuilder;

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -54,4 +54,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/DerivedTypes.cs

@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/DynamicILInfo.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Runtime.InteropServices;

+ 4 - 3
mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs

@@ -31,7 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 
 using System;
 using System.Reflection;
@@ -424,8 +424,9 @@ namespace System.Reflection.Emit {
 		}
 
 		// This class takes care of constructing the module in a thread safe manner
-		class AnonHostModuleHolder {
-			public static Module anon_host_module;
+		static class AnonHostModuleHolder
+		{
+			public static readonly Module anon_host_module;
 
 			static AnonHostModuleHolder () {
 				AssemblyName aname = new AssemblyName ();

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/DynamicMethod.notsupported.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 using System.Globalization;
 
@@ -148,4 +148,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 28 - 24
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs

@@ -31,7 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -40,12 +40,36 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_EnumBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
-	public sealed class EnumBuilder : 
-		TypeInfo
-		, _EnumBuilder
+	partial class EnumBuilder : _EnumBuilder
+	{
+		void _EnumBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _EnumBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _EnumBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _EnumBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
+	public sealed partial class EnumBuilder : 	TypeInfo
 	{
 		private TypeBuilder _tb;
 		private FieldBuilder _underlyingField;
@@ -402,26 +426,6 @@ namespace System.Reflection.Emit {
 			return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
 		}
 
-		void _EnumBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _EnumBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _EnumBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _EnumBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-
 		internal override bool IsUserType {
 			get {
 				return false;

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/EnumBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -114,4 +114,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 28 - 22
mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs

@@ -31,7 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -40,11 +40,37 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_EventBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class EventBuilder : _EventBuilder
+	{
+		void _EventBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _EventBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _EventBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _EventBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}		
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class EventBuilder : _EventBuilder {
+	public sealed partial class EventBuilder {
 #pragma warning disable 169, 414
 		internal string name;
 		Type type;
@@ -139,26 +165,6 @@ namespace System.Reflection.Emit {
 			if (typeb.is_created)
 				throw new InvalidOperationException ("Type definition of the method is complete.");
 		}
-
-		void _EventBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _EventBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _EventBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _EventBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
 	}
 }
 

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/EventBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -64,4 +64,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/EventOnTypeBuilderInst.cs

@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Collections;
 using System.Globalization;

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/EventToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 28 - 22
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs

@@ -31,7 +31,7 @@
 // (C) 2001-2002 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -40,11 +40,37 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_FieldBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class FieldBuilder : _FieldBuilder
+	{
+		void _FieldBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _FieldBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _FieldBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _FieldBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}		
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class FieldBuilder : FieldInfo, _FieldBuilder {
+	public sealed partial class FieldBuilder : FieldInfo {
 	
 #pragma warning disable 169, 414
 		private FieldAttributes attrs;
@@ -244,26 +270,6 @@ namespace System.Reflection.Emit {
 				return base.Module;
 			}
 		}
-
-		void _FieldBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _FieldBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _FieldBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _FieldBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
 	}
 }
 

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -83,4 +83,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/FieldOnTypeBuilderInst.cs

@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Globalization;
 using System.Reflection;

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/FieldToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.cs

@@ -29,7 +29,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -112,4 +112,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 28 - 25
mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs

@@ -31,7 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -186,11 +186,34 @@ namespace System.Reflection.Emit {
 		int GetToken (SignatureHelper helper);
 	}		
 
-	[ComVisible (true)]
-	[ComDefaultInterface (typeof (_ILGenerator))]
-	[ClassInterface (ClassInterfaceType.None)]
+#if !MOBILE
+	partial class ILGenerator : _ILGenerator
+	{
+		void _ILGenerator.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ILGenerator.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ILGenerator.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ILGenerator.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}		
+	}
+#endif
+
+
 	[StructLayout (LayoutKind.Sequential)]
-	public class ILGenerator: _ILGenerator {
+	public partial class ILGenerator {
 		private struct LabelFixup {
 			public int offset;    // The number of bytes between pos and the
 							      // offset of the jump
@@ -1133,26 +1156,6 @@ namespace System.Reflection.Emit {
 		virtual int ILOffset {
 			get { return code_len; }
 		}
-
-		void _ILGenerator.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ILGenerator.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ILGenerator.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ILGenerator.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
 	}
 	
 	internal class SequencePointList

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/ILGenerator.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -226,4 +226,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 27 - 27
mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs

@@ -41,16 +41,37 @@ using System.Runtime.InteropServices;
 using System.Diagnostics.SymbolStore;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
-#if !FULL_AOT_RUNTIME
 	[ComDefaultInterface (typeof (_LocalBuilder))]
-#endif
 	[ClassInterface (ClassInterfaceType.None)]
-	[StructLayout (LayoutKind.Sequential)]
-	public sealed class LocalBuilder : LocalVariableInfo
-#if !FULL_AOT_RUNTIME
-		, _LocalBuilder
+	partial class LocalBuilder : _LocalBuilder
+	{
+		void _LocalBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _LocalBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _LocalBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _LocalBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
 #endif
+	
+	[StructLayout (LayoutKind.Sequential)]
+	public sealed partial class LocalBuilder : LocalVariableInfo
 	{
 
 		// Some fields are already defined in LocalVariableInfo
@@ -112,26 +133,5 @@ namespace System.Reflection.Emit {
 		internal int EndOffset {
 			get { return endOffset; }
 		}
-#if !FULL_AOT_RUNTIME
-		void _LocalBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _LocalBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _LocalBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _LocalBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-#endif
 	}
 }

+ 27 - 22
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs

@@ -30,7 +30,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -44,11 +44,36 @@ using System.Collections.Generic;
 
 namespace System.Reflection.Emit
 {
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_MethodBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class MethodBuilder : _MethodBuilder
+	{
+		void _MethodBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _MethodBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _MethodBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _MethodBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class MethodBuilder : MethodInfo, _MethodBuilder
+	public sealed partial class MethodBuilder : MethodInfo
 	{
 #pragma warning disable 169, 414
 		private RuntimeMethodHandle mhandle;
@@ -697,26 +722,6 @@ namespace System.Reflection.Emit
 			}
 		}
 
-		void _MethodBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _MethodBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _MethodBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _MethodBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-
 		public override ParameterInfo ReturnParameter {
 			get { return base.ReturnParameter; }
 		}

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -109,4 +109,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs

@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Globalization;
 using System.Reflection;

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/MethodRental.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Security.Permissions;
 using System.Runtime.InteropServices;
 

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/MethodToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 28 - 22
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs

@@ -30,7 +30,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Collections;
@@ -43,11 +43,37 @@ using System.Resources;
 using System.Globalization;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_ModuleBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class ModuleBuilder : _ModuleBuilder
+	{
+		void _ModuleBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ModuleBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ModuleBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ModuleBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public class ModuleBuilder : Module, _ModuleBuilder {
+	public partial class ModuleBuilder : Module {
 
 #pragma warning disable 169, 414
 		#region Sync with object-internals.h
@@ -1024,26 +1050,6 @@ namespace System.Reflection.Emit {
 			return mb.GetModuleVersionId ();
 		}
 
-		void _ModuleBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ModuleBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ModuleBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _ModuleBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-
 		public override	Assembly Assembly {
 			get { return assemblyb; }
 		}

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -119,4 +119,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs

@@ -31,7 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Globalization;
 using System.Runtime.CompilerServices;

+ 30 - 24
mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs

@@ -32,7 +32,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -41,12 +41,38 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_ParameterBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
-	[StructLayout (LayoutKind.Sequential)]
-	public class ParameterBuilder : _ParameterBuilder {
+	partial class ParameterBuilder : _ParameterBuilder
+	{
+		void _ParameterBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ParameterBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ParameterBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _ParameterBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}		
+	}
+#endif
 
+	[StructLayout (LayoutKind.Sequential)]
+	public partial class ParameterBuilder
+	{
 #pragma warning disable 169, 414
 		private MethodBase methodb; /* MethodBuilder, ConstructorBuilder or DynamicMethod */
 		private string name;
@@ -96,7 +122,7 @@ namespace System.Reflection.Emit {
 		{
 			if (position > 0) {
 				TypeBuilder.SetConstantValue (methodb.GetParameterType (position - 1),
-							      defaultValue, ref defaultValue);
+								  defaultValue, ref defaultValue);
 			}
 
 			def_value = defaultValue;
@@ -148,26 +174,6 @@ namespace System.Reflection.Emit {
 			marshal_info = unmanagedMarshal;
 			attrs |= ParameterAttributes.HasFieldMarshal;
 		}
-
-                void _ParameterBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                void _ParameterBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                void _ParameterBuilder.GetTypeInfoCount (out uint pcTInfo)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                void _ParameterBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-                {
-                        throw new NotImplementedException ();
-                }
 	}
 }
 

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -89,4 +89,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 28 - 22
mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs

@@ -31,7 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;
@@ -40,11 +40,37 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
+
+#if !MOBILE
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_PropertyBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class PropertyBuilder : _PropertyBuilder
+	{
+		void _PropertyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _PropertyBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _PropertyBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _PropertyBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class PropertyBuilder : PropertyInfo, _PropertyBuilder {
+	public sealed partial class PropertyBuilder : PropertyInfo {
 
 // Managed version of MonoReflectionPropertyBuilder
 #pragma warning disable 169, 414
@@ -178,26 +204,6 @@ namespace System.Reflection.Emit {
 			}
 		}
 
-                void _PropertyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                void _PropertyBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                void _PropertyBuilder.GetTypeInfoCount (out uint pcTInfo)
-                {
-                        throw new NotImplementedException ();
-                }
-
-                void _PropertyBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-                {
-                        throw new NotImplementedException ();
-                }
-
 		private Exception not_supported ()
 		{
 			return new NotSupportedException ("The invoked member is not supported in a dynamic module.");

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -105,4 +105,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs

@@ -27,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Globalization;
 using System.Reflection;

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs

@@ -31,7 +31,7 @@
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Reflection;
 using System.Reflection.Emit;

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/SignatureHelper.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -113,4 +113,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/StringToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 28 - 23
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs

@@ -31,7 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System;
 using System.Text;
 using System.Reflection;
@@ -48,11 +48,37 @@ using System.Diagnostics.SymbolStore;
 
 namespace System.Reflection.Emit
 {
+#if !MOBILE
+	
 	[ComVisible (true)]
 	[ComDefaultInterface (typeof (_TypeBuilder))]
 	[ClassInterface (ClassInterfaceType.None)]
+	partial class TypeBuilder : _TypeBuilder
+	{
+		void _TypeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _TypeBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _TypeBuilder.GetTypeInfoCount (out uint pcTInfo)
+		{
+			throw new NotImplementedException ();
+		}
+
+		void _TypeBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+		{
+			throw new NotImplementedException ();
+		}		
+	}
+#endif
+
 	[StructLayout (LayoutKind.Sequential)]
-	public sealed class TypeBuilder : TypeInfo, _TypeBuilder
+	public sealed partial class TypeBuilder : TypeInfo
 	{
 #pragma warning disable 169		
 		#region Sync with reflection.h
@@ -1868,27 +1894,6 @@ namespace System.Reflection.Emit
 				return res;
 		}
 
-
-		void _TypeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _TypeBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _TypeBuilder.GetTypeInfoCount (out uint pcTInfo)
-		{
-			throw new NotImplementedException ();
-		}
-
-		void _TypeBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
-		{
-			throw new NotImplementedException ();
-		}
-
 		internal override bool IsUserType {
 			get {
 				return false;

+ 2 - 2
mcs/class/corlib/System.Reflection.Emit/TypeBuilder.pns.cs

@@ -26,7 +26,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if FULL_AOT_RUNTIME
+#if !MONO_FEATURE_SRE
 
 namespace System.Reflection.Emit
 {
@@ -281,4 +281,4 @@ namespace System.Reflection.Emit
 	}
 }
 
-#endif
+#endif

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/TypeBuilderInstantiation.cs

@@ -31,7 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/TypeToken.cs

@@ -25,7 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {

+ 1 - 1
mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs

@@ -31,7 +31,7 @@
 // (C) 2001-2002 Ximian, Inc.  http://www.ximian.com
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Reflection.Emit;
 using System.Runtime.InteropServices;
 using System;

+ 7 - 9
mcs/class/corlib/System.Reflection/MonoParameterInfo.cs

@@ -28,7 +28,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Reflection.Emit;
 #endif
 using System.Runtime.CompilerServices;
@@ -79,7 +79,7 @@ namespace System.Reflection
 			}
 		}
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 		internal MonoParameterInfo (ParameterBuilder pb, Type type, MemberInfo member, int position) {
 			this.ClassImpl = type;
 			this.MemberImpl = member;
@@ -93,6 +93,11 @@ namespace System.Reflection
 				this.AttrsImpl = ParameterAttributes.None;
 			}
 		}
+
+		internal static ParameterInfo New (ParameterBuilder pb, Type type, MemberInfo member, int position)
+		{
+			return new MonoParameterInfo (pb, type, member, position);
+		}		
 #endif
 
 		/*FIXME this constructor looks very broken in the position parameter*/
@@ -307,13 +312,6 @@ namespace System.Reflection
 		[MethodImplAttribute (MethodImplOptions.InternalCall)]
 		internal extern Type[] GetTypeModifiers (bool optional);		
 
-#if !FULL_AOT_RUNTIME
-		internal static ParameterInfo New (ParameterBuilder pb, Type type, MemberInfo member, int position)
-		{
-			return new MonoParameterInfo (pb, type, member, position);
-		}
-#endif
-
 		internal static ParameterInfo New (ParameterInfo pinfo, Type type, MemberInfo member, int position)
 		{
 			return new MonoParameterInfo (pinfo, type, member, position);

+ 3 - 3
mcs/class/corlib/System/AppDomain.cs

@@ -36,7 +36,7 @@
 using System.Globalization;
 using System.IO;
 using System.Reflection;
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 using System.Reflection.Emit;
 #endif
 using System.Threading;
@@ -505,7 +505,7 @@ namespace System {
 			return (oh != null) ? oh.Unwrap () : null;
 		}
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 		public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
 		{
 			return DefineDynamicAssembly (name, access, null, null, null, null, null, false);
@@ -1339,7 +1339,7 @@ namespace System {
 
 			string name;
 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 			if (name_or_tb is TypeBuilder)
 				name = ((TypeBuilder) name_or_tb).FullName;
 			else

+ 1 - 1
mcs/class/referencesource/mscorlib/system/reflection/emit/symboltype.cs

@@ -5,7 +5,7 @@
 // ==--==
 // <OWNER>Microsoft</OWNER>
 // 
-#if !FULL_AOT_RUNTIME
+#if MONO_FEATURE_SRE
 namespace System.Reflection.Emit 
 {
     using System.Runtime.InteropServices;