diff --git a/src/evm/opcode_handlers.cpp b/src/evm/opcode_handlers.cpp index f557804c..86e12221 100644 --- a/src/evm/opcode_handlers.cpp +++ b/src/evm/opcode_handlers.cpp @@ -10,9 +10,9 @@ #include "host/evm/crypto.h" #include "runtime/evm_instance.h" -zen::evm::EVMFrame *zen::evm::EVMResource::CurrentFrame = nullptr; -zen::evm::InterpreterExecContext *zen::evm::EVMResource::CurrentContext = - nullptr; +thread_local zen::evm::EVMFrame *zen::evm::EVMResource::CurrentFrame = nullptr; +thread_local zen::evm::InterpreterExecContext + *zen::evm::EVMResource::CurrentContext = nullptr; using namespace zen; using namespace zen::evm; diff --git a/src/evm/opcode_handlers.h b/src/evm/opcode_handlers.h index 8886ceac..0287893a 100644 --- a/src/evm/opcode_handlers.h +++ b/src/evm/opcode_handlers.h @@ -45,8 +45,8 @@ namespace zen::evm { class EVMResource { public: - static EVMFrame *CurrentFrame; - static InterpreterExecContext *CurrentContext; + static thread_local EVMFrame *CurrentFrame; + static thread_local InterpreterExecContext *CurrentContext; static void setExecutionContext(EVMFrame *Frame, InterpreterExecContext *Context) { @@ -211,7 +211,7 @@ DEFINE_BINARY_OP(Sgt, intx::slt(B, A)); #define DEFINE_MULTIOPCODE_UNIMPLEMENT_HANDLER(OpName) \ class OpName##Handler : public EVMOpcodeHandlerBase { \ public: \ - inline static evmc_opcode OpCode = OP_INVALID; \ + inline static thread_local evmc_opcode OpCode = OP_INVALID; \ static EVMFrame *getFrame() { return EVMResource::getCurFrame(); } \ static InterpreterExecContext *getContext() { \ return EVMResource::getInterpreterExecContext(); \