private void InitializeMethods() { int numCtors; if (IsSzArray) { numCtors = 1; // Jagged arrays have constructor for each possible depth var t = this.ElementType; while (t.IsSzArray) { t = ((ArrayType)t).ElementType; numCtors++; } } else { // Multidimensional arrays have two ctors, one with and one without lower bounds numCtors = 2; } MethodDesc[] methods = new MethodDesc[(int)ArrayMethodKind.Ctor + numCtors]; for (int i = 0; i < methods.Length; i++) { methods[i] = new ArrayMethod(this, (ArrayMethodKind)i); } Interlocked.CompareExchange(ref _methods, methods, null); }
private void InitializeMethods() { int numCtors; if (IsSzArray) { numCtors = 1; var t = this.ElementType; while (t.IsSzArray) { t = ((ArrayType)t).ElementType; numCtors++; } } else { // ELEMENT_TYPE_ARRAY has two ctor functions, one with and one without lower bounds numCtors = 2; } MethodDesc[] methods = new MethodDesc[(int)ArrayMethodKind.Ctor + numCtors]; for (int i = 0; i < methods.Length; i++) methods[i] = new ArrayMethod(this, (ArrayMethodKind)i); Interlocked.CompareExchange(ref _methods, methods, null); }
private void InitializeMethods() { int numCtors; if (IsSzArray) { numCtors = 1; var t = this.ElementType; while (t.IsSzArray) { t = ((ArrayType)t).ElementType; numCtors++; } } else { // ELEMENT_TYPE_ARRAY has two ctor functions, one with and one without lower bounds numCtors = 2; } MethodDesc[] methods = new MethodDesc[(int)ArrayMethodKind.Ctor + numCtors]; for (int i = 0; i < methods.Length; i++) { methods[i] = new ArrayMethod(this, (ArrayMethodKind)i); } Interlocked.CompareExchange(ref _methods, methods, null); }
public ArrayMethodILEmitter(ArrayMethod method) { _method = method; ArrayType arrayType = (ArrayType)method.OwningType; _rank = arrayType.Rank; _elementType = arrayType.ElementType; }
private ArrayMethodILEmitter(ArrayMethod method) { _method = method; ArrayType arrayType = (ArrayType)method.OwningType; _rank = arrayType.Rank; _elementType = arrayType.ElementType; _emitter = new ILEmitter(); // This helper field is needed to generate proper GC tracking. There is no direct way // to create interior pointer. _helperFieldToken = _emitter.NewToken(_method.Context.GetWellKnownType(WellKnownType.Object).GetField("m_pEEType")); }
public static MethodIL EmitIL(ArrayMethod arrayMethod) { return new ArrayMethodILEmitter(arrayMethod).EmitIL(); }
private void InitializeMethods() { int numCtors; if (IsSzArray) { numCtors = 1; // Jagged arrays have constructor for each possible depth var t = this.ElementType; while (t.IsSzArray) { t = ((ArrayType)t).ElementType; numCtors++; } } else { // Multidimensional arrays have two ctors, one with and one without lower bounds numCtors = 2; } MethodDesc[] methods = new MethodDesc[(int)ArrayMethodKind.Ctor + numCtors]; for (int i = 0; i < methods.Length; i++) methods[i] = new ArrayMethod(this, (ArrayMethodKind)i); Interlocked.CompareExchange(ref _methods, methods, null); }