mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-08 14:58:08 +00:00
add extra node to the symbol ref for better insertion per
This commit is contained in:
committed by
Ryan Fleury
parent
871f94a202
commit
9616307503
+5
-4
@@ -1783,8 +1783,8 @@ lnk_link_inputs(TP_Context *tp,
|
|||||||
local_persist LNK_Symbol *null_symbol = 0;
|
local_persist LNK_Symbol *null_symbol = 0;
|
||||||
if (null_symbol == 0) {
|
if (null_symbol == 0) {
|
||||||
null_symbol = push_array(inputer->arena, LNK_Symbol, 1);
|
null_symbol = push_array(inputer->arena, LNK_Symbol, 1);
|
||||||
null_symbol->refs = push_array(inputer->arena, LNK_ObjSymbolRefNode, 1);
|
null_symbol->first_ref = push_array(inputer->arena, LNK_ObjSymbolRefNode, 1);
|
||||||
null_symbol->refs->v.obj = &link->objs.first->data;
|
null_symbol->first_ref->v.obj = &link->objs.first->data;
|
||||||
}
|
}
|
||||||
LNK_LibMemberRef *member_refs = push_array(scratch.arena, LNK_LibMemberRef, lib->member_count);
|
LNK_LibMemberRef *member_refs = push_array(scratch.arena, LNK_LibMemberRef, lib->member_count);
|
||||||
for EachIndex(member_idx, lib->member_count) {
|
for EachIndex(member_idx, lib->member_count) {
|
||||||
@@ -1876,10 +1876,11 @@ lnk_link_inputs(TP_Context *tp,
|
|||||||
LNK_Symbol *import_stub = lnk_symbol_table_search(symtab, str8_lit(LNK_IMPORT_STUB));
|
LNK_Symbol *import_stub = lnk_symbol_table_search(symtab, str8_lit(LNK_IMPORT_STUB));
|
||||||
|
|
||||||
// same import symbol must never be queued more than once, if it is, there is a bug in the link set logic
|
// same import symbol must never be queued more than once, if it is, there is a bug in the link set logic
|
||||||
AssertAlways(member_ref->link_symbol->refs != import_stub->refs);
|
AssertAlways(member_ref->link_symbol->first_ref != import_stub->first_ref);
|
||||||
|
|
||||||
// replace the import symbol with a stub, which is later replaced with the real import symbol once import obj is ready.
|
// replace the import symbol with a stub, which is later replaced with the real import symbol once import obj is ready.
|
||||||
member_ref->link_symbol->refs = import_stub->refs;
|
member_ref->link_symbol->first_ref = import_stub->first_ref;
|
||||||
|
member_ref->link_symbol->last_ref = import_stub->last_ref;
|
||||||
|
|
||||||
// push import member for import obj generation
|
// push import member for import obj generation
|
||||||
lnk_lib_member_ref_list_push_node(&link->imports, member_ref);
|
lnk_lib_member_ref_list_push_node(&link->imports, member_ref);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ lnk_make_symbol(Arena *arena, String8 name, LNK_Obj *obj, U32 symbol_idx)
|
|||||||
|
|
||||||
LNK_Symbol *symbol = push_array(arena, LNK_Symbol, 1);
|
LNK_Symbol *symbol = push_array(arena, LNK_Symbol, 1);
|
||||||
symbol->name = name;
|
symbol->name = name;
|
||||||
symbol->refs = ref;
|
SLLQueuePush(symbol->first_ref, symbol->last_ref, ref);
|
||||||
|
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
@@ -351,9 +351,8 @@ lnk_on_symbol_replace(LNK_Symbol *dst, LNK_Symbol *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// merge symbol refs
|
// merge symbol refs
|
||||||
LNK_ObjSymbolRefNode *src_last_ref;
|
src->last_ref->next = dst->first_ref;
|
||||||
for (src_last_ref = src->refs; src_last_ref->next != 0; src_last_ref = src_last_ref->next);
|
src->last_ref = dst->last_ref;
|
||||||
src_last_ref->next = dst->refs;
|
|
||||||
|
|
||||||
// assert leader section is live
|
// assert leader section is live
|
||||||
#if BUILD_DEBUG
|
#if BUILD_DEBUG
|
||||||
@@ -494,14 +493,14 @@ lnk_array_from_symbol_hash_trie_chunk_list(Arena *arena, LNK_SymbolHashTrieChunk
|
|||||||
internal LNK_ObjSymbolRef
|
internal LNK_ObjSymbolRef
|
||||||
lnk_ref_from_symbol(LNK_Symbol *symbol)
|
lnk_ref_from_symbol(LNK_Symbol *symbol)
|
||||||
{
|
{
|
||||||
return symbol->refs->v;
|
return symbol->first_ref->v;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal U64
|
internal U64
|
||||||
lnk_ref_count_from_symbol(LNK_Symbol *symbol)
|
lnk_ref_count_from_symbol(LNK_Symbol *symbol)
|
||||||
{
|
{
|
||||||
U64 count = 0;
|
U64 count = 0;
|
||||||
for (LNK_ObjSymbolRefNode *node = symbol->refs; node != 0; node = node->next, count += 1);
|
for (LNK_ObjSymbolRefNode *node = symbol->first_ref; node != 0; node = node->next, count += 1);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +511,7 @@ lnk_ref_from_symbol_many(Arena *arena, LNK_Symbol *symbol, U64 *count_out)
|
|||||||
U64 refs_count = lnk_ref_count_from_symbol(symbol);
|
U64 refs_count = lnk_ref_count_from_symbol(symbol);
|
||||||
LNK_ObjSymbolRef **refs = push_array(arena, LNK_ObjSymbolRef *, refs_count);
|
LNK_ObjSymbolRef **refs = push_array(arena, LNK_ObjSymbolRef *, refs_count);
|
||||||
U64 i = 0;
|
U64 i = 0;
|
||||||
for (LNK_ObjSymbolRefNode *node = symbol->refs; node != 0; node = node->next, i += 1) {
|
for (LNK_ObjSymbolRefNode *node = symbol->first_ref; node != 0; node = node->next, i += 1) {
|
||||||
refs[i] = &node->v;
|
refs[i] = &node->v;
|
||||||
}
|
}
|
||||||
radsort(refs, refs_count, lnk_obj_symbol_ref_ptr_is_before);
|
radsort(refs, refs_count, lnk_obj_symbol_ref_ptr_is_before);
|
||||||
@@ -785,7 +784,7 @@ THREAD_POOL_TASK_FUNC(lnk_replace_weak_with_default_symbol_task)
|
|||||||
symbol16->storage_class = COFF_SymStorageClass_External;
|
symbol16->storage_class = COFF_SymStorageClass_External;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
symbol->refs->v = resolve;
|
symbol->first_ref->v = resolve;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ typedef struct LNK_ObjSymbolRefNode
|
|||||||
typedef struct LNK_Symbol
|
typedef struct LNK_Symbol
|
||||||
{
|
{
|
||||||
String8 name;
|
String8 name;
|
||||||
LNK_ObjSymbolRefNode *refs;
|
LNK_ObjSymbolRefNode *first_ref;
|
||||||
|
LNK_ObjSymbolRefNode *last_ref;
|
||||||
} LNK_Symbol;
|
} LNK_Symbol;
|
||||||
|
|
||||||
// --- Symbol Containers -------------------------------------------------------
|
// --- Symbol Containers -------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user