first pass at new hash-store-based disassembly cache layer; can serve as a general-purpose asynchronous disassembly visualization cache layer, regardless of where that data ultimately comes from - can click into a file, process memory cache, etc.

This commit is contained in:
Ryan Fleury
2024-03-28 10:57:34 -07:00
parent f46691d79a
commit c91cd69536
8 changed files with 756 additions and 5 deletions
+3 -3
View File
@@ -721,7 +721,7 @@ txt_scope_close(TXT_Scope *scope)
{
for(TXT_Node *n = slot->first; n != 0; n = n->next)
{
if(u128_match(hash, n->hash))
if(u128_match(hash, n->hash) && touch->lang == n->lang)
{
ins_atomic_u64_dec_eval(&n->scope_ref_count);
break;
@@ -750,6 +750,7 @@ txt_scope_touch_node__stripe_r_guarded(TXT_Scope *scope, TXT_Node *node)
}
MemoryZeroStruct(touch);
touch->hash = node->hash;
touch->lang = node->lang;
SLLStackPush(scope->top_touch, touch);
}
@@ -1193,12 +1194,11 @@ txt_parse_thread__entry_point(void *p)
{
for(;;)
{
HS_Scope *scope = hs_scope_open();
//- rjf: get next key
U128 hash = {0};
TXT_LangKind lang = TXT_LangKind_Null;
txt_u2p_dequeue_req(&hash, &lang);
HS_Scope *scope = hs_scope_open();
//- rjf: unpack hash
U64 slot_idx = hash.u64[1]%txt_shared->slots_count;
+9 -1
View File
@@ -125,12 +125,19 @@ typedef TXT_TokenArray TXT_LangLexFunctionType(Arena *arena, U64 *bytes_processe
typedef struct TXT_Node TXT_Node;
struct TXT_Node
{
// rjf: links
TXT_Node *next;
TXT_Node *prev;
// rjf: key
U128 hash;
TXT_LangKind lang;
// rjf: artifacts
Arena *arena;
TXT_TextInfo info;
// rjf: metadata
B32 is_working;
U64 scope_ref_count;
U64 last_time_touched_us;
@@ -161,6 +168,7 @@ struct TXT_Touch
{
TXT_Touch *next;
U128 hash;
TXT_LangKind lang;
};
typedef struct TXT_Scope TXT_Scope;
@@ -283,7 +291,7 @@ internal String8 txt_string_from_info_data_line_num(TXT_TextInfo *info, String8
internal TXT_LineTokensSlice txt_line_tokens_slice_from_info_data_line_range(Arena *arena, TXT_TextInfo *info, String8 data, Rng1S64 line_range);
////////////////////////////////
//~ rjf: Transfer Threads
//~ rjf: Parse Threads
internal B32 txt_u2p_enqueue_req(U128 hash, TXT_LangKind lang, U64 endt_us);
internal void txt_u2p_dequeue_req(U128 *hash_out, TXT_LangKind *lang_out);