diff --git a/src/vm/dt_evmc_vm.cpp b/src/vm/dt_evmc_vm.cpp index 09c24ebd..b6fcf63f 100644 --- a/src/vm/dt_evmc_vm.cpp +++ b/src/vm/dt_evmc_vm.cpp @@ -185,10 +185,6 @@ struct DTVM : evmc_vm { Isolation *Iso = nullptr; // ---- Module & instance cache (shared by interpreter and multipass) ---- - // L0: pointer-based inline cache (fastest, 2 integer comparisons) - const uint8_t *LastCodePtr = nullptr; - size_t LastCodeSize = 0; - EVMModule *L0Mod = nullptr; // L1: address-based cache map (code_address + rev -> module) std::unordered_map @@ -282,9 +278,9 @@ EVMModule *loadTransientModule(DTVM *VM, const uint8_t *Code, size_t CodeSize, } /// Find or load a cached EVMModule using two-level cache: -/// L0 (code pointer+size) -> L1 (address map) -> Cold load. -/// Shared by both interpreter and multipass paths. -/// Returns nullptr on failure. +/// L1 address-based lookup (code_address + revision) + validateCodeMatch() +/// followed by a cold module load on miss or validation failure. +/// Shared by both interpreter and multipass paths. Returns nullptr on failure. EVMModule *findModuleCached(DTVM *VM, const uint8_t *Code, size_t CodeSize, evmc_revision Rev, const evmc_message *Msg, bool &IsTransient) { @@ -312,8 +308,6 @@ EVMModule *findModuleCached(DTVM *VM, const uint8_t *Code, size_t CodeSize, // If validation failed for an existing entry, evict the stale module if (It != VM->AddrCache.end()) { EVMModule *OldMod = It->second; - if (VM->L0Mod == OldMod && Msg->depth == 0) - VM->L0Mod = nullptr; VM->RT->unloadEVMModule(OldMod); VM->AddrCache.erase(It); } @@ -325,16 +319,6 @@ EVMModule *findModuleCached(DTVM *VM, const uint8_t *Code, size_t CodeSize, VM->AddrCache[AddrKey] = Mod; } - // Update L0 cache members. Even though L0 lookup is disabled, we maintain - // these state variables for two reasons: - // 1. Eviction tracking: If a stale L1 entry is replaced, we need to - // invalidate - // L0Mod if it pointed to the old module (done in the eviction path above). - // 2. Future extensibility: It keeps the door open for re-enabling L0 later - // with a safer validation scheme (e.g., pointer + size + hash). - VM->LastCodePtr = Code; - VM->LastCodeSize = CodeSize; - VM->L0Mod = Mod; return Mod; }