strip out ctrl process memory cache fresh flags & hash history, since both will be replaced by hash store layer's capabilities

This commit is contained in:
Ryan Fleury
2024-01-25 09:09:36 -08:00
parent d0c3d9dc21
commit b14b9f0344
4 changed files with 4 additions and 17 deletions
-11
View File
@@ -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
-2
View File
@@ -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;
+3 -3
View File
@@ -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;
}
}
+1 -1
View File
@@ -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);
////////////////////////////////