mirror of
https://github.com/wownero/RandomWOW.git
synced 2026-11-24 17:15:17 +01:00
Large page support for cache
Bug fixes
This commit is contained in:
+22
-2
@@ -23,12 +23,32 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
|
||||
#include <new>
|
||||
#include "common.hpp"
|
||||
#include "dataset.hpp"
|
||||
#include "virtualMemory.hpp"
|
||||
|
||||
namespace RandomX {
|
||||
|
||||
class Cache {
|
||||
public:
|
||||
void* operator new(size_t size) {
|
||||
static void* alloc(bool largePages) {
|
||||
if (largePages) {
|
||||
return allocLargePagesMemory(sizeof(Cache));
|
||||
}
|
||||
else {
|
||||
void* ptr = _mm_malloc(sizeof(Cache), sizeof(__m128i));
|
||||
if (ptr == nullptr)
|
||||
throw std::bad_alloc();
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
static void dealloc(Cache* cache, bool largePages) {
|
||||
if (largePages) {
|
||||
//allocLargePagesMemory(sizeof(Cache));
|
||||
}
|
||||
else {
|
||||
_mm_free(cache);
|
||||
}
|
||||
}
|
||||
/*void* operator new(size_t size) {
|
||||
void* ptr = _mm_malloc(size, sizeof(__m128i));
|
||||
if (ptr == nullptr)
|
||||
throw std::bad_alloc();
|
||||
@@ -37,7 +57,7 @@ namespace RandomX {
|
||||
|
||||
void operator delete(void* ptr) {
|
||||
_mm_free(ptr);
|
||||
}
|
||||
}*/
|
||||
|
||||
template<bool softAes>
|
||||
void initialize(const void* seed, size_t seedSize);
|
||||
|
||||
Reference in New Issue
Block a user