示例#1
0
 static CORINFO_FIELD_STRUCT_* _embedFieldHandle(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* handle, ref void* ppIndirection)
 {
     var _this = GetThis(thisHandle);
     try
     {
         return _this.embedFieldHandle(handle, ref ppIndirection);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
         return default(CORINFO_FIELD_STRUCT_*);
     }
 }
示例#2
0
 private void* getFieldAddress(IntPtr _this, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
 { throw new NotImplementedException("getFieldAddress"); }
示例#3
0
 private FieldDesc HandleToObject(CORINFO_FIELD_STRUCT_* field) { return (FieldDesc)HandleToObject((IntPtr)field); }
示例#4
0
        private uint getFieldOffset(IntPtr _this, CORINFO_FIELD_STRUCT_* field)
        {
            var fieldDesc = HandleToObject(field);

            Debug.Assert(fieldDesc.Offset != FieldAndOffset.InvalidOffset);

            return (uint)fieldDesc.Offset;
        }
示例#5
0
 private bool isFieldStatic(IntPtr _this, CORINFO_FIELD_STRUCT_* fldHnd)
 {
     return HandleToObject(fldHnd).IsStatic;
 }
示例#6
0
        private void* getArrayInitializationData(IntPtr _this, CORINFO_FIELD_STRUCT_* field, uint size)
        {
            var fd = HandleToObject(field);

            // Check for invalid arguments passed to InitializeArray intrinsic
            if (!fd.HasRva ||
                size > fd.FieldType.GetElementSize())
            {
                return null;
            }

            return (void*)ObjectToHandle(_compilation.GetFieldRvaData(fd));
        }
示例#7
0
 private CORINFO_CLASS_STRUCT_* getFieldClass(IntPtr _this, CORINFO_FIELD_STRUCT_* field)
 {
     var fieldDesc = HandleToObject(field);
     return ObjectToHandle(fieldDesc.OwningType);
 }
示例#8
0
        public virtual CORINFO_CLASS_STRUCT_* getFieldClass_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field)
        {
            exception = IntPtr.Zero;
            try
            {
                return getFieldClass(field);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (CORINFO_CLASS_STRUCT_*)0;
        }
示例#9
0
        public virtual CorInfoType getFieldType_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field, ref CORINFO_CLASS_STRUCT_* structType, CORINFO_CLASS_STRUCT_* memberParent)
        {
            exception = IntPtr.Zero;
            try
            {
                return getFieldType(field, ref structType, memberParent);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (CorInfoType)0;
        }
示例#10
0
        public virtual void* getArrayInitializationData_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field, uint size)
        {
            exception = IntPtr.Zero;
            try
            {
                return getArrayInitializationData(field, size);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (void*)0;
        }
示例#11
0
        public virtual byte* getFieldName_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* ftn, byte** moduleName)
        {
            exception = IntPtr.Zero;
            try
            {
                return getFieldName(ftn, moduleName);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (byte*)0;
        }
示例#12
0
        public virtual CorInfoInitClassResult initClass_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field, CORINFO_METHOD_STRUCT_* method, CORINFO_CONTEXT_STRUCT* context, [MarshalAs(UnmanagedType.Bool)]bool speculative)
        {
            exception = IntPtr.Zero;
            try
            {
                return initClass(field, method, context, speculative);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (CorInfoInitClassResult)0;
        }
示例#13
0
 static uint _getFieldThreadLocalStoreID(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
 {
     var _this = GetThis(thisHandle);
     try
     {
         return _this.getFieldThreadLocalStoreID(field, ref ppIndirection);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
         return default(uint);
     }
 }
示例#14
0
 static void* _getFieldAddress(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
 {
     var _this = GetThis(thisHandle);
     try
     {
         return _this.getFieldAddress(field, ref ppIndirection);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
         return default(void*);
     }
 }
示例#15
0
        private byte* getFieldName(CORINFO_FIELD_STRUCT_* ftn, byte** moduleName)
        {
            var field = HandleToObject(ftn);
            if (moduleName != null)
            {
                MetadataType typeDef = field.OwningType.GetTypeDefinition() as MetadataType;
                if (typeDef != null)
                    *moduleName = (byte*)GetPin(StringToUTF8(typeDef.GetFullName()));
                else
                    *moduleName = (byte*)GetPin(StringToUTF8("unknown"));
            }

            return (byte*)GetPin(StringToUTF8(field.Name));
        }
示例#16
0
        public virtual uint getFieldOffset_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field)
        {
            exception = IntPtr.Zero;
            try
            {
                return getFieldOffset(field);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (uint)0;
        }
示例#17
0
 private void* getFieldAddress(CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
 {
     FieldDesc fieldDesc = HandleToObject(field);
     Debug.Assert(fieldDesc.HasRva);
     return (void*)ObjectToHandle(_compilation.GetFieldRvaData(fieldDesc));
 }
示例#18
0
        [return: MarshalAs(UnmanagedType.I1)]public virtual bool isWriteBarrierHelperRequired_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field)
        {
            exception = IntPtr.Zero;
            try
            {
                return isWriteBarrierHelperRequired(field);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return false;
        }
示例#19
0
        private byte* getFieldName(IntPtr _this, CORINFO_FIELD_STRUCT_* ftn, byte** moduleName)
        {
            var field = HandleToObject(ftn);
            if (moduleName != null)
            {
                throw new NotImplementedException("getFieldName");
            }

            return (byte*)GetPin(StringToUTF8(field.Name));
        }
示例#20
0
        [return: MarshalAs(UnmanagedType.I1)]public virtual bool isFieldStatic_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* fldHnd)
        {
            exception = IntPtr.Zero;
            try
            {
                return isFieldStatic(fldHnd);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return false;
        }
示例#21
0
 private CorInfoType getFieldType(IntPtr _this, CORINFO_FIELD_STRUCT_* field, ref CORINFO_CLASS_STRUCT_* structType, CORINFO_CLASS_STRUCT_* memberParent)
 {
     var fieldDesc = HandleToObject(field);
     return asCorInfoType(fieldDesc.FieldType, out structType);
 }
示例#22
0
        public virtual CORINFO_FIELD_STRUCT_* embedFieldHandle_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* handle, ref void* ppIndirection)
        {
            exception = IntPtr.Zero;
            try
            {
                return embedFieldHandle(handle, ref ppIndirection);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (CORINFO_FIELD_STRUCT_*)0;
        }
示例#23
0
 private bool isWriteBarrierHelperRequired(IntPtr _this, CORINFO_FIELD_STRUCT_* field)
 { throw new NotImplementedException("isWriteBarrierHelperRequired"); }
示例#24
0
        public virtual void* getFieldAddress_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
        {
            exception = IntPtr.Zero;
            try
            {
                return getFieldAddress(field, ref ppIndirection);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (void*)0;
        }
示例#25
0
 private CORINFO_FIELD_STRUCT_* embedFieldHandle(IntPtr _this, CORINFO_FIELD_STRUCT_* handle, ref void* ppIndirection)
 { throw new NotImplementedException("embedFieldHandle"); }
示例#26
0
        public virtual uint getFieldThreadLocalStoreID_wrapper(IntPtr _this, out IntPtr exception, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
        {
            exception = IntPtr.Zero;
            try
            {
                return getFieldThreadLocalStoreID(field, ref ppIndirection);

            }
            catch (Exception ex)
            {
                exception = AllocException(ex);
            }
            return (uint)0;
        }
示例#27
0
 private uint getFieldThreadLocalStoreID(IntPtr _this, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
 { throw new NotImplementedException("getFieldThreadLocalStoreID"); }
示例#28
0
 internal static unsafe int GetValue(CORINFO_FIELD_STRUCT_* val)
 {
     return ((int)val - 1) >> 4;
 }
示例#29
0
        private CorInfoInitClassResult initClass(IntPtr _this, CORINFO_FIELD_STRUCT_* field, CORINFO_METHOD_STRUCT_* method, CORINFO_CONTEXT_STRUCT* context, [MarshalAs(UnmanagedType.Bool)]bool speculative)
        {
            FieldDesc fd = field == null ? null : HandleToObject(field);
            Debug.Assert(fd == null || fd.IsStatic);

            MethodDesc md = HandleToObject(method);
            TypeDesc type = fd != null ? fd.OwningType : typeFromContext(context);

            if (!type.HasStaticConstructor)
            {
                return CorInfoInitClassResult.CORINFO_INITCLASS_NOT_REQUIRED;
            }

            MetadataType typeToInit = (MetadataType)type;

            if (typeToInit.IsModuleType)
            {
                // For both jitted and ngen code the global class is always considered initialized
                return CorInfoInitClassResult.CORINFO_INITCLASS_NOT_REQUIRED;
            }

            if (fd == null)
            {
                if (typeToInit.IsBeforeFieldInit)
                {
                    // We can wait for field accesses to run .cctor
                    return CorInfoInitClassResult.CORINFO_INITCLASS_NOT_REQUIRED;
                }

                // Run .cctor on statics & constructors
                if (md.Signature.IsStatic)
                {
                    // Except don't class construct on .cctor - it would be circular
                    if (md.IsStaticConstructor)
                    {
                        return CorInfoInitClassResult.CORINFO_INITCLASS_NOT_REQUIRED;
                    }
                }
                else if (!md.IsConstructor && !typeToInit.IsValueType)
                {
                    // According to the spec, we should be able to do this optimization for both reference and valuetypes.
                    // To maintain backward compatibility, we are doing it for reference types only.
                    // For instance methods of types with precise-initialization
                    // semantics, we can assume that the .ctor triggerred the
                    // type initialization.
                    // This does not hold for NULL "this" object. However, the spec does
                    // not require that case to work.
                    return CorInfoInitClassResult.CORINFO_INITCLASS_NOT_REQUIRED;
                }
            }

            // TODO: before giving up and asking to generate a helper call, check to see if this is some pattern we can
            //       prove doesn't need initclass anymore because we initialized it earlier.

            return CorInfoInitClassResult.CORINFO_INITCLASS_USE_HELPER;
        }
示例#30
0
 [return: MarshalAs(UnmanagedType.I1)]static bool _isFieldStatic(IntPtr thisHandle, IntPtr* ppException, CORINFO_FIELD_STRUCT_* fldHnd)
 {
     var _this = GetThis(thisHandle);
     try
     {
         return _this.isFieldStatic(fldHnd);
     }
     catch (Exception ex)
     {
         *ppException = _this.AllocException(ex);
         return default(bool);
     }
 }