diff --git a/src/dasm_cache/dasm_cache.c b/src/dasm_cache/dasm_cache.c index 38759fc4..5ed5ef15 100644 --- a/src/dasm_cache/dasm_cache.c +++ b/src/dasm_cache/dasm_cache.c @@ -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); diff --git a/src/file_stream/file_stream.c b/src/file_stream/file_stream.c index 087c05ec..acb7c129 100644 --- a/src/file_stream/file_stream.c +++ b/src/file_stream/file_stream.c @@ -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); diff --git a/src/geo_cache/geo_cache.c b/src/geo_cache/geo_cache.c index 99534036..502b5b98 100644 --- a/src/geo_cache/geo_cache.c +++ b/src/geo_cache/geo_cache.c @@ -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); diff --git a/src/hash_store/hash_store.h b/src/hash_store/hash_store.h index 4caa1e24..ff886e79 100644 --- a/src/hash_store/hash_store.h +++ b/src/hash_store/hash_store.h @@ -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; }; diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 9ba0cdb9..2bc32d62 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -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); diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index da3add01..e52621c3 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -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; diff --git a/src/text_cache/text_cache.c b/src/text_cache/text_cache.c index 342cbd75..cecd5c38 100644 --- a/src/text_cache/text_cache.c +++ b/src/text_cache/text_cache.c @@ -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); diff --git a/src/texture_cache/texture_cache.c b/src/texture_cache/texture_cache.c index 0f2484df..e9025c51 100644 --- a/src/texture_cache/texture_cache.c +++ b/src/texture_cache/texture_cache.c @@ -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);