increase hash store history limit; fix incorrectly skipping important go-to-code-location commands

This commit is contained in:
Ryan Fleury
2024-10-08 17:02:49 -07:00
parent aea1999af0
commit 05045c8db0
8 changed files with 13 additions and 20 deletions
+1 -1
View File
@@ -432,7 +432,7 @@ internal DASM_Info
dasm_info_from_key_params(DASM_Scope *scope, U128 key, DASM_Params *params, U128 *hash_out)
{
DASM_Info result = {0};
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
for(U64 rewind_idx = 0; rewind_idx < HS_KEY_HASH_HISTORY_COUNT; rewind_idx += 1)
{
U128 hash = hs_hash_from_key(key, rewind_idx);
result = dasm_info_from_hash_params(scope, hash, params);
+1 -1
View File
@@ -85,7 +85,7 @@ fs_hash_from_path_range(String8 path, Rng1U64 range, U64 endt_us)
//- rjf: loop through key -> hash history; obtain most recent hash for this key
U128 result = {0};
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
for(U64 rewind_idx = 0; rewind_idx < HS_KEY_HASH_HISTORY_COUNT; rewind_idx += 1)
{
result = hs_hash_from_key(key, rewind_idx);
+1 -1
View File
@@ -201,7 +201,7 @@ internal R_Handle
geo_buffer_from_key(GEO_Scope *scope, U128 key)
{
R_Handle handle = {0};
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
for(U64 rewind_idx = 0; rewind_idx < HS_KEY_HASH_HISTORY_COUNT; rewind_idx += 1)
{
U128 hash = hs_hash_from_key(key, rewind_idx);
handle = geo_buffer_from_hash(scope, hash);
+3 -1
View File
@@ -7,12 +7,14 @@
////////////////////////////////
//~ rjf: Cache Types
#define HS_KEY_HASH_HISTORY_COUNT 64
typedef struct HS_KeyNode HS_KeyNode;
struct HS_KeyNode
{
HS_KeyNode *next;
U128 key;
U128 hash_history[2];
U128 hash_history[HS_KEY_HASH_HISTORY_COUNT];
U64 hash_history_gen;
};
+2 -1
View File
@@ -11109,6 +11109,7 @@ rd_frame(void)
//- rjf: loop - consume events in core, tick engine, and repeat
//
CTRL_Handle find_thread_retry = {0};
RD_Cmd *cmd = 0;
for(U64 cmd_process_loop_idx = 0; cmd_process_loop_idx < 3; cmd_process_loop_idx += 1)
{
////////////////////////////
@@ -11422,7 +11423,7 @@ rd_frame(void)
B32 panel_reset_done = 0;
if(depth == 0)
{
for(RD_Cmd *cmd = 0; rd_next_cmd(&cmd);) RD_RegsScope()
for(;rd_next_cmd(&cmd);) RD_RegsScope()
{
// rjf: unpack command
RD_CmdKind kind = rd_cmd_kind_from_string(cmd->name);
+3 -13
View File
@@ -395,16 +395,12 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
//- rjf: find text (forward)
if(cv->find_text_fwd.size != 0)
{
Temp scratch = scratch_begin(0, 0);
B32 found = 0;
B32 first = 1;
S64 line_num_start = rd_regs()->cursor.line;
S64 line_num_last = (S64)text_info->lines_count;
for(S64 line_num = line_num_start;; first = 0)
for(S64 line_num = line_num_start; 1 <= line_num && line_num <= line_num_last; first = 0)
{
// rjf: pop scratch
temp_end(scratch);
// rjf: gather line info
String8 line_string = str8_substr(text_data, text_info->lines_ranges[line_num-1]);
U64 search_start = 0;
@@ -442,22 +438,17 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
{
log_user_errorf("Could not find \"%S\"", cv->find_text_fwd);
}
scratch_end(scratch);
}
//- rjf: find text (backward)
if(cv->find_text_bwd.size != 0)
{
Temp scratch = scratch_begin(0, 0);
B32 found = 0;
B32 first = 1;
S64 line_num_start = rd_regs()->cursor.line;
S64 line_num_last = (S64)text_info->lines_count;
for(S64 line_num = line_num_start;; first = 0)
for(S64 line_num = line_num_start; 1 <= line_num && line_num <= line_num_last; first = 0)
{
// rjf: pop scratch
temp_end(scratch);
// rjf: gather line info
String8 line_string = str8_substr(text_data, text_info->lines_ranges[line_num-1]);
if(rd_regs()->cursor.line == line_num && first)
@@ -503,7 +494,6 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
{
log_user_errorf("Could not find \"%S\"", cv->find_text_bwd);
}
scratch_end(scratch);
}
MemoryZeroStruct(&cv->find_text_fwd);
@@ -6062,7 +6052,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(text)
//- rjf: build code contents
//
DI_KeyList dbgi_keys = {0};
if(!file_is_missing && info.lines_count != 0)
if(!file_is_missing)
{
RD_CodeViewBuildResult result = rd_code_view_build(scratch.arena, cv, RD_CodeViewBuildFlag_All, code_area_rect, data, &info, 0, r1u64(0, 0), di_key_zero());
dbgi_keys = result.dbgi_keys;
+1 -1
View File
@@ -1767,7 +1767,7 @@ internal TXT_TextInfo
txt_text_info_from_key_lang(TXT_Scope *scope, U128 key, TXT_LangKind lang, U128 *hash_out)
{
TXT_TextInfo result = {0};
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
for(U64 rewind_idx = 0; rewind_idx < HS_KEY_HASH_HISTORY_COUNT; rewind_idx += 1)
{
U128 hash = hs_hash_from_key(key, rewind_idx);
result = txt_text_info_from_hash_lang(scope, hash, lang);
+1 -1
View File
@@ -216,7 +216,7 @@ internal R_Handle
tex_texture_from_key_topology(TEX_Scope *scope, U128 key, TEX_Topology topology, U128 *hash_out)
{
R_Handle handle = {0};
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
for(U64 rewind_idx = 0; rewind_idx < HS_KEY_HASH_HISTORY_COUNT; rewind_idx += 1)
{
U128 hash = hs_hash_from_key(key, rewind_idx);
handle = tex_texture_from_hash_topology(scope, hash, topology);