Move methodbody and exceptionHandlingClause to shared (#19364)
authorAnirudh Agnihotry <anirudhagnihotry098@gmail.com>
Thu, 9 Aug 2018 03:08:38 +0000 (20:08 -0700)
committerGitHub <noreply@github.com>
Thu, 9 Aug 2018 03:08:38 +0000 (20:08 -0700)
* Changing names and making runtime files

* Movel methodbody and exceptionHandlingClause to shared

* Fixing build error

16 files changed:
src/System.Private.CoreLib/System.Private.CoreLib.csproj
src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs [new file with mode: 0644]
src/System.Private.CoreLib/shared/System/Reflection/MethodBody.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Reflection/ExceptionHandlingClause.cs [deleted file]
src/System.Private.CoreLib/src/System/Reflection/MethodBody.cs [deleted file]
src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Reflection/RuntimeLocalVariableInfo.cs
src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodBody.cs [new file with mode: 0644]
src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs
src/System.Private.CoreLib/src/System/RuntimeHandles.cs
src/vm/comcallablewrapper.cpp
src/vm/mscorlib.h
src/vm/runtimehandles.cpp
src/vm/runtimehandles.h

index d231b4d..715e6e2 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttributeExtensions.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\ConstructorInfo.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttribute.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Reflection\ExceptionHandlingClause.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeExceptionHandlingClause.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\INVOCATION_FLAGS.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\MdImport.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\MemberInfo.Internal.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBase.CoreCLR.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBody.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeMethodBody.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\RtFieldInfo.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeAssembly.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeConstructorInfo.cs" />
index afb7c6b..db2fffb 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Emit\StackBehaviour.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventAttributes.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventInfo.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ExceptionHandlingClause.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ExceptionHandlingClauseOptions.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\FieldAttributes.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\FieldInfo.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberTypes.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodAttributes.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodBase.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodBody.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodImplAttributes.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodInfo.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodInfo.Internal.cs" />
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs b/src/System.Private.CoreLib/shared/System/Reflection/ExceptionHandlingClause.cs
new file mode 100644 (file)
index 0000000..15780f1
--- /dev/null
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+
+namespace System.Reflection
+{
+    public class ExceptionHandlingClause
+    {
+        protected ExceptionHandlingClause() { }
+        public virtual ExceptionHandlingClauseOptions Flags => default;
+        public virtual int TryOffset => 0;
+        public virtual int TryLength => 0;
+        public virtual int HandlerOffset => 0;
+        public virtual int HandlerLength => 0;
+        public virtual int FilterOffset => throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
+        public virtual Type CatchType => null;
+
+        public override string ToString()
+        {
+            return string.Format(CultureInfo.CurrentUICulture,
+                "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
+                Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
+        }
+    }
+}
+
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/MethodBody.cs b/src/System.Private.CoreLib/shared/System/Reflection/MethodBody.cs
new file mode 100644 (file)
index 0000000..bdf53ad
--- /dev/null
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+
+namespace System.Reflection
+{
+    public class MethodBody
+    {
+        protected MethodBody() { }
+        public virtual int LocalSignatureMetadataToken => 0;
+        public virtual IList<LocalVariableInfo> LocalVariables => throw new ArgumentNullException("array");
+        public virtual int MaxStackSize => 0;
+        public virtual bool InitLocals => false;
+        public virtual byte[] GetILAsByteArray() => null;
+        public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses => throw new ArgumentNullException("array");
+    }
+}
+
diff --git a/src/System.Private.CoreLib/src/System/Reflection/ExceptionHandlingClause.cs b/src/System.Private.CoreLib/src/System/Reflection/ExceptionHandlingClause.cs
deleted file mode 100644 (file)
index 89a3e23..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Globalization;
-
-namespace System.Reflection
-{
-    public class ExceptionHandlingClause
-    {
-        #region constructor
-        // This class can only be created from inside the EE.
-        protected ExceptionHandlingClause() { }
-        #endregion
-
-        #region Private Data Members
-        private MethodBody m_methodBody;
-        private ExceptionHandlingClauseOptions m_flags;
-        private int m_tryOffset;
-        private int m_tryLength;
-        private int m_handlerOffset;
-        private int m_handlerLength;
-        private int m_catchMetadataToken;
-        private int m_filterOffset;
-        #endregion
-
-        #region Public Members
-        public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
-        public virtual int TryOffset { get { return m_tryOffset; } }
-        public virtual int TryLength { get { return m_tryLength; } }
-        public virtual int HandlerOffset { get { return m_handlerOffset; } }
-        public virtual int HandlerLength { get { return m_handlerLength; } }
-
-        public virtual int FilterOffset
-        {
-            get
-            {
-                if (m_flags != ExceptionHandlingClauseOptions.Filter)
-                    throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
-
-                return m_filterOffset;
-            }
-        }
-
-        public virtual Type CatchType
-        {
-            get
-            {
-                if (m_flags != ExceptionHandlingClauseOptions.Clause)
-                    throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
-
-                Type type = null;
-
-                if (!MetadataToken.IsNullToken(m_catchMetadataToken))
-                {
-                    Type declaringType = m_methodBody.m_methodBase.DeclaringType;
-                    Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
-                    type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
-                        m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
-                }
-
-                return type;
-            }
-        }
-        #endregion
-
-        #region Object Overrides
-        public override string ToString()
-        {
-            if (Flags == ExceptionHandlingClauseOptions.Clause)
-            {
-                return string.Format(CultureInfo.CurrentUICulture,
-                    "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
-                    Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
-            }
-
-            if (Flags == ExceptionHandlingClauseOptions.Filter)
-            {
-                return string.Format(CultureInfo.CurrentUICulture,
-                    "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
-                    Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
-            }
-
-            return string.Format(CultureInfo.CurrentUICulture,
-                "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
-                Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
-        }
-        #endregion
-    }
-}
-
diff --git a/src/System.Private.CoreLib/src/System/Reflection/MethodBody.cs b/src/System.Private.CoreLib/src/System/Reflection/MethodBody.cs
deleted file mode 100644 (file)
index e1d18bf..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-
-namespace System.Reflection
-{
-    public class MethodBody
-    {
-        #region constructor
-        // This class can only be created from inside the EE.
-        protected MethodBody() { }
-        #endregion
-
-        #region Private Data Members
-        private byte[] m_IL;
-        private ExceptionHandlingClause[] m_exceptionHandlingClauses;
-        private LocalVariableInfo[] m_localVariables;
-        internal MethodBase m_methodBase;
-        private int m_localSignatureMetadataToken;
-        private int m_maxStackSize;
-        private bool m_initLocals;
-        #endregion
-
-        #region Public Members
-        public virtual int LocalSignatureMetadataToken { get { return m_localSignatureMetadataToken; } }
-        public virtual IList<LocalVariableInfo> LocalVariables { get { return Array.AsReadOnly(m_localVariables); } }
-        public virtual int MaxStackSize { get { return m_maxStackSize; } }
-        public virtual bool InitLocals { get { return m_initLocals; } }
-        public virtual byte[] GetILAsByteArray() { return m_IL; }
-        public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses { get { return Array.AsReadOnly(m_exceptionHandlingClauses); } }
-        #endregion
-    }
-}
-
index 5e9d5e3..02a3d2b 100644 (file)
@@ -370,9 +370,9 @@ namespace System.Reflection
 
         public override MethodBody GetMethodBody()
         {
-            MethodBody mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
+            RuntimeMethodBody mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
             if (mb != null)
-                mb.m_methodBase = this;
+                mb._methodBase = this;
             return mb;
         }
 
diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs
new file mode 100644 (file)
index 0000000..eff671e
--- /dev/null
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+
+namespace System.Reflection
+{
+    internal sealed class RuntimeExceptionHandlingClause : ExceptionHandlingClause
+    {
+        // This class can only be created from inside the EE.
+        private RuntimeExceptionHandlingClause() { }
+        
+        private RuntimeMethodBody _methodBody;
+        private ExceptionHandlingClauseOptions _flags;
+        private int _tryOffset;
+        private int _tryLength;
+        private int _handlerOffset;
+        private int _handlerLength;
+        private int _catchMetadataToken;
+        private int _filterOffset;
+        
+        public override ExceptionHandlingClauseOptions Flags => _flags;
+        public override int TryOffset => _tryOffset;
+        public override int TryLength => _tryLength;
+        public override int HandlerOffset => _handlerOffset;
+        public override int HandlerLength => _handlerLength;
+
+        public override int FilterOffset
+        {
+            get
+            {
+                if (_flags != ExceptionHandlingClauseOptions.Filter)
+                    throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
+
+                return _filterOffset;
+            }
+        }
+
+        public override Type CatchType
+        {
+            get
+            {
+                if (_flags != ExceptionHandlingClauseOptions.Clause)
+                    throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
+
+                Type type = null;
+
+                if (!MetadataToken.IsNullToken(_catchMetadataToken))
+                {
+                    Type declaringType = _methodBody._methodBase.DeclaringType;
+                    Module module = (declaringType == null) ? _methodBody._methodBase.Module : declaringType.Module;
+                    type = module.ResolveType(_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
+                        _methodBody._methodBase is MethodInfo ? _methodBody._methodBase.GetGenericArguments() : null);
+                }
+
+                return type;
+            }
+        }
+
+        public override string ToString()
+        {
+            if (Flags == ExceptionHandlingClauseOptions.Clause)
+            {
+                return string.Format(CultureInfo.CurrentUICulture,
+                    "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
+                    Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
+            }
+
+            if (Flags == ExceptionHandlingClauseOptions.Filter)
+            {
+                return string.Format(CultureInfo.CurrentUICulture,
+                    "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
+                    Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
+            }
+
+            return string.Format(CultureInfo.CurrentUICulture,
+                "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
+                Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
+        }
+    }
+}
+
index 77b4591..1b3dbd4 100644 (file)
@@ -12,7 +12,7 @@ namespace System.Reflection
         private int _localIndex;
         private bool _isPinned;
 
-        protected RuntimeLocalVariableInfo() { }
+        private RuntimeLocalVariableInfo() { }
 
         public override Type LocalType { get { Debug.Assert(_type != null, "type must be set!"); return _type; } }
         public override int LocalIndex => _localIndex;
diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodBody.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodBody.cs
new file mode 100644 (file)
index 0000000..a1b962a
--- /dev/null
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+
+namespace System.Reflection
+{
+    internal sealed class RuntimeMethodBody : MethodBody
+    {
+        // This class can only be created from inside the EE.
+        private RuntimeMethodBody() { }
+        
+        private byte[] _IL;
+        private ExceptionHandlingClause[] _exceptionHandlingClauses;
+        private LocalVariableInfo[] _localVariables;
+        internal MethodBase _methodBase;
+        private int _localSignatureMetadataToken;
+        private int _maxStackSize;
+        private bool _initLocals;
+
+        public override int LocalSignatureMetadataToken => _localSignatureMetadataToken;
+        public override IList<LocalVariableInfo> LocalVariables => Array.AsReadOnly(_localVariables);
+        public override int MaxStackSize => _maxStackSize;
+        public override bool InitLocals => _initLocals;
+        public override byte[] GetILAsByteArray() => _IL;
+        public override IList<ExceptionHandlingClause> ExceptionHandlingClauses => Array.AsReadOnly(_exceptionHandlingClauses);
+    }
+}
+
index b58f956..1e7e9de 100644 (file)
@@ -402,9 +402,9 @@ namespace System.Reflection
 
         public override MethodBody GetMethodBody()
         {
-            MethodBody mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
+            RuntimeMethodBody mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
             if (mb != null)
-                mb.m_methodBase = this;
+                mb._methodBase = this;
             return mb;
         }
         #endregion
index f07ce90..c053ee3 100644 (file)
@@ -982,7 +982,7 @@ namespace System
         internal static extern Resolver GetResolver(RuntimeMethodHandleInternal method);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        internal static extern MethodBody GetMethodBody(IRuntimeMethodInfo method, RuntimeType declaringType);
+        internal static extern RuntimeMethodBody GetMethodBody(IRuntimeMethodInfo method, RuntimeType declaringType);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         internal static extern bool IsConstructor(RuntimeMethodHandleInternal method);
index a2186a7..7b91668 100644 (file)
@@ -5564,7 +5564,7 @@ BOOL ComCallWrapperTemplate::IsSafeTypeForMarshalling()
         if (pMt->CanCastToClass(MscorlibBinder::GetClass(CLASS__ASSEMBLYBASE)) ||
         pMt->CanCastToClass(MscorlibBinder::GetClass(CLASS__MEMBER)) ||
         pMt->CanCastToClass(MscorlibBinder::GetClass(CLASS__MODULEBASE)) ||
-        pMt->CanCastToClass(MscorlibBinder::GetClass(CLASS__METHOD_BODY)) ||
+        pMt->CanCastToClass(MscorlibBinder::GetClass(CLASS__RUNTIME_METHOD_BODY)) ||
         pMt->CanCastToClass(MscorlibBinder::GetClass(CLASS__PARAMETER)))
         {
             isSafe = FALSE;
index 31d7231..c33e9e1 100644 (file)
@@ -540,16 +540,16 @@ DEFINE_METHOD(METHOD,               GET_PARAMETERS,         GetParameters,
 DEFINE_CLASS(METHOD_BASE,           Reflection,             MethodBase)
 DEFINE_METHOD(METHOD_BASE,          GET_METHODDESC,         GetMethodDesc,              IM_RetIntPtr)
 
-DEFINE_CLASS_U(Reflection,             ExceptionHandlingClause,    ExceptionHandlingClause)
-DEFINE_FIELD_U(m_methodBody,               ExceptionHandlingClause,        m_methodBody)
-DEFINE_FIELD_U(m_flags,                    ExceptionHandlingClause,        m_flags)
-DEFINE_FIELD_U(m_tryOffset,                ExceptionHandlingClause,        m_tryOffset)
-DEFINE_FIELD_U(m_tryLength,                ExceptionHandlingClause,        m_tryLength)
-DEFINE_FIELD_U(m_handlerOffset,            ExceptionHandlingClause,        m_handlerOffset)
-DEFINE_FIELD_U(m_handlerLength,            ExceptionHandlingClause,        m_handlerLength)
-DEFINE_FIELD_U(m_catchMetadataToken,       ExceptionHandlingClause,        m_catchToken)
-DEFINE_FIELD_U(m_filterOffset,             ExceptionHandlingClause,        m_filterOffset)
-DEFINE_CLASS(EH_CLAUSE,             Reflection,             ExceptionHandlingClause)
+DEFINE_CLASS_U(Reflection,             RuntimeExceptionHandlingClause,    RuntimeExceptionHandlingClause)
+DEFINE_FIELD_U(_methodBody,            RuntimeExceptionHandlingClause,        _methodBody)
+DEFINE_FIELD_U(_flags,                 RuntimeExceptionHandlingClause,        _flags)
+DEFINE_FIELD_U(_tryOffset,             RuntimeExceptionHandlingClause,        _tryOffset)
+DEFINE_FIELD_U(_tryLength,             RuntimeExceptionHandlingClause,        _tryLength)
+DEFINE_FIELD_U(_handlerOffset,         RuntimeExceptionHandlingClause,        _handlerOffset)
+DEFINE_FIELD_U(_handlerLength,         RuntimeExceptionHandlingClause,        _handlerLength)
+DEFINE_FIELD_U(_catchMetadataToken,    RuntimeExceptionHandlingClause,        _catchToken)
+DEFINE_FIELD_U(_filterOffset,          RuntimeExceptionHandlingClause,        _filterOffset)
+DEFINE_CLASS(RUNTIME_EH_CLAUSE,             Reflection,             RuntimeExceptionHandlingClause)
 
 DEFINE_CLASS_U(Reflection,             RuntimeLocalVariableInfo,        RuntimeLocalVariableInfo)
 DEFINE_FIELD_U(_type,                  RuntimeLocalVariableInfo,        _type)
@@ -557,15 +557,15 @@ DEFINE_FIELD_U(_localIndex,            RuntimeLocalVariableInfo,        _localIn
 DEFINE_FIELD_U(_isPinned,              RuntimeLocalVariableInfo,        _isPinned)
 DEFINE_CLASS(RUNTIME_LOCAL_VARIABLE_INFO,   Reflection,             RuntimeLocalVariableInfo)
 
-DEFINE_CLASS_U(Reflection,             MethodBody,                 MethodBody)
-DEFINE_FIELD_U(m_IL,                       MethodBody,         m_IL)
-DEFINE_FIELD_U(m_exceptionHandlingClauses, MethodBody,         m_exceptionClauses)
-DEFINE_FIELD_U(m_localVariables,           MethodBody,         m_localVariables)
-DEFINE_FIELD_U(m_methodBase,               MethodBody,         m_methodBase)
-DEFINE_FIELD_U(m_localSignatureMetadataToken, MethodBody,      m_localVarSigToken)
-DEFINE_FIELD_U(m_maxStackSize,             MethodBody,         m_maxStackSize)
-DEFINE_FIELD_U(m_initLocals,               MethodBody,         m_initLocals)
-DEFINE_CLASS(METHOD_BODY,           Reflection,             MethodBody)
+DEFINE_CLASS_U(Reflection,             RuntimeMethodBody,           RuntimeMethodBody)
+DEFINE_FIELD_U(_IL,                    RuntimeMethodBody,         _IL)
+DEFINE_FIELD_U(_exceptionHandlingClauses, RuntimeMethodBody,         _exceptionClauses)
+DEFINE_FIELD_U(_localVariables,           RuntimeMethodBody,         _localVariables)
+DEFINE_FIELD_U(_methodBase,               RuntimeMethodBody,         _methodBase)
+DEFINE_FIELD_U(_localSignatureMetadataToken, RuntimeMethodBody,      _localVarSigToken)
+DEFINE_FIELD_U(_maxStackSize,             RuntimeMethodBody,         _maxStackSize)
+DEFINE_FIELD_U(_initLocals,               RuntimeMethodBody,         _initLocals)
+DEFINE_CLASS(RUNTIME_METHOD_BODY,           Reflection,             RuntimeMethodBody)
 
 DEFINE_CLASS(METHOD_INFO,           Reflection,             MethodInfo)
 
index f587b4c..25a96a3 100644 (file)
@@ -2418,7 +2418,7 @@ FCIMPL2(MethodDesc*, RuntimeMethodHandle::GetMethodFromCanonical, MethodDesc *pM
 FCIMPLEND
 
 
-FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *pMethodUNSAFE, ReflectClassBaseObject *pDeclaringTypeUNSAFE)
+FCIMPL2(RuntimeMethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *pMethodUNSAFE, ReflectClassBaseObject *pDeclaringTypeUNSAFE)
 {      
     CONTRACTL 
     {
@@ -2428,8 +2428,8 @@ FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *p
 
     struct _gc
     {
-        METHODBODYREF MethodBodyObj;
-        EXCEPTIONHANDLINGCLAUSEREF EHClauseObj;
+        RUNTIMEMETHODBODYREF MethodBodyObj;
+        RUNTIMEEXCEPTIONHANDLINGCLAUSEREF EHClauseObj;
         RUNTIMELOCALVARIABLEINFOREF RuntimeLocalVariableInfoObj;
         U1ARRAYREF                  U1Array;
         BASEARRAYREF                TempArray;
@@ -2466,7 +2466,7 @@ FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *p
         
         if (pILHeader)
         {
-            MethodTable * pExceptionHandlingClauseMT = MscorlibBinder::GetClass(CLASS__EH_CLAUSE);
+            MethodTable * pExceptionHandlingClauseMT = MscorlibBinder::GetClass(CLASS__RUNTIME_EH_CLAUSE);
             TypeHandle thEHClauseArray = ClassLoader::LoadArrayTypeThrowing(TypeHandle(pExceptionHandlingClauseMT), ELEMENT_TYPE_SZARRAY);
 
             MethodTable * pLocalVariableMT = MscorlibBinder::GetClass(CLASS__RUNTIME_LOCAL_VARIABLE_INFO);
@@ -2489,30 +2489,30 @@ FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *p
                 }
             }
 
-            gc.MethodBodyObj = (METHODBODYREF)AllocateObject(MscorlibBinder::GetClass(CLASS__METHOD_BODY));
+            gc.MethodBodyObj = (RUNTIMEMETHODBODYREF)AllocateObject(MscorlibBinder::GetClass(CLASS__RUNTIME_METHOD_BODY));
             
-            gc.MethodBodyObj->m_maxStackSize = header.GetMaxStack();
-            gc.MethodBodyObj->m_initLocals = !!(header.GetFlags() & CorILMethod_InitLocals);
+            gc.MethodBodyObj->_maxStackSize = header.GetMaxStack();
+            gc.MethodBodyObj->_initLocals = !!(header.GetFlags() & CorILMethod_InitLocals);
 
             if (header.IsFat())
-                gc.MethodBodyObj->m_localVarSigToken = header.GetLocalVarSigTok();
+                gc.MethodBodyObj->_localVarSigToken = header.GetLocalVarSigTok();
             else
-                gc.MethodBodyObj->m_localVarSigToken = 0;
+                gc.MethodBodyObj->_localVarSigToken = 0;
 
             // Allocate the array of IL and fill it in from the method header.
             BYTE* pIL = const_cast<BYTE*>(header.Code);
             COUNT_T cIL = header.GetCodeSize();
             gc.U1Array  = (U1ARRAYREF) AllocatePrimitiveArray(ELEMENT_TYPE_U1, cIL);
 
-            SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->m_IL, gc.U1Array, GetAppDomain());
-            memcpyNoGCRefs(gc.MethodBodyObj->m_IL->GetDataPtr(), pIL, cIL);
+            SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->_IL, gc.U1Array, GetAppDomain());
+            memcpyNoGCRefs(gc.MethodBodyObj->_IL->GetDataPtr(), pIL, cIL);
 
             // Allocate the array of exception clauses.
             INT32 cEh = (INT32)header.EHCount();
             const COR_ILMETHOD_SECT_EH* ehInfo = header.EH;
             gc.TempArray = (BASEARRAYREF) AllocateArrayEx(thEHClauseArray, &cEh, 1);
 
-            SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->m_exceptionClauses, gc.TempArray, GetAppDomain());
+            SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->_exceptionClauses, gc.TempArray, GetAppDomain());
             
             for (INT32 i = 0; i < cEh; i++)
             {                    
@@ -2520,21 +2520,21 @@ FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *p
                 const COR_ILMETHOD_SECT_EH_CLAUSE_FAT* ehClause = 
                     (const COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)ehInfo->EHClause(i, &ehBuff); 
 
-                gc.EHClauseObj = (EXCEPTIONHANDLINGCLAUSEREF) AllocateObject(pExceptionHandlingClauseMT);
+                gc.EHClauseObj = (RUNTIMEEXCEPTIONHANDLINGCLAUSEREF) AllocateObject(pExceptionHandlingClauseMT);
 
-                gc.EHClauseObj->m_flags = ehClause->GetFlags();  
-                gc.EHClauseObj->m_tryOffset = ehClause->GetTryOffset();
-                gc.EHClauseObj->m_tryLength = ehClause->GetTryLength();
-                gc.EHClauseObj->m_handlerOffset = ehClause->GetHandlerOffset();
-                gc.EHClauseObj->m_handlerLength = ehClause->GetHandlerLength();
+                gc.EHClauseObj->_flags = ehClause->GetFlags();  
+                gc.EHClauseObj->_tryOffset = ehClause->GetTryOffset();
+                gc.EHClauseObj->_tryLength = ehClause->GetTryLength();
+                gc.EHClauseObj->_handlerOffset = ehClause->GetHandlerOffset();
+                gc.EHClauseObj->_handlerLength = ehClause->GetHandlerLength();
                 
                 if ((ehClause->GetFlags() & COR_ILEXCEPTION_CLAUSE_FILTER) == 0)
-                    gc.EHClauseObj->m_catchToken = ehClause->GetClassToken();
+                    gc.EHClauseObj->_catchToken = ehClause->GetClassToken();
                 else
-                    gc.EHClauseObj->m_filterOffset = ehClause->GetFilterOffset();
+                    gc.EHClauseObj->_filterOffset = ehClause->GetFilterOffset();
                 
-                gc.MethodBodyObj->m_exceptionClauses->SetAt(i, (OBJECTREF) gc.EHClauseObj);
-                SetObjectReference((OBJECTREF*)&(gc.EHClauseObj->m_methodBody), (OBJECTREF)gc.MethodBodyObj, GetAppDomain());
+                gc.MethodBodyObj->_exceptionClauses->SetAt(i, (OBJECTREF) gc.EHClauseObj);
+                SetObjectReference((OBJECTREF*)&(gc.EHClauseObj->_methodBody), (OBJECTREF)gc.MethodBodyObj, GetAppDomain());
             }     
            
             if (header.LocalVarSig != NULL)
@@ -2547,7 +2547,7 @@ FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *p
                                 MetaSig::sigLocalVars);
                 INT32 cLocals = metaSig.NumFixedArgs();
                 gc.TempArray  = (BASEARRAYREF) AllocateArrayEx(thLocalVariableArray, &cLocals, 1);
-                SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->m_localVariables, gc.TempArray, GetAppDomain());
+                SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->_localVariables, gc.TempArray, GetAppDomain());
 
                 for (INT32 i = 0; i < cLocals; i ++)
                 {
@@ -2565,20 +2565,20 @@ FCIMPL2(MethodBody *, RuntimeMethodHandle::GetMethodBody, ReflectMethodObject *p
                     TypeHandle  tempType= metaSig.GetArgProps().GetTypeHandleThrowing(pModule, &sigTypeContext);       
                     OBJECTREF refLocalType = tempType.GetManagedClassObject();
                     gc.RuntimeLocalVariableInfoObj->SetType(refLocalType);
-                    gc.MethodBodyObj->m_localVariables->SetAt(i, (OBJECTREF) gc.RuntimeLocalVariableInfoObj);
+                    gc.MethodBodyObj->_localVariables->SetAt(i, (OBJECTREF) gc.RuntimeLocalVariableInfoObj);
                 }        
             }
             else
             {
                 INT32 cLocals = 0;
                 gc.TempArray  = (BASEARRAYREF) AllocateArrayEx(thLocalVariableArray, &cLocals, 1);
-                SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->m_localVariables, gc.TempArray, GetAppDomain());
+                SetObjectReference((OBJECTREF*)&gc.MethodBodyObj->_localVariables, gc.TempArray, GetAppDomain());
             }
         }
     }
     HELPER_METHOD_FRAME_END();
 
-    return (MethodBody*)OBJECTREFToObject(gc.MethodBodyObj);
+    return (RuntimeMethodBody*)OBJECTREFToObject(gc.MethodBodyObj);
 }
 FCIMPLEND
 
index f35ef44..213e90d 100644 (file)
@@ -30,54 +30,54 @@ typedef enum ReflectionCallConv {
 
 // Types used to expose method bodies via reflection.
 
-class ExceptionHandlingClause;
-class MethodBody;
+class RuntimeExceptionHandlingClause;
+class RuntimeMethodBody;
 class RuntimeLocalVariableInfo;
 
 #ifdef USE_CHECKED_OBJECTREFS
-typedef REF<ExceptionHandlingClause> EXCEPTIONHANDLINGCLAUSEREF;
-typedef REF<MethodBody> METHODBODYREF;
+typedef REF<RuntimeExceptionHandlingClause> RUNTIMEEXCEPTIONHANDLINGCLAUSEREF;
+typedef REF<RuntimeMethodBody> RUNTIMEMETHODBODYREF;
 typedef REF<RuntimeLocalVariableInfo> RUNTIMELOCALVARIABLEINFOREF;
 #else
-typedef DPTR(ExceptionHandlingClause) EXCEPTIONHANDLINGCLAUSEREF;
-typedef DPTR(MethodBody) METHODBODYREF;
+typedef DPTR(RuntimeExceptionHandlingClause) RUNTIMEEXCEPTIONHANDLINGCLAUSEREF;
+typedef DPTR(RuntimeMethodBody) RUNTIMEMETHODBODYREF;
 typedef DPTR(RuntimeLocalVariableInfo) RUNTIMELOCALVARIABLEINFOREF;
 #endif
 
-class ExceptionHandlingClause : Object 
+class RuntimeExceptionHandlingClause : Object 
 {
 private:
     // Disallow creation and copy construction of these.
-    ExceptionHandlingClause() { }
-    ExceptionHandlingClause(ExceptionHandlingClause &r) { }    
+    RuntimeExceptionHandlingClause() { }
+    RuntimeExceptionHandlingClause(RuntimeExceptionHandlingClause &r) { }    
 
 public:
-    METHODBODYREF m_methodBody;
-    CorExceptionFlag m_flags;
-    INT32 m_tryOffset;
-    INT32 m_tryLength;
-    INT32 m_handlerOffset;
-    INT32 m_handlerLength;
-    mdTypeDef m_catchToken;
-    INT32 m_filterOffset;
+    RUNTIMEMETHODBODYREF _methodBody;
+    CorExceptionFlag _flags;
+    INT32 _tryOffset;
+    INT32 _tryLength;
+    INT32 _handlerOffset;
+    INT32 _handlerLength;
+    mdTypeDef _catchToken;
+    INT32 _filterOffset;
 };
 
-class MethodBody : Object 
+class RuntimeMethodBody : Object 
 {     
 private:
     // Disallow creation and copy construction of these.
-    MethodBody() { }
-    MethodBody(MethodBody &r) { }    
+    RuntimeMethodBody() { }
+    RuntimeMethodBody(RuntimeMethodBody &r) { }    
 
 public:
-    U1ARRAYREF m_IL;
-    PTRARRAYREF m_exceptionClauses;
-    PTRARRAYREF m_localVariables;
-    OBJECTREF m_methodBase;
-
-    INT32 m_localVarSigToken;
-    INT32 m_maxStackSize;
-    CLR_BOOL m_initLocals;    
+    U1ARRAYREF _IL;
+    PTRARRAYREF _exceptionClauses;
+    PTRARRAYREF _localVariables;
+    OBJECTREF _methodBase;
+
+    INT32 _localVarSigToken;
+    INT32 _maxStackSize;
+    CLR_BOOL _initLocals;    
 };
 
 class RuntimeLocalVariableInfo : Object
@@ -358,7 +358,7 @@ public:
     static
     void QCALLTYPE GetCallerType(QCall::StackCrawlMarkHandle pStackMark, QCall::ObjectHandleOnStack retType);
 
-    static FCDECL2(MethodBody*, GetMethodBody, ReflectMethodObject *pMethodUNSAFE, PTR_ReflectClassBaseObject pDeclaringType);
+    static FCDECL2(RuntimeMethodBody*, GetMethodBody, ReflectMethodObject *pMethodUNSAFE, PTR_ReflectClassBaseObject pDeclaringType);
 
     static FCDECL1(FC_BOOL_RET, IsConstructor, MethodDesc *pMethod);