summaryrefslogtreecommitdiff
path: root/src/md/hotdata/hottable.h
blob: 361638e3f5393675e0240ee74ae726f45a1a155f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// 
// File: HotTable.h
// 

// 
// Class code:MetaData::HotTable stores hot table records cache, a cache of often-accessed 
// table records stored only in NGEN images.
// The cache is created using IBC logging.
// 
// ======================================================================================

#pragma once

#include "external.h"

#include "hotdataformat.h"

namespace MetaData
{

// --------------------------------------------------------------------------------------
// 
// This class stores hot table records cache, a cache of often-accessed table records stored only in NGEN 
// images.
// The cache is created using IBC logging.
// 
class HotTable
{
public:
    __checkReturn
    static HRESULT GetData(
                        UINT32 nRowIndex, 
        __deref_out_opt BYTE **ppRecord, 
                        UINT32 cbRecordSize, 
                        struct HotTableHeader *pHotTableHeader);
    
    inline static struct HotTableHeader *GetTableHeader(
        struct HotTablesDirectory *pHotTablesDirectory, 
        UINT32                     nTableIndex)
    {
        _ASSERTE(pHotTablesDirectory != NULL);
        
        INT32 nTableOffset = pHotTablesDirectory->m_rgTableHeader_SignedOffset[nTableIndex];
        _ASSERTE(nTableOffset != 0);
        
        BYTE *pHotTableHeaderData = ((BYTE *)pHotTablesDirectory) + nTableOffset;
        return (struct HotTableHeader *)pHotTableHeaderData;
    }
    
    static void CheckTables(struct HotTablesDirectory *pHotTablesDirectory);
    
};  // class HotTable

};  // namespace MetaData