Monero
Toggle main menu visibility
Loading...
Searching...
No Matches
external
randomx
src
vm_interpreted_light.hpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 2018-2019, tevador <tevador@gmail.com>
3
4
All rights reserved.
5
6
Redistribution and use in source and binary forms, with or without
7
modification, are permitted provided that the following conditions are met:
8
* Redistributions of source code must retain the above copyright
9
notice, this list of conditions and the following disclaimer.
10
* Redistributions in binary form must reproduce the above copyright
11
notice, this list of conditions and the following disclaimer in the
12
documentation and/or other materials provided with the distribution.
13
* Neither the name of the copyright holder nor the
14
names of its contributors may be used to endorse or promote products
15
derived from this software without specific prior written permission.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#pragma once
30
31
#include <new>
32
#include "
vm_interpreted.hpp
"
33
34
namespace
randomx
{
35
36
template
<
class
Allocator,
bool
softAes>
37
class
InterpretedLightVm
:
public
InterpretedVm
<Allocator, softAes> {
38
public
:
39
using
VmBase
<
Allocator
, softAes>
::mem
;
40
using
VmBase
<
Allocator
, softAes>
::cachePtr
;
41
void
*
operator
new
(
size_t
size) {
42
void
* ptr =
AlignedAllocator<CacheLineSize>::allocMemory
(size);
43
if
(ptr ==
nullptr
)
44
throw
std::bad_alloc();
45
return
ptr;
46
}
47
void
operator
delete
(
void
* ptr) {
48
AlignedAllocator<CacheLineSize>::freeMemory
(ptr,
sizeof
(
InterpretedLightVm
));
49
}
50
void
setDataset
(
randomx_dataset
* dataset)
override
{ }
51
void
setCache
(
randomx_cache
*
cache
)
override
;
52
protected
:
53
void
datasetRead
(
uint64_t
address
,
int_reg_t
(&r)[8])
override
;
54
void
datasetPrefetch
(
uint64_t
address
)
override
{ }
55
};
56
57
using
InterpretedLightVmDefault
=
InterpretedLightVm<AlignedAllocator<CacheLineSize>
,
true
>;
58
using
InterpretedLightVmHardAes
=
InterpretedLightVm<AlignedAllocator<CacheLineSize>
,
false
>;
59
using
InterpretedLightVmLargePage
=
InterpretedLightVm<LargePageAllocator, true>
;
60
using
InterpretedLightVmLargePageHardAes
=
InterpretedLightVm<LargePageAllocator, false>
;
61
}
randomx::InterpretedLightVm
Definition
vm_interpreted_light.hpp:37
randomx::InterpretedLightVm::setCache
void setCache(randomx_cache *cache) override
Definition
vm_interpreted_light.cpp:35
randomx::InterpretedLightVm::datasetRead
void datasetRead(uint64_t address, int_reg_t(&r)[8]) override
Definition
vm_interpreted_light.cpp:41
randomx::InterpretedLightVm::datasetPrefetch
void datasetPrefetch(uint64_t address) override
Definition
vm_interpreted_light.hpp:54
randomx::InterpretedLightVm::setDataset
void setDataset(randomx_dataset *dataset) override
Definition
vm_interpreted_light.hpp:50
randomx::InterpretedVm
Definition
vm_interpreted.hpp:42
randomx::VmBase
Definition
virtual_machine.hpp:80
randomx_vm::cachePtr
randomx_cache * cachePtr
Definition
virtual_machine.hpp:68
randomx_vm::mem
randomx::MemoryRegisters mem
Definition
virtual_machine.hpp:65
Allocator
Concept for allocating, resizing and freeing memory block.
randomx
Definition
allocator.cpp:35
randomx::int_reg_t
uint64_t int_reg_t
Definition
common.hpp:140
randomx::InterpretedLightVmLargePageHardAes
InterpretedLightVm< LargePageAllocator, false > InterpretedLightVmLargePageHardAes
Definition
vm_interpreted_light.hpp:60
randomx::InterpretedLightVmHardAes
InterpretedLightVm< AlignedAllocator< CacheLineSize >, false > InterpretedLightVmHardAes
Definition
vm_interpreted_light.hpp:58
randomx::InterpretedLightVmLargePage
InterpretedLightVm< LargePageAllocator, true > InterpretedLightVmLargePage
Definition
vm_interpreted_light.hpp:59
randomx::InterpretedLightVmDefault
InterpretedLightVm< AlignedAllocator< CacheLineSize >, true > InterpretedLightVmDefault
Definition
vm_interpreted_light.hpp:57
address
static cryptonote::account_public_address address
Definition
signature.cpp:38
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
randomx::AlignedAllocator::allocMemory
static void * allocMemory(size_t)
Definition
allocator.cpp:38
randomx::AlignedAllocator::freeMemory
static void freeMemory(void *, size_t)
Definition
allocator.cpp:46
randomx_cache
Definition
dataset.hpp:46
randomx_dataset
Definition
dataset.hpp:40
cache
randomx_cache * cache
Definition
tests.cpp:19
vm_interpreted.hpp
Generated on
for Monero by
1.17.0