Skip to content

Commit c5c891f

Browse files
committed
Correctly call JitCompiler destructor
Fix cmake/ccache
1 parent ec29d53 commit c5c891f

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ target_link_libraries(randomx
6464
PRIVATE
6565
${CMAKE_THREAD_LIBS_INIT})
6666
set_property(TARGET randomx PROPERTY POSITION_INDEPENDENT_CODE ON)
67+
68+
# cheat because cmake and ccache hate each other
69+
set_property(SOURCE src/jit_compiler_x86_static.S PROPERTY LANGUAGE C)

src/dataset.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value o
4747

4848
namespace randomx {
4949

50+
template<class Allocator>
51+
void deallocCache(randomx_cache* cache) {
52+
if (cache->memory != nullptr)
53+
Allocator::freeMemory(cache->memory, CacheSize);
54+
if (cache->jit != nullptr)
55+
delete cache->jit;
56+
}
57+
58+
template void deallocCache<DefaultAllocator>(randomx_cache* cache);
59+
template void deallocCache<LargePageAllocator>(randomx_cache* cache);
60+
5061
void initCache(randomx_cache* cache, const void* key, size_t keySize) {
5162
uint32_t memory_blocks, segment_length;
5263
argon2_instance_t instance;

src/dataset.hpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@ namespace randomx {
5858
}
5959

6060
template<class Allocator>
61-
void deallocCache(randomx_cache* cache) {
62-
if(cache->memory != nullptr)
63-
Allocator::freeMemory(cache->memory, CacheSize);
64-
if (cache->jit != nullptr)
65-
delete cache->jit;
66-
}
61+
void deallocCache(randomx_cache* cache);
6762

6863
void initCache(randomx_cache*, const void*, size_t);
6964
void initCacheCompile(randomx_cache*, const void*, size_t);

0 commit comments

Comments
 (0)