Fabcoin Core  0.16.2
P2P Digital Currency
Cache.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <unordered_map>
5 
7 #include <llvm/ExecutionEngine/ObjectCache.h>
8 #include <llvm/IR/LLVMContext.h>
10 
11 namespace llvm
12 {
13  class ExecutionEngine;
14 }
15 
16 namespace dev
17 {
18 namespace evmjit
19 {
20 class JITListener;
21 
22 enum class CacheMode
23 {
24  off,
25  on,
26  read,
27  write,
28  clear,
29  preload
30 };
31 
32 class ObjectCache : public llvm::ObjectCache
33 {
34 public:
36  virtual void notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBufferRef _object) final override;
37 
42  virtual std::unique_ptr<llvm::MemoryBuffer> getObject(llvm::Module const* _module) final override;
43 };
44 
45 
46 class Cache
47 {
48 public:
49  static ObjectCache* init(CacheMode _mode, JITListener* _listener);
50  static std::unique_ptr<llvm::Module> getObject(std::string const& id, llvm::LLVMContext& _llvmContext);
51 
53  static void clear();
54 
56  static void preload(llvm::ExecutionEngine& _ee, std::unordered_map<std::string, uint64_t>& _funcCache,
57  llvm::LLVMContext& _llvmContext);
58 };
59 
60 }
61 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
Definition: Cache.h:11