2 using System.Collections.Generic;
3 using System.Runtime.InteropServices;
5 public struct SmallMixed
13 public struct LargeMixed {
14 public SmallMixed a,b,c,d,e;
17 public class SmallBitMap {
21 public class LargeBitMap {
23 public long b,c,d,e,f,g,h;
27 public class ComplexBitMap {
28 public SmallMixed a,b,c,d,e,f,g,h,i,j,k,l;
31 public class PtrFree {
35 public struct LargeStruct {
36 public long a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15;
39 public struct LargeStruct2 {
40 public LargeStruct a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15;
43 public struct LargeStruct3 {
44 public LargeStruct2 a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15;
47 public class HugePtrFree {
48 public LargeStruct3 a,b;
49 public LargeStruct2 c;
52 [StructLayout (LayoutKind.Sequential)]
53 public class Non32bitBitmap {
55 public long i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25, i26, i27, i28, i29, i30, i31, i32, i33, i34, i35;
60 This is a stress test for descriptors.
63 static char[] FOO = new char[] { 'f', 'o', 'b' };
65 static void Fill (int cycles) {
66 object[] root = new object [13];
67 object[] current = root;
68 for (int i = 0; i < cycles; ++i) {
69 current [0] = new object [13];
70 current [1] = new int [6];
71 current [2] = new int [2,3];
72 current [3] = new string (FOO);
73 current [4] = new SmallBitMap ();
74 current [5] = new LargeBitMap ();
75 current [6] = new ComplexBitMap ();
76 current [7] = new PtrFree ();
77 current [8] = new SmallMixed [3];
78 current [9] = new LargeMixed [3];
81 current [10] = new HugePtrFree ();
83 current [11] = new LargeStruct2 [1];
85 /* Test for 64 bit bitmap descriptors (#14834) */
86 current [12] = new Non32bitBitmap () { o = new object (), i32 = 1, i33 = 1, i34 = 1, i35 = 1, o2 = new object () };
88 current = (object[])current [0];
92 static unsafe void FillPtr (int cycles) {
93 var l = new List<Byte*[]> ();
94 for (int i = 0; i < cycles; ++i)
96 var a = new Byte* [128];
97 for (int j = 0; j < a.Length; ++j)
98 a [j] = (Byte*) new IntPtr (j).ToPointer ();
106 static void Main () {
109 for (int i = 0; i < loops; ++i) {