mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Limited old cached objects detection
This commit is contained in:
parent
84b6251181
commit
0ba0833138
1 changed files with 14 additions and 0 deletions
|
|
@ -36,6 +36,20 @@ std::unique_ptr<llvm::Module> Cache::getObject(std::string const& id)
|
|||
llvm::sys::path::system_temp_directory(false, cachePath);
|
||||
llvm::sys::path::append(cachePath, "evm_objs", id);
|
||||
|
||||
#if defined(__GNUC__) && !defined(NDEBUG)
|
||||
llvm::sys::fs::file_status st;
|
||||
auto err = llvm::sys::fs::status(cachePath.str(), st);
|
||||
if (err)
|
||||
return nullptr;
|
||||
auto mtime = st.getLastModificationTime().toEpochTime();
|
||||
|
||||
std::tm tm;
|
||||
strptime(__DATE__ __TIME__, " %b %d %Y %H:%M:%S", &tm);
|
||||
auto btime = (uint64_t)std::mktime(&tm);
|
||||
if (btime > mtime)
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
if (auto r = llvm::MemoryBuffer::getFile(cachePath.str(), -1, false))
|
||||
lastObject = llvm::MemoryBuffer::getMemBufferCopy(r.get()->getBuffer());
|
||||
else if (r.getError() != std::make_error_code(std::errc::no_such_file_or_directory))
|
||||
|
|
|
|||
Loading…
Reference in a new issue