Fix: hardcoded JIT code buffer size (#98)

* code buffer size is calculated based on RandomX parameters
* added a maximum value constraint for program size and superscalar latency
* reduced the x86 code size of memory instructions by 1 byte
* disclaimer note in configuration documentation
This commit is contained in:
tevador
2019-07-09 20:27:10 +02:00
committed by GitHub
parent 47ade5e894
commit c433f6d3a8
9 changed files with 39 additions and 17 deletions
+1 -5
View File
@@ -97,17 +97,13 @@ void* allocExecutableMemory(std::size_t bytes) {
return mem;
}
constexpr std::size_t align(std::size_t pos, std::size_t align) {
return ((pos - 1) / align + 1) * align;
}
void* allocLargePagesMemory(std::size_t bytes) {
void* mem;
#if defined(_WIN32) || defined(__CYGWIN__)
setPrivilege("SeLockMemoryPrivilege", 1);
auto pageMinimum = GetLargePageMinimum();
if (pageMinimum > 0)
mem = VirtualAlloc(NULL, align(bytes, pageMinimum), MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES, PAGE_READWRITE);
mem = VirtualAlloc(NULL, alignSize(bytes, pageMinimum), MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES, PAGE_READWRITE);
else
throw std::runtime_error("allocLargePagesMemory - Large pages are not supported");
if (mem == nullptr)