B= 1
}
+public sealed class Tests3 {
+ public static void M1 () {
+ }
+
+ static void M2 () {
+ }
+
+ public void M3 () {
+ }
+
+ void M4 () {
+ }
+
+}
+
[DebuggerDisplay ("Tests", Name="FOO", Target=typeof (int))]
[DebuggerTypeProxy (typeof (Tests))]
public class Tests2 {
}
}
+interface ITest
+{
+ void Foo ();
+ void Bar ();
+}
+
+interface ITest<T>
+{
+ void Foo ();
+ void Bar ();
+}
+
+class TestIfaces : ITest
+{
+ void ITest.Foo () {
+ }
+
+ void ITest.Bar () {
+ }
+
+ TestIfaces<int> Baz () {
+ return null;
+ }
+}
+
+class TestIfaces<T> : ITest<T>
+{
+ void ITest<T>.Foo () {
+ }
+
+ void ITest<T>.Bar () {
+ }
+}
+
public class Tests : TestsBase
{
#pragma warning disable 0414
}
public static int Main (String[] args) {
+ tls_i = 42;
+
if (args.Length > 0 && args [0] == "suspend-test")
/* This contains an infinite loop, so execute it conditionally */
suspend ();
assembly_load ();
invoke ();
exceptions ();
+ exception_filter ();
threads ();
dynamic_methods ();
+ user ();
+ type_load ();
+ regress ();
if (args.Length > 0 && args [0] == "domain-test")
/* This takes a lot of time, so execute it conditionally */
domains ();
ss6 (true);
} catch {
}
+ ss_regress_654694 ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void locals () {
locals1 (null);
- locals2 (null, 5);
+ locals2<string> (null, 5, "ABC");
locals3 ();
+ locals6 ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
- public static void locals2 (string[] args, int arg) {
+ public static void locals2<T> (string[] args, int arg, T t) {
long i = 42;
string s = "AB";
for (int j = 0; j < 10; ++j) {
if (s != null)
i ++;
+ if (t != null)
+ i ++;
}
}
public static void locals5 () {
}
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6 () {
+ int i = 0;
+ int j = 0;
+ for (i = 0; i < 10; ++i)
+ j ++;
+ sbyte sb = 0;
+ for (i = 0; i < 10; ++i)
+ sb ++;
+ locals6_1 ();
+ locals6_2 (j);
+ locals6_3 ();
+ locals6_4 (j);
+ locals6_5 ();
+ locals6_6 (sb);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6_1 () {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6_2 (int arg) {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6_3 () {
+ // Clobber all registers
+ int sum = 0, i, j, k, l, m;
+ for (i = 0; i < 100; ++i)
+ sum ++;
+ for (j = 0; j < 100; ++j)
+ sum ++;
+ for (k = 0; k < 100; ++k)
+ sum ++;
+ for (l = 0; l < 100; ++l)
+ sum ++;
+ for (m = 0; m < 100; ++m)
+ sum ++;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6_4 (int arg) {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6_5 () {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals6_6 (int arg) {
+ }
+
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void line_numbers () {
LineNumbers.ln1 ();
return 42;
}
+ public int? invoke_return_nullable () {
+ return 42;
+ }
+
+ public int? invoke_return_nullable_null () {
+ return null;
+ }
+
public void invoke_type_load () {
new Class3 ();
}
o.GetType ();
} catch (Exception) {
}
+
+ try {
+ exceptions2 ();
+ } catch (Exception) {
+ }
+ }
+
+ internal static Delegate create_filter_delegate (Delegate dlg, MethodInfo filter_method)
+ {
+ if (dlg == null)
+ throw new ArgumentNullException ();
+ if (dlg.Target != null)
+ throw new ArgumentException ();
+ if (dlg.Method == null)
+ throw new ArgumentException ();
+
+ var ret_type = dlg.Method.ReturnType;
+ var param_types = dlg.Method.GetParameters ().Select (x => x.ParameterType).ToArray ();
+
+ var dynamic = new DynamicMethod (Guid.NewGuid ().ToString (), ret_type, param_types, typeof (object), true);
+ var ig = dynamic.GetILGenerator ();
+
+ LocalBuilder retval = null;
+ if (ret_type != typeof (void))
+ retval = ig.DeclareLocal (ret_type);
+
+ var label = ig.BeginExceptionBlock ();
+
+ for (int i = 0; i < param_types.Length; i++)
+ ig.Emit (OpCodes.Ldarg, i);
+ ig.Emit (OpCodes.Call, dlg.Method);
+
+ if (retval != null)
+ ig.Emit (OpCodes.Stloc, retval);
+
+ ig.Emit (OpCodes.Leave, label);
+
+ ig.BeginExceptFilterBlock ();
+
+ ig.Emit (OpCodes.Call, filter_method);
+
+ ig.BeginCatchBlock (null);
+
+ ig.Emit (OpCodes.Pop);
+
+ ig.EndExceptionBlock ();
+
+ if (retval != null)
+ ig.Emit (OpCodes.Ldloc, retval);
+
+ ig.Emit (OpCodes.Ret);
+
+ return dynamic.CreateDelegate (dlg.GetType ());
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static void exception_filter_method () {
+ throw new InvalidOperationException ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static int exception_filter_filter (Exception exc) {
+ return 1;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void exception_filter () {
+ var method = typeof (Tests).GetMethod (
+ "exception_filter_method", BindingFlags.NonPublic | BindingFlags.Static);
+ var filter_method = typeof (Tests).GetMethod (
+ "exception_filter_filter", BindingFlags.NonPublic | BindingFlags.Static);
+
+ var dlg = Delegate.CreateDelegate (typeof (Action), method);
+
+ var wrapper = (Action) create_filter_delegate (dlg, filter_method);
+
+ wrapper ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static bool return_true () {
+ return true;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void exceptions2 () {
+ if (return_true ())
+ throw new Exception ();
+ Console.WriteLine ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void frames_in_native () {
Thread.Sleep (500);
}
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void string_call (string s) {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void ss_regress_654694 () {
+ if (true) {
+ string h = "hi";
+ string_call (h);
+ }
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void user () {
+ Debugger.Break ();
+
+ Debugger.Log (5, Debugger.IsLogging () ? "A" : "", "B");
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void type_load () {
+ type_load_2 ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static void type_load_2 () {
+ var c1 = new Dictionary<int, int> ();
+ c1.ToString ();
+ var c = new TypeLoadClass ();
+ c.ToString ();
+ var c2 = new TypeLoadClass2 ();
+ c2.ToString ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void regress () {
+ regress_2755 (DateTime.Now);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static unsafe void regress_2755 (DateTime d) {
+ int* buffer = stackalloc int [128];
+
+ regress_2755_2 ();
+
+ int sum = 0;
+ for (int i = 0; i < 128; ++i)
+ sum += buffer [i];
+
+ regress_2755_3 (sum);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void regress_2755_2 () {
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void regress_2755_3 (int sum) {
+ }
+}
+
+class TypeLoadClass {
+}
+
+class TypeLoadClass2 {
}
public class CrossDomain : MarshalByRefObject