Skip to content

Commit 5239299

Browse files
committed
Replace LFU with LRU cache replacement policy
The LFU (least-frequently-used) replacement policy would encounter the performance issue when the cache is not big enough to hold all translated blocks (IRs). The LRU (least-recently-used) replacement policy is more suitable for our needs. However, when the least-used cache is dropped, the counter which is used to trigger JIT compilation is going to be cleared. To address this issue, we store the "live" cache in both list and hash map, and manage the history of the replaced cache in hash map. Since the out-of-use cache is added again, it can retrieve the previous counter. However, the hash map might become very big if we don't trim the unused history in it. We use the distance with the current counter and the last accessed time to determine the history should be dropped or not.
1 parent 6647215 commit 5239299

File tree

2 files changed

+180
-95
lines changed

2 files changed

+180
-95
lines changed

0 commit comments

Comments
 (0)