コード例 #1
0
        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);
        }
コード例 #2
0
 public static T UnboxRaw <T>(object value) where T : struct
 {
     lock (value) {
         Pointer <byte> addr = AddressOfHeap(value, OffsetOptions.Fields);
         return(addr.Cast <T>().Read());
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        /// <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));
        }
コード例 #5
0
 public void Free <T>(Pointer <T> p)
 {
     m_free(p.Address);
     m_pointers.Remove(p.Cast());
 }
コード例 #6
0
 public void Free <T>(Pointer <T> p)
 {
     m_allocator.Free(p.Cast());
     m_pointers.Remove(p.Cast());
 }
コード例 #7
0
 // 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);
 }
コード例 #8
0
ファイル: MetaType.cs プロジェクト: Decimation/NeoCore
 public MetaType(Pointer <MethodTable> mt) : base(mt)
 {
     RuntimeType          = Runtime.ResolveType(mt.Cast());
     InspectionProperties = Inspector.ReadProperties(RuntimeType);
 }