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_*); } }
private void* getFieldAddress(IntPtr _this, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection) { throw new NotImplementedException("getFieldAddress"); }
private FieldDesc HandleToObject(CORINFO_FIELD_STRUCT_* field) { return (FieldDesc)HandleToObject((IntPtr)field); }
private uint getFieldOffset(IntPtr _this, CORINFO_FIELD_STRUCT_* field) { var fieldDesc = HandleToObject(field); Debug.Assert(fieldDesc.Offset != FieldAndOffset.InvalidOffset); return (uint)fieldDesc.Offset; }
private bool isFieldStatic(IntPtr _this, CORINFO_FIELD_STRUCT_* fldHnd) { return HandleToObject(fldHnd).IsStatic; }
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)); }
private CORINFO_CLASS_STRUCT_* getFieldClass(IntPtr _this, CORINFO_FIELD_STRUCT_* field) { var fieldDesc = HandleToObject(field); return ObjectToHandle(fieldDesc.OwningType); }
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; }
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; }
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; }
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; }
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; }
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); } }
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*); } }
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)); }
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; }
private void* getFieldAddress(CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection) { FieldDesc fieldDesc = HandleToObject(field); Debug.Assert(fieldDesc.HasRva); return (void*)ObjectToHandle(_compilation.GetFieldRvaData(fieldDesc)); }
[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; }
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)); }
[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; }
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); }
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; }
private bool isWriteBarrierHelperRequired(IntPtr _this, CORINFO_FIELD_STRUCT_* field) { throw new NotImplementedException("isWriteBarrierHelperRequired"); }
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; }
private CORINFO_FIELD_STRUCT_* embedFieldHandle(IntPtr _this, CORINFO_FIELD_STRUCT_* handle, ref void* ppIndirection) { throw new NotImplementedException("embedFieldHandle"); }
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; }
private uint getFieldThreadLocalStoreID(IntPtr _this, CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection) { throw new NotImplementedException("getFieldThreadLocalStoreID"); }
internal static unsafe int GetValue(CORINFO_FIELD_STRUCT_* val) { return ((int)val - 1) >> 4; }
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; }
[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); } }