diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 37e5f437..a0363a3c 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -821,7 +821,6 @@ ctrl_query_cached_data_from_process_vaddr_range(Arena *arena, CTRL_MachineID mac { page_found = 1; MemoryCopy((U8*)read_out + (page_vaddr-page_range.min), page_data.str, KB(4)); - result.fresh = result.fresh || !!(node4->page_fresh_flags[lvl5_idx/64] & (1ull<<(lvl5_idx%64))); } else { @@ -899,16 +898,6 @@ ctrl_query_cached_data_from_process_vaddr_range(Arena *arena, CTRL_MachineID mac }; U128 page_key = hs_hash_from_data(str8((U8 *)page_key_data, sizeof(page_key_data))); U128 page_hash = hs_submit_data(page_key, &page_arena, str8((U8 *)page_base, KB(4))); - if(!u128_match(node4->page_hashes[lvl5_idx], u128_zero()) && - !u128_match(node4->page_hashes[lvl5_idx], page_hash)) - { - node4->page_fresh_flags[lvl5_idx/64] |= (1ull<<(lvl5_idx%64)); - } - else - { - node4->page_fresh_flags[lvl5_idx/64] &= ~(1ull<<(lvl5_idx%64)); - } - result.fresh = result.fresh || !!(node4->page_fresh_flags[lvl5_idx/64] & (1ull<<(lvl5_idx%64))); node4->page_hashes[lvl5_idx] = page_hash; } else diff --git a/src/ctrl/ctrl_core.h b/src/ctrl/ctrl_core.h index c667c7de..2187459c 100644 --- a/src/ctrl/ctrl_core.h +++ b/src/ctrl/ctrl_core.h @@ -333,8 +333,6 @@ struct CTRL_ProcessMemoryCacheNode4 { U64 page_memgen_idxs[256]; U128 page_hashes[256]; - U128 last_page_hashes[256]; - U64 page_fresh_flags[4]; }; typedef struct CTRL_ProcessMemoryCacheNode3 CTRL_ProcessMemoryCacheNode3; diff --git a/src/hash_store/hash_store.c b/src/hash_store/hash_store.c index 0d25bdce..81b7d6a2 100644 --- a/src/hash_store/hash_store.c +++ b/src/hash_store/hash_store.c @@ -243,7 +243,7 @@ hs_scope_touch_node__stripe_r_guarded(HS_Scope *scope, HS_Node *node) //~ rjf: Cache Lookup internal U128 -hs_hash_from_key(U128 key) +hs_hash_from_key(U128 key, U64 rewind_count) { U128 result = {0}; U64 key_slot_idx = key.u64[1]%hs_shared->key_slots_count; @@ -254,9 +254,9 @@ hs_hash_from_key(U128 key) { for(HS_KeyNode *n = key_slot->first; n != 0; n = n->next) { - if(u128_match(n->key, key) && n->hash_history_gen > 0) + if(u128_match(n->key, key) && n->hash_history_gen > 0 && n->hash_history_gen-1 >= rewind_count) { - result = n->hash_history[(n->hash_history_gen-1)%ArrayCount(n->hash_history)]; + result = n->hash_history[(n->hash_history_gen-1-rewind_count)%ArrayCount(n->hash_history)]; break; } } diff --git a/src/hash_store/hash_store.h b/src/hash_store/hash_store.h index bec35029..d2eae943 100644 --- a/src/hash_store/hash_store.h +++ b/src/hash_store/hash_store.h @@ -139,7 +139,7 @@ internal void hs_scope_touch_node__stripe_r_guarded(HS_Scope *scope, HS_Node *no //////////////////////////////// //~ rjf: Cache Lookups -internal U128 hs_hash_from_key(U128 key); +internal U128 hs_hash_from_key(U128 key, U64 rewind_count); internal String8 hs_data_from_hash(HS_Scope *scope, U128 hash); ////////////////////////////////