mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 14:28:40 +00:00
only push unique hashes to key history in content layer; fix staleness detection in search
This commit is contained in:
@@ -275,6 +275,13 @@ c_submit_data(C_Key key, Arena **data_arena, String8 data)
|
|||||||
|
|
||||||
// rjf: push hash into key's history
|
// rjf: push hash into key's history
|
||||||
if(key_node)
|
if(key_node)
|
||||||
|
{
|
||||||
|
U128 last_hash = {0};
|
||||||
|
if(key_node->hash_history_gen >= 1)
|
||||||
|
{
|
||||||
|
last_hash = key_node->hash_history[(key_node->hash_history_gen-1)%ArrayCount(key_node->hash_history)];
|
||||||
|
}
|
||||||
|
if(!u128_match(last_hash, hash))
|
||||||
{
|
{
|
||||||
if(key_node->hash_history_gen >= C_KEY_HASH_HISTORY_STRONG_REF_COUNT)
|
if(key_node->hash_history_gen >= C_KEY_HASH_HISTORY_STRONG_REF_COUNT)
|
||||||
{
|
{
|
||||||
@@ -283,6 +290,7 @@ c_submit_data(C_Key key, Arena **data_arena, String8 data)
|
|||||||
key_node->hash_history[key_node->hash_history_gen%ArrayCount(key_node->hash_history)] = hash;
|
key_node->hash_history[key_node->hash_history_gen%ArrayCount(key_node->hash_history)] = hash;
|
||||||
key_node->hash_history_gen += 1;
|
key_node->hash_history_gen += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: key is new -> add this key to the associated root
|
// rjf: key is new -> add this key to the associated root
|
||||||
if(key_is_new)
|
if(key_is_new)
|
||||||
|
|||||||
@@ -1352,7 +1352,7 @@ di_search_artifact_destroy(AC_Artifact artifact)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DI_SearchItemArray
|
internal DI_SearchItemArray
|
||||||
di_search_item_array_from_target_query(Access *access, RDI_SectionKind target, String8 query, U64 endt_us)
|
di_search_item_array_from_target_query(Access *access, RDI_SectionKind target, String8 query, U64 endt_us, B32 *stale_out)
|
||||||
{
|
{
|
||||||
DI_SearchItemArray result = {0};
|
DI_SearchItemArray result = {0};
|
||||||
{
|
{
|
||||||
@@ -1366,7 +1366,7 @@ di_search_item_array_from_target_query(Access *access, RDI_SectionKind target, S
|
|||||||
String8 key = str8_list_join(scratch.arena, &key_parts, 0);
|
String8 key = str8_list_join(scratch.arena, &key_parts, 0);
|
||||||
|
|
||||||
// rjf: get artifact
|
// rjf: get artifact
|
||||||
AC_Artifact artifact = ac_artifact_from_key(access, key, di_search_artifact_create, di_search_artifact_destroy, endt_us, .gen = di_load_gen(), .flags = AC_Flag_Wide);
|
AC_Artifact artifact = ac_artifact_from_key(access, key, di_search_artifact_create, di_search_artifact_destroy, endt_us, .gen = di_load_gen(), .flags = AC_Flag_Wide, .stale_out = stale_out);
|
||||||
|
|
||||||
// rjf: unpack artifact
|
// rjf: unpack artifact
|
||||||
result.v = (DI_SearchItem *)artifact.u64[1];
|
result.v = (DI_SearchItem *)artifact.u64[1];
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ internal void di_conversion_completion_signal_receiver_thread_entry_point(void *
|
|||||||
|
|
||||||
internal AC_Artifact di_search_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out);
|
internal AC_Artifact di_search_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out);
|
||||||
internal void di_search_artifact_destroy(AC_Artifact artifact);
|
internal void di_search_artifact_destroy(AC_Artifact artifact);
|
||||||
internal DI_SearchItemArray di_search_item_array_from_target_query(Access *access, RDI_SectionKind target, String8 query, U64 endt_us);
|
internal DI_SearchItemArray di_search_item_array_from_target_query(Access *access, RDI_SectionKind target, String8 query, U64 endt_us, B32 *stale_out);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Match Artifact Cache Hooks / Lookups
|
//~ rjf: Match Artifact Cache Hooks / Lookups
|
||||||
|
|||||||
@@ -1661,13 +1661,14 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table)
|
|||||||
{
|
{
|
||||||
U64 endt_us = rd_state->frame_eval_memread_endt_us;
|
U64 endt_us = rd_state->frame_eval_memread_endt_us;
|
||||||
U128 fuzzy_search_key = {d_hash_from_string(str8_struct(&rd_regs()->view)), (U64)section};
|
U128 fuzzy_search_key = {d_hash_from_string(str8_struct(&rd_regs()->view)), (U64)section};
|
||||||
|
B32 stale = 0;
|
||||||
accel->section = section;
|
accel->section = section;
|
||||||
accel->items = di_search_item_array_from_target_query(rd_state->frame_access, section, filter, endt_us);
|
accel->items = di_search_item_array_from_target_query(rd_state->frame_access, section, filter, endt_us, &stale);
|
||||||
RD_ViewState *vs = rd_view_state_from_cfg(rd_cfg_from_id(rd_regs()->view));
|
RD_ViewState *vs = rd_view_state_from_cfg(rd_cfg_from_id(rd_regs()->view));
|
||||||
if(accel->items.count == 0)
|
if(stale)
|
||||||
{
|
{
|
||||||
String8 last_query = str8(vs->last_successful_query_buffer, vs->last_successful_query_string_size);
|
String8 last_query = str8(vs->last_successful_query_buffer, vs->last_successful_query_string_size);
|
||||||
accel->items = di_search_item_array_from_target_query(rd_state->frame_access, section, last_query, endt_us);
|
accel->items = di_search_item_array_from_target_query(rd_state->frame_access, section, last_query, endt_us, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user