mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-20 20:40:28 -05:00
Implemented unified cryptonight and RandomX scratchpad memory.
This commit is contained in:
@@ -33,29 +33,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
namespace randomx {
|
||||
|
||||
template<class Allocator, bool softAes>
|
||||
class InterpretedLightVm : public InterpretedVm<Allocator, softAes> {
|
||||
template<bool softAes>
|
||||
class InterpretedLightVm : public InterpretedVm<softAes> {
|
||||
public:
|
||||
using VmBase<Allocator, softAes>::mem;
|
||||
using VmBase<Allocator, softAes>::cachePtr;
|
||||
using VmBase<softAes>::mem;
|
||||
using VmBase<softAes>::cachePtr;
|
||||
|
||||
void* operator new(size_t size) {
|
||||
void* ptr = AlignedAllocator<CacheLineSize>::allocMemory(size);
|
||||
if (ptr == nullptr)
|
||||
throw std::bad_alloc();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void operator delete(void* ptr) {
|
||||
AlignedAllocator<CacheLineSize>::freeMemory(ptr, sizeof(InterpretedLightVm));
|
||||
}
|
||||
|
||||
void setDataset(randomx_dataset* dataset) override { }
|
||||
void setCache(randomx_cache* cache) override;
|
||||
|
||||
protected:
|
||||
void datasetRead(uint64_t address, int_reg_t(&r)[8]) override;
|
||||
void datasetPrefetch(uint64_t address) override { }
|
||||
};
|
||||
|
||||
using InterpretedLightVmDefault = InterpretedLightVm<AlignedAllocator<CacheLineSize>, true>;
|
||||
using InterpretedLightVmHardAes = InterpretedLightVm<AlignedAllocator<CacheLineSize>, false>;
|
||||
using InterpretedLightVmLargePage = InterpretedLightVm<LargePageAllocator, true>;
|
||||
using InterpretedLightVmLargePageHardAes = InterpretedLightVm<LargePageAllocator, false>;
|
||||
using InterpretedLightVmDefault = InterpretedLightVm<true>;
|
||||
using InterpretedLightVmHardAes = InterpretedLightVm<false>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user