mirror of
				https://git.wownero.com/wownero/RandomWOW.git
				synced 2024-08-15 00:23:14 +00:00 
			
		
		
		
	Correctly call JitCompiler destructor
Fix cmake/ccache
This commit is contained in:
		
							parent
							
								
									ec29d5320d
								
							
						
					
					
						commit
						c5c891ff8e
					
				
					 3 changed files with 15 additions and 6 deletions
				
			
		|  | @ -64,3 +64,6 @@ target_link_libraries(randomx | ||||||
|   PRIVATE |   PRIVATE | ||||||
|     ${CMAKE_THREAD_LIBS_INIT}) |     ${CMAKE_THREAD_LIBS_INIT}) | ||||||
| set_property(TARGET randomx PROPERTY POSITION_INDEPENDENT_CODE ON) | 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) | ||||||
|  |  | ||||||
|  | @ -47,6 +47,17 @@ static_assert(ARGON2_BLOCK_SIZE == randomx::ArgonBlockSize, "Unpexpected value o | ||||||
| 
 | 
 | ||||||
| namespace randomx { | namespace randomx { | ||||||
| 
 | 
 | ||||||
|  | 	template<class Allocator> | ||||||
|  | 	void deallocCache(randomx_cache* cache) { | ||||||
|  | 		if (cache->memory != nullptr) | ||||||
|  | 			Allocator::freeMemory(cache->memory, CacheSize); | ||||||
|  | 		if (cache->jit != nullptr) | ||||||
|  | 			delete cache->jit; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	template void deallocCache<DefaultAllocator>(randomx_cache* cache); | ||||||
|  | 	template void deallocCache<LargePageAllocator>(randomx_cache* cache); | ||||||
|  | 
 | ||||||
| 	void initCache(randomx_cache* cache, const void* key, size_t keySize) { | 	void initCache(randomx_cache* cache, const void* key, size_t keySize) { | ||||||
| 		uint32_t memory_blocks, segment_length; | 		uint32_t memory_blocks, segment_length; | ||||||
| 		argon2_instance_t instance; | 		argon2_instance_t instance; | ||||||
|  |  | ||||||
|  | @ -58,12 +58,7 @@ namespace randomx { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	template<class Allocator> | 	template<class Allocator> | ||||||
| 	void deallocCache(randomx_cache* cache) { | 	void deallocCache(randomx_cache* cache); | ||||||
| 		if(cache->memory != nullptr) |  | ||||||
| 			Allocator::freeMemory(cache->memory, CacheSize); |  | ||||||
| 		if (cache->jit != nullptr) |  | ||||||
| 			delete cache->jit; |  | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	void initCache(randomx_cache*, const void*, size_t); | 	void initCache(randomx_cache*, const void*, size_t); | ||||||
| 	void initCacheCompile(randomx_cache*, const void*, size_t); | 	void initCacheCompile(randomx_cache*, const void*, size_t); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue