4 * Application program used by the debugger tests.
7 using System.Runtime.CompilerServices;
8 using System.Reflection;
9 using System.Reflection.Emit;
10 using System.Diagnostics;
11 using System.Threading;
12 using System.Collections.Generic;
15 public class TestsBase
17 #pragma warning disable 0414
18 #pragma warning disable 0169
19 public int base_field_i;
20 public string base_field_s;
21 static int base_static_i = 57;
22 static string base_static_s = "C";
23 #pragma warning restore 0414
24 #pragma warning restore 0169
32 public sealed class Tests3 {
33 public static void M1 () {
47 public static class Tests4 {
52 public class AAttribute : Attribute {
56 public class BAttribute : AAttribute {
60 [DebuggerDisplay ("Tests", Name="FOO", Target=typeof (int))]
61 [DebuggerTypeProxy (typeof (Tests))]
62 [BAttribute (afield = 1, bfield = 2)]
64 [DebuggerBrowsableAttribute (DebuggerBrowsableState.Collapsed)]
66 public static int static_field_j;
68 [DebuggerBrowsableAttribute (DebuggerBrowsableState.Collapsed)]
69 public int AProperty {
75 public void invoke () {
79 public struct AStruct {
85 [MethodImplAttribute (MethodImplOptions.NoInlining)]
86 public int foo (int val) {
90 [MethodImplAttribute (MethodImplOptions.NoInlining)]
91 public static int static_foo (int val) {
95 [MethodImplAttribute (MethodImplOptions.NoInlining)]
96 public int invoke_return_int () {
100 [MethodImplAttribute (MethodImplOptions.NoInlining)]
101 public static int invoke_static () {
105 [MethodImplAttribute (MethodImplOptions.NoInlining)]
106 public IntPtr invoke_return_intptr () {
111 public class GClass<T> {
113 public static T static_field;
115 [MethodImplAttribute (MethodImplOptions.NoInlining)]
119 [MethodImplAttribute (MethodImplOptions.NoInlining)]
120 public void bp<T2> () {
124 public struct GStruct<T> {
129 [MethodImplAttribute (MethodImplOptions.NoInlining)]
130 public int invoke_return_int () {
135 public struct NestedStruct {
136 NestedInner nested1, nested2;
139 public struct NestedInner {
154 class TestIfaces : ITest
162 TestIfaces<int> Baz () {
167 class TestIfaces<T> : ITest<T>
169 void ITest<T>.Foo () {
172 void ITest<T>.Bar () {
176 public interface ITest2
181 public class Tests : TestsBase, ITest2
183 #pragma warning disable 0414
187 bool field_bool1, field_bool2;
200 static int static_i = 55;
201 static string static_s = "A";
202 public const int literal_i = 56;
203 public const string literal_s = "B";
205 public AStruct field_struct;
206 public object field_boxed_struct;
207 public GStruct<int> generic_field_struct;
208 public KeyValuePair<int, object> boxed_struct_field;
210 public static int tls_i;
211 public static bool is_attached = Debugger.IsAttached;
212 public NestedStruct nested_struct;
214 #pragma warning restore 0414
216 public class NestedClass {
219 public int IntProperty {
228 public int ReadOnlyProperty {
234 public int this [int index] {
240 public static void wait_one ()
242 ManualResetEvent evt = new ManualResetEvent (false);
246 public static int Main (String[] args) {
249 if (args.Length > 0 && args [0] == "suspend-test")
250 /* This contains an infinite loop, so execute it conditionally */
252 if (args.Length >0 && args [0] == "unhandled-exception") {
253 unhandled_exception ();
256 if (args.Length >0 && args [0] == "unhandled-exception-endinvoke") {
257 unhandled_exception_endinvoke ();
260 if (args.Length >0 && args [0] == "unhandled-exception-user") {
261 unhandled_exception_user ();
264 if (args.Length >0 && args [0] == "wait-one") {
287 if (args.Length > 0 && args [0] == "domain-test")
288 /* This takes a lot of time, so execute it conditionally */
290 if (args.Length > 0 && args [0] == "ref-emit-test")
292 if (args.Length > 0 && args [0] == "frames-in-native")
294 if (args.Length > 0 && args [0] == "invoke-single-threaded")
295 new Tests ().invoke_single_threaded ();
299 public static void breakpoints () {
300 /* Call these early so it is JITted by the time a breakpoint is placed on it */
312 bp6<string> (new GClass <int> ());
317 [MethodImplAttribute (MethodImplOptions.NoInlining)]
318 public static void bp1 () {
321 [MethodImplAttribute (MethodImplOptions.NoInlining)]
322 public static void bp2 () {
325 [MethodImplAttribute (MethodImplOptions.NoInlining)]
326 public static void bp3 () {
329 [MethodImplAttribute (MethodImplOptions.NoInlining)]
330 public static void bp4 () {
333 [MethodImplAttribute (MethodImplOptions.NoInlining)]
334 public static void bp5 () {
337 [MethodImplAttribute (MethodImplOptions.NoInlining)]
338 public static void bp6<T> (GClass<int> gc) {
342 [MethodImplAttribute (MethodImplOptions.NoInlining)]
343 public static void bp7<T> () {
346 [MethodImplAttribute (MethodImplOptions.NoInlining)]
347 public static void single_stepping () {
354 ss5 (new int [] { 1, 2, 3 }, new Func<int, bool> (is_even));
361 ss_regress_654694 ();
364 [MethodImplAttribute (MethodImplOptions.NoInlining)]
365 public static void ss1 () {
368 [MethodImplAttribute (MethodImplOptions.NoInlining)]
369 public static void ss2 () {
372 [MethodImplAttribute (MethodImplOptions.NoInlining)]
373 public static int ss3 () {
376 for (int i = 0; i < 10; ++i)
382 [MethodImplAttribute (MethodImplOptions.NoInlining)]
383 public static void ss3_2 () {
387 [MethodImplAttribute (MethodImplOptions.NoInlining)]
388 public static void ss3_2_2 () {
391 [MethodImplAttribute (MethodImplOptions.NoInlining)]
392 public static int ss4 () {
398 [MethodImplAttribute (MethodImplOptions.NoInlining)]
399 public static void ss5 (int[] arr, Func<int, bool> selector) {
400 // Call into linq which calls back into this assembly
401 arr.Count (selector);
404 [MethodImplAttribute (MethodImplOptions.NoInlining)]
405 public static void ss6 (bool b) {
408 throw new Exception ();
412 [MethodImplAttribute (MethodImplOptions.NoInlining)]
413 public static void ss6_2 () {
416 [MethodImplAttribute (MethodImplOptions.NoInlining)]
417 public static void ss7 () {
426 [MethodImplAttribute (MethodImplOptions.NoInlining)]
427 public static void ss7_2 () {
430 [MethodImplAttribute (MethodImplOptions.NoInlining)]
431 public static void ss7_3 () {
432 throw new Exception ();
435 [MethodImplAttribute (MethodImplOptions.NoInlining)]
436 public static void ss_nested () {
437 ss_nested_1 (ss_nested_2 ());
438 ss_nested_1 (ss_nested_2 ());
442 [MethodImplAttribute (MethodImplOptions.NoInlining)]
443 public static void ss_nested_1 (int i) {
446 [MethodImplAttribute (MethodImplOptions.NoInlining)]
447 public static int ss_nested_2 () {
451 [MethodImplAttribute (MethodImplOptions.NoInlining)]
452 public static void ss_nested_3 () {
455 [MethodImplAttribute (MethodImplOptions.NoInlining)]
456 public static bool is_even (int i) {
462 Console.WriteLine ("HIT!");
468 [MethodImplAttribute (MethodImplOptions.NoInlining)]
469 public static void arguments () {
470 arg1 (SByte.MaxValue - 5, Byte.MaxValue - 5, true, Int16.MaxValue - 5, UInt16.MaxValue - 5, 'F', Int32.MaxValue - 5, UInt32.MaxValue - 5, Int64.MaxValue - 5, UInt64.MaxValue - 5, 1.2345f, 6.78910, new IntPtr (Int32.MaxValue - 5), new UIntPtr (UInt32.MaxValue - 5));
472 arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object ());
473 Tests t = new Tests () { field_i = 42, field_s = "S" };
477 [MethodImplAttribute (MethodImplOptions.NoInlining)]
478 public static int arg1 (sbyte sb, byte b, bool bl, short s, ushort us, char c, int i, uint ui, long l, ulong ul, float f, double d, IntPtr ip, UIntPtr uip) {
479 return (int)(sb + b + (bl ? 0 : 1) + s + us + (int)c + i + ui + l + (long)ul + f + d + (int)ip + (int)uip);
482 [MethodImplAttribute (MethodImplOptions.NoInlining)]
483 public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2) {
484 return s + (s3 != null ? "" : "") + o + i + gc.field + o2;
487 [MethodImplAttribute (MethodImplOptions.NoInlining)]
488 public object arg3 (string s) {
489 return s + s + s + s + this;
492 [MethodImplAttribute (MethodImplOptions.NoInlining)]
493 public static void objects () {
494 Tests t = new Tests () { field_i = 42, field_bool1 = true, field_bool2 = false, field_char = 'A', field_byte = 129, field_sbyte = -33, field_short = Int16.MaxValue - 5, field_ushort = UInt16.MaxValue - 5, field_long = Int64.MaxValue - 5, field_ulong = UInt64.MaxValue - 5, field_float = 3.14f, field_double = 3.14f, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B, field_class = null, field_intptr = new IntPtr (Int32.MaxValue - 5), field_nullable = null };
495 t.o1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
496 o2 (new string [] { "BAR", "BAZ" }, new int[] { 42, 43 }, new int [,] { { 1, 2 }, { 3, 4 }}, (int[,])Array.CreateInstance (typeof (int), new int [] { 2, 2}, new int [] { 1, 3}), new int[] { 0 });
499 [MethodImplAttribute (MethodImplOptions.NoInlining)]
500 public object o1 (Tests2 t, GClass <int> gc1, GClass <string> gc2) {
501 if (t == null || gc1 == null || gc2 == null)
507 [MethodImplAttribute (MethodImplOptions.NoInlining)]
508 public static string o2 (string[] s2, int[] s3, int[,] s4, int[,] s5, IList<int> s6) {
509 return s2 [0] + s3 [0] + s4 [0, 0] + s6 [0];
512 [MethodImplAttribute (MethodImplOptions.NoInlining)]
513 public static void objrefs () {
514 Tests t = new Tests () {};
522 [MethodImplAttribute (MethodImplOptions.NoInlining)]
523 public static void set_child (Tests t) {
524 t.child = new Tests ();
527 [MethodImplAttribute (MethodImplOptions.NoInlining)]
528 public void objrefs1 () {
531 [MethodImplAttribute (MethodImplOptions.NoInlining)]
532 public static void objrefs2 () {
535 public static void vtypes () {
536 Tests t = new Tests () { field_struct = new AStruct () { i = 42, s = "S", k = 43 }, generic_field_struct = new GStruct<int> () { i = 42 }, field_boxed_struct = new AStruct () { i = 42 }, boxed_struct_field = new KeyValuePair<int, object> (1, (long)42 ) };
537 AStruct s = new AStruct { i = 44, s = "T", k = 45 };
538 AStruct[] arr = new AStruct[] {
539 new AStruct () { i = 1, s = "S1" },
540 new AStruct () { i = 2, s = "S2" } };
546 [MethodImplAttribute (MethodImplOptions.NoInlining)]
547 public object vtypes1 (AStruct s, AStruct[] arr) {
554 [MethodImplAttribute (MethodImplOptions.NoInlining)]
555 public static void vtypes2 (AStruct s) {
559 [MethodImplAttribute (MethodImplOptions.NoInlining)]
560 public static void vtypes3 (AStruct s) {
561 AStruct.static_foo (5);
564 [MethodImplAttribute (MethodImplOptions.NoInlining)]
565 public static void locals () {
568 locals2<string> (null, 5, "ABC", ref s);
574 [MethodImplAttribute (MethodImplOptions.NoInlining)]
575 static void locals11 (double a, ref double b) {
578 [MethodImplAttribute (MethodImplOptions.NoInlining)]
579 public static void locals1 (string[] args) {
583 locals11 (b: ref ri, a: ri);
585 for (int j = 0; j < 10; ++j) {
590 [MethodImplAttribute (MethodImplOptions.NoInlining)]
592 [StateMachine (typeof (int))]
594 public static void locals2<T> (string[] args, int arg, T t, ref string rs) {
598 for (int j = 0; j < 10; ++j) {
608 [MethodImplAttribute (MethodImplOptions.NoInlining)]
609 public static void locals3 () {
629 [MethodImplAttribute (MethodImplOptions.NoInlining)]
630 public static void locals4 () {
633 [MethodImplAttribute (MethodImplOptions.NoInlining)]
634 public static void locals5 () {
637 [MethodImplAttribute (MethodImplOptions.NoInlining)]
638 public static void locals6 () {
641 for (i = 0; i < 10; ++i)
644 for (i = 0; i < 10; ++i)
654 [MethodImplAttribute (MethodImplOptions.NoInlining)]
655 public static void locals6_1 () {
658 [MethodImplAttribute (MethodImplOptions.NoInlining)]
659 public static void locals6_2 (int arg) {
662 [MethodImplAttribute (MethodImplOptions.NoInlining)]
663 public static void locals6_3 () {
664 // Clobber all registers
665 int sum = 0, i, j, k, l, m;
666 for (i = 0; i < 100; ++i)
668 for (j = 0; j < 100; ++j)
670 for (k = 0; k < 100; ++k)
672 for (l = 0; l < 100; ++l)
674 for (m = 0; m < 100; ++m)
678 [MethodImplAttribute (MethodImplOptions.NoInlining)]
679 public static void locals6_4 (int arg) {
682 [MethodImplAttribute (MethodImplOptions.NoInlining)]
683 public static void locals6_5 () {
686 [MethodImplAttribute (MethodImplOptions.NoInlining)]
687 public static void locals6_6 (int arg) {
690 [MethodImplAttribute (MethodImplOptions.NoInlining)]
691 public static void locals7<T> (T arg) {
696 [MethodImplAttribute (MethodImplOptions.NoInlining)]
697 public static void line_numbers () {
701 [MethodImplAttribute (MethodImplOptions.NoInlining)]
702 public static void suspend () {
710 [MethodImplAttribute (MethodImplOptions.NoInlining)]
711 public static void type_info () {
712 Tests t = new Tests () { field_i = 42, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B };
713 t.ti1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
716 AStruct s = new AStruct () { i = 42, s = "S", k = 43 };
718 ti2 (new string [] { "BAR", "BAZ" }, new int[] { 42, 43 }, new int [,] { { 1, 2 }, { 3, 4 }}, ref val, (int*)IntPtr.Zero, 5, s, new Tests (), new Tests2 (), new GClass <int> (), AnEnum.B);
722 [MethodImplAttribute (MethodImplOptions.NoInlining)]
723 public object ti1 (Tests2 t, GClass <int> gc1, GClass <string> gc2) {
724 if (t == null || gc1 == null || gc2 == null)
730 [MethodImplAttribute (MethodImplOptions.NoInlining)]
731 public static unsafe string ti2 (string[] s2, int[] s3, int[,] s4, ref int ri, int* ptr, int i, AStruct s, Tests t, Tests2 t2, GClass<int> g, AnEnum ae) {
732 return s2 [0] + s3 [0] + s4 [0, 0];
735 [MethodImplAttribute (MethodImplOptions.NoInlining)]
736 public static void assembly_load () {
740 [MethodImplAttribute (MethodImplOptions.NoInlining)]
741 public static void assembly_load_2 () {
742 // This will load System.dll while holding the loader lock
746 [MethodImplAttribute (MethodImplOptions.NoInlining)]
747 public static void invoke () {
748 new Tests ().invoke1 (new Tests2 (), new AStruct () { i = 42, j = (IntPtr)43 }, new GStruct<int> { j = 42 });
749 new Tests ().invoke_ex ();
752 [MethodImplAttribute (MethodImplOptions.NoInlining)]
753 public void invoke1 (Tests2 t, AStruct s, GStruct<int> g) {
757 [MethodImplAttribute (MethodImplOptions.NoInlining)]
758 public void invoke2 () {
761 [MethodImplAttribute (MethodImplOptions.NoInlining)]
762 public void invoke_ex () {
766 [MethodImplAttribute (MethodImplOptions.NoInlining)]
767 public void invoke_ex_inner () {
769 throw new Exception ();
776 [MethodImplAttribute (MethodImplOptions.NoInlining)]
777 public void invoke_single_threaded () {
778 // Spawn a thread incrementing a counter
779 bool finished = false;
781 new Thread (delegate () {
788 invoke_single_threaded_2 ();
793 [MethodImplAttribute (MethodImplOptions.NoInlining)]
794 public void invoke_single_threaded_2 () {
797 public void invoke_return_void () {
800 public string invoke_return_ref () {
804 public object invoke_return_null () {
808 public int invoke_return_primitive () {
812 public int? invoke_return_nullable () {
816 public int? invoke_return_nullable_null () {
820 public void invoke_type_load () {
827 public long invoke_pass_primitive (byte ub, sbyte sb, short ss, ushort us, int i, uint ui, long l, ulong ul, char c, bool b, float f, double d) {
828 return ub + sb + ss + us + i + ui + l + (long)ul + (int)c + (b ? 1 : 0) + (int)f + (int)d;
831 public int invoke_pass_primitive2 (bool b) {
835 public string invoke_pass_ref (string s) {
839 public static string invoke_static_pass_ref (string s) {
843 public static void invoke_static_return_void () {
846 public static void invoke_throws () {
847 throw new Exception ();
850 public int invoke_iface () {
854 [MethodImplAttribute (MethodImplOptions.NoInlining)]
855 public static void exceptions () {
857 throw new OverflowException ();
858 } catch (Exception) {
861 throw new OverflowException ();
862 } catch (Exception) {
865 throw new ArgumentException ();
866 } catch (Exception) {
869 throw new OverflowException ();
870 } catch (Exception) {
876 } catch (Exception) {
881 } catch (Exception) {
885 [MethodImplAttribute (MethodImplOptions.NoInlining)]
886 public static void unhandled_exception () {
887 ThreadPool.QueueUserWorkItem (delegate {
888 throw new InvalidOperationException ();
890 Thread.Sleep (10000);
893 [MethodImplAttribute (MethodImplOptions.NoInlining)]
894 public static void unhandled_exception_endinvoke_2 () {
897 [MethodImplAttribute (MethodImplOptions.NoInlining)]
898 public static void unhandled_exception_endinvoke () {
899 Action action = new Action (() =>
901 throw new Exception ("thrown");
903 action.BeginInvoke ((ar) => {
905 action.EndInvoke (ar);
906 } catch (Exception ex) {
907 //Console.WriteLine (ex);
911 unhandled_exception_endinvoke_2 ();
914 [MethodImplAttribute (MethodImplOptions.NoInlining)]
915 public static void unhandled_exception_user () {
917 System.Threading.Tasks.Task.Factory.StartNew (() => {
920 Thread.Sleep (10000);
924 [MethodImplAttribute (MethodImplOptions.NoInlining)]
925 public static void Throw () {
926 throw new Exception ();
929 internal static Delegate create_filter_delegate (Delegate dlg, MethodInfo filter_method)
932 throw new ArgumentNullException ();
933 if (dlg.Target != null)
934 throw new ArgumentException ();
935 if (dlg.Method == null)
936 throw new ArgumentException ();
938 var ret_type = dlg.Method.ReturnType;
939 var param_types = dlg.Method.GetParameters ().Select (x => x.ParameterType).ToArray ();
941 var dynamic = new DynamicMethod (Guid.NewGuid ().ToString (), ret_type, param_types, typeof (object), true);
942 var ig = dynamic.GetILGenerator ();
944 LocalBuilder retval = null;
945 if (ret_type != typeof (void))
946 retval = ig.DeclareLocal (ret_type);
948 var label = ig.BeginExceptionBlock ();
950 for (int i = 0; i < param_types.Length; i++)
951 ig.Emit (OpCodes.Ldarg, i);
952 ig.Emit (OpCodes.Call, dlg.Method);
955 ig.Emit (OpCodes.Stloc, retval);
957 ig.Emit (OpCodes.Leave, label);
959 ig.BeginExceptFilterBlock ();
961 ig.Emit (OpCodes.Call, filter_method);
963 ig.BeginCatchBlock (null);
965 ig.Emit (OpCodes.Pop);
967 ig.EndExceptionBlock ();
970 ig.Emit (OpCodes.Ldloc, retval);
972 ig.Emit (OpCodes.Ret);
974 return dynamic.CreateDelegate (dlg.GetType ());
977 [MethodImplAttribute (MethodImplOptions.NoInlining)]
978 static void exception_filter_method () {
979 throw new InvalidOperationException ();
982 [MethodImplAttribute (MethodImplOptions.NoInlining)]
983 static int exception_filter_filter (Exception exc) {
987 [MethodImplAttribute (MethodImplOptions.NoInlining)]
988 public static void exception_filter () {
989 var method = typeof (Tests).GetMethod (
990 "exception_filter_method", BindingFlags.NonPublic | BindingFlags.Static);
991 var filter_method = typeof (Tests).GetMethod (
992 "exception_filter_filter", BindingFlags.NonPublic | BindingFlags.Static);
994 var dlg = Delegate.CreateDelegate (typeof (Action), method);
996 var wrapper = (Action) create_filter_delegate (dlg, filter_method);
1001 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1002 public static bool return_true () {
1006 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1007 public static void exceptions2 () {
1009 throw new Exception ();
1010 Console.WriteLine ();
1013 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1014 public static void threads () {
1015 Thread t = new Thread (delegate () {});
1021 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1022 public static void domains () {
1023 AppDomain domain = AppDomain.CreateDomain ("domain");
1025 CrossDomain o = (CrossDomain)domain.CreateInstanceAndUnwrap (
1026 typeof (CrossDomain).Assembly.FullName, "CrossDomain");
1028 domains_2 (o, new CrossDomain ());
1036 AppDomain.Unload (domain);
1041 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1042 public static void domains_2 (object o, object o2) {
1045 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1046 public static void domains_3 () {
1049 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1050 public static void invoke_in_domain () {
1053 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1054 public static void invoke_in_domain_2 () {
1057 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1058 public static void dynamic_methods () {
1059 var m = new DynamicMethod ("dyn_method", typeof (void), new Type [] { typeof (int) }, typeof (object).Module);
1060 var ig = m.GetILGenerator ();
1062 ig.Emit (OpCodes.Ldstr, "FOO");
1063 ig.Emit (OpCodes.Call, typeof (Tests).GetMethod ("dyn_call"));
1064 ig.Emit (OpCodes.Ret);
1066 var del = (Action<int>)m.CreateDelegate (typeof (Action<int>));
1071 public static void dyn_call (string s) {
1074 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1075 public static void ref_emit () {
1076 AssemblyName assemblyName = new AssemblyName ();
1077 assemblyName.Name = "foo";
1079 AssemblyBuilder assembly =
1080 Thread.GetDomain ().DefineDynamicAssembly (
1081 assemblyName, AssemblyBuilderAccess.RunAndSave);
1083 ModuleBuilder module = assembly.DefineDynamicModule ("foo.dll");
1085 TypeBuilder tb = module.DefineType ("foo", TypeAttributes.Public, typeof (object));
1086 MethodBuilder mb = tb.DefineMethod ("ref_emit_method", MethodAttributes.Public|MethodAttributes.Static, CallingConventions.Standard, typeof (void), new Type [] { });
1087 ILGenerator ig = mb.GetILGenerator ();
1088 ig.Emit (OpCodes.Ldstr, "FOO");
1089 ig.Emit (OpCodes.Call, typeof (Tests).GetMethod ("ref_emit_call"));
1090 ig.Emit (OpCodes.Ret);
1092 Type t = tb.CreateType ();
1094 t.GetMethod ("ref_emit_method").Invoke (null, null);
1097 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1098 public static void ref_emit_call (string s) {
1101 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1102 public static void frames_in_native () {
1104 var evt = new ManualResetEvent (false);
1106 object mon = new object ();
1107 ThreadPool.QueueUserWorkItem (delegate {
1108 frames_in_native_2 ();
1114 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1115 static void frames_in_native_2 () {
1116 frames_in_native_3 ();
1119 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1120 static void frames_in_native_3 () {
1123 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1124 public static void string_call (string s) {
1127 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1128 public static void ss_regress_654694 () {
1135 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1136 public static void user () {
1139 Debugger.Log (5, Debugger.IsLogging () ? "A" : "", "B");
1142 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1143 public static void type_load () {
1147 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1148 static void type_load_2 () {
1149 var c1 = new Dictionary<int, int> ();
1151 var c = new TypeLoadClass ();
1153 var c2 = new TypeLoadClass2 ();
1157 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1158 public static void regress () {
1159 regress_2755 (DateTime.Now);
1162 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1163 public static unsafe void regress_2755 (DateTime d) {
1164 int* buffer = stackalloc int [128];
1169 for (int i = 0; i < 128; ++i)
1172 regress_2755_3 (sum);
1175 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1176 public static void regress_2755_2 () {
1179 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1180 public static void regress_2755_3 (int sum) {
1183 static object gc_suspend_field;
1185 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1186 static unsafe void set_gc_suspend_field () {
1187 set_gc_suspend_field_2 ();
1189 int* buffer = stackalloc int [4096];
1192 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1193 static void set_gc_suspend_field_2 () {
1194 gc_suspend_field = new object ();
1197 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1198 static void gc_suspend_1 () {
1201 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1202 public static void gc_suspend_invoke () {
1203 gc_suspend_field = null;
1205 GC.WaitForPendingFinalizers ();
1208 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1209 public static void gc_suspend () {
1210 set_gc_suspend_field ();
1214 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1215 public static void generic_method<T> () where T : class {
1219 class TypeLoadClass {
1222 class TypeLoadClass2 {
1225 public class CrossDomain : MarshalByRefObject
1227 public void invoke () {
1228 Tests.invoke_in_domain ();
1231 public void invoke_2 () {
1232 Tests.invoke_in_domain_2 ();
1235 public int invoke_3 () {
1242 public ProcessStartInfo info;
1245 // Class used for line number info testing, don't change its layout
1246 public class LineNumbers
1248 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1249 public static void ln1 () {
1255 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1256 public static void ln2 () {
1259 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1260 public static void ln3 () {
1261 #pragma warning disable 0219
1263 #pragma warning restore 0219