Ejemplo n.º 1
0
        public unsafe ILTypeStaticInstance(ILType type)
        {
            this.type   = type;
            fields      = new StackObject[type.StaticFieldTypes.Length];
            managedObjs = new List <object>(fields.Length);
            for (int i = 0; i < fields.Length; i++)
            {
                var ft = type.StaticFieldTypes[i];
                var t  = ft.TypeForCLR;
                managedObjs.Add(null);
                StackObject.Initialized(ref fields[i], i, t, ft, managedObjs);
            }
            int idx = 0;

            foreach (var i in type.TypeDefinition.Fields)
            {
                if (i.IsStatic)
                {
                    if (i.InitialValue != null && i.InitialValue.Length > 0)
                    {
                        fields[idx].ObjectType = ObjectTypes.Object;
                        managedObjs[idx]       = i.InitialValue;
                    }
                    idx++;
                }
            }
        }
Ejemplo n.º 2
0
 void InitializeFields(ILType type)
 {
     for (int i = 0; i < type.FieldTypes.Length; i++)
     {
         StackObject.Initialized(ref fields[type.FieldStartIndex + i], type.FieldTypes[i].TypeForCLR);
     }
     if (type.BaseType != null && type.BaseType is ILType)
     {
         InitializeFields((ILType)type.BaseType);
     }
 }
Ejemplo n.º 3
0
 void InitializeFields(ILType type)
 {
     for (int i = 0; i < type.FieldTypes.Length; i++)
     {
         var ft = type.FieldTypes[i];
         StackObject.Initialized(ref fields[type.FieldStartIndex + i], type.FieldStartIndex + i, ft.TypeForCLR, ft, managedObjs);
     }
     if (type.BaseType != null && type.BaseType is ILType)
     {
         InitializeFields((ILType)type.BaseType);
     }
 }
Ejemplo n.º 4
0
 internal void InitializeField(int fieldIdx)
 {
     if (fieldIdx < fields.Length && fieldIdx >= 0)
     {
         var ft = type.FieldTypes[fieldIdx];
         StackObject.Initialized(ref fields[fieldIdx], fieldIdx, ft.TypeForCLR, ft, managedObjs);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Ejemplo n.º 5
0
 void InitializeFields(ILType type)
 {
     for (int i = 0; i < type.FieldTypes.Length; i++)
     {
         var idx = type.FieldStartIndex + i;
         var ft  = type.FieldTypes[i];
         if (ft.IsValueType && idx < 64)
         {
             valueTypeMask |= (ulong)1 << idx;
         }
         StackObject.Initialized(ref fields[idx], idx, ft, managedObjs);
     }
     if (type.BaseType != null && type.BaseType is ILType)
     {
         InitializeFields((ILType)type.BaseType);
     }
 }
Ejemplo n.º 6
0
        internal void InitializeField(int fieldIdx)
        {
            int    curStart = type.FieldStartIndex;
            ILType curType  = type;

            while (curType != null)
            {
                int maxIdx = curType.FieldStartIndex + curType.FieldTypes.Length;
                if (fieldIdx < maxIdx && fieldIdx >= curType.FieldStartIndex)
                {
                    var ft = curType.FieldTypes[fieldIdx - curType.FieldStartIndex];
                    StackObject.Initialized(ref fields[fieldIdx], fieldIdx, ft.TypeForCLR, ft, managedObjs);
                    return;
                }
                else
                {
                    curType = curType.BaseType as ILType;
                }
            }
            throw new NotImplementedException();
        }