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 () {
147 class TestIfaces : ITest
155 TestIfaces<int> Baz () {
160 class TestIfaces<T> : ITest<T>
162 void ITest<T>.Foo () {
165 void ITest<T>.Bar () {
169 public class Tests : TestsBase
171 #pragma warning disable 0414
175 bool field_bool1, field_bool2;
188 static int static_i = 55;
189 static string static_s = "A";
190 public const int literal_i = 56;
191 public const string literal_s = "B";
193 public AStruct field_struct;
194 public object field_boxed_struct;
195 public GStruct<int> generic_field_struct;
197 public static int tls_i;
198 public static bool is_attached = Debugger.IsAttached;
200 #pragma warning restore 0414
202 public class NestedClass {
205 public int IntProperty {
214 public int ReadOnlyProperty {
220 public int this [int index] {
226 public static int Main (String[] args) {
229 if (args.Length > 0 && args [0] == "suspend-test")
230 /* This contains an infinite loop, so execute it conditionally */
232 if (args.Length >0 && args [0] == "unhandled-exception") {
233 unhandled_exception ();
236 if (args.Length >0 && args [0] == "unhandled-exception-user") {
237 unhandled_exception_user ();
259 if (args.Length > 0 && args [0] == "domain-test")
260 /* This takes a lot of time, so execute it conditionally */
262 if (args.Length > 0 && args [0] == "ref-emit-test")
264 if (args.Length > 0 && args [0] == "frames-in-native")
266 if (args.Length > 0 && args [0] == "invoke-single-threaded")
267 new Tests ().invoke_single_threaded ();
271 public static void breakpoints () {
272 /* Call these early so it is JITted by the time a breakpoint is placed on it */
284 bp6<string> (new GClass <int> ());
289 [MethodImplAttribute (MethodImplOptions.NoInlining)]
290 public static void bp1 () {
293 [MethodImplAttribute (MethodImplOptions.NoInlining)]
294 public static void bp2 () {
297 [MethodImplAttribute (MethodImplOptions.NoInlining)]
298 public static void bp3 () {
301 [MethodImplAttribute (MethodImplOptions.NoInlining)]
302 public static void bp4 () {
305 [MethodImplAttribute (MethodImplOptions.NoInlining)]
306 public static void bp5 () {
309 [MethodImplAttribute (MethodImplOptions.NoInlining)]
310 public static void bp6<T> (GClass<int> gc) {
314 [MethodImplAttribute (MethodImplOptions.NoInlining)]
315 public static void bp7<T> () {
318 [MethodImplAttribute (MethodImplOptions.NoInlining)]
319 public static void single_stepping () {
326 ss5 (new int [] { 1, 2, 3 }, new Func<int, bool> (is_even));
332 ss_regress_654694 ();
335 [MethodImplAttribute (MethodImplOptions.NoInlining)]
336 public static void ss1 () {
339 [MethodImplAttribute (MethodImplOptions.NoInlining)]
340 public static void ss2 () {
343 [MethodImplAttribute (MethodImplOptions.NoInlining)]
344 public static int ss3 () {
347 for (int i = 0; i < 10; ++i)
353 [MethodImplAttribute (MethodImplOptions.NoInlining)]
354 public static void ss3_2 () {
358 [MethodImplAttribute (MethodImplOptions.NoInlining)]
359 public static void ss3_2_2 () {
362 [MethodImplAttribute (MethodImplOptions.NoInlining)]
363 public static int ss4 () {
369 [MethodImplAttribute (MethodImplOptions.NoInlining)]
370 public static void ss5 (int[] arr, Func<int, bool> selector) {
371 // Call into linq which calls back into this assembly
372 arr.Count (selector);
375 [MethodImplAttribute (MethodImplOptions.NoInlining)]
376 public static void ss6 (bool b) {
379 throw new Exception ();
383 [MethodImplAttribute (MethodImplOptions.NoInlining)]
384 public static void ss6_2 () {
387 [MethodImplAttribute (MethodImplOptions.NoInlining)]
388 public static void ss7 () {
397 [MethodImplAttribute (MethodImplOptions.NoInlining)]
398 public static void ss7_2 () {
401 [MethodImplAttribute (MethodImplOptions.NoInlining)]
402 public static void ss7_3 () {
403 throw new Exception ();
406 [MethodImplAttribute (MethodImplOptions.NoInlining)]
407 public static bool is_even (int i) {
413 Console.WriteLine ("HIT!");
419 [MethodImplAttribute (MethodImplOptions.NoInlining)]
420 public static void arguments () {
421 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));
423 arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object ());
424 Tests t = new Tests () { field_i = 42, field_s = "S" };
428 [MethodImplAttribute (MethodImplOptions.NoInlining)]
429 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) {
430 return (int)(sb + b + (bl ? 0 : 1) + s + us + (int)c + i + ui + l + (long)ul + f + d + (int)ip + (int)uip);
433 [MethodImplAttribute (MethodImplOptions.NoInlining)]
434 public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2) {
435 return s + (s3 != null ? "" : "") + o + i + gc.field + o2;
438 [MethodImplAttribute (MethodImplOptions.NoInlining)]
439 public object arg3 (string s) {
440 return s + s + s + s + this;
443 [MethodImplAttribute (MethodImplOptions.NoInlining)]
444 public static void objects () {
445 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 };
446 t.o1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
447 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 });
450 [MethodImplAttribute (MethodImplOptions.NoInlining)]
451 public object o1 (Tests2 t, GClass <int> gc1, GClass <string> gc2) {
452 if (t == null || gc1 == null || gc2 == null)
458 [MethodImplAttribute (MethodImplOptions.NoInlining)]
459 public static string o2 (string[] s2, int[] s3, int[,] s4, int[,] s5, IList<int> s6) {
460 return s2 [0] + s3 [0] + s4 [0, 0] + s6 [0];
463 [MethodImplAttribute (MethodImplOptions.NoInlining)]
464 public static void objrefs () {
465 Tests t = new Tests () {};
473 [MethodImplAttribute (MethodImplOptions.NoInlining)]
474 public static void set_child (Tests t) {
475 t.child = new Tests ();
478 [MethodImplAttribute (MethodImplOptions.NoInlining)]
479 public void objrefs1 () {
482 [MethodImplAttribute (MethodImplOptions.NoInlining)]
483 public static void objrefs2 () {
486 public static void vtypes () {
487 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 }};
488 AStruct s = new AStruct { i = 44, s = "T", k = 45 };
489 AStruct[] arr = new AStruct[] {
490 new AStruct () { i = 1, s = "S1" },
491 new AStruct () { i = 2, s = "S2" } };
497 [MethodImplAttribute (MethodImplOptions.NoInlining)]
498 public object vtypes1 (AStruct s, AStruct[] arr) {
505 [MethodImplAttribute (MethodImplOptions.NoInlining)]
506 public static void vtypes2 (AStruct s) {
510 [MethodImplAttribute (MethodImplOptions.NoInlining)]
511 public static void vtypes3 (AStruct s) {
512 AStruct.static_foo (5);
515 [MethodImplAttribute (MethodImplOptions.NoInlining)]
516 public static void locals () {
519 locals2<string> (null, 5, "ABC", ref s);
524 [MethodImplAttribute (MethodImplOptions.NoInlining)]
525 static void locals11 (double a, ref double b) {
528 [MethodImplAttribute (MethodImplOptions.NoInlining)]
529 public static void locals1 (string[] args) {
533 locals11 (b: ref ri, a: ri);
535 for (int j = 0; j < 10; ++j) {
540 [MethodImplAttribute (MethodImplOptions.NoInlining)]
541 [StateMachine (typeof (int))]
542 public static void locals2<T> (string[] args, int arg, T t, ref string rs) {
546 for (int j = 0; j < 10; ++j) {
555 [MethodImplAttribute (MethodImplOptions.NoInlining)]
556 public static void locals3 () {
576 [MethodImplAttribute (MethodImplOptions.NoInlining)]
577 public static void locals4 () {
580 [MethodImplAttribute (MethodImplOptions.NoInlining)]
581 public static void locals5 () {
584 [MethodImplAttribute (MethodImplOptions.NoInlining)]
585 public static void locals6 () {
588 for (i = 0; i < 10; ++i)
591 for (i = 0; i < 10; ++i)
601 [MethodImplAttribute (MethodImplOptions.NoInlining)]
602 public static void locals6_1 () {
605 [MethodImplAttribute (MethodImplOptions.NoInlining)]
606 public static void locals6_2 (int arg) {
609 [MethodImplAttribute (MethodImplOptions.NoInlining)]
610 public static void locals6_3 () {
611 // Clobber all registers
612 int sum = 0, i, j, k, l, m;
613 for (i = 0; i < 100; ++i)
615 for (j = 0; j < 100; ++j)
617 for (k = 0; k < 100; ++k)
619 for (l = 0; l < 100; ++l)
621 for (m = 0; m < 100; ++m)
625 [MethodImplAttribute (MethodImplOptions.NoInlining)]
626 public static void locals6_4 (int arg) {
629 [MethodImplAttribute (MethodImplOptions.NoInlining)]
630 public static void locals6_5 () {
633 [MethodImplAttribute (MethodImplOptions.NoInlining)]
634 public static void locals6_6 (int arg) {
637 [MethodImplAttribute (MethodImplOptions.NoInlining)]
638 public static void line_numbers () {
642 [MethodImplAttribute (MethodImplOptions.NoInlining)]
643 public static void suspend () {
651 [MethodImplAttribute (MethodImplOptions.NoInlining)]
652 public static void type_info () {
653 Tests t = new Tests () { field_i = 42, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B };
654 t.ti1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
657 AStruct s = new AStruct () { i = 42, s = "S", k = 43 };
659 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);
663 [MethodImplAttribute (MethodImplOptions.NoInlining)]
664 public object ti1 (Tests2 t, GClass <int> gc1, GClass <string> gc2) {
665 if (t == null || gc1 == null || gc2 == null)
671 [MethodImplAttribute (MethodImplOptions.NoInlining)]
672 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) {
673 return s2 [0] + s3 [0] + s4 [0, 0];
676 [MethodImplAttribute (MethodImplOptions.NoInlining)]
677 public static void assembly_load () {
681 [MethodImplAttribute (MethodImplOptions.NoInlining)]
682 public static void assembly_load_2 () {
683 // This will load System.dll while holding the loader lock
687 [MethodImplAttribute (MethodImplOptions.NoInlining)]
688 public static void invoke () {
689 new Tests ().invoke1 (new Tests2 (), new AStruct () { i = 42, j = (IntPtr)43 }, new GStruct<int> { j = 42 });
690 new Tests ().invoke_ex ();
693 [MethodImplAttribute (MethodImplOptions.NoInlining)]
694 public void invoke1 (Tests2 t, AStruct s, GStruct<int> g) {
698 [MethodImplAttribute (MethodImplOptions.NoInlining)]
699 public void invoke2 () {
702 [MethodImplAttribute (MethodImplOptions.NoInlining)]
703 public void invoke_ex () {
707 [MethodImplAttribute (MethodImplOptions.NoInlining)]
708 public void invoke_ex_inner () {
710 throw new Exception ();
717 [MethodImplAttribute (MethodImplOptions.NoInlining)]
718 public void invoke_single_threaded () {
719 // Spawn a thread incrementing a counter
720 bool finished = false;
722 new Thread (delegate () {
729 invoke_single_threaded_2 ();
734 [MethodImplAttribute (MethodImplOptions.NoInlining)]
735 public void invoke_single_threaded_2 () {
738 public void invoke_return_void () {
741 public string invoke_return_ref () {
745 public object invoke_return_null () {
749 public int invoke_return_primitive () {
753 public int? invoke_return_nullable () {
757 public int? invoke_return_nullable_null () {
761 public void invoke_type_load () {
768 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) {
769 return ub + sb + ss + us + i + ui + l + (long)ul + (int)c + (b ? 1 : 0) + (int)f + (int)d;
772 public int invoke_pass_primitive2 (bool b) {
776 public string invoke_pass_ref (string s) {
780 public static string invoke_static_pass_ref (string s) {
784 public static void invoke_static_return_void () {
787 public static void invoke_throws () {
788 throw new Exception ();
791 [MethodImplAttribute (MethodImplOptions.NoInlining)]
792 public static void exceptions () {
794 throw new OverflowException ();
795 } catch (Exception) {
798 throw new OverflowException ();
799 } catch (Exception) {
802 throw new ArgumentException ();
803 } catch (Exception) {
806 throw new OverflowException ();
807 } catch (Exception) {
813 } catch (Exception) {
818 } catch (Exception) {
822 [MethodImplAttribute (MethodImplOptions.NoInlining)]
823 public static void unhandled_exception () {
824 ThreadPool.QueueUserWorkItem (delegate {
825 throw new InvalidOperationException ();
827 Thread.Sleep (10000);
830 [MethodImplAttribute (MethodImplOptions.NoInlining)]
831 public static void unhandled_exception_user () {
833 System.Threading.Tasks.Task.Factory.StartNew (() => {
836 Thread.Sleep (10000);
840 [MethodImplAttribute (MethodImplOptions.NoInlining)]
841 public static void Throw () {
842 throw new Exception ();
845 internal static Delegate create_filter_delegate (Delegate dlg, MethodInfo filter_method)
848 throw new ArgumentNullException ();
849 if (dlg.Target != null)
850 throw new ArgumentException ();
851 if (dlg.Method == null)
852 throw new ArgumentException ();
854 var ret_type = dlg.Method.ReturnType;
855 var param_types = dlg.Method.GetParameters ().Select (x => x.ParameterType).ToArray ();
857 var dynamic = new DynamicMethod (Guid.NewGuid ().ToString (), ret_type, param_types, typeof (object), true);
858 var ig = dynamic.GetILGenerator ();
860 LocalBuilder retval = null;
861 if (ret_type != typeof (void))
862 retval = ig.DeclareLocal (ret_type);
864 var label = ig.BeginExceptionBlock ();
866 for (int i = 0; i < param_types.Length; i++)
867 ig.Emit (OpCodes.Ldarg, i);
868 ig.Emit (OpCodes.Call, dlg.Method);
871 ig.Emit (OpCodes.Stloc, retval);
873 ig.Emit (OpCodes.Leave, label);
875 ig.BeginExceptFilterBlock ();
877 ig.Emit (OpCodes.Call, filter_method);
879 ig.BeginCatchBlock (null);
881 ig.Emit (OpCodes.Pop);
883 ig.EndExceptionBlock ();
886 ig.Emit (OpCodes.Ldloc, retval);
888 ig.Emit (OpCodes.Ret);
890 return dynamic.CreateDelegate (dlg.GetType ());
893 [MethodImplAttribute (MethodImplOptions.NoInlining)]
894 static void exception_filter_method () {
895 throw new InvalidOperationException ();
898 [MethodImplAttribute (MethodImplOptions.NoInlining)]
899 static int exception_filter_filter (Exception exc) {
903 [MethodImplAttribute (MethodImplOptions.NoInlining)]
904 public static void exception_filter () {
905 var method = typeof (Tests).GetMethod (
906 "exception_filter_method", BindingFlags.NonPublic | BindingFlags.Static);
907 var filter_method = typeof (Tests).GetMethod (
908 "exception_filter_filter", BindingFlags.NonPublic | BindingFlags.Static);
910 var dlg = Delegate.CreateDelegate (typeof (Action), method);
912 var wrapper = (Action) create_filter_delegate (dlg, filter_method);
917 [MethodImplAttribute (MethodImplOptions.NoInlining)]
918 public static bool return_true () {
922 [MethodImplAttribute (MethodImplOptions.NoInlining)]
923 public static void exceptions2 () {
925 throw new Exception ();
926 Console.WriteLine ();
929 [MethodImplAttribute (MethodImplOptions.NoInlining)]
930 public static void threads () {
931 Thread t = new Thread (delegate () {});
937 [MethodImplAttribute (MethodImplOptions.NoInlining)]
938 public static void domains () {
939 AppDomain domain = AppDomain.CreateDomain ("domain");
941 CrossDomain o = (CrossDomain)domain.CreateInstanceAndUnwrap (
942 typeof (CrossDomain).Assembly.FullName, "CrossDomain");
944 domains_2 (o, new CrossDomain ());
952 AppDomain.Unload (domain);
957 [MethodImplAttribute (MethodImplOptions.NoInlining)]
958 public static void domains_2 (object o, object o2) {
961 [MethodImplAttribute (MethodImplOptions.NoInlining)]
962 public static void domains_3 () {
965 [MethodImplAttribute (MethodImplOptions.NoInlining)]
966 public static void invoke_in_domain () {
969 [MethodImplAttribute (MethodImplOptions.NoInlining)]
970 public static void invoke_in_domain_2 () {
973 [MethodImplAttribute (MethodImplOptions.NoInlining)]
974 public static void dynamic_methods () {
975 var m = new DynamicMethod ("dyn_method", typeof (void), new Type [] { typeof (int) }, typeof (object).Module);
976 var ig = m.GetILGenerator ();
978 ig.Emit (OpCodes.Ldstr, "FOO");
979 ig.Emit (OpCodes.Call, typeof (Tests).GetMethod ("dyn_call"));
980 ig.Emit (OpCodes.Ret);
982 var del = (Action<int>)m.CreateDelegate (typeof (Action<int>));
987 public static void dyn_call (string s) {
990 [MethodImplAttribute (MethodImplOptions.NoInlining)]
991 public static void ref_emit () {
992 AssemblyName assemblyName = new AssemblyName ();
993 assemblyName.Name = "foo";
995 AssemblyBuilder assembly =
996 Thread.GetDomain ().DefineDynamicAssembly (
997 assemblyName, AssemblyBuilderAccess.RunAndSave);
999 ModuleBuilder module = assembly.DefineDynamicModule ("foo.dll");
1001 TypeBuilder tb = module.DefineType ("foo", TypeAttributes.Public, typeof (object));
1002 MethodBuilder mb = tb.DefineMethod ("ref_emit_method", MethodAttributes.Public|MethodAttributes.Static, CallingConventions.Standard, typeof (void), new Type [] { });
1003 ILGenerator ig = mb.GetILGenerator ();
1004 ig.Emit (OpCodes.Ldstr, "FOO");
1005 ig.Emit (OpCodes.Call, typeof (Tests).GetMethod ("ref_emit_call"));
1006 ig.Emit (OpCodes.Ret);
1008 Type t = tb.CreateType ();
1010 t.GetMethod ("ref_emit_method").Invoke (null, null);
1013 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1014 public static void ref_emit_call (string s) {
1017 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1018 public static void frames_in_native () {
1020 object mon = new object ();
1021 ThreadPool.QueueUserWorkItem (delegate {
1022 frames_in_native_2 ();
1024 Monitor.Pulse (mon);
1032 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1033 static void frames_in_native_2 () {
1034 frames_in_native_3 ();
1037 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1038 static void frames_in_native_3 () {
1041 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1042 public static void string_call (string s) {
1045 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1046 public static void ss_regress_654694 () {
1053 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1054 public static void user () {
1057 Debugger.Log (5, Debugger.IsLogging () ? "A" : "", "B");
1060 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1061 public static void type_load () {
1065 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1066 static void type_load_2 () {
1067 var c1 = new Dictionary<int, int> ();
1069 var c = new TypeLoadClass ();
1071 var c2 = new TypeLoadClass2 ();
1075 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1076 public static void regress () {
1077 regress_2755 (DateTime.Now);
1080 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1081 public static unsafe void regress_2755 (DateTime d) {
1082 int* buffer = stackalloc int [128];
1087 for (int i = 0; i < 128; ++i)
1090 regress_2755_3 (sum);
1093 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1094 public static void regress_2755_2 () {
1097 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1098 public static void regress_2755_3 (int sum) {
1101 static object gc_suspend_field;
1103 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1104 static unsafe void set_gc_suspend_field () {
1105 set_gc_suspend_field_2 ();
1107 int* buffer = stackalloc int [4096];
1110 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1111 static void set_gc_suspend_field_2 () {
1112 gc_suspend_field = new object ();
1115 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1116 static void gc_suspend_1 () {
1119 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1120 public static void gc_suspend_invoke () {
1121 gc_suspend_field = null;
1123 GC.WaitForPendingFinalizers ();
1126 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1127 public static void gc_suspend () {
1128 set_gc_suspend_field ();
1133 class TypeLoadClass {
1136 class TypeLoadClass2 {
1139 public class CrossDomain : MarshalByRefObject
1141 public void invoke () {
1142 Tests.invoke_in_domain ();
1145 public void invoke_2 () {
1146 Tests.invoke_in_domain_2 ();
1149 public int invoke_3 () {
1156 public ProcessStartInfo info;
1159 // Class used for line number info testing, don't change its layout
1160 public class LineNumbers
1162 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1163 public static void ln1 () {
1169 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1170 public static void ln2 () {
1173 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1174 public static void ln3 () {
1175 #pragma warning disable 0219
1177 #pragma warning restore 0219