diff --git a/libevmjit/Compiler.cpp b/libevmjit/Compiler.cpp index 80bd647add..20b17e9fe5 100644 --- a/libevmjit/Compiler.cpp +++ b/libevmjit/Compiler.cpp @@ -1,6 +1,7 @@ #include "Compiler.h" +#include #include #include @@ -153,8 +154,13 @@ void Compiler::createBasicBlocks(bytes const& _bytecode) std::unique_ptr Compiler::compile(bytes const& _bytecode) { + // TODO: Better hash of code needed, probably SHA3 + std::string code{reinterpret_cast(_bytecode.data()), _bytecode.size()}; + auto hash = std::hash{}(code); + auto strHash = std::to_string(hash); + auto compilationStartTime = std::chrono::high_resolution_clock::now(); - auto module = std::unique_ptr(new llvm::Module("main", m_builder.getContext())); + auto module = std::unique_ptr(new llvm::Module(strHash, m_builder.getContext())); // Create main function auto mainFuncType = llvm::FunctionType::get(Type::MainReturn, Type::RuntimePtr, false);