Large page support for cache

Bug fixes
This commit is contained in:
tevador
2019-01-18 17:57:47 +01:00
parent 8b1102ee05
commit 4fb168e249
13 changed files with 135 additions and 33 deletions
+22 -2
View File
@@ -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);