public static int test_0_large_nullable_invoke() { var s = new LargeStruct() { a = 1, b = 2, c = 3, d = 4 }; GetHasValue <LargeStruct> (s); #if __MOBILE__ var m = typeof(AotTests).GetMethod("GetHasValue", BindingFlags.Static | BindingFlags.Public); #else var m = typeof(Tests).GetMethod("GetHasValue", BindingFlags.Static | BindingFlags.Public); #endif Type type = typeof(LargeStruct?).GetGenericArguments() [0]; bool b1 = (bool)m.MakeGenericMethod(new Type[] { type }).Invoke(null, new object[] { s }); if (!b1) { return(1); } bool b2 = (bool)m.MakeGenericMethod(new Type[] { type }).Invoke(null, new object[] { null }); if (b2) { return(2); } return(0); }
public void ConcurrentMutableStructTest() { LargeStruct mutable = new LargeStruct(); ThreadPool.QueueUserWorkItem(delegate { decimal n = 0; while (true) { var newStruct = new LargeStruct { D1 = n, D2 = n, D3 = n, D4 = n, D5 = n, }; mutable = newStruct; n++; } }); Assert.Throws <AssertionException>(() => { while (true) { Validate(mutable); } }); }
public void Execute(int i) { LargeStruct ls = new LargeStruct(); ls.h1 = 1; largeStructs[i] = ls; }
public void Setup() { _serializer = new Serializer(); _stream = new MemoryStream(); _testStruct = LargeStruct.Create(); _testPerson = TypicalPersonData.MakeRandom(); }
public static int test_0_arm64_dyncall_vtypebyrefonstack() { var s = new LargeStruct() { a = 1, b = 2, c = 3, d = 4 }; NullableMethods.GetHasValueManyArgs <LargeStruct> (1, 2, 3, 4, 5, 6, 7, 8, s); Type type = typeof(LargeStruct?).GetGenericArguments() [0]; var m = typeof(NullableMethods).GetMethod("GetHasValueManyArgs", BindingFlags.Static | BindingFlags.Public); bool b1 = (bool)m.MakeGenericMethod(new Type[] { type }).Invoke(null, new object[] { 1, 2, 3, 4, 5, 6, 7, 8, s }); if (!b1) { return(1); } bool b2 = (bool)m.MakeGenericMethod(new Type[] { type }).Invoke(null, new object[] { 1, 2, 3, 4, 5, 6, 7, 8, null }); if (b2) { return(2); } return(0); }
public unsafe static void Test1(int n) { Console.WriteLine("Enter Test1"); LargeStruct s = new LargeStruct(); s.i1 = 7; s.i2 = 9; BigArgSpace(s); // Localloc some space; this moves the outgoing argument space. if (n < 1) { n = 1; } int *a = stackalloc int[n * 4096]; a[0] = 7; int i; for (i = 1; i < 5; ++i) { a[i] = i + a[i - 1]; } // Now call a function that touches the potentially un-probed // outgoing argument space. SmallArgSpace(1, 2, 3, 4, 5, 6, 7, 8, 9, a[4]); iret = 100; }
public static void BigArgSpace(LargeStruct s) { long result = s.i1 + s.i2; Console.Write("BigArgSpace: "); Console.WriteLine(result); }
public bool Equals(LargeStruct other) => X == other.X && Y == other.Y && Z == other.Z && C == other.C && A == other.A && B == other.B && F == other.F;
public void Cleanup() { _stream.Dispose(); _stream = null; _serializer = null; _testStruct = default(LargeStruct); _testPerson = null; }
static bool CheckBigStruct() { var v = new LargeStruct[4, 4, 4]; var e = new LargeStruct(33f); v[1, 2, 3] = e; return(UseArrayElementAsCallArgument(v, e)); }
private static void Validate(LargeStruct largeStruct) { decimal n = largeStruct.D1; Assert.IsTrue(n == largeStruct.D2); Assert.IsTrue(n == largeStruct.D3); Assert.IsTrue(n == largeStruct.D4); Assert.IsTrue(n == largeStruct.D5); }
public override bool Equals(object obj) { if (!(obj is LargeStruct)) { return(false); } LargeStruct s2 = (LargeStruct)obj; return((f1 == s2.f1) && (f2 == s2.f2) && (f3 == s2.f3) && (f4 == s2.f4) && (f5 == s2.f5)); }
public void Execute(int i) { LargeStruct ls = largeStructs[i]; ls.h1 = 1; ls.h2 = 1; ls.h3 = 1; ls.h4 = 1; largeStructs[i] = ls; }
public void ForcePassByValueParameter() { var value = new LargeStruct(); value.I[0] = 10; value.I[1] = 20; value.I[2] = 30; Assert.Equal(60, NativeFunctions.SumValues(value)); }
internal void Read(out LargeStruct result) { var lockTaken = false; spinLock.Enter(ref lockTaken); result = value; if (lockTaken) { spinLock.Exit(false); } }
public override void Setup(BenchmarkContext context) { base.Setup(context); _testStruct = LargeStruct.Create(); _testObject = TypicalPersonData.MakeRandom(); var a = new CyclicA(); var b = new CyclicB(); a.B = b; b.A = a; _cyclic = a; }
int Get(ref LargeStruct @class) { return @class.Val; }
public static void Escape(ref LargeStruct s) { }
public void GlobalSetup() { _data = new byte[1000]; new Random().NextBytes(_data); _control = new LargeStruct(_data[0], _data[1], _data[2], _data[3], _data[4], _data[5]); }
public override void Setup(BenchmarkContext context) { base.Setup(context); InitStreamWith(LargeStruct.Create()); }
public void Execute(int i) { largeStructs[i] = new LargeStruct(); }
internal void Read(out LargeStruct result) => result = value;
int GetForceInlining(ref LargeStruct @class) { return @class.Val; }