From c5c891ff8e531c23a2291e4c10a2f0c2e1d84ad7 Mon Sep 17 00:00:00 2001 From: tevador Date: Sat, 18 May 2019 00:14:43 +0200 Subject: [PATCH] Correctly call JitCompiler destructor Fix cmake/ccache --- CMakeLists.txt | 3 +++ src/dataset.cpp | 11 +++++++++++ src/dataset.hpp | 7 +------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 10e2bb5..9899da0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,3 +64,6 @@ target_link_libraries(randomx PRIVATE ${CMAKE_THREAD_LIBS_INIT}) set_property(TARGET randomx PROPERTY POSITION_INDEPENDENT_CODE ON) + +# cheat because cmake and ccache hate each other +set_property(SOURCE src/jit_compiler_x86_static.S PROPERTY LANGUAGE C) diff --git a/src/dataset.cpp b/src/dataset.cpp index 8aa6511..0b1772d 100644 --- a/src/dataset.cpp +++ b/src/dataset.cpp @@ -47,6 +47,17 @@ static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value o namespace randomx { + template + void deallocCache(randomx_cache* cache) { + if (cache->memory != nullptr) + Allocator::freeMemory(cache->memory, CacheSize); + if (cache->jit != nullptr) + delete cache->jit; + } + + template void deallocCache(randomx_cache* cache); + template void deallocCache(randomx_cache* cache); + void initCache(randomx_cache* cache, const void* key, size_t keySize) { uint32_t memory_blocks, segment_length; argon2_instance_t instance; diff --git a/src/dataset.hpp b/src/dataset.hpp index 20d939a..85d8e56 100644 --- a/src/dataset.hpp +++ b/src/dataset.hpp @@ -58,12 +58,7 @@ namespace randomx { } template - void deallocCache(randomx_cache* cache) { - if(cache->memory != nullptr) - Allocator::freeMemory(cache->memory, CacheSize); - if (cache->jit != nullptr) - delete cache->jit; - } + void deallocCache(randomx_cache* cache); void initCache(randomx_cache*, const void*, size_t); void initCacheCompile(randomx_cache*, const void*, size_t);