| 1 | // Licensed to the .NET Foundation under one or more agreements. |
|---|---|
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | // |
| 5 | // File: HotTable.h |
| 6 | // |
| 7 | |
| 8 | // |
| 9 | // Class code:MetaData::HotTable stores hot table records cache, a cache of often-accessed |
| 10 | // table records stored only in NGEN images. |
| 11 | // The cache is created using IBC logging. |
| 12 | // |
| 13 | // ====================================================================================== |
| 14 | |
| 15 | #pragma once |
| 16 | |
| 17 | #include "external.h" |
| 18 | |
| 19 | #include "hotdataformat.h" |
| 20 | |
| 21 | namespace MetaData |
| 22 | { |
| 23 | |
| 24 | // -------------------------------------------------------------------------------------- |
| 25 | // |
| 26 | // This class stores hot table records cache, a cache of often-accessed table records stored only in NGEN |
| 27 | // images. |
| 28 | // The cache is created using IBC logging. |
| 29 | // |
| 30 | class HotTable |
| 31 | { |
| 32 | public: |
| 33 | __checkReturn |
| 34 | static HRESULT GetData( |
| 35 | UINT32 nRowIndex, |
| 36 | __deref_out_opt BYTE **ppRecord, |
| 37 | UINT32 cbRecordSize, |
| 38 | struct HotTableHeader *pHotTableHeader); |
| 39 | |
| 40 | inline static struct HotTableHeader *GetTableHeader( |
| 41 | struct HotTablesDirectory *pHotTablesDirectory, |
| 42 | UINT32 nTableIndex) |
| 43 | { |
| 44 | _ASSERTE(pHotTablesDirectory != NULL); |
| 45 | |
| 46 | INT32 nTableOffset = pHotTablesDirectory->m_rgTableHeader_SignedOffset[nTableIndex]; |
| 47 | _ASSERTE(nTableOffset != 0); |
| 48 | |
| 49 | BYTE *pHotTableHeaderData = ((BYTE *)pHotTablesDirectory) + nTableOffset; |
| 50 | return (struct HotTableHeader *)pHotTableHeaderData; |
| 51 | } |
| 52 | |
| 53 | static void CheckTables(struct HotTablesDirectory *pHotTablesDirectory); |
| 54 | |
| 55 | }; // class HotTable |
| 56 | |
| 57 | }; // namespace MetaData |
| 58 |