コード例 #1
0
        internal unsafe static NativeReader GetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob)
        {
            NativeReader reader;

            if (TryGetNativeReaderForBlob(module, blob, out reader))
            {
                return(reader);
            }

            Debug.Assert(false);
            return(default(NativeReader));
        }
コード例 #2
0
ファイル: ModuleList.cs プロジェクト: karelz/runtime
 internal unsafe bool TryFindBlob(ReflectionMapBlob blobId, out byte *pBlob, out uint cbBlob)
 {
     pBlob  = null;
     cbBlob = 0;
     fixed(byte **ppBlob = &pBlob)
     {
         fixed(uint *pcbBlob = &cbBlob)
         {
             return(RuntimeAugments.FindBlob(Handle, (int)blobId, new IntPtr(ppBlob), new IntPtr(pcbBlob)));
         }
     }
 }
コード例 #3
0
        private unsafe static bool TryGetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte *pBlob;
            uint  cbBlob;

            if (RuntimeAugments.FindBlob(module, (int)blob, (IntPtr)(&pBlob), (IntPtr)(&cbBlob)))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return(true);
            }

            reader = default(NativeReader);
            return(false);
        }
コード例 #4
0
        private unsafe bool Initialize(NativeFormatModuleInfo module, ReflectionMapBlob blobId)
        {
            byte *pBlob;
            uint  cbBlob;

            if (!module.TryFindBlob(blobId, out pBlob, out cbBlob))
            {
                _elements      = IntPtr.Zero;
                _elementsCount = 0;
                return(false);
            }

            _elements      = (IntPtr)pBlob;
            _elementsCount = (uint)(cbBlob / sizeof(uint));

            return(true);
        }
コード例 #5
0
        private unsafe bool Initialize(IntPtr moduleHandle, ReflectionMapBlob blobId)
        {
            _moduleHandle = moduleHandle;

            byte* pBlob;
            uint cbBlob;
            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                _RVAs = IntPtr.Zero;
                _RVAsCount = 0;
                return false;
            }

            _RVAs = (IntPtr)pBlob;
            _RVAsCount = (uint)(cbBlob / sizeof(IntPtr));
            return true;
        }
コード例 #6
0
        private unsafe bool Initialize(TypeManagerHandle typeManager, ReflectionMapBlob blobId)
        {
            byte *pBlob;
            uint  cbBlob;

            if (!RuntimeAugments.FindBlob(typeManager, (int)blobId, (IntPtr)(void *)&pBlob, (IntPtr)(void *)&cbBlob))
            {
                _elements      = IntPtr.Zero;
                _elementsCount = 0;
                return(false);
            }

            _elements      = (IntPtr)pBlob;
            _elementsCount = (uint)(cbBlob / sizeof(uint));

            return(true);
        }
コード例 #7
0
        // get the generics hash table and external references table for a module
        // TODO multi-file: consider whether we want to cache this info
        private unsafe bool GetHashtableFromBlob(NativeFormatModuleInfo module, ReflectionMapBlob blobId, out NativeHashtable hashtable, out ExternalReferencesTable externalReferencesLookup)
        {
            byte* pBlob;
            uint cbBlob;

            hashtable = default(NativeHashtable);
            externalReferencesLookup = default(ExternalReferencesTable);

            if (!module.TryFindBlob(blobId, out pBlob, out cbBlob))
                return false;

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            hashtable = new NativeHashtable(parser);

            return externalReferencesLookup.InitializeNativeReferences(module);
        }
コード例 #8
0
        private unsafe bool Initialize(IntPtr moduleHandle, ReflectionMapBlob blobId)
        {
            _moduleHandle = moduleHandle;

            byte *pBlob;
            uint  cbBlob;

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                _elements      = IntPtr.Zero;
                _elementsCount = 0;
                return(false);
            }

            _elements      = (IntPtr)pBlob;
            _elementsCount = (uint)(cbBlob / sizeof(TableElement));
            return(true);
        }
コード例 #9
0
        // get the generics hash table and external references table for a module
        // TODO multi-file: consider whether we want to cache this info
        private unsafe bool GetHashtableFromBlob(IntPtr moduleHandle, ReflectionMapBlob blobId, out NativeHashtable hashtable, out ExternalReferencesTable externalReferencesLookup)
        {
            byte* pBlob;
            uint cbBlob;

            hashtable = default(NativeHashtable);
            externalReferencesLookup = default(ExternalReferencesTable);

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                return false;

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            hashtable = new NativeHashtable(parser);

            return externalReferencesLookup.InitializeNativeReferences(moduleHandle);
        }
コード例 #10
0
            unsafe public ExternalReferencesTable(IntPtr moduleHandle, ReflectionMapBlob blobId)
            {
                _moduleHandle = moduleHandle;

                uint *pBlob;
                uint  cbBlob;

                if (RuntimeAugments.FindBlob(moduleHandle, (int)blobId, (IntPtr)(&pBlob), (IntPtr)(&cbBlob)))
                {
                    _count = cbBlob / sizeof(uint);
                    _base  = pBlob;
                }
                else
                {
                    _count = 0;
                    _base  = null;
                }
            }
