* the IL code looks.
*/
-class Tests {
-
- static int Main () {
- return TestDriver.RunTests (typeof (Tests));
- }
+#if __MOBILE__
+class ArrayTests
+#else
+class Tests
+#endif
+{
+
+#if !__MOBILE__
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
+ }
+#endif
public static int test_10_create () {
int[] a = new int [10];
return 0;
}
- private Int32[] m_array = new int [10];
-
- void setBit (int bitIndex, bool value) {
- int index = bitIndex/32;
- int shift = bitIndex%32;
+ class BitClass {
+ private Int32[] m_array = new int [10];
- Int32 theBit = 1 << shift;
- if (value)
- m_array[index] |= theBit;
- else
- m_array[index] &= ~theBit;
- }
-
- bool getBit (int bitIndex) {
- int index = bitIndex/32;
- int shift = bitIndex%32;
+ public void setBit (int bitIndex, bool value) {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
- Int32 theBit = m_array[index] & (1 << shift);
- return (theBit == 0) ? false : true;
+ Int32 theBit = 1 << shift;
+ if (value)
+ m_array[index] |= theBit;
+ else
+ m_array[index] &= ~theBit;
+ }
+
+ public bool getBit (int bitIndex) {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+ Int32 theBit = m_array[index] & (1 << shift);
+ return (theBit == 0) ? false : true;
+ }
}
public static int test_1_bit_index () {
- Tests t = new Tests ();
+ var t = new BitClass ();
t.setBit (0, true);
t.setBit (3, true);
if (t.getBit (1))
return y;
}
+ class RefClass {
+ }
+
public static int test_0_stelem_ref_null_opt () {
- object[] arr = new Tests [1];
+ object[] arr = new RefClass [1];
- arr [0] = new Tests ();
+ arr [0] = new RefClass ();
arr [0] = null;
return arr [0] == null ? 0 : 1;
test[x+100,y+100] = true;
}
return 0;
- }
+ }
+
+ static bool alloc_long (long l) {
+ try {
+ var arr = new byte[l];
+ return false;
+ } catch (Exception e) {
+ return true;
+ }
+ }
+
+ // #13544
+ public static int test_0_newarr_ovf () {
+ if (!alloc_long (5000000000))
+ return 1;
+ if (!alloc_long (4000000000))
+ return 2;
+ if (!alloc_long (-1))
+ return 3;
+ if (!alloc_long (-4000000000))
+ return 4;
+ if (!alloc_long (-6000000000))
+ return 5;
+ return 0;
+ }
+
+ static int llvm_ldlen_licm (int[] arr) {
+ int sum = 0;
+ // The ldlen should be moved out of the loop
+ for (int i = 0; i < arr.Length; ++i)
+ sum += arr [i];
+ return sum;
+ }
+
+ public static int test_10_llvm_ldlen_licm () {
+ int[] arr = new int [10];
+ for (int i = 0; i < 10; ++i)
+ arr [i] = 1;
+ return llvm_ldlen_licm (arr);
+ }
}