private static void FastLoadField(MetaField fieldInfo, Pointer <byte> addr, Pointer <byte> fieldAddr) { int fieldSize = fieldInfo.Size; byte[] memCpy = addr.Cast().Copy(fieldSize); fieldAddr.WriteAll(memCpy); }
public static T UnboxRaw <T>(object value) where T : struct { lock (value) { Pointer <byte> addr = AddressOfHeap(value, OffsetOptions.Fields); return(addr.Cast <T>().Read()); } }
public Pointer <T> ReAlloc <T>(Pointer <T> p, int elemCnt = 1) { int size = Mem.FullSize <T>(elemCnt); var reAlloc = m_reAlloc(p.Address, size); var i = m_pointers.IndexOf(p.Cast()); m_pointers[i] = reAlloc; return(reAlloc); }
/// <summary> /// Returns the address of the data of <paramref name="value"/>. If <typeparamref name="T" /> is a value type, /// this will return <see cref="AddressOf{T}" />. If <typeparamref name="T" /> is a reference type, /// this will return the equivalent of <see cref="AddressOfHeap{T}(T, OffsetOptions)" /> with /// <see cref="OffsetOptions.Fields" />. /// </summary> public static Pointer <byte> AddressOfFields <T>(ref T value) { Pointer <T> addr = AddressOf(ref value); if (Runtime.Info.IsStruct(value)) { return(addr.Cast()); } return(AddressOfHeapInternal(value, OffsetOptions.Fields)); }
public void Free <T>(Pointer <T> p) { m_free(p.Address); m_pointers.Remove(p.Cast()); }
public void Free <T>(Pointer <T> p) { m_allocator.Free(p.Cast()); m_pointers.Remove(p.Cast()); }
// Root constructor internal MetaType(Pointer <MethodTable> mt) : base(mt) { RuntimeType = Runtime.ResolveType(mt.Cast()); Fields = new VirtualCollection <MetaField>(GetField, GetFields); Methods = new VirtualCollection <MetaMethod>(GetMethod, GetMethods); }
public MetaType(Pointer <MethodTable> mt) : base(mt) { RuntimeType = Runtime.ResolveType(mt.Cast()); InspectionProperties = Inspector.ReadProperties(RuntimeType); }