コード例 #11
0
            public MetadataTable(IntPtr moduleHandle, ReflectionMapBlob blobId, int elementSize)
            {
                Debug.Assert(elementSize != 0);

                _elementSize = elementSize;

                byte *pBlob;
                uint  cbBlob;

                if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                {
                    pBlob  = null;
                    cbBlob = 0;
                }

                Debug.Assert(cbBlob % elementSize == 0);

                _blob        = pBlob;
                ElementCount = cbBlob / (uint)elementSize;
            }
コード例 #12
0
ファイル: TemplateLocator.cs プロジェクト: wtgodbe/corert
        // Lazy loadings of hashtables (load on-demand only)
        private unsafe NativeHashtable LoadHashtable(IntPtr moduleHandle, ReflectionMapBlob hashtableBlobId, out ExternalReferencesTable externalFixupsTable)
        {
            // Load the common fixups table
            externalFixupsTable = default(ExternalReferencesTable);
            if (!externalFixupsTable.InitializeCommonFixupsTable(moduleHandle))
            {
                return(default(NativeHashtable));
            }

            // Load the hashtable
            byte *pBlob;
            uint  cbBlob;

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)hashtableBlobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                return(default(NativeHashtable));
            }

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            return(new NativeHashtable(parser));
        }
コード例 #13
0
ファイル: TemplateLocator.cs プロジェクト: z77ma/runtime
        // Lazy loadings of hashtables (load on-demand only)
        private unsafe NativeHashtable LoadHashtable(NativeFormatModuleInfo module, ReflectionMapBlob hashtableBlobId, out ExternalReferencesTable externalFixupsTable)
        {
            // Load the common fixups table
            externalFixupsTable = default(ExternalReferencesTable);
            if (!externalFixupsTable.InitializeCommonFixupsTable(module))
            {
                return(default(NativeHashtable));
            }

            // Load the hashtable
            byte *pBlob;
            uint  cbBlob;

            if (!module.TryFindBlob(hashtableBlobId, out pBlob, out cbBlob))
            {
                return(default(NativeHashtable));
            }

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            return(new NativeHashtable(parser));
        }
コード例 #14
0
        private unsafe bool Initialize(NativeFormatModuleInfo module, ReflectionMapBlob blobId)
        {
            if (module == null)
            {
                isDebuggerPrepared = true;
            }
            else
            {
                _moduleHandle = module.Handle;

                byte *pBlob;
                uint  cbBlob;
                if (!module.TryFindBlob(blobId, out pBlob, out cbBlob))
                {
                    _elements      = IntPtr.Zero;
                    _elementsCount = 0;
                    return(false);
                }

                _elements      = (IntPtr)pBlob;
                _elementsCount = (uint)(cbBlob / sizeof(TableElement));
            }
            return(true);
        }
コード例 #15
0
        private static unsafe bool TryGetNativeReaderForBlob(NativeFormatModuleInfo module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte *pBlob;
            uint  cbBlob;

            if (module.TryFindBlob((int)blob, out pBlob, out cbBlob))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return(true);
            }

            reader = default(NativeReader);
            return(false);
        }
コード例 #16
0
ファイル: TemplateLocator.cs プロジェクト: nattress/corert
        // Lazy loadings of hashtables (load on-demand only)
        private unsafe NativeHashtable LoadHashtable(IntPtr moduleHandle, ReflectionMapBlob hashtableBlobId, out ExternalReferencesTable externalFixupsTable)
        {
            // Load the common fixups table
            externalFixupsTable = default(ExternalReferencesTable);
            if (!externalFixupsTable.InitializeCommonFixupsTable(moduleHandle))
                return default(NativeHashtable);

            // Load the hashtable
            byte* pBlob;
            uint cbBlob;
            if (!RuntimeAugments.FindBlob(moduleHandle, (int)hashtableBlobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                return default(NativeHashtable);

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);
            return new NativeHashtable(parser);
        }
コード例 #17
0
        private unsafe static bool TryGetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte* pBlob;
            uint cbBlob;

            if (RuntimeAugments.FindBlob(module, (int)blob, (IntPtr)(&pBlob), (IntPtr)(&cbBlob)))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return true;
            }

            reader = default(NativeReader);
            return false;
        }
コード例 #18
0
        internal unsafe static NativeReader GetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob)
        {
            NativeReader reader;
            if (TryGetNativeReaderForBlob(module, blob, out reader))
            {
                return reader;
            }

            Debug.Assert(false);
            return default(NativeReader);
        }
コード例 #19
0
ファイル: RuntimeInteropData.cs プロジェクト: dotnet/runtime
        private static unsafe bool TryGetNativeReaderForBlob(TypeManagerHandle module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte *pBlob;
            uint  cbBlob;

            if (RuntimeImports.RhFindBlob(module, (uint)blob, &pBlob, &cbBlob))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return(true);
            }

            reader = default(NativeReader);
            return(false);
        }
コード例 #20
0
        // get the generics hash table and external references table for a module
        // TODO multi-file: consider whether we want to cache this info
        private unsafe bool GetHashtableFromBlob(IntPtr moduleHandle, ReflectionMapBlob blobId, out NativeHashtable hashtable, out ExternalReferencesTable externalReferencesLookup)
        {
            byte* pBlob;
            uint cbBlob;

            hashtable = default(NativeHashtable);
            externalReferencesLookup = default(ExternalReferencesTable);

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                return false;

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            hashtable = new NativeHashtable(parser);

            return externalReferencesLookup.InitializeNativeReferences(moduleHandle);
        }