[sgen] Add missing memory barrier
[mono.git] / mcs / class / corlib / ReferenceSources / MethodBase.cs
1 #if !FULL_AOT_RUNTIME
2 using System.Reflection.Emit;
3 #endif
4
5 using System.Runtime.CompilerServices;
6
7 namespace System.Reflection
8 {
9         partial class MethodBase
10         {
11                 //
12                 // This is a quick version for our own use. We should override
13                 // it where possible so that it does not allocate an array.
14                 // They cannot be abstract otherwise we break public contract
15                 //
16                 internal virtual ParameterInfo[] GetParametersInternal ()
17                 {
18                         // Override me
19                         return GetParameters ();
20                 }
21
22                 internal virtual int GetParametersCount ()
23                 {
24                         // Override me
25                         return GetParametersInternal ().Length;
26                 }
27
28                 internal virtual Type GetParameterType (int pos)
29                 {
30                         throw new NotImplementedException ();
31                 }
32
33                 internal virtual int get_next_table_index (object obj, int table, bool inc) {
34 #if !FULL_AOT_RUNTIME
35                         if (this is MethodBuilder) {
36                                 MethodBuilder mb = (MethodBuilder)this;
37                                 return mb.get_next_table_index (obj, table, inc);
38                         }
39                         if (this is ConstructorBuilder) {
40                                 ConstructorBuilder mb = (ConstructorBuilder)this;
41                                 return mb.get_next_table_index (obj, table, inc);
42                         }
43 #endif
44                         throw new Exception ("Method is not a builder method");
45                 }
46
47                 internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle)
48                 {
49                         return GetMethodFromHandleInternalType (handle.Value, IntPtr.Zero);
50                 }
51
52                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
53                 internal extern static MethodBody GetMethodBodyInternal (IntPtr handle);
54
55                 internal static MethodBody GetMethodBody (IntPtr handle) 
56                 {
57                         return GetMethodBodyInternal (handle);
58                 }
59
60                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
61                 extern static MethodBase GetMethodFromHandleInternalType (IntPtr method_handle, IntPtr type_handle);            
62         }
63 }