summaryrefslogtreecommitdiff
path: root/src/ToolBox/superpmi/superpmi-shim-counter/jithost.cpp
blob: d4efc33c690d84e97cc0f5128dbcc64eeaef0a03 (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
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

#include "standardpch.h"
#include "runtimedetails.h"
#include "spmiutil.h"
#include "methodcallsummarizer.h"
#include "jithost.h"

JitHost* g_ourJitHost;

JitHost::JitHost(ICorJitHost* wrappedHost) : wrappedHost(wrappedHost), mcs(nullptr)
{
}

void JitHost::setMethodCallSummarizer(MethodCallSummarizer* methodCallSummarizer)
{
    this->mcs = methodCallSummarizer;
}

void* JitHost::allocateMemory(size_t size, bool usePageAllocator)
{
    return wrappedHost->allocateMemory(size, usePageAllocator);
}

void JitHost::freeMemory(void* block, bool usePageAllocator)
{
    return wrappedHost->freeMemory(block, usePageAllocator);
}

int JitHost::getIntConfigValue(const wchar_t* key, int defaultValue)
{
    mcs->AddCall("getIntConfigValue");
    return wrappedHost->getIntConfigValue(key, defaultValue);
}

const wchar_t* JitHost::getStringConfigValue(const wchar_t* key)
{
    mcs->AddCall("getStringConfigValue");
    return wrappedHost->getStringConfigValue(key);
}

void JitHost::freeStringConfigValue(const wchar_t* value)
{
    mcs->AddCall("freeStringConfigValue");
    wrappedHost->freeStringConfigValue(value);
}