From 5c33c410d34364b042320878fba2ef61ddc9dc9c Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 12 Feb 2024 15:11:20 -0800 Subject: [PATCH] flatten cons api; eliminate private/public distinction --- src/raddbgi_cons/raddbgi_cons.c | 746 ++++++++++++++++---------------- src/raddbgi_cons/raddbgi_cons.h | 360 +++++++-------- 2 files changed, 553 insertions(+), 553 deletions(-) diff --git a/src/raddbgi_cons/raddbgi_cons.c b/src/raddbgi_cons/raddbgi_cons.c index a6fa9e37..17612767 100644 --- a/src/raddbgi_cons/raddbgi_cons.c +++ b/src/raddbgi_cons/raddbgi_cons.c @@ -105,8 +105,8 @@ cons_bytecode_concat_in_place(CONS_EvalBytecode *left_dst, CONS_EvalBytecode *ri //- rjf: sortable range sorting -static CONS__SortKey* -cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) +static CONS_SortKey* +cons_sort_key_array(Arena *arena, CONS_SortKey *keys, U64 count) { // This sort is designed to take advantage of lots of pre-existing sorted ranges. // Most line info is already sorted or close to already sorted. @@ -114,9 +114,9 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) // Also - this sort should be a "stable" sort. In the use case of sorting vmap // ranges, we want to be able to rely on order, so it needs to be preserved here. - ProfBegin("cons__sort_key_array"); + ProfBegin("cons_sort_key_array"); Temp scratch = scratch_begin(&arena, 1); - CONS__SortKey *result = 0; + CONS_SortKey *result = 0; if(count <= 1) { @@ -124,8 +124,8 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) } else { - CONS__OrderedRange *ranges_first = 0; - CONS__OrderedRange *ranges_last = 0; + CONS_OrderedRange *ranges_first = 0; + CONS_OrderedRange *ranges_last = 0; U64 range_count = 0; { U64 pos = 0; @@ -137,7 +137,7 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) for(; opl < count && keys[opl - 1].key <= keys[opl].key; opl += 1); // generate an ordered range node - CONS__OrderedRange *new_range = push_array(scratch.arena, CONS__OrderedRange, 1); + CONS_OrderedRange *new_range = push_array(scratch.arena, CONS_OrderedRange, 1); SLLQueuePush(ranges_first, ranges_last, new_range); range_count += 1; new_range->first = first; @@ -154,12 +154,12 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) } else { - CONS__SortKey *keys_swap = push_array_no_zero(arena, CONS__SortKey, count); - CONS__SortKey *src = keys; - CONS__SortKey *dst = keys_swap; - CONS__OrderedRange *src_ranges = ranges_first; - CONS__OrderedRange *dst_ranges = 0; - CONS__OrderedRange *dst_ranges_last = 0; + CONS_SortKey *keys_swap = push_array_no_zero(arena, CONS_SortKey, count); + CONS_SortKey *src = keys; + CONS_SortKey *dst = keys_swap; + CONS_OrderedRange *src_ranges = ranges_first; + CONS_OrderedRange *dst_ranges = 0; + CONS_OrderedRange *dst_ranges_last = 0; for(;;) { @@ -173,7 +173,7 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) } // get first range - CONS__OrderedRange *range1 = src_ranges; + CONS_OrderedRange *range1 = src_ranges; SLLStackPop(src_ranges); // if this range is the whole array, we are done @@ -193,7 +193,7 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) } // get second range - CONS__OrderedRange *range2 = src_ranges; + CONS_OrderedRange *range2 = src_ranges; SLLStackPop(src_ranges); Assert(range1->opl == range2->first); @@ -242,7 +242,7 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) } // end pass by swapping buffers and range nodes - Swap(CONS__SortKey*, src, dst); + Swap(CONS_SortKey*, src, dst); src_ranges = dst_ranges; dst_ranges = 0; dst_ranges_last = 0; @@ -270,18 +270,18 @@ cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count) //- rjf: u64 -> ptr map static void -cons__u64toptr_init(Arena *arena, CONS__U64ToPtrMap *map, U64 bucket_count) +cons_u64toptr_init(Arena *arena, CONS_U64ToPtrMap *map, U64 bucket_count) { Assert(IsPow2OrZero(bucket_count) && bucket_count > 0); - map->buckets = push_array(arena, CONS__U64ToPtrNode*, bucket_count); + map->buckets = push_array(arena, CONS_U64ToPtrNode*, bucket_count); map->buckets_count = bucket_count; } static void -cons__u64toptr_lookup(CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrLookup *lookup_out) +cons_u64toptr_lookup(CONS_U64ToPtrMap *map, U64 key, U64 hash, CONS_U64ToPtrLookup *lookup_out) { U64 bucket_idx = hash&(map->buckets_count - 1); - CONS__U64ToPtrNode *check_node = map->buckets[bucket_idx]; + CONS_U64ToPtrNode *check_node = map->buckets[bucket_idx]; for(;check_node != 0; check_node = check_node->next){ for(U32 k = 0; k < ArrayCount(check_node->key); k += 1){ if(check_node->ptr[k] == 0){ @@ -298,11 +298,11 @@ cons__u64toptr_lookup(CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrL } static void -cons__u64toptr_insert(Arena *arena, CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrLookup *lookup, void *ptr) +cons_u64toptr_insert(Arena *arena, CONS_U64ToPtrMap *map, U64 key, U64 hash, CONS_U64ToPtrLookup *lookup, void *ptr) { if(lookup->fill_node != 0) { - CONS__U64ToPtrNode *node = lookup->fill_node; + CONS_U64ToPtrNode *node = lookup->fill_node; U32 k = lookup->fill_k; node->key[k] = key; node->ptr[k] = ptr; @@ -311,7 +311,7 @@ cons__u64toptr_insert(Arena *arena, CONS__U64ToPtrMap *map, U64 key, U64 hash, C { U64 bucket_idx = hash&(map->buckets_count - 1); - CONS__U64ToPtrNode *node = push_array(arena, CONS__U64ToPtrNode, 1); + CONS_U64ToPtrNode *node = push_array(arena, CONS_U64ToPtrNode, 1); SLLStackPush(map->buckets[bucket_idx], node); node->key[0] = key; node->ptr[0] = ptr; @@ -327,18 +327,18 @@ cons__u64toptr_insert(Arena *arena, CONS__U64ToPtrMap *map, U64 key, U64 hash, C //- rjf: string8 -> ptr map static void -cons__str8toptr_init(Arena *arena, CONS__Str8ToPtrMap *map, U64 bucket_count) +cons_str8toptr_init(Arena *arena, CONS_Str8ToPtrMap *map, U64 bucket_count) { map->buckets_count = bucket_count; - map->buckets = push_array(arena, CONS__Str8ToPtrNode*, map->buckets_count); + map->buckets = push_array(arena, CONS_Str8ToPtrNode*, map->buckets_count); } static void* -cons__str8toptr_lookup(CONS__Str8ToPtrMap *map, String8 key, U64 hash) +cons_str8toptr_lookup(CONS_Str8ToPtrMap *map, String8 key, U64 hash) { void *result = 0; U64 bucket_idx = hash%map->buckets_count; - for(CONS__Str8ToPtrNode *node = map->buckets[bucket_idx]; + for(CONS_Str8ToPtrNode *node = map->buckets[bucket_idx]; node != 0; node = node->next) { @@ -352,11 +352,11 @@ cons__str8toptr_lookup(CONS__Str8ToPtrMap *map, String8 key, U64 hash) } static void -cons__str8toptr_insert(Arena *arena, CONS__Str8ToPtrMap *map, String8 key, U64 hash, void *ptr) +cons_str8toptr_insert(Arena *arena, CONS_Str8ToPtrMap *map, String8 key, U64 hash, void *ptr) { U64 bucket_idx = hash%map->buckets_count; - CONS__Str8ToPtrNode *node = push_array(arena, CONS__Str8ToPtrNode, 1); + CONS_Str8ToPtrNode *node = push_array(arena, CONS_Str8ToPtrNode, 1); SLLStackPush(map->buckets[bucket_idx], node); node->key = push_str8_copy(arena, key); @@ -385,8 +385,8 @@ cons_root_new(CONS_RootParams *params) // setup singular types { - result->nil_type = cons__type_new(result); - result->variadic_type = cons__type_new(result); + result->nil_type = cons_type_new(result); + result->variadic_type = cons_type_new(result); result->variadic_type->kind = RADDBGI_TypeKind_Variadic; // references to "handled nil type" should be emitted as @@ -404,19 +404,19 @@ cons_root_new(CONS_RootParams *params) // rjf: setup null UDT { - cons__type_udt_from_any_type(result, result->nil_type); + cons_type_udt_from_any_type(result, result->nil_type); } // initialize maps { #define BKTCOUNT(x) ((x)?(u64_up_to_pow2(x)):(128)) - cons__u64toptr_init(arena, &result->unit_map, BKTCOUNT(params->bucket_count_units)); - cons__u64toptr_init(arena, &result->symbol_map, BKTCOUNT(params->bucket_count_symbols)); - cons__u64toptr_init(arena, &result->scope_map, BKTCOUNT(params->bucket_count_scopes)); - cons__u64toptr_init(arena, &result->local_map, BKTCOUNT(params->bucket_count_locals)); - cons__u64toptr_init(arena, &result->type_from_id_map, BKTCOUNT(params->bucket_count_types)); - cons__str8toptr_init(arena, &result->construct_map, BKTCOUNT(params->bucket_count_type_constructs)); + cons_u64toptr_init(arena, &result->unit_map, BKTCOUNT(params->bucket_count_units)); + cons_u64toptr_init(arena, &result->symbol_map, BKTCOUNT(params->bucket_count_symbols)); + cons_u64toptr_init(arena, &result->scope_map, BKTCOUNT(params->bucket_count_scopes)); + cons_u64toptr_init(arena, &result->local_map, BKTCOUNT(params->bucket_count_locals)); + cons_u64toptr_init(arena, &result->type_from_id_map, BKTCOUNT(params->bucket_count_types)); + cons_str8toptr_init(arena, &result->construct_map, BKTCOUNT(params->bucket_count_type_constructs)); #undef BKTCOUNT } @@ -488,8 +488,8 @@ cons_add_binary_section(CONS_Root *root, String8 name, RADDBGI_BinarySectionFlag static CONS_Unit* cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id, U64 unit_user_id_hash) { - CONS__U64ToPtrLookup lookup = {0}; - cons__u64toptr_lookup(&root->unit_map, unit_user_id, unit_user_id_hash, &lookup); + CONS_U64ToPtrLookup lookup = {0}; + cons_u64toptr_lookup(&root->unit_map, unit_user_id, unit_user_id_hash, &lookup); CONS_Unit *result = 0; if(lookup.match != 0) { @@ -501,7 +501,7 @@ cons_unit_handle_from_user_id(CONS_Root *root, U64 unit_user_id, U64 unit_user_i result->idx = root->unit_count; SLLQueuePush_N(root->unit_first, root->unit_last, result, next_order); root->unit_count += 1; - cons__u64toptr_insert(root->arena, &root->unit_map, unit_user_id, unit_user_id, &lookup, result); + cons_u64toptr_insert(root->arena, &root->unit_map, unit_user_id, unit_user_id, &lookup, result); } return result; } @@ -560,8 +560,8 @@ cons_unit_vmap_add_range(CONS_Root *root, CONS_Unit *unit, U64 first, U64 opl) static CONS_Type* cons_type_from_id(CONS_Root *root, U64 type_user_id, U64 type_user_id_hash) { - CONS__U64ToPtrLookup lookup = {0}; - cons__u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id_hash, &lookup); + CONS_U64ToPtrLookup lookup = {0}; + cons_u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id_hash, &lookup); CONS_Type *result = (CONS_Type*)lookup.match; return result; } @@ -570,11 +570,11 @@ static CONS_Reservation* cons_type_reserve_id(CONS_Root *root, U64 type_user_id, U64 type_user_id_hash) { CONS_Reservation *result = 0; - CONS__U64ToPtrLookup lookup = {0}; - cons__u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id_hash, &lookup); + CONS_U64ToPtrLookup lookup = {0}; + cons_u64toptr_lookup(&root->type_from_id_map, type_user_id, type_user_id_hash, &lookup); if(lookup.match == 0) { - cons__u64toptr_insert(root->arena, &root->type_from_id_map, type_user_id, type_user_id_hash, &lookup, root->nil_type); + cons_u64toptr_insert(root->arena, &root->type_from_id_map, type_user_id, type_user_id_hash, &lookup, root->nil_type); void **slot = &lookup.fill_node->ptr[lookup.fill_k]; result = (CONS_Reservation*)slot; } @@ -620,7 +620,7 @@ cons_type_variadic(CONS_Root *root) //- rjf: base type info constructors static CONS_Type* -cons__type_new(CONS_Root *root) +cons_type_new(CONS_Root *root) { CONS_Type *result = push_array(root->arena, CONS_Type, 1); result->idx = root->type_count; @@ -630,7 +630,7 @@ cons__type_new(CONS_Root *root) } static CONS_TypeUDT* -cons__type_udt_from_any_type(CONS_Root *root, CONS_Type *type) +cons_type_udt_from_any_type(CONS_Root *root, CONS_Type *type) { if(type->udt == 0) { @@ -646,7 +646,7 @@ cons__type_udt_from_any_type(CONS_Root *root, CONS_Type *type) } static CONS_TypeUDT* -cons__type_udt_from_record_type(CONS_Root *root, CONS_Type *type) +cons_type_udt_from_record_type(CONS_Root *root, CONS_Type *type) { cons_requiref(root, (type->kind == RADDBGI_TypeKind_Struct || type->kind == RADDBGI_TypeKind_Class || @@ -654,7 +654,7 @@ cons__type_udt_from_record_type(CONS_Root *root, CONS_Type *type) return 0, "Tried to use non-user-defined-type-kind to create user-defined-type."); CONS_TypeUDT *result = 0; - result = cons__type_udt_from_any_type(root, type); + result = cons_type_udt_from_any_type(root, type); return result; } @@ -686,7 +686,7 @@ cons_type_basic(CONS_Root *root, RADDBGI_TypeKind type_kind, String8 name) // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0) { @@ -698,18 +698,18 @@ cons_type_basic(CONS_Root *root, RADDBGI_TypeKind type_kind, String8 name) } // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = type_kind; result->name = push_str8_copy(root->arena, name); result->byte_size = byte_size; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); // save in name map { - CONS__NameMap *map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_Types); - cons__name_map_add_pair(root, map, result->name, result->idx); + CONS_NameMap *map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_Types); + cons_name_map_add_pair(root, map, result->name, result->idx); } } @@ -743,19 +743,19 @@ cons_type_modifier(CONS_Root *root, CONS_Type *direct_type, RADDBGI_TypeModifier // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0){ // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Modifier; result->flags = flags; result->byte_size = direct_type->byte_size; result->direct_type = direct_type; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); } scratch_end(scratch); @@ -791,12 +791,12 @@ cons_type_bitfield(CONS_Root *root, CONS_Type *direct_type, U32 bit_off, U32 bit // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0) { // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Bitfield; result->byte_size = direct_type->byte_size; result->off = bit_off; @@ -804,7 +804,7 @@ cons_type_bitfield(CONS_Root *root, CONS_Type *direct_type, U32 bit_off, U32 bit result->direct_type = direct_type; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); } scratch_end(scratch); @@ -842,18 +842,18 @@ cons_type_pointer(CONS_Root *root, CONS_Type *direct_type, RADDBGI_TypeKind ptr_ // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0) { // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = ptr_type_kind; result->byte_size = root->addr_size; result->direct_type = direct_type; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); } scratch_end(scratch); @@ -887,19 +887,19 @@ cons_type_array(CONS_Root *root, CONS_Type *direct_type, U64 count) // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0) { // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Array; result->count = count; result->direct_type = direct_type; result->byte_size = direct_type->byte_size*count; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); } scratch_end(scratch); @@ -937,7 +937,7 @@ cons_type_proc(CONS_Root *root, CONS_Type *return_type, struct CONS_TypeList *pa // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0) { @@ -955,7 +955,7 @@ cons_type_proc(CONS_Root *root, CONS_Type *return_type, struct CONS_TypeList *pa } // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Function; result->byte_size = root->addr_size; result->count = params->count; @@ -963,7 +963,7 @@ cons_type_proc(CONS_Root *root, CONS_Type *return_type, struct CONS_TypeList *pa result->param_types = param_types; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); } scratch_end(scratch); @@ -1005,7 +1005,7 @@ cons_type_method(CONS_Root *root, CONS_Type *this_type, CONS_Type *return_type, // check for duplicate construct String8 blob = str8(buf, buf_size); U64 blob_hash = raddbgi_hash(buf, buf_size); - void *lookup_ptr = cons__str8toptr_lookup(&root->construct_map, blob, blob_hash); + void *lookup_ptr = cons_str8toptr_lookup(&root->construct_map, blob, blob_hash); result = (CONS_Type*)lookup_ptr; if(result == 0) { @@ -1027,7 +1027,7 @@ cons_type_method(CONS_Root *root, CONS_Type *this_type, CONS_Type *return_type, } // setup new node - result = cons__type_new(root); + result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Method; result->byte_size = root->addr_size; result->count = params->count; @@ -1035,7 +1035,7 @@ cons_type_method(CONS_Root *root, CONS_Type *this_type, CONS_Type *return_type, result->param_types = param_types; // save in construct map - cons__str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); + cons_str8toptr_insert(root->arena, &root->construct_map, blob, blob_hash, result); } scratch_end(scratch); @@ -1055,15 +1055,15 @@ cons_type_udt(CONS_Root *root, RADDBGI_TypeKind record_type_kind, String8 name, "Non-user-defined-type-kind used to create user-defined type."); // rjf: make type - CONS_Type *result = cons__type_new(root); + CONS_Type *result = cons_type_new(root); result->kind = record_type_kind; result->byte_size = size; result->name = push_str8_copy(root->arena, name); // rjf: save in name map { - CONS__NameMap *map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_Types); - cons__name_map_add_pair(root, map, result->name, result->idx); + CONS_NameMap *map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_Types); + cons_name_map_add_pair(root, map, result->name, result->idx); } return result; @@ -1073,7 +1073,7 @@ static CONS_Type* cons_type_enum(CONS_Root *root, CONS_Type *direct_type, String8 name) { // rjf: make type - CONS_Type *result = cons__type_new(root); + CONS_Type *result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Enum; result->byte_size = direct_type->byte_size; result->name = push_str8_copy(root->arena, name); @@ -1081,8 +1081,8 @@ cons_type_enum(CONS_Root *root, CONS_Type *direct_type, String8 name) // rjf: save in name map { - CONS__NameMap *map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_Types); - cons__name_map_add_pair(root, map, result->name, result->idx); + CONS_NameMap *map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_Types); + cons_name_map_add_pair(root, map, result->name, result->idx); } return result; @@ -1092,7 +1092,7 @@ static CONS_Type* cons_type_alias(CONS_Root *root, CONS_Type *direct_type, String8 name) { // rjf: make type - CONS_Type *result = cons__type_new(root); + CONS_Type *result = cons_type_new(root); result->kind = RADDBGI_TypeKind_Alias; result->byte_size = direct_type->byte_size; result->name = push_str8_copy(root->arena, name); @@ -1100,8 +1100,8 @@ cons_type_alias(CONS_Root *root, CONS_Type *direct_type, String8 name) // rjf: save in name map { - CONS__NameMap *map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_Types); - cons__name_map_add_pair(root, map, result->name, result->idx); + CONS_NameMap *map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_Types); + cons_name_map_add_pair(root, map, result->name, result->idx); } return result; @@ -1118,14 +1118,14 @@ cons_type_incomplete(CONS_Root *root, RADDBGI_TypeKind type_kind, String8 name) "Non-incomplete-type-kind used to create incomplete type."); // rjf: make type - CONS_Type *result = cons__type_new(root); + CONS_Type *result = cons_type_new(root); result->kind = type_kind; result->name = push_str8_copy(root->arena, name); // save in name map { - CONS__NameMap *map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_Types); - cons__name_map_add_pair(root, map, result->name, result->idx); + CONS_NameMap *map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_Types); + cons_name_map_add_pair(root, map, result->name, result->idx); } return result; @@ -1136,7 +1136,7 @@ cons_type_incomplete(CONS_Root *root, RADDBGI_TypeKind type_kind, String8 name) static void cons_type_add_member_data_field(CONS_Root *root, CONS_Type *record_type, String8 name, CONS_Type *mem_type, U32 off) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1153,7 +1153,7 @@ cons_type_add_member_data_field(CONS_Root *root, CONS_Type *record_type, String8 static void cons_type_add_member_static_data(CONS_Root *root, CONS_Type *record_type, String8 name, CONS_Type *mem_type) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1169,7 +1169,7 @@ cons_type_add_member_static_data(CONS_Root *root, CONS_Type *record_type, String static void cons_type_add_member_method(CONS_Root *root, CONS_Type *record_type, String8 name, CONS_Type *mem_type) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1185,7 +1185,7 @@ cons_type_add_member_method(CONS_Root *root, CONS_Type *record_type, String8 nam static void cons_type_add_member_static_method(CONS_Root *root, CONS_Type *record_type, String8 name, CONS_Type *mem_type) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1203,7 +1203,7 @@ cons_type_add_member_static_method(CONS_Root *root, CONS_Type *record_type, Stri static void cons_type_add_member_virtual_method(CONS_Root *root, CONS_Type *record_type, String8 name, CONS_Type *mem_type) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1219,7 +1219,7 @@ cons_type_add_member_virtual_method(CONS_Root *root, CONS_Type *record_type, Str static void cons_type_add_member_base(CONS_Root *root, CONS_Type *record_type, CONS_Type *base_type, U32 off) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1235,7 +1235,7 @@ cons_type_add_member_base(CONS_Root *root, CONS_Type *record_type, CONS_Type *ba static void cons_type_add_member_virtual_base(CONS_Root *root, CONS_Type *record_type, CONS_Type *base_type, U32 vptr_off, U32 vtable_off) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1251,7 +1251,7 @@ cons_type_add_member_virtual_base(CONS_Root *root, CONS_Type *record_type, CONS_ static void cons_type_add_member_nested_type(CONS_Root *root, CONS_Type *record_type, CONS_Type *nested_type) { - CONS_TypeUDT *udt = cons__type_udt_from_record_type(root, record_type); + CONS_TypeUDT *udt = cons_type_udt_from_record_type(root, record_type); if(udt != 0) { CONS_TypeMember *member = push_array(root->arena, CONS_TypeMember, 1); @@ -1267,7 +1267,7 @@ static void cons_type_add_enum_val(CONS_Root *root, CONS_Type *enum_type, String8 name, U64 val) { cons_requiref(root, (enum_type->kind == RADDBGI_TypeKind_Enum), return, "Tried to add enum value to non-enum type."); - CONS_TypeUDT *udt = cons__type_udt_from_any_type(root, enum_type); + CONS_TypeUDT *udt = cons_type_udt_from_any_type(root, enum_type); if(udt != 0) { CONS_TypeEnumVal *enum_val = push_array(root->arena, CONS_TypeEnumVal, 1); @@ -1285,7 +1285,7 @@ cons_type_set_source_coordinates(CONS_Root *root, CONS_Type *defined_type, Strin { cons_requiref(root, (RADDBGI_TypeKind_FirstUserDefined <= defined_type->kind && defined_type->kind <= RADDBGI_TypeKind_LastUserDefined), return, "Tried to add source coordinates to non-user-defined type."); - CONS_TypeUDT *udt = cons__type_udt_from_any_type(root, defined_type); + CONS_TypeUDT *udt = cons_type_udt_from_any_type(root, defined_type); if(udt != 0) { udt->source_path = push_str8_copy(root->arena, source_path); @@ -1299,8 +1299,8 @@ cons_type_set_source_coordinates(CONS_Root *root, CONS_Type *defined_type, Strin static CONS_Symbol* cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id, U64 symbol_user_id_hash) { - CONS__U64ToPtrLookup lookup = {0}; - cons__u64toptr_lookup(&root->symbol_map, symbol_user_id, symbol_user_id_hash, &lookup); + CONS_U64ToPtrLookup lookup = {0}; + cons_u64toptr_lookup(&root->symbol_map, symbol_user_id, symbol_user_id_hash, &lookup); CONS_Symbol *result = 0; if(lookup.match != 0) { @@ -1311,7 +1311,7 @@ cons_symbol_handle_from_user_id(CONS_Root *root, U64 symbol_user_id, U64 symbol_ result = push_array(root->arena, CONS_Symbol, 1); SLLQueuePush_N(root->first_symbol, root->last_symbol, result, next_order); root->symbol_count += 1; - cons__u64toptr_insert(root->arena, &root->symbol_map, symbol_user_id, symbol_user_id_hash, &lookup, result); + cons_u64toptr_insert(root->arena, &root->symbol_map, symbol_user_id, symbol_user_id_hash, &lookup, result); } return result; } @@ -1355,40 +1355,40 @@ cons_symbol_set_info(CONS_Root *root, CONS_Symbol *symbol, CONS_SymbolInfo *info { cons_requiref(root, info->root_scope != 0, NoOp, "Procedure symbol initialized without root scope."); symbol->root_scope = info->root_scope; - cons__scope_recursive_set_symbol(info->root_scope, symbol); + cons_scope_recursive_set_symbol(info->root_scope, symbol); }break; } // save name map { - CONS__NameMap *map = 0; + CONS_NameMap *map = 0; switch(kind) { default:{}break; case CONS_SymbolKind_GlobalVariable: { - map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_GlobalVariables); + map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_GlobalVariables); }break; case CONS_SymbolKind_ThreadVariable: { - map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_ThreadVariables); + map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_ThreadVariables); }break; case CONS_SymbolKind_Procedure: { - map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_Procedures); + map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_Procedures); }break; } if(map != 0) { - cons__name_map_add_pair(root, map, symbol->name, symbol->idx); + cons_name_map_add_pair(root, map, symbol->name, symbol->idx); } } // save link name map if(kind == CONS_SymbolKind_Procedure && symbol->link_name.size > 0) { - CONS__NameMap *map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_LinkNameProcedures); - cons__name_map_add_pair(root, map, symbol->link_name, symbol->idx); + CONS_NameMap *map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_LinkNameProcedures); + cons_name_map_add_pair(root, map, symbol->link_name, symbol->idx); } } @@ -1398,8 +1398,8 @@ static CONS_Scope * cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id, U64 scope_user_id_hash) { CONS_Scope *result = 0; - CONS__U64ToPtrLookup lookup = {0}; - cons__u64toptr_lookup(&root->scope_map, scope_user_id, scope_user_id_hash, &lookup); + CONS_U64ToPtrLookup lookup = {0}; + cons_u64toptr_lookup(&root->scope_map, scope_user_id, scope_user_id_hash, &lookup); if(lookup.match != 0) { result = (CONS_Scope*)lookup.match; @@ -1410,7 +1410,7 @@ cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id, U64 scope_use result->idx = root->scope_count; SLLQueuePush_N(root->first_scope, root->last_scope, result, next_order); root->scope_count += 1; - cons__u64toptr_insert(root->arena, &root->scope_map, scope_user_id, scope_user_id_hash, &lookup, result); + cons_u64toptr_insert(root->arena, &root->scope_map, scope_user_id, scope_user_id_hash, &lookup, result); } return result; } @@ -1428,7 +1428,7 @@ cons_scope_set_parent(CONS_Root *root, CONS_Scope *scope, CONS_Scope *parent) static void cons_scope_add_voff_range(CONS_Root *root, CONS_Scope *scope, U64 voff_first, U64 voff_opl) { - CONS__VOffRange *range = push_array(root->arena, CONS__VOffRange, 1); + CONS_VOffRange *range = push_array(root->arena, CONS_VOffRange, 1); SLLQueuePush(scope->first_range, scope->last_range, range); scope->range_count += 1; range->voff_first = voff_first; @@ -1438,14 +1438,14 @@ cons_scope_add_voff_range(CONS_Root *root, CONS_Scope *scope, U64 voff_first, U6 } static void -cons__scope_recursive_set_symbol(CONS_Scope *scope, CONS_Symbol *symbol) +cons_scope_recursive_set_symbol(CONS_Scope *scope, CONS_Symbol *symbol) { scope->symbol = symbol; for(CONS_Scope *node = scope->first_child; node != 0; node = node->next_sibling) { - cons__scope_recursive_set_symbol(node, symbol); + cons_scope_recursive_set_symbol(node, symbol); } } @@ -1455,8 +1455,8 @@ static CONS_Local* cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id, U64 local_user_id_hash) { CONS_Local *result = 0; - CONS__U64ToPtrLookup lookup = {0}; - cons__u64toptr_lookup(&root->local_map, local_user_id, local_user_id_hash, &lookup); + CONS_U64ToPtrLookup lookup = {0}; + cons_u64toptr_lookup(&root->local_map, local_user_id, local_user_id_hash, &lookup); if(lookup.match != 0) { result = (CONS_Local*)lookup.match; @@ -1464,7 +1464,7 @@ cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id, U64 local_use else { result = push_array(root->arena, CONS_Local, 1); - cons__u64toptr_insert(root->arena, &root->local_map, local_user_id, local_user_id_hash, &lookup, result); + cons_u64toptr_insert(root->arena, &root->local_map, local_user_id, local_user_id_hash, &lookup, result); } return result; } @@ -1502,7 +1502,7 @@ cons_location_set_from_local(CONS_Root *root, CONS_Local *local) static void cons_location_set_add_case(CONS_Root *root, CONS_LocationSet *locset, U64 voff_first, U64 voff_opl, CONS_Location *location) { - CONS__LocationCase *location_case = push_array(root->arena, CONS__LocationCase, 1); + CONS_LocationCase *location_case = push_array(root->arena, CONS_LocationCase, 1); SLLQueuePush(locset->first_location_case, locset->last_location_case, location_case); locset->location_case_count += 1; root->location_count += 1; @@ -1560,17 +1560,17 @@ cons_location_val_reg(CONS_Root *root, U8 reg_code) //- rjf: name map building -static CONS__NameMap* -cons__name_map_for_kind(CONS_Root *root, RADDBGI_NameMapKind kind) +static CONS_NameMap* +cons_name_map_for_kind(CONS_Root *root, RADDBGI_NameMapKind kind) { - CONS__NameMap *result = 0; + CONS_NameMap *result = 0; if(kind < RADDBGI_NameMapKind_COUNT) { if(root->name_maps[kind] == 0) { - root->name_maps[kind] = push_array(root->arena, CONS__NameMap, 1); + root->name_maps[kind] = push_array(root->arena, CONS_NameMap, 1); root->name_maps[kind]->buckets_count = 16384; - root->name_maps[kind]->buckets = push_array(root->arena, CONS__NameMapNode *, root->name_maps[kind]->buckets_count); + root->name_maps[kind]->buckets = push_array(root->arena, CONS_NameMapNode *, root->name_maps[kind]->buckets_count); } result = root->name_maps[kind]; } @@ -1578,15 +1578,15 @@ cons__name_map_for_kind(CONS_Root *root, RADDBGI_NameMapKind kind) } static void -cons__name_map_add_pair(CONS_Root *root, CONS__NameMap *map, String8 string, U32 idx) +cons_name_map_add_pair(CONS_Root *root, CONS_NameMap *map, String8 string, U32 idx) { // hash U64 hash = raddbgi_hash(string.str, string.size); U64 bucket_idx = hash%map->buckets_count; // find existing name node - CONS__NameMapNode *match = 0; - for(CONS__NameMapNode *node = map->buckets[bucket_idx]; + CONS_NameMapNode *match = 0; + for(CONS_NameMapNode *node = map->buckets[bucket_idx]; node != 0; node = node->bucket_next) { @@ -1600,7 +1600,7 @@ cons__name_map_add_pair(CONS_Root *root, CONS__NameMap *map, String8 string, U32 // make name node if necessary if(match == 0) { - match = push_array(root->arena, CONS__NameMapNode, 1); + match = push_array(root->arena, CONS_NameMapNode, 1); match->string = push_str8_copy(root->arena, string); SLLStackPush_N(map->buckets[bucket_idx], match, bucket_next); SLLQueuePush_N(map->first, map->last, match, order_next); @@ -1610,7 +1610,7 @@ cons__name_map_add_pair(CONS_Root *root, CONS__NameMap *map, String8 string, U32 // find existing idx B32 existing_idx = 0; - for(CONS__NameMapIdxNode *node = match->idx_first; + for(CONS_NameMapIdxNode *node = match->idx_first; node != 0; node = node->next) { @@ -1631,11 +1631,11 @@ cons__name_map_add_pair(CONS_Root *root, CONS__NameMap *map, String8 string, U32 // insert new idx if necessary if(!existing_idx) { - CONS__NameMapIdxNode *idx_node = match->idx_last; + CONS_NameMapIdxNode *idx_node = match->idx_last; U32 insert_i = match->idx_count%ArrayCount(idx_node->idx); if(insert_i == 0) { - idx_node = push_array(root->arena, CONS__NameMapIdxNode, 1); + idx_node = push_array(root->arena, CONS_NameMapIdxNode, 1); SLLQueuePush(match->idx_first, match->idx_last, idx_node); } @@ -1649,27 +1649,27 @@ cons__name_map_add_pair(CONS_Root *root, CONS__NameMap *map, String8 string, U32 //- rjf: bake context construction -static CONS__BakeCtx* -cons__bake_ctx_begin(CONS__BakeParams *params) +static CONS_BakeCtx* +cons_bake_ctx_begin(CONS_BakeParams *params) { Arena *arena = arena_alloc(); - CONS__BakeCtx *result = push_array(arena, CONS__BakeCtx, 1); + CONS_BakeCtx *result = push_array(arena, CONS_BakeCtx, 1); result->arena = arena; #define BKTCOUNT(x) ((x)?(u64_up_to_pow2(x)):(16384)) result->strs.buckets_count = BKTCOUNT(params->strings_bucket_count); result->idxs.buckets_count = BKTCOUNT(params->idx_runs_bucket_count); #undef BKTCOUNT - result->strs.buckets = push_array(arena, CONS__StringNode *, result->strs.buckets_count); - result->idxs.buckets = push_array(arena, CONS__IdxRunNode *, result->idxs.buckets_count); + result->strs.buckets = push_array(arena, CONS_StringNode *, result->strs.buckets_count); + result->idxs.buckets = push_array(arena, CONS_IdxRunNode *, result->idxs.buckets_count); - cons__string(result, str8_lit("")); - cons__idx_run(result, 0, 0); + cons_string(result, str8_lit("")); + cons_idx_run(result, 0, 0); - result->tree = push_array(arena, CONS__PathTree, 1); + result->tree = push_array(arena, CONS_PathTree, 1); { - CONS__PathNode *nil_path_node = cons__paths_new_node(result); + CONS_PathNode *nil_path_node = cons_paths_new_node(result); nil_path_node->name = str8_lit(""); - CONS__SrcNode *nil_src_node = cons__paths_new_src_node(result); + CONS_SrcNode *nil_src_node = cons_paths_new_src_node(result); nil_src_node->path_node = nil_path_node; nil_src_node->normal_full_path = str8_lit(""); nil_path_node->src_file = nil_src_node; @@ -1679,7 +1679,7 @@ cons__bake_ctx_begin(CONS__BakeParams *params) } static void -cons__bake_ctx_release(CONS__BakeCtx *bake_ctx) +cons_bake_ctx_release(CONS_BakeCtx *bake_ctx) { arena_release(bake_ctx->arena); } @@ -1687,16 +1687,16 @@ cons__bake_ctx_release(CONS__BakeCtx *bake_ctx) //- rjf: string baking static U32 -cons__string(CONS__BakeCtx *bctx, String8 str) +cons_string(CONS_BakeCtx *bctx, String8 str) { Arena *arena = bctx->arena; - CONS__Strings *strs = &bctx->strs; + CONS_Strings *strs = &bctx->strs; U64 hash = raddbgi_hash(str.str, str.size); U64 bucket_idx = hash%strs->buckets_count; // look for a match - CONS__StringNode *match = 0; - for(CONS__StringNode *node = strs->buckets[bucket_idx]; + CONS_StringNode *match = 0; + for(CONS_StringNode *node = strs->buckets[bucket_idx]; node != 0; node = node->bucket_next) { @@ -1710,7 +1710,7 @@ cons__string(CONS__BakeCtx *bctx, String8 str) // insert new node if no match if(match == 0) { - CONS__StringNode *node = push_array_no_zero(arena, CONS__StringNode, 1); + CONS_StringNode *node = push_array_no_zero(arena, CONS_StringNode, 1); node->str = push_str8_copy(arena, str); node->hash = hash; node->idx = strs->count; @@ -1730,7 +1730,7 @@ cons__string(CONS__BakeCtx *bctx, String8 str) //- rjf: idx run baking static U64 -cons__idx_run_hash(U32 *idx_run, U32 count) +cons_idx_run_hash(U32 *idx_run, U32 count) { U64 hash = 5381; U32 *ptr = idx_run; @@ -1743,17 +1743,17 @@ cons__idx_run_hash(U32 *idx_run, U32 count) } static U32 -cons__idx_run(CONS__BakeCtx *bctx, U32 *idx_run, U32 count) +cons_idx_run(CONS_BakeCtx *bctx, U32 *idx_run, U32 count) { Arena *arena = bctx->arena; - CONS__IdxRuns *idxs = &bctx->idxs; + CONS_IdxRuns *idxs = &bctx->idxs; - U64 hash = cons__idx_run_hash(idx_run, count); + U64 hash = cons_idx_run_hash(idx_run, count); U64 bucket_idx = hash%idxs->buckets_count; // look for a match - CONS__IdxRunNode *match = 0; - for(CONS__IdxRunNode *node = idxs->buckets[bucket_idx]; + CONS_IdxRunNode *match = 0; + for(CONS_IdxRunNode *node = idxs->buckets[bucket_idx]; node != 0; node = node->bucket_next) { @@ -1780,7 +1780,7 @@ cons__idx_run(CONS__BakeCtx *bctx, U32 *idx_run, U32 count) // insert new node if no match if(match == 0) { - CONS__IdxRunNode *node = push_array_no_zero(arena, CONS__IdxRunNode, 1); + CONS_IdxRunNode *node = push_array_no_zero(arena, CONS_IdxRunNode, 1); U32 *idx_run_copy = push_array_no_zero(arena, U32, count); for(U32 i = 0; i < count; i += 1) { @@ -1807,10 +1807,10 @@ cons__idx_run(CONS__BakeCtx *bctx, U32 *idx_run, U32 count) //- rjf: data section baking static U32 -cons__dsection(Arena *arena, CONS__DSections *dss, void *data, U64 size, RADDBGI_DataSectionTag tag) +cons_dsection(Arena *arena, CONS_DSections *dss, void *data, U64 size, RADDBGI_DataSectionTag tag) { U32 result = dss->count; - CONS__DSectionNode *node = push_array(arena, CONS__DSectionNode, 1); + CONS_DSectionNode *node = push_array(arena, CONS_DSectionNode, 1); SLLQueuePush(dss->first, dss->last, node); node->data = data; node->size = size; @@ -1822,13 +1822,13 @@ cons__dsection(Arena *arena, CONS__DSections *dss, void *data, U64 size, RADDBGI //- rjf: paths baking static String8 -cons__normal_string_from_path_node(Arena *arena, CONS__PathNode *node) +cons_normal_string_from_path_node(Arena *arena, CONS_PathNode *node) { Temp scratch = scratch_begin(&arena, 1); String8List list = {0}; if(node != 0) { - cons__normal_string_from_path_node_build(scratch.arena, node, &list); + cons_normal_string_from_path_node_build(scratch.arena, node, &list); } StringJoin join = {0}; join.sep = str8_lit("/"); @@ -1848,12 +1848,12 @@ cons__normal_string_from_path_node(Arena *arena, CONS__PathNode *node) } static void -cons__normal_string_from_path_node_build(Arena *arena, CONS__PathNode *node, String8List *out) +cons_normal_string_from_path_node_build(Arena *arena, CONS_PathNode *node, String8List *out) { // TODO(rjf): why is this recursive... if(node->parent != 0) { - cons__normal_string_from_path_node_build(arena, node->parent, out); + cons_normal_string_from_path_node_build(arena, node->parent, out); } if(node->name.size > 0) { @@ -1861,23 +1861,23 @@ cons__normal_string_from_path_node_build(Arena *arena, CONS__PathNode *node, Str } } -static CONS__PathNode* -cons__paths_new_node(CONS__BakeCtx *bctx) +static CONS_PathNode* +cons_paths_new_node(CONS_BakeCtx *bctx) { - CONS__PathTree *tree = bctx->tree; - CONS__PathNode *result = push_array(bctx->arena, CONS__PathNode, 1); + CONS_PathTree *tree = bctx->tree; + CONS_PathNode *result = push_array(bctx->arena, CONS_PathNode, 1); SLLQueuePush_N(tree->first, tree->last, result, next_order); result->idx = tree->count; tree->count += 1; return result; } -static CONS__PathNode* -cons__paths_sub_path(CONS__BakeCtx *bctx, CONS__PathNode *dir, String8 sub_dir) +static CONS_PathNode* +cons_paths_sub_path(CONS_BakeCtx *bctx, CONS_PathNode *dir, String8 sub_dir) { // look for existing match - CONS__PathNode *match = 0; - for(CONS__PathNode *node = dir->first_child; + CONS_PathNode *match = 0; + for(CONS_PathNode *node = dir->first_child; node != 0; node = node->next_sibling){ if(str8_match(node->name, sub_dir, StringMatchFlag_CaseInsensitive)){ @@ -1887,16 +1887,16 @@ cons__paths_sub_path(CONS__BakeCtx *bctx, CONS__PathNode *dir, String8 sub_dir) } // construct new node if no match - CONS__PathNode *new_node = 0; + CONS_PathNode *new_node = 0; if(match == 0){ - new_node = cons__paths_new_node(bctx); + new_node = cons_paths_new_node(bctx); new_node->parent = dir; SLLQueuePush_N(dir->first_child, dir->last_child, new_node, next_sibling); new_node->name = push_str8_copy(bctx->arena, sub_dir); } // select result from the two paths - CONS__PathNode *result = match; + CONS_PathNode *result = match; if(match == 0){ result = new_node; } @@ -1904,10 +1904,10 @@ cons__paths_sub_path(CONS__BakeCtx *bctx, CONS__PathNode *dir, String8 sub_dir) return result; } -static CONS__PathNode* -cons__paths_node_from_path(CONS__BakeCtx *bctx, String8 path) +static CONS_PathNode* +cons_paths_node_from_path(CONS_BakeCtx *bctx, String8 path) { - CONS__PathNode *node_cursor = &bctx->tree->root; + CONS_PathNode *node_cursor = &bctx->tree->root; U8 *ptr = path.str; U8 *opl = path.str + path.size; @@ -1924,42 +1924,42 @@ cons__paths_node_from_path(CONS__BakeCtx *bctx, String8 path) // if range is non-empty advance the node cursor if(range_first < ptr){ String8 sub_dir = str8_range(range_first, ptr); - node_cursor = cons__paths_sub_path(bctx, node_cursor, sub_dir); + node_cursor = cons_paths_sub_path(bctx, node_cursor, sub_dir); } } - CONS__PathNode *result = node_cursor; + CONS_PathNode *result = node_cursor; return result; } static U32 -cons__paths_idx_from_path(CONS__BakeCtx *bctx, String8 path) +cons_paths_idx_from_path(CONS_BakeCtx *bctx, String8 path) { - CONS__PathNode *node = cons__paths_node_from_path(bctx, path); + CONS_PathNode *node = cons_paths_node_from_path(bctx, path); U32 result = node->idx; return result; } -static CONS__SrcNode* -cons__paths_new_src_node(CONS__BakeCtx *bctx) +static CONS_SrcNode* +cons_paths_new_src_node(CONS_BakeCtx *bctx) { - CONS__PathTree *tree = bctx->tree; - CONS__SrcNode *result = push_array(bctx->arena, CONS__SrcNode, 1); + CONS_PathTree *tree = bctx->tree; + CONS_SrcNode *result = push_array(bctx->arena, CONS_SrcNode, 1); SLLQueuePush(tree->src_first, tree->src_last, result); result->idx = tree->src_count; tree->src_count += 1; return result; } -static CONS__SrcNode* -cons__paths_src_node_from_path_node(CONS__BakeCtx *bctx, CONS__PathNode *path_node) +static CONS_SrcNode* +cons_paths_src_node_from_path_node(CONS_BakeCtx *bctx, CONS_PathNode *path_node) { - CONS__SrcNode *result = path_node->src_file; + CONS_SrcNode *result = path_node->src_file; if(result == 0) { - CONS__SrcNode *new_node = cons__paths_new_src_node(bctx); + CONS_SrcNode *new_node = cons_paths_new_src_node(bctx); new_node->path_node = path_node; - new_node->normal_full_path = cons__normal_string_from_path_node(bctx->arena, path_node); + new_node->normal_full_path = cons_normal_string_from_path_node(bctx->arena, path_node); result = path_node->src_file = new_node; } return result; @@ -1967,10 +1967,10 @@ cons__paths_src_node_from_path_node(CONS__BakeCtx *bctx, CONS__PathNode *path_no //- rjf: per-unit line info baking -static CONS__UnitLinesCombined* -cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNode *first_seq) +static CONS_UnitLinesCombined* +cons_unit_combine_lines(Arena *arena, CONS_BakeCtx *bctx, CONS_LineSequenceNode *first_seq) { - ProfBegin("cons__unit_combine_lines"); + ProfBegin("cons_unit_combine_lines"); Temp scratch = scratch_begin(&arena, 1); // gather up all line info into two arrays @@ -1986,19 +1986,19 @@ cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNod } U64 key_count = line_count + seq_count; - CONS__SortKey *line_keys = push_array_no_zero(scratch.arena, CONS__SortKey, key_count); - CONS__LineRec *line_recs = push_array_no_zero(scratch.arena, CONS__LineRec, line_count); + CONS_SortKey *line_keys = push_array_no_zero(scratch.arena, CONS_SortKey, key_count); + CONS_LineRec *line_recs = push_array_no_zero(scratch.arena, CONS_LineRec, line_count); { - CONS__SortKey *key_ptr = line_keys; - CONS__LineRec *rec_ptr = line_recs; + CONS_SortKey *key_ptr = line_keys; + CONS_LineRec *rec_ptr = line_recs; for(CONS_LineSequenceNode *node = first_seq; node != 0; node = node->next){ - CONS__PathNode *src_path = - cons__paths_node_from_path(bctx, node->line_seq.file_name); - CONS__SrcNode *src_file = cons__paths_src_node_from_path_node(bctx, src_path); + CONS_PathNode *src_path = + cons_paths_node_from_path(bctx, node->line_seq.file_name); + CONS_SrcNode *src_file = cons_paths_src_node_from_path_node(bctx, src_path); U32 file_id = src_file->idx; U64 node_line_count = node->line_seq.line_count; @@ -2020,14 +2020,14 @@ cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNod key_ptr->val = 0; key_ptr += 1; - CONS__LineMapFragment *fragment = push_array(arena, CONS__LineMapFragment, 1); + CONS_LineMapFragment *fragment = push_array(arena, CONS_LineMapFragment, 1); SLLQueuePush(src_file->first_fragment, src_file->last_fragment, fragment); fragment->sequence = node; } } // sort - CONS__SortKey *sorted_line_keys = cons__sort_key_array(scratch.arena, line_keys, key_count); + CONS_SortKey *sorted_line_keys = cons_sort_key_array(scratch.arena, line_keys, key_count); // TODO(allen): do a pass over sorted keys to make sure duplicate keys are sorted with // null record first, and no more than one null record and one non-null record @@ -2041,7 +2041,7 @@ cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNod } arranged_voffs[key_count] = ~0ull; for(U64 i = 0; i < key_count; i += 1){ - CONS__LineRec *rec = (CONS__LineRec*)sorted_line_keys[i].val; + CONS_LineRec *rec = (CONS_LineRec*)sorted_line_keys[i].val; if(rec != 0){ arranged_lines[i].file_idx = rec->file_id; arranged_lines[i].line_num = rec->line_num; @@ -2052,7 +2052,7 @@ cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNod } } - CONS__UnitLinesCombined *result = push_array(arena, CONS__UnitLinesCombined, 1); + CONS_UnitLinesCombined *result = push_array(arena, CONS_UnitLinesCombined, 1); result->voffs = arranged_voffs; result->lines = arranged_lines; result->cols = 0; @@ -2066,23 +2066,23 @@ cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNod //- rjf: per-src line info baking -static CONS__SrcLinesCombined* -cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) +static CONS_SrcLinesCombined* +cons_source_combine_lines(Arena *arena, CONS_LineMapFragment *first) { - ProfBegin("cons__source_combine_lines"); + ProfBegin("cons_source_combine_lines"); Temp scratch = scratch_begin(&arena, 1); // gather line number map - CONS__SrcLineMapBucket *first_bucket = 0; - CONS__SrcLineMapBucket *last_bucket = 0; + CONS_SrcLineMapBucket *first_bucket = 0; + CONS_SrcLineMapBucket *last_bucket = 0; U64 line_hash_slots_count = 1024; - CONS__SrcLineMapBucket **line_hash_slots = push_array(scratch.arena, CONS__SrcLineMapBucket *, line_hash_slots_count); + CONS_SrcLineMapBucket **line_hash_slots = push_array(scratch.arena, CONS_SrcLineMapBucket *, line_hash_slots_count); U64 line_count = 0; U64 voff_count = 0; U64 max_line_num = 0; ProfScope("gather line number map") { - for(CONS__LineMapFragment *map_fragment = first; + for(CONS_LineMapFragment *map_fragment = first; map_fragment != 0; map_fragment = map_fragment->next) { @@ -2101,9 +2101,9 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) max_line_num = Max(max_line_num, line_num); // find match - CONS__SrcLineMapBucket *match = 0; + CONS_SrcLineMapBucket *match = 0; { - for(CONS__SrcLineMapBucket *node = line_hash_slots[line_hash_slot_idx]; + for(CONS_SrcLineMapBucket *node = line_hash_slots[line_hash_slot_idx]; node != 0; node = node->hash_next){ if(node->line_num == line_num){ @@ -2115,7 +2115,7 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) // introduce new line if no match if(match == 0){ - match = push_array(scratch.arena, CONS__SrcLineMapBucket, 1); + match = push_array(scratch.arena, CONS_SrcLineMapBucket, 1); SLLQueuePush_N(first_bucket, last_bucket, match, order_next); SLLStackPush_N(line_hash_slots[line_hash_slot_idx], match, hash_next); match->line_num = line_num; @@ -2124,7 +2124,7 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) // insert new voff { - CONS__SrcLineMapVoffBlock *block = push_array(scratch.arena, CONS__SrcLineMapVoffBlock, 1); + CONS_SrcLineMapVoffBlock *block = push_array(scratch.arena, CONS_SrcLineMapVoffBlock, 1); SLLQueuePush(match->first_voff_block, match->last_voff_block, block); match->voff_count += 1; block->voff = voff; @@ -2134,11 +2134,11 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) } // bake sortable keys array - CONS__SortKey *keys = push_array_no_zero(scratch.arena, CONS__SortKey, line_count); + CONS_SortKey *keys = push_array_no_zero(scratch.arena, CONS_SortKey, line_count); ProfScope("bake sortable keys array") { - CONS__SortKey *key_ptr = keys; - for(CONS__SrcLineMapBucket *node = first_bucket; + CONS_SortKey *key_ptr = keys; + for(CONS_SrcLineMapBucket *node = first_bucket; node != 0; node = node->order_next, key_ptr += 1){ key_ptr->key = node->line_num; @@ -2147,7 +2147,7 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) } // sort - CONS__SortKey *sorted_keys = cons__sort_key_array(scratch.arena, keys, line_count); + CONS_SortKey *sorted_keys = cons_sort_key_array(scratch.arena, keys, line_count); // bake result U32 *line_nums = push_array_no_zero(arena, U32, line_count); @@ -2159,8 +2159,8 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) for(U32 i = 0; i < line_count; i += 1){ line_nums[i] = sorted_keys[i].key; line_ranges[i] = (U32)(voff_ptr - voffs); - CONS__SrcLineMapBucket *bucket = (CONS__SrcLineMapBucket*)sorted_keys[i].val; - for(CONS__SrcLineMapVoffBlock *node = bucket->first_voff_block; + CONS_SrcLineMapBucket *bucket = (CONS_SrcLineMapBucket*)sorted_keys[i].val; + for(CONS_SrcLineMapVoffBlock *node = bucket->first_voff_block; node != 0; node = node->next){ *voff_ptr = node->voff; @@ -2170,7 +2170,7 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) line_ranges[line_count] = voff_count; } - CONS__SrcLinesCombined *result = push_array(arena, CONS__SrcLinesCombined, 1); + CONS_SrcLinesCombined *result = push_array(arena, CONS_SrcLinesCombined, 1); result->line_nums = line_nums; result->line_ranges = line_ranges; result->line_count = line_count; @@ -2184,13 +2184,13 @@ cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first) } //- rjf: vmap baking -static CONS__VMap* -cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey *keys, U64 marker_count) +static CONS_VMap* +cons_vmap_from_markers(Arena *arena, CONS_VMapMarker *markers, CONS_SortKey *keys, U64 marker_count) { Temp scratch = scratch_begin(&arena, 1); // sort markers - CONS__SortKey *sorted_keys = cons__sort_key_array(scratch.arena, keys, marker_count); + CONS_SortKey *sorted_keys = cons_sort_key_array(scratch.arena, keys, marker_count); // determine if an extra vmap entry for zero is needed U32 extra_vmap_entry = 0; @@ -2212,11 +2212,11 @@ cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey * vmap_ptr += 1; } - CONS__VMapRangeTracker *tracker_stack = 0; - CONS__VMapRangeTracker *tracker_free = 0; + CONS_VMapRangeTracker *tracker_stack = 0; + CONS_VMapRangeTracker *tracker_free = 0; - CONS__SortKey *key_ptr = sorted_keys; - CONS__SortKey *key_opl = sorted_keys + marker_count; + CONS_SortKey *key_ptr = sorted_keys; + CONS_SortKey *key_opl = sorted_keys + marker_count; for(;key_ptr < key_opl;){ // get initial map state from tracker stack U32 initial_idx = max_U32; @@ -2229,17 +2229,17 @@ cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey * U64 voff = key_ptr->key; for(;key_ptr < key_opl && key_ptr->key == voff; key_ptr += 1){ - CONS__VMapMarker *marker = (CONS__VMapMarker*)key_ptr->val; + CONS_VMapMarker *marker = (CONS_VMapMarker*)key_ptr->val; U32 idx = marker->idx; // push to stack if(marker->begin_range){ - CONS__VMapRangeTracker *new_tracker = tracker_free; + CONS_VMapRangeTracker *new_tracker = tracker_free; if(new_tracker != 0){ SLLStackPop(tracker_free); } else{ - new_tracker = push_array(scratch.arena, CONS__VMapRangeTracker, 1); + new_tracker = push_array(scratch.arena, CONS_VMapRangeTracker, 1); } SLLStackPush(tracker_stack, new_tracker); new_tracker->idx = idx; @@ -2247,9 +2247,9 @@ cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey * // pop matching node from stack (not always the top) else{ - CONS__VMapRangeTracker **ptr_in = &tracker_stack; - CONS__VMapRangeTracker *match = 0; - for(CONS__VMapRangeTracker *node = tracker_stack; + CONS_VMapRangeTracker **ptr_in = &tracker_stack; + CONS_VMapRangeTracker *match = 0; + for(CONS_VMapRangeTracker *node = tracker_stack; node != 0;){ if(node->idx == idx){ match = node; @@ -2325,7 +2325,7 @@ cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey * } // fill result - CONS__VMap *result = push_array(arena, CONS__VMap, 1); + CONS_VMap *result = push_array(arena, CONS_VMap, 1); result->vmap = vmap; result->count = vmap_entry_count - 1; @@ -2334,8 +2334,8 @@ cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey * return result; } -static CONS__VMap* -cons__vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count) +static CONS_VMap* +cons_vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count) { Temp scratch = scratch_begin(&arena, 1); @@ -2343,12 +2343,12 @@ cons__vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count) U64 marker_count = count*2; // fill markers - CONS__SortKey *keys = push_array_no_zero(scratch.arena, CONS__SortKey, marker_count); - CONS__VMapMarker *markers = push_array_no_zero(scratch.arena, CONS__VMapMarker, marker_count); + CONS_SortKey *keys = push_array_no_zero(scratch.arena, CONS_SortKey, marker_count); + CONS_VMapMarker *markers = push_array_no_zero(scratch.arena, CONS_VMapMarker, marker_count); { - CONS__SortKey *key_ptr = keys; - CONS__VMapMarker *marker_ptr = markers; + CONS_SortKey *key_ptr = keys; + CONS_VMapMarker *marker_ptr = markers; for(CONS_UnitVMapRange *range = first; range != 0; range = range->next){ @@ -2373,7 +2373,7 @@ cons__vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count) } // construct vmap - CONS__VMap *result = cons__vmap_from_markers(arena, markers, keys, marker_count); + CONS_VMap *result = cons_vmap_from_markers(arena, markers, keys, marker_count); scratch_end(scratch); return result; } @@ -2381,7 +2381,7 @@ cons__vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count) //- rjf: type info baking static U32* -cons__idx_run_from_types(Arena *arena, CONS_Type **types, U32 count) +cons_idx_run_from_types(Arena *arena, CONS_Type **types, U32 count) { U32 *result = push_array(arena, U32, count); for(U32 i = 0; i < count; i += 1){ @@ -2390,10 +2390,10 @@ cons__idx_run_from_types(Arena *arena, CONS_Type **types, U32 count) return result; } -static CONS__TypeData* -cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) +static CONS_TypeData* +cons_type_data_combine(Arena *arena, CONS_Root *root, CONS_BakeCtx *bctx) { - ProfBegin("cons__type_data_combine"); + ProfBegin("cons_type_data_combine"); Temp scratch = scratch_begin(&arena, 1); // fill type nodes @@ -2416,7 +2416,7 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) // built-in if(RADDBGI_TypeKind_FirstBuiltIn <= kind && kind <= RADDBGI_TypeKind_LastBuiltIn){ - ptr->built_in.name_string_idx = cons__string(bctx, loose_type->name); + ptr->built_in.name_string_idx = cons_string(bctx, loose_type->name); } // constructed @@ -2433,8 +2433,8 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) { // parameters U32 count = loose_type->count; - U32 *idx_run = cons__idx_run_from_types(scratch.arena, loose_type->param_types, count); - ptr->constructed.param_idx_run_first = cons__idx_run(bctx, idx_run, count); + U32 *idx_run = cons_idx_run_from_types(scratch.arena, loose_type->param_types, count); + ptr->constructed.param_idx_run_first = cons_idx_run(bctx, idx_run, count); ptr->constructed.count = count; }break; @@ -2442,8 +2442,8 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) { // parameters U32 count = loose_type->count; - U32 *idx_run = cons__idx_run_from_types(scratch.arena, loose_type->param_types, count); - ptr->constructed.param_idx_run_first = cons__idx_run(bctx, idx_run, count); + U32 *idx_run = cons_idx_run_from_types(scratch.arena, loose_type->param_types, count); + ptr->constructed.param_idx_run_first = cons_idx_run(bctx, idx_run, count); ptr->constructed.count = count; }break; } @@ -2451,7 +2451,7 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) // user-defined else if(RADDBGI_TypeKind_FirstUserDefined <= kind && kind <= RADDBGI_TypeKind_LastUserDefined){ - ptr->user_defined.name_string_idx = cons__string(bctx, loose_type->name); + ptr->user_defined.name_string_idx = cons_string(bctx, loose_type->name); if(loose_type->udt != 0){ ptr->user_defined.udt_idx = loose_type->udt->idx; } @@ -2515,7 +2515,7 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) for(U32 i = 0; i < local_enum_val_count; i += 1, enum_member_ptr += 1, loose_enum_val = loose_enum_val->next){ - enum_member_ptr->name_string_idx = cons__string(bctx, loose_enum_val->name); + enum_member_ptr->name_string_idx = cons_string(bctx, loose_enum_val->name); enum_member_ptr->val = loose_enum_val->val; } } @@ -2532,7 +2532,7 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) i += 1, member_ptr += 1, loose_member = loose_member->next){ member_ptr->kind = loose_member->kind; // TODO(allen): member_ptr->visibility = ; - member_ptr->name_string_idx = cons__string(bctx, loose_member->name); + member_ptr->name_string_idx = cons_string(bctx, loose_member->name); member_ptr->off = loose_member->off; member_ptr->type_idx = loose_member->type->idx; @@ -2547,8 +2547,8 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) U32 file_idx = 0; if(loose_udt->source_path.size > 0){ - CONS__PathNode *path_node = cons__paths_node_from_path(bctx, loose_udt->source_path); - CONS__SrcNode *src_node = cons__paths_src_node_from_path_node(bctx, path_node); + CONS_PathNode *path_node = cons_paths_node_from_path(bctx, loose_udt->source_path); + CONS_SrcNode *src_node = cons_paths_src_node_from_path_node(bctx, path_node); file_idx = src_node->idx; } @@ -2566,7 +2566,7 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) // fill result - CONS__TypeData *result = push_array(arena, CONS__TypeData, 1); + CONS_TypeData *result = push_array(arena, CONS_TypeData, 1); result->type_nodes = type_nodes; result->type_node_count = type_count; result->udts = udts; @@ -2583,10 +2583,10 @@ cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) //- rjf: symbol data baking -static CONS__SymbolData* -cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) +static CONS_SymbolData* +cons_symbol_data_combine(Arena *arena, CONS_Root *root, CONS_BakeCtx *bctx) { - ProfBegin("cons__symbol_data_combine"); + ProfBegin("cons_symbol_data_combine"); Temp scratch = scratch_begin(&arena, 1); // count symbol kinds @@ -2618,8 +2618,8 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) for(CONS_Symbol *node = root->first_symbol; node != 0; node = node->next_order){ - U32 name_string_idx = cons__string(bctx, node->name); - U32 link_name_string_idx = cons__string(bctx, node->link_name); + U32 name_string_idx = cons_string(bctx, node->name); + U32 link_name_string_idx = cons_string(bctx, node->link_name); U32 type_idx = node->type->idx; RADDBGI_LinkFlags link_flags = 0; @@ -2680,17 +2680,17 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) } // global vmap - CONS__VMap *global_vmap = 0; + CONS_VMap *global_vmap = 0; { // count necessary markers U32 marker_count = globalvar_count*2; // fill markers - CONS__SortKey *keys = push_array_no_zero(scratch.arena, CONS__SortKey, marker_count); - CONS__VMapMarker *markers = push_array_no_zero(scratch.arena, CONS__VMapMarker, marker_count); + CONS_SortKey *keys = push_array_no_zero(scratch.arena, CONS_SortKey, marker_count); + CONS_VMapMarker *markers = push_array_no_zero(scratch.arena, CONS_VMapMarker, marker_count); - CONS__SortKey *key_ptr = keys; - CONS__VMapMarker *marker_ptr = markers; + CONS_SortKey *key_ptr = keys; + CONS_VMapMarker *marker_ptr = markers; // real globals for(CONS_Symbol *node = root->first_symbol; @@ -2745,7 +2745,7 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) marker_ptr - markers == marker_count); // construct vmap - global_vmap = cons__vmap_from_markers(arena, markers, keys, marker_count); + global_vmap = cons_vmap_from_markers(arena, markers, keys, marker_count); } // allocate scope array @@ -2786,7 +2786,7 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) // emit voffs U32 voff_first = (U32)(scope_voff_ptr - scope_voffs); - for(CONS__VOffRange *range = node->first_range; + for(CONS_VOffRange *range = node->first_range; range != 0; range = range->next){ *scope_voff_ptr = range->voff_first; @@ -2803,7 +2803,7 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) slocal != 0; slocal = slocal->next, local_ptr += 1){ local_ptr->kind = slocal->kind; - local_ptr->name_string_idx = cons__string(bctx, slocal->name); + local_ptr->name_string_idx = cons_string(bctx, slocal->name); local_ptr->type_idx = slocal->type->idx; CONS_LocationSet *locset = slocal->locset; @@ -2813,7 +2813,7 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) local_ptr->location_first = location_first; local_ptr->location_opl = location_opl; - for(CONS__LocationCase *location_case = locset->first_location_case; + for(CONS_LocationCase *location_case = locset->first_location_case; location_case != 0; location_case = location_case->next){ location_block_ptr->scope_off_first = location_case->voff_first; @@ -2906,24 +2906,24 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) String8 location_data_str = str8_list_join(arena, &location_data, 0); // scope vmap - CONS__VMap *scope_vmap = 0; + CONS_VMap *scope_vmap = 0; { // count necessary markers U32 marker_count = scope_voff_count; // fill markers - CONS__SortKey *keys = push_array_no_zero(scratch.arena, CONS__SortKey, marker_count); - CONS__VMapMarker *markers = push_array_no_zero(scratch.arena, CONS__VMapMarker, marker_count); + CONS_SortKey *keys = push_array_no_zero(scratch.arena, CONS_SortKey, marker_count); + CONS_VMapMarker *markers = push_array_no_zero(scratch.arena, CONS_VMapMarker, marker_count); - CONS__SortKey *key_ptr = keys; - CONS__VMapMarker *marker_ptr = markers; + CONS_SortKey *key_ptr = keys; + CONS_VMapMarker *marker_ptr = markers; for(CONS_Scope *node = root->first_scope; node != 0; node = node->next_order){ U32 scope_idx = node->idx; - for(CONS__VOffRange *range = node->first_range; + for(CONS_VOffRange *range = node->first_range; range != 0; range = range->next){ key_ptr->key = range->voff_first; @@ -2942,11 +2942,11 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) } } - scope_vmap = cons__vmap_from_markers(arena, markers, keys, marker_count); + scope_vmap = cons_vmap_from_markers(arena, markers, keys, marker_count); } // fill result - CONS__SymbolData *result = push_array(arena, CONS__SymbolData, 1); + CONS_SymbolData *result = push_array(arena, CONS_SymbolData, 1); result->global_variables = global_variables; result->global_variable_count = globalvar_count; result->global_vmap = global_vmap; @@ -2974,8 +2974,8 @@ cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx) //- rjf: name map baking -static CONS__NameMapBaked* -cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__NameMap *map) +static CONS_NameMapBaked* +cons_name_map_bake(Arena *arena, CONS_Root *root, CONS_BakeCtx *bctx, CONS_NameMap *map) { Temp scratch = scratch_begin(&arena, 1); @@ -2983,13 +2983,13 @@ cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__Na U32 node_count = map->name_count; // setup the final bucket layouts - CONS__NameMapSemiBucket *sbuckets = push_array(scratch.arena, CONS__NameMapSemiBucket, bucket_count); - for(CONS__NameMapNode *node = map->first; + CONS_NameMapSemiBucket *sbuckets = push_array(scratch.arena, CONS_NameMapSemiBucket, bucket_count); + for(CONS_NameMapNode *node = map->first; node != 0; node = node->order_next){ U64 hash = raddbgi_hash(node->string.str, node->string.size); U64 bi = hash%bucket_count; - CONS__NameMapSemiNode *snode = push_array(scratch.arena, CONS__NameMapSemiNode, 1); + CONS_NameMapSemiNode *snode = push_array(scratch.arena, CONS_NameMapSemiNode, 1); SLLQueuePush(sbuckets[bi].first, sbuckets[bi].last, snode); snode->node = node; sbuckets[bi].count += 1; @@ -3007,13 +3007,13 @@ cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__Na bucket_ptr->first_node = (U32)(node_ptr - nodes); bucket_ptr->node_count = sbuckets[i].count; - for(CONS__NameMapSemiNode *snode = sbuckets[i].first; + for(CONS_NameMapSemiNode *snode = sbuckets[i].first; snode != 0; snode = snode->next){ - CONS__NameMapNode *node = snode->node; + CONS_NameMapNode *node = snode->node; // cons name and index(es) - U32 string_idx = cons__string(bctx, node->string); + U32 string_idx = cons_string(bctx, node->string); U32 match_count = node->idx_count; U32 idx = 0; if(match_count == 1){ @@ -3023,7 +3023,7 @@ cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__Na Temp temp = temp_begin(scratch.arena); U32 *idx_run = push_array_no_zero(temp.arena, U32, match_count); U32 *idx_ptr = idx_run; - for(CONS__NameMapIdxNode *idxnode = node->idx_first; + for(CONS_NameMapIdxNode *idxnode = node->idx_first; idxnode != 0; idxnode = idxnode->next){ for(U32 i = 0; i < ArrayCount(idxnode->idx); i += 1){ @@ -3036,7 +3036,7 @@ cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__Na } dblbreak:; Assert(idx_ptr == idx_run + match_count); - idx = cons__idx_run(bctx, idx_run, match_count); + idx = cons_idx_run(bctx, idx_run, match_count); temp_end(temp); } @@ -3052,7 +3052,7 @@ cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__Na scratch_end(scratch); - CONS__NameMapBaked *result = push_array(arena, CONS__NameMapBaked, 1); + CONS_NameMapBaked *result = push_array(arena, CONS_NameMapBaked, 1); result->buckets = buckets; result->nodes = nodes; result->bucket_count = bucket_count; @@ -3069,15 +3069,15 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) str8_serial_begin(arena, out); // setup cons helpers - CONS__DSections dss = {0}; - cons__dsection(arena, &dss, 0, 0, RADDBGI_DataSectionTag_NULL); + CONS_DSections dss = {0}; + cons_dsection(arena, &dss, 0, 0, RADDBGI_DataSectionTag_NULL); - CONS__BakeParams bctx_params = {0}; + CONS_BakeParams bctx_params = {0}; { bctx_params.strings_bucket_count = u64_up_to_pow2(root->symbol_map.pair_count*8); bctx_params.idx_runs_bucket_count = u64_up_to_pow2(root->symbol_map.pair_count*8); } - CONS__BakeCtx *bctx = cons__bake_ctx_begin(&bctx_params); + CONS_BakeCtx *bctx = cons_bake_ctx_begin(&bctx_params); //////////////////////////////// // MAIN PART: allocating and filling out sections of the file @@ -3087,11 +3087,11 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) { CONS_TopLevelInfo *cons_tli = &root->top_level_info; tli->architecture = cons_tli->architecture; - tli->exe_name_string_idx = cons__string(bctx, cons_tli->exe_name); + tli->exe_name_string_idx = cons_string(bctx, cons_tli->exe_name); tli->exe_hash = cons_tli->exe_hash; tli->voff_max = cons_tli->voff_max; } - cons__dsection(arena, &dss, tli, sizeof(*tli), RADDBGI_DataSectionTag_TopLevelInfo); + cons_dsection(arena, &dss, tli, sizeof(*tli), RADDBGI_DataSectionTag_TopLevelInfo); // binary sections array { @@ -3101,14 +3101,14 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) for(CONS_BinarySection *ssec = root->binary_section_first; ssec != 0; ssec = ssec->next, dsec += 1){ - dsec->name_string_idx = cons__string(bctx, ssec->name); + dsec->name_string_idx = cons_string(bctx, ssec->name); dsec->flags = ssec->flags; dsec->voff_first = ssec->voff_first; dsec->voff_opl = ssec->voff_opl; dsec->foff_first = ssec->foff_first; dsec->foff_opl = ssec->foff_opl; } - cons__dsection(arena, &dss, sections, sizeof(*sections)*count, RADDBGI_DataSectionTag_BinarySections); + cons_dsection(arena, &dss, sections, sizeof(*sections)*count, RADDBGI_DataSectionTag_BinarySections); } // units array @@ -3123,13 +3123,13 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) sunit != 0; sunit = sunit->next_order, dunit += 1){ // strings & paths - U32 unit_name = cons__string(bctx, sunit->unit_name); - U32 cmp_name = cons__string(bctx, sunit->compiler_name); + U32 unit_name = cons_string(bctx, sunit->unit_name); + U32 cmp_name = cons_string(bctx, sunit->compiler_name); - U32 src_path = cons__paths_idx_from_path(bctx, sunit->source_file); - U32 obj_path = cons__paths_idx_from_path(bctx, sunit->object_file); - U32 archive_path = cons__paths_idx_from_path(bctx, sunit->archive_file); - U32 build_path = cons__paths_idx_from_path(bctx, sunit->build_path); + U32 src_path = cons_paths_idx_from_path(bctx, sunit->source_file); + U32 obj_path = cons_paths_idx_from_path(bctx, sunit->object_file); + U32 archive_path = cons_paths_idx_from_path(bctx, sunit->archive_file); + U32 build_path = cons_paths_idx_from_path(bctx, sunit->build_path); dunit->unit_name_string_idx = unit_name; dunit->compiler_name_string_idx = cmp_name; @@ -3141,139 +3141,139 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) // line info (voff -> file*line*col) CONS_LineSequenceNode *first_seq = sunit->line_seq_first; - CONS__UnitLinesCombined *lines = cons__unit_combine_lines(arena, bctx, first_seq); + CONS_UnitLinesCombined *lines = cons_unit_combine_lines(arena, bctx, first_seq); U32 line_count = lines->line_count; if(line_count > 0){ dunit->line_info_voffs_data_idx = - cons__dsection(arena, &dss, lines->voffs, sizeof(U64)*(line_count + 1), - RADDBGI_DataSectionTag_LineInfoVoffs); + cons_dsection(arena, &dss, lines->voffs, sizeof(U64)*(line_count + 1), + RADDBGI_DataSectionTag_LineInfoVoffs); dunit->line_info_data_idx = - cons__dsection(arena, &dss, lines->lines, sizeof(RADDBGI_Line)*line_count, - RADDBGI_DataSectionTag_LineInfoData); + cons_dsection(arena, &dss, lines->lines, sizeof(RADDBGI_Line)*line_count, + RADDBGI_DataSectionTag_LineInfoData); if(lines->cols != 0){ dunit->line_info_col_data_idx = - cons__dsection(arena, &dss, lines->cols, sizeof(RADDBGI_Column)*line_count, - RADDBGI_DataSectionTag_LineInfoColumns); + cons_dsection(arena, &dss, lines->cols, sizeof(RADDBGI_Column)*line_count, + RADDBGI_DataSectionTag_LineInfoColumns); } dunit->line_info_count = line_count; } } - cons__dsection(arena, &dss, units, sizeof(*units)*count, RADDBGI_DataSectionTag_Units); + cons_dsection(arena, &dss, units, sizeof(*units)*count, RADDBGI_DataSectionTag_Units); } // source file line info baking // * pass for "source_combine_line" for each source file - // * can only be run after a pass that does "unit_combine_lines" for each unit. - for(CONS__SrcNode *src_node = bctx->tree->src_first; + for(CONS_SrcNode *src_node = bctx->tree->src_first; src_node != 0; src_node = src_node->next){ - CONS__LineMapFragment *first_fragment = src_node->first_fragment; - CONS__SrcLinesCombined *lines = cons__source_combine_lines(arena, first_fragment); + CONS_LineMapFragment *first_fragment = src_node->first_fragment; + CONS_SrcLinesCombined *lines = cons_source_combine_lines(arena, first_fragment); U32 line_count = lines->line_count; if(line_count > 0){ src_node->line_map_count = line_count; src_node->line_map_nums_data_idx = - cons__dsection(arena, &dss, lines->line_nums, sizeof(*lines->line_nums)*line_count, - RADDBGI_DataSectionTag_LineMapNumbers); + cons_dsection(arena, &dss, lines->line_nums, sizeof(*lines->line_nums)*line_count, + RADDBGI_DataSectionTag_LineMapNumbers); src_node->line_map_range_data_idx = - cons__dsection(arena, &dss, lines->line_ranges, sizeof(*lines->line_ranges)*(line_count + 1), - RADDBGI_DataSectionTag_LineMapRanges); + cons_dsection(arena, &dss, lines->line_ranges, sizeof(*lines->line_ranges)*(line_count + 1), + RADDBGI_DataSectionTag_LineMapRanges); src_node->line_map_voff_data_idx = - cons__dsection(arena, &dss, lines->voffs, sizeof(*lines->voffs)*lines->voff_count, - RADDBGI_DataSectionTag_LineMapVoffs); + cons_dsection(arena, &dss, lines->voffs, sizeof(*lines->voffs)*lines->voff_count, + RADDBGI_DataSectionTag_LineMapVoffs); } } // source file name mapping { - CONS__NameMap* map = cons__name_map_for_kind(root, RADDBGI_NameMapKind_NormalSourcePaths); - for(CONS__SrcNode *src_node = bctx->tree->src_first; + CONS_NameMap* map = cons_name_map_for_kind(root, RADDBGI_NameMapKind_NormalSourcePaths); + for(CONS_SrcNode *src_node = bctx->tree->src_first; src_node != 0; src_node = src_node->next){ if(src_node->idx != 0){ - cons__name_map_add_pair(root, map, src_node->normal_full_path, src_node->idx); + cons_name_map_add_pair(root, map, src_node->normal_full_path, src_node->idx); } } } // unit vmap baking { - CONS__VMap *vmap = cons__vmap_from_unit_ranges(arena, - root->unit_vmap_range_first, - root->unit_vmap_range_count); + CONS_VMap *vmap = cons_vmap_from_unit_ranges(arena, + root->unit_vmap_range_first, + root->unit_vmap_range_count); U64 vmap_size = sizeof(*vmap->vmap)*(vmap->count + 1); - cons__dsection(arena, &dss, vmap->vmap, vmap_size, RADDBGI_DataSectionTag_UnitVmap); + cons_dsection(arena, &dss, vmap->vmap, vmap_size, RADDBGI_DataSectionTag_UnitVmap); } // type info baking { - CONS__TypeData *types = cons__type_data_combine(arena, root, bctx); + CONS_TypeData *types = cons_type_data_combine(arena, root, bctx); U64 type_nodes_size = sizeof(*types->type_nodes)*types->type_node_count; - cons__dsection(arena, &dss, types->type_nodes, type_nodes_size, RADDBGI_DataSectionTag_TypeNodes); + cons_dsection(arena, &dss, types->type_nodes, type_nodes_size, RADDBGI_DataSectionTag_TypeNodes); U64 udt_size = sizeof(*types->udts)*types->udt_count; - cons__dsection(arena, &dss, types->udts, udt_size, RADDBGI_DataSectionTag_UDTs); + cons_dsection(arena, &dss, types->udts, udt_size, RADDBGI_DataSectionTag_UDTs); U64 member_size = sizeof(*types->members)*types->member_count; - cons__dsection(arena, &dss, types->members, member_size, RADDBGI_DataSectionTag_Members); + cons_dsection(arena, &dss, types->members, member_size, RADDBGI_DataSectionTag_Members); U64 enum_member_size = sizeof(*types->enum_members)*types->enum_member_count; - cons__dsection(arena, &dss, types->enum_members, enum_member_size, RADDBGI_DataSectionTag_EnumMembers); + cons_dsection(arena, &dss, types->enum_members, enum_member_size, RADDBGI_DataSectionTag_EnumMembers); } // symbol info baking { - CONS__SymbolData *symbol_data = cons__symbol_data_combine(arena, root, bctx); + CONS_SymbolData *symbol_data = cons_symbol_data_combine(arena, root, bctx); U64 global_variables_size = sizeof(*symbol_data->global_variables)*symbol_data->global_variable_count; - cons__dsection(arena, &dss, symbol_data->global_variables, global_variables_size, - RADDBGI_DataSectionTag_GlobalVariables); + cons_dsection(arena, &dss, symbol_data->global_variables, global_variables_size, + RADDBGI_DataSectionTag_GlobalVariables); - CONS__VMap *global_vmap = symbol_data->global_vmap; + CONS_VMap *global_vmap = symbol_data->global_vmap; U64 global_vmap_size = sizeof(*global_vmap->vmap)*(global_vmap->count + 1); - cons__dsection(arena, &dss, global_vmap->vmap, global_vmap_size, - RADDBGI_DataSectionTag_GlobalVmap); + cons_dsection(arena, &dss, global_vmap->vmap, global_vmap_size, + RADDBGI_DataSectionTag_GlobalVmap); U64 thread_variables_size = sizeof(*symbol_data->thread_variables)*symbol_data->thread_variable_count; - cons__dsection(arena, &dss, symbol_data->thread_variables, thread_variables_size, - RADDBGI_DataSectionTag_ThreadVariables); + cons_dsection(arena, &dss, symbol_data->thread_variables, thread_variables_size, + RADDBGI_DataSectionTag_ThreadVariables); U64 procedures_size = sizeof(*symbol_data->procedures)*symbol_data->procedure_count; - cons__dsection(arena, &dss, symbol_data->procedures, procedures_size, - RADDBGI_DataSectionTag_Procedures); + cons_dsection(arena, &dss, symbol_data->procedures, procedures_size, + RADDBGI_DataSectionTag_Procedures); U64 scopes_size = sizeof(*symbol_data->scopes)*symbol_data->scope_count; - cons__dsection(arena, &dss, symbol_data->scopes, scopes_size, RADDBGI_DataSectionTag_Scopes); + cons_dsection(arena, &dss, symbol_data->scopes, scopes_size, RADDBGI_DataSectionTag_Scopes); U64 scope_voffs_size = sizeof(*symbol_data->scope_voffs)*symbol_data->scope_voff_count; - cons__dsection(arena, &dss, symbol_data->scope_voffs, scope_voffs_size, - RADDBGI_DataSectionTag_ScopeVoffData); + cons_dsection(arena, &dss, symbol_data->scope_voffs, scope_voffs_size, + RADDBGI_DataSectionTag_ScopeVoffData); - CONS__VMap *scope_vmap = symbol_data->scope_vmap; + CONS_VMap *scope_vmap = symbol_data->scope_vmap; U64 scope_vmap_size = sizeof(*scope_vmap->vmap)*(scope_vmap->count + 1); - cons__dsection(arena, &dss, scope_vmap->vmap, scope_vmap_size, RADDBGI_DataSectionTag_ScopeVmap); + cons_dsection(arena, &dss, scope_vmap->vmap, scope_vmap_size, RADDBGI_DataSectionTag_ScopeVmap); U64 local_size = sizeof(*symbol_data->locals)*symbol_data->local_count; - cons__dsection(arena, &dss, symbol_data->locals, local_size, RADDBGI_DataSectionTag_Locals); + cons_dsection(arena, &dss, symbol_data->locals, local_size, RADDBGI_DataSectionTag_Locals); U64 location_blocks_size = sizeof(*symbol_data->location_blocks)*symbol_data->location_block_count; - cons__dsection(arena, &dss, symbol_data->location_blocks, location_blocks_size, - RADDBGI_DataSectionTag_LocationBlocks); + cons_dsection(arena, &dss, symbol_data->location_blocks, location_blocks_size, + RADDBGI_DataSectionTag_LocationBlocks); U64 location_data_size = symbol_data->location_data_size; - cons__dsection(arena, &dss, symbol_data->location_data, location_data_size, - RADDBGI_DataSectionTag_LocationData); + cons_dsection(arena, &dss, symbol_data->location_data, location_data_size, + RADDBGI_DataSectionTag_LocationData); } // name map baking @@ -3289,23 +3289,23 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) RADDBGI_NameMap *name_map_ptr = name_maps; for(U32 i = 0; i < RADDBGI_NameMapKind_COUNT; i += 1){ - CONS__NameMap *map = root->name_maps[i]; + CONS_NameMap *map = root->name_maps[i]; if(map != 0){ - CONS__NameMapBaked *baked = cons__name_map_bake(arena, root, bctx, map); + CONS_NameMapBaked *baked = cons_name_map_bake(arena, root, bctx, map); name_map_ptr->kind = i; name_map_ptr->bucket_data_idx = - cons__dsection(arena, &dss, baked->buckets, sizeof(*baked->buckets)*baked->bucket_count, - RADDBGI_DataSectionTag_NameMapBuckets); + cons_dsection(arena, &dss, baked->buckets, sizeof(*baked->buckets)*baked->bucket_count, + RADDBGI_DataSectionTag_NameMapBuckets); name_map_ptr->node_data_idx = - cons__dsection(arena, &dss, baked->nodes, sizeof(*baked->nodes)*baked->node_count, - RADDBGI_DataSectionTag_NameMapNodes); + cons_dsection(arena, &dss, baked->nodes, sizeof(*baked->nodes)*baked->node_count, + RADDBGI_DataSectionTag_NameMapNodes); name_map_ptr += 1; } } - cons__dsection(arena, &dss, name_maps, sizeof(*name_maps)*name_map_count, - RADDBGI_DataSectionTag_NameMaps); + cons_dsection(arena, &dss, name_maps, sizeof(*name_maps)*name_map_count, + RADDBGI_DataSectionTag_NameMaps); } //////////////////////////////// @@ -3317,10 +3317,10 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) RADDBGI_FilePathNode *nodes = push_array(arena, RADDBGI_FilePathNode, count); RADDBGI_FilePathNode *out_node = nodes; - for(CONS__PathNode *node = bctx->tree->first; + for(CONS_PathNode *node = bctx->tree->first; node != 0; node = node->next_order, out_node += 1){ - out_node->name_string_idx = cons__string(bctx, node->name); + out_node->name_string_idx = cons_string(bctx, node->name); if(node->parent != 0){ out_node->parent_path_node = node->parent->idx; } @@ -3335,7 +3335,7 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) } } - cons__dsection(arena, &dss, nodes, sizeof(*nodes)*count, RADDBGI_DataSectionTag_FilePathNodes); + cons_dsection(arena, &dss, nodes, sizeof(*nodes)*count, RADDBGI_DataSectionTag_FilePathNodes); } // generate data sections for files @@ -3344,18 +3344,18 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) RADDBGI_SourceFile *src_files = push_array(arena, RADDBGI_SourceFile, count); RADDBGI_SourceFile *out_src_file = src_files; - for(CONS__SrcNode *node = bctx->tree->src_first; + for(CONS_SrcNode *node = bctx->tree->src_first; node != 0; node = node->next, out_src_file += 1){ out_src_file->file_path_node_idx = node->path_node->idx; - out_src_file->normal_full_path_string_idx = cons__string(bctx, node->normal_full_path); + out_src_file->normal_full_path_string_idx = cons_string(bctx, node->normal_full_path); out_src_file->line_map_nums_data_idx = node->line_map_nums_data_idx; out_src_file->line_map_range_data_idx = node->line_map_range_data_idx; out_src_file->line_map_count = node->line_map_count; out_src_file->line_map_voff_data_idx = node->line_map_voff_data_idx; } - cons__dsection(arena, &dss, src_files, sizeof(*src_files)*count, RADDBGI_DataSectionTag_SourceFiles); + cons_dsection(arena, &dss, src_files, sizeof(*src_files)*count, RADDBGI_DataSectionTag_SourceFiles); } // generate data sections for strings @@ -3367,7 +3367,7 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) U32 *off_ptr = str_offs; *off_ptr = 0; off_ptr += 1; - for(CONS__StringNode *node = bctx->strs.order_first; + for(CONS_StringNode *node = bctx->strs.order_first; node != 0; node = node->order_next){ off_cursor += node->str.size; @@ -3379,7 +3379,7 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) U8 *buf = push_array(arena, U8, off_cursor); { U8 *ptr = buf; - for(CONS__StringNode *node = bctx->strs.order_first; + for(CONS_StringNode *node = bctx->strs.order_first; node != 0; node = node->order_next){ MemoryCopy(ptr, node->str.str, node->str.size); @@ -3387,9 +3387,9 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) } } - cons__dsection(arena, &dss, str_offs, sizeof(*str_offs)*(bctx->strs.count + 1), - RADDBGI_DataSectionTag_StringTable); - cons__dsection(arena, &dss, buf, off_cursor, RADDBGI_DataSectionTag_StringData); + cons_dsection(arena, &dss, str_offs, sizeof(*str_offs)*(bctx->strs.count + 1), + RADDBGI_DataSectionTag_StringTable); + cons_dsection(arena, &dss, buf, off_cursor, RADDBGI_DataSectionTag_StringData); } // generate data sections for index runs @@ -3399,7 +3399,7 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) { U32 *out_ptr = idx_data; U32 *opl = out_ptr + bctx->idxs.idx_count; - CONS__IdxRunNode *node = bctx->idxs.order_first; + CONS_IdxRunNode *node = bctx->idxs.order_first; for(;node != 0 && out_ptr < opl; node = node->order_next){ MemoryCopy(out_ptr, node->idx_run, sizeof(*node->idx_run)*node->count); @@ -3408,8 +3408,8 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) Assert(out_ptr == opl); } - cons__dsection(arena, &dss, idx_data, sizeof(*idx_data)*bctx->idxs.idx_count, - RADDBGI_DataSectionTag_IndexRuns); + cons_dsection(arena, &dss, idx_data, sizeof(*idx_data)*bctx->idxs.idx_count, + RADDBGI_DataSectionTag_IndexRuns); } // layout @@ -3431,7 +3431,7 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) } { U64 test_dss_count = 0; - for(CONS__DSectionNode *node = dss.first; + for(CONS_DSectionNode *node = dss.first; node != 0; node = node->next){ test_dss_count += 1; @@ -3439,7 +3439,7 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) Assert(test_dss_count == dss.count); RADDBGI_DataSection *ptr = dstable; - for(CONS__DSectionNode *node = dss.first; + for(CONS_DSectionNode *node = dss.first; node != 0; node = node->next, ptr += 1){ U64 data_section_offset = 0; @@ -3458,6 +3458,6 @@ cons_bake_file(Arena *arena, CONS_Root *root, String8List *out) Assert(ptr == dstable + dss.count); } - cons__bake_ctx_release(bctx); + cons_bake_ctx_release(bctx); ProfEnd(); } diff --git a/src/raddbgi_cons/raddbgi_cons.h b/src/raddbgi_cons/raddbgi_cons.h index f1c7e573..e9ab4716 100644 --- a/src/raddbgi_cons/raddbgi_cons.h +++ b/src/raddbgi_cons/raddbgi_cons.h @@ -27,47 +27,47 @@ struct CONS_ErrorList //- rjf: u64 -> pointer map -typedef struct CONS__U64ToPtrNode CONS__U64ToPtrNode; -struct CONS__U64ToPtrNode +typedef struct CONS_U64ToPtrNode CONS_U64ToPtrNode; +struct CONS_U64ToPtrNode { - CONS__U64ToPtrNode *next; + CONS_U64ToPtrNode *next; U64 _padding_; U64 key[1]; void *ptr[1]; }; -typedef struct CONS__U64ToPtrMap CONS__U64ToPtrMap; -struct CONS__U64ToPtrMap +typedef struct CONS_U64ToPtrMap CONS_U64ToPtrMap; +struct CONS_U64ToPtrMap { - CONS__U64ToPtrNode **buckets; + CONS_U64ToPtrNode **buckets; U64 buckets_count; U64 bucket_collision_count; U64 pair_count; }; -typedef struct CONS__U64ToPtrLookup CONS__U64ToPtrLookup; -struct CONS__U64ToPtrLookup +typedef struct CONS_U64ToPtrLookup CONS_U64ToPtrLookup; +struct CONS_U64ToPtrLookup { void *match; - CONS__U64ToPtrNode *fill_node; + CONS_U64ToPtrNode *fill_node; U32 fill_k; }; //- rjf: string8 -> pointer map -typedef struct CONS__Str8ToPtrNode CONS__Str8ToPtrNode; -struct CONS__Str8ToPtrNode +typedef struct CONS_Str8ToPtrNode CONS_Str8ToPtrNode; +struct CONS_Str8ToPtrNode { - struct CONS__Str8ToPtrNode *next; + struct CONS_Str8ToPtrNode *next; String8 key; U64 hash; void *ptr; }; -typedef struct CONS__Str8ToPtrMap CONS__Str8ToPtrMap; -struct CONS__Str8ToPtrMap +typedef struct CONS_Str8ToPtrMap CONS_Str8ToPtrMap; +struct CONS_Str8ToPtrMap { - CONS__Str8ToPtrNode **buckets; + CONS_Str8ToPtrNode **buckets; U64 buckets_count; U64 bucket_collision_count; U64 pair_count; @@ -75,17 +75,17 @@ struct CONS__Str8ToPtrMap //- rjf: sortable range data structure -typedef struct CONS__SortKey CONS__SortKey; -struct CONS__SortKey +typedef struct CONS_SortKey CONS_SortKey; +struct CONS_SortKey { U64 key; void *val; }; -typedef struct CONS__OrderedRange CONS__OrderedRange; -struct CONS__OrderedRange +typedef struct CONS_OrderedRange CONS_OrderedRange; +struct CONS_OrderedRange { - CONS__OrderedRange *next; + CONS_OrderedRange *next; U64 first; U64 opl; }; @@ -314,10 +314,10 @@ struct CONS_Local struct CONS_LocationSet *locset; }; -typedef struct CONS__VOffRange CONS__VOffRange; -struct CONS__VOffRange +typedef struct CONS_VOffRange CONS_VOffRange; +struct CONS_VOffRange { - CONS__VOffRange *next; + CONS_VOffRange *next; U64 voff_first; U64 voff_opl; }; @@ -332,8 +332,8 @@ struct CONS_Scope CONS_Scope *last_child; CONS_Scope *next_sibling; U64 voff_base; - CONS__VOffRange *first_range; - CONS__VOffRange *last_range; + CONS_VOffRange *first_range; + CONS_VOffRange *last_range; U32 range_count; U32 idx; CONS_Local *first_local; @@ -371,10 +371,10 @@ struct CONS_Location CONS_EvalBytecode bytecode; }; -typedef struct CONS__LocationCase CONS__LocationCase; -struct CONS__LocationCase +typedef struct CONS_LocationCase CONS_LocationCase; +struct CONS_LocationCase { - CONS__LocationCase *next; + CONS_LocationCase *next; U64 voff_first; U64 voff_opl; CONS_Location *location; @@ -383,40 +383,40 @@ struct CONS__LocationCase typedef struct CONS_LocationSet CONS_LocationSet; struct CONS_LocationSet { - CONS__LocationCase *first_location_case; - CONS__LocationCase *last_location_case; + CONS_LocationCase *first_location_case; + CONS_LocationCase *last_location_case; U64 location_case_count; }; //////////////////////////////// //~ rjf: Name Map Types -typedef struct CONS__NameMapIdxNode CONS__NameMapIdxNode; -struct CONS__NameMapIdxNode +typedef struct CONS_NameMapIdxNode CONS_NameMapIdxNode; +struct CONS_NameMapIdxNode { - CONS__NameMapIdxNode *next; + CONS_NameMapIdxNode *next; U32 idx[8]; }; -typedef struct CONS__NameMapNode CONS__NameMapNode; -struct CONS__NameMapNode +typedef struct CONS_NameMapNode CONS_NameMapNode; +struct CONS_NameMapNode { - CONS__NameMapNode *bucket_next; - CONS__NameMapNode *order_next; + CONS_NameMapNode *bucket_next; + CONS_NameMapNode *order_next; String8 string; - CONS__NameMapIdxNode *idx_first; - CONS__NameMapIdxNode *idx_last; + CONS_NameMapIdxNode *idx_first; + CONS_NameMapIdxNode *idx_last; U64 idx_count; }; -typedef struct CONS__NameMap CONS__NameMap; -struct CONS__NameMap +typedef struct CONS_NameMap CONS_NameMap; +struct CONS_NameMap { - CONS__NameMapNode **buckets; + CONS_NameMapNode **buckets; U64 buckets_count; U64 bucket_collision_count; - CONS__NameMapNode *first; - CONS__NameMapNode *last; + CONS_NameMapNode *first; + CONS_NameMapNode *last; U64 name_count; }; @@ -513,16 +513,16 @@ struct CONS_Root U64 location_count; // name maps - CONS__NameMap *name_maps[RADDBGI_NameMapKind_COUNT]; + CONS_NameMap *name_maps[RADDBGI_NameMapKind_COUNT]; //////// Handle Relationship Maps - CONS__U64ToPtrMap unit_map; - CONS__U64ToPtrMap symbol_map; - CONS__U64ToPtrMap scope_map; - CONS__U64ToPtrMap local_map; - CONS__U64ToPtrMap type_from_id_map; - CONS__Str8ToPtrMap construct_map; + CONS_U64ToPtrMap unit_map; + CONS_U64ToPtrMap symbol_map; + CONS_U64ToPtrMap scope_map; + CONS_U64ToPtrMap local_map; + CONS_U64ToPtrMap type_from_id_map; + CONS_Str8ToPtrMap construct_map; }; //////////////////////////////// @@ -530,41 +530,41 @@ struct CONS_Root //- rjf: bake data section data structure -typedef struct CONS__DSectionNode CONS__DSectionNode; -struct CONS__DSectionNode +typedef struct CONS_DSectionNode CONS_DSectionNode; +struct CONS_DSectionNode { - CONS__DSectionNode *next; + CONS_DSectionNode *next; void *data; U64 size; RADDBGI_DataSectionTag tag; }; -typedef struct CONS__DSections CONS__DSections; -struct CONS__DSections +typedef struct CONS_DSections CONS_DSections; +struct CONS_DSections { - CONS__DSectionNode *first; - CONS__DSectionNode *last; + CONS_DSectionNode *first; + CONS_DSectionNode *last; U32 count; }; //- rjf: bake string data structure -typedef struct CONS__StringNode CONS__StringNode; -struct CONS__StringNode +typedef struct CONS_StringNode CONS_StringNode; +struct CONS_StringNode { - CONS__StringNode *order_next; - CONS__StringNode *bucket_next; + CONS_StringNode *order_next; + CONS_StringNode *bucket_next; String8 str; U64 hash; U32 idx; }; -typedef struct CONS__Strings CONS__Strings; -struct CONS__Strings +typedef struct CONS_Strings CONS_Strings; +struct CONS_Strings { - CONS__StringNode *order_first; - CONS__StringNode *order_last; - CONS__StringNode **buckets; + CONS_StringNode *order_first; + CONS_StringNode *order_last; + CONS_StringNode **buckets; U64 buckets_count; U64 bucket_collision_count; U32 count; @@ -572,23 +572,23 @@ struct CONS__Strings //- rjf: index run baking data structure -typedef struct CONS__IdxRunNode CONS__IdxRunNode; -struct CONS__IdxRunNode +typedef struct CONS_IdxRunNode CONS_IdxRunNode; +struct CONS_IdxRunNode { - CONS__IdxRunNode *order_next; - CONS__IdxRunNode *bucket_next; + CONS_IdxRunNode *order_next; + CONS_IdxRunNode *bucket_next; U32 *idx_run; U64 hash; U32 count; U32 first_idx; }; -typedef struct CONS__IdxRuns CONS__IdxRuns; -struct CONS__IdxRuns +typedef struct CONS_IdxRuns CONS_IdxRuns; +struct CONS_IdxRuns { - CONS__IdxRunNode *order_first; - CONS__IdxRunNode *order_last; - CONS__IdxRunNode **buckets; + CONS_IdxRunNode *order_first; + CONS_IdxRunNode *order_last; + CONS_IdxRunNode **buckets; U64 buckets_count; U64 bucket_collision_count; U32 count; @@ -597,38 +597,38 @@ struct CONS__IdxRuns //- rjf: source file & file path baking data structures -typedef struct CONS__PathNode CONS__PathNode; -struct CONS__PathNode +typedef struct CONS_PathNode CONS_PathNode; +struct CONS_PathNode { - CONS__PathNode *next_order; - CONS__PathNode *parent; - CONS__PathNode *first_child; - CONS__PathNode *last_child; - CONS__PathNode *next_sibling; + CONS_PathNode *next_order; + CONS_PathNode *parent; + CONS_PathNode *first_child; + CONS_PathNode *last_child; + CONS_PathNode *next_sibling; String8 name; - struct CONS__SrcNode *src_file; + struct CONS_SrcNode *src_file; U32 idx; }; -typedef struct CONS__LineMapFragment CONS__LineMapFragment; -struct CONS__LineMapFragment +typedef struct CONS_LineMapFragment CONS_LineMapFragment; +struct CONS_LineMapFragment { - CONS__LineMapFragment *next; + CONS_LineMapFragment *next; CONS_LineSequenceNode *sequence; }; -typedef struct CONS__SrcNode CONS__SrcNode; -struct CONS__SrcNode +typedef struct CONS_SrcNode CONS_SrcNode; +struct CONS_SrcNode { - CONS__SrcNode *next; - CONS__PathNode *path_node; + CONS_SrcNode *next; + CONS_PathNode *path_node; U32 idx; String8 normal_full_path; // place to gather the line info attached to this src file - CONS__LineMapFragment *first_fragment; - CONS__LineMapFragment *last_fragment; + CONS_LineMapFragment *first_fragment; + CONS_LineMapFragment *last_fragment; // place to put the final baked version of this file's line map U32 line_map_nums_data_idx; @@ -637,22 +637,22 @@ struct CONS__SrcNode U32 line_map_voff_data_idx; }; -typedef struct CONS__PathTree CONS__PathTree; -struct CONS__PathTree +typedef struct CONS_PathTree CONS_PathTree; +struct CONS_PathTree { - CONS__PathNode *first; - CONS__PathNode *last; + CONS_PathNode *first; + CONS_PathNode *last; U32 count; - CONS__PathNode root; - CONS__SrcNode *src_first; - CONS__SrcNode *src_last; + CONS_PathNode root; + CONS_SrcNode *src_first; + CONS_SrcNode *src_last; U32 src_count; }; //- rjf: line info baking data structures -typedef struct CONS__LineRec CONS__LineRec; -struct CONS__LineRec +typedef struct CONS_LineRec CONS_LineRec; +struct CONS_LineRec { U32 file_id; U32 line_num; @@ -660,8 +660,8 @@ struct CONS__LineRec U16 col_opl; }; -typedef struct CONS__UnitLinesCombined CONS__UnitLinesCombined; -struct CONS__UnitLinesCombined +typedef struct CONS_UnitLinesCombined CONS_UnitLinesCombined; +struct CONS_UnitLinesCombined { U64 *voffs; RADDBGI_Line *lines; @@ -669,8 +669,8 @@ struct CONS__UnitLinesCombined U32 line_count; }; -typedef struct CONS__SrcLinesCombined CONS__SrcLinesCombined; -struct CONS__SrcLinesCombined +typedef struct CONS_SrcLinesCombined CONS_SrcLinesCombined; +struct CONS_SrcLinesCombined { U32 *line_nums; U32 *line_ranges; @@ -679,51 +679,51 @@ struct CONS__SrcLinesCombined U32 voff_count; }; -typedef struct CONS__SrcLineMapVoffBlock CONS__SrcLineMapVoffBlock; -struct CONS__SrcLineMapVoffBlock +typedef struct CONS_SrcLineMapVoffBlock CONS_SrcLineMapVoffBlock; +struct CONS_SrcLineMapVoffBlock { - CONS__SrcLineMapVoffBlock *next; + CONS_SrcLineMapVoffBlock *next; U64 voff; }; -typedef struct CONS__SrcLineMapBucket CONS__SrcLineMapBucket; -struct CONS__SrcLineMapBucket +typedef struct CONS_SrcLineMapBucket CONS_SrcLineMapBucket; +struct CONS_SrcLineMapBucket { - CONS__SrcLineMapBucket *order_next; - CONS__SrcLineMapBucket *hash_next; + CONS_SrcLineMapBucket *order_next; + CONS_SrcLineMapBucket *hash_next; U32 line_num; - CONS__SrcLineMapVoffBlock *first_voff_block; - CONS__SrcLineMapVoffBlock *last_voff_block; + CONS_SrcLineMapVoffBlock *first_voff_block; + CONS_SrcLineMapVoffBlock *last_voff_block; U64 voff_count; }; //- rjf: vmap baking data structure -typedef struct CONS__VMap CONS__VMap; -struct CONS__VMap +typedef struct CONS_VMap CONS_VMap; +struct CONS_VMap { RADDBGI_VMapEntry *vmap; // [count + 1] U32 count; }; -typedef struct CONS__VMapMarker CONS__VMapMarker; -struct CONS__VMapMarker +typedef struct CONS_VMapMarker CONS_VMapMarker; +struct CONS_VMapMarker { U32 idx; U32 begin_range; }; -typedef struct CONS__VMapRangeTracker CONS__VMapRangeTracker; -struct CONS__VMapRangeTracker +typedef struct CONS_VMapRangeTracker CONS_VMapRangeTracker; +struct CONS_VMapRangeTracker { - CONS__VMapRangeTracker *next; + CONS_VMapRangeTracker *next; U32 idx; }; //- rjf: type data baking types -typedef struct CONS__TypeData CONS__TypeData; -struct CONS__TypeData +typedef struct CONS_TypeData CONS_TypeData; +struct CONS_TypeData { RADDBGI_TypeNode *type_nodes; U32 type_node_count; @@ -740,13 +740,13 @@ struct CONS__TypeData //- rjf: symbol data baking types -typedef struct CONS__SymbolData CONS__SymbolData; -struct CONS__SymbolData +typedef struct CONS_SymbolData CONS_SymbolData; +struct CONS_SymbolData { RADDBGI_GlobalVariable *global_variables; U32 global_variable_count; - CONS__VMap *global_vmap; + CONS_VMap *global_vmap; RADDBGI_ThreadVariable *thread_variables; U32 thread_variable_count; @@ -760,7 +760,7 @@ struct CONS__SymbolData U64 *scope_voffs; U32 scope_voff_count; - CONS__VMap *scope_vmap; + CONS_VMap *scope_vmap; RADDBGI_Local *locals; U32 local_count; @@ -774,23 +774,23 @@ struct CONS__SymbolData //- rjf: name map baking types -typedef struct CONS__NameMapSemiNode CONS__NameMapSemiNode; -struct CONS__NameMapSemiNode +typedef struct CONS_NameMapSemiNode CONS_NameMapSemiNode; +struct CONS_NameMapSemiNode { - CONS__NameMapSemiNode *next; - CONS__NameMapNode *node; + CONS_NameMapSemiNode *next; + CONS_NameMapNode *node; }; -typedef struct CONS__NameMapSemiBucket CONS__NameMapSemiBucket; -struct CONS__NameMapSemiBucket +typedef struct CONS_NameMapSemiBucket CONS_NameMapSemiBucket; +struct CONS_NameMapSemiBucket { - CONS__NameMapSemiNode *first; - CONS__NameMapSemiNode *last; + CONS_NameMapSemiNode *first; + CONS_NameMapSemiNode *last; U64 count; }; -typedef struct CONS__NameMapBaked CONS__NameMapBaked; -struct CONS__NameMapBaked +typedef struct CONS_NameMapBaked CONS_NameMapBaked; +struct CONS_NameMapBaked { RADDBGI_NameMapBucket *buckets; RADDBGI_NameMapNode *nodes; @@ -800,20 +800,20 @@ struct CONS__NameMapBaked //- rjf: bundle baking context type -typedef struct CONS__BakeParams CONS__BakeParams; -struct CONS__BakeParams +typedef struct CONS_BakeParams CONS_BakeParams; +struct CONS_BakeParams { U64 strings_bucket_count; U64 idx_runs_bucket_count; }; -typedef struct CONS__BakeCtx CONS__BakeCtx; -struct CONS__BakeCtx +typedef struct CONS_BakeCtx CONS_BakeCtx; +struct CONS_BakeCtx { Arena *arena; - CONS__Strings strs; - CONS__IdxRuns idxs; - CONS__PathTree *tree; + CONS_Strings strs; + CONS_IdxRuns idxs; + CONS_PathTree *tree; }; //////////////////////////////// @@ -829,20 +829,20 @@ static void cons_bytecode_push_sconst(Arena *arena, CONS_EvalBytecode *bytecode, static void cons_bytecode_concat_in_place(CONS_EvalBytecode *left_dst, CONS_EvalBytecode *right_destroyed); //- rjf: sortable range sorting -static CONS__SortKey* cons__sort_key_array(Arena *arena, CONS__SortKey *keys, U64 count); +static CONS_SortKey* cons_sort_key_array(Arena *arena, CONS_SortKey *keys, U64 count); //////////////////////////////// //~ rjf: Auxiliary Data Structure Functions //- rjf: u64 -> ptr map -static void cons__u64toptr_init(Arena *arena, CONS__U64ToPtrMap *map, U64 bucket_count); -static void cons__u64toptr_lookup(CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrLookup *lookup_out); -static void cons__u64toptr_insert(Arena *arena, CONS__U64ToPtrMap *map, U64 key, U64 hash, CONS__U64ToPtrLookup *lookup, void *ptr); +static void cons_u64toptr_init(Arena *arena, CONS_U64ToPtrMap *map, U64 bucket_count); +static void cons_u64toptr_lookup(CONS_U64ToPtrMap *map, U64 key, U64 hash, CONS_U64ToPtrLookup *lookup_out); +static void cons_u64toptr_insert(Arena *arena, CONS_U64ToPtrMap *map, U64 key, U64 hash, CONS_U64ToPtrLookup *lookup, void *ptr); //- rjf: string8 -> ptr map -static void cons__str8toptr_init(Arena *arena, CONS__Str8ToPtrMap *map, U64 bucket_count); -static void*cons__str8toptr_lookup(CONS__Str8ToPtrMap *map, String8 key, U64 hash); -static void cons__str8toptr_insert(Arena *arena, CONS__Str8ToPtrMap *map, String8 key, U64 hash, void *ptr); +static void cons_str8toptr_init(Arena *arena, CONS_Str8ToPtrMap *map, U64 bucket_count); +static void*cons_str8toptr_lookup(CONS_Str8ToPtrMap *map, String8 key, U64 hash); +static void cons_str8toptr_insert(Arena *arena, CONS_Str8ToPtrMap *map, String8 key, U64 hash, void *ptr); //////////////////////////////// //~ rjf: Loose Debug Info Construction (Anything -> Loose) Functions @@ -884,9 +884,9 @@ static CONS_Type* cons_type_nil(CONS_Root *root); static CONS_Type* cons_type_variadic(CONS_Root *root); //- rjf: base type info constructors -static CONS_Type* cons__type_new(CONS_Root *root); -static CONS_TypeUDT* cons__type_udt_from_any_type(CONS_Root *root, CONS_Type *type); -static CONS_TypeUDT* cons__type_udt_from_record_type(CONS_Root *root, CONS_Type *type); +static CONS_Type* cons_type_new(CONS_Root *root); +static CONS_TypeUDT* cons_type_udt_from_any_type(CONS_Root *root, CONS_Type *type); +static CONS_TypeUDT* cons_type_udt_from_record_type(CONS_Root *root, CONS_Type *type); //- rjf: basic/operator type construction helpers static CONS_Type* cons_type_basic(CONS_Root *root, RADDBGI_TypeKind type_kind, String8 name); @@ -925,7 +925,7 @@ static void cons_symbol_set_info(CONS_Root *root, CONS_Symbol *symbol, CONS_Symb static CONS_Scope *cons_scope_handle_from_user_id(CONS_Root *root, U64 scope_user_id, U64 scope_user_id_hash); static void cons_scope_set_parent(CONS_Root *root, CONS_Scope *scope, CONS_Scope *parent); static void cons_scope_add_voff_range(CONS_Root *root, CONS_Scope *scope, U64 voff_first, U64 voff_opl); -static void cons__scope_recursive_set_symbol(CONS_Scope *scope, CONS_Symbol *symbol); +static void cons_scope_recursive_set_symbol(CONS_Scope *scope, CONS_Symbol *symbol); //- rjf: local info building static CONS_Local* cons_local_handle_from_user_id(CONS_Root *root, U64 local_user_id, U64 local_user_id_hash); @@ -941,55 +941,55 @@ static CONS_Location* cons_location_addr_addr_reg_plus_u16(CONS_Root *root, U8 r static CONS_Location* cons_location_val_reg(CONS_Root *root, U8 reg_code); //- rjf: name map building -static CONS__NameMap* cons__name_map_for_kind(CONS_Root *root, RADDBGI_NameMapKind kind); -static void cons__name_map_add_pair(CONS_Root *root, CONS__NameMap *map, String8 name, U32 idx); +static CONS_NameMap* cons_name_map_for_kind(CONS_Root *root, RADDBGI_NameMapKind kind); +static void cons_name_map_add_pair(CONS_Root *root, CONS_NameMap *map, String8 name, U32 idx); //////////////////////////////// //~ rjf: Debug Info Baking (Loose -> Tight) Functions //- rjf: bake context construction -static CONS__BakeCtx* cons__bake_ctx_begin(CONS__BakeParams *params); -static void cons__bake_ctx_release(CONS__BakeCtx *bake_ctx); +static CONS_BakeCtx* cons_bake_ctx_begin(CONS_BakeParams *params); +static void cons_bake_ctx_release(CONS_BakeCtx *bake_ctx); //- rjf: string baking -static U32 cons__string(CONS__BakeCtx *bctx, String8 str); +static U32 cons_string(CONS_BakeCtx *bctx, String8 str); //- rjf: idx run baking -static U64 cons__idx_run_hash(U32 *idx_run, U32 count); -static U32 cons__idx_run(CONS__BakeCtx *bctx, U32 *idx_run, U32 count); +static U64 cons_idx_run_hash(U32 *idx_run, U32 count); +static U32 cons_idx_run(CONS_BakeCtx *bctx, U32 *idx_run, U32 count); //- rjf: data section baking -static U32 cons__dsection(Arena *arena, CONS__DSections *dss, void *data, U64 size, RADDBGI_DataSectionTag tag); +static U32 cons_dsection(Arena *arena, CONS_DSections *dss, void *data, U64 size, RADDBGI_DataSectionTag tag); //- rjf: paths baking -static String8 cons__normal_string_from_path_node(Arena *arena, CONS__PathNode *node); -static void cons__normal_string_from_path_node_build(Arena *arena, CONS__PathNode *node, String8List *out); -static CONS__PathNode* cons__paths_new_node(CONS__BakeCtx *bctx); -static CONS__PathNode* cons__paths_sub_path(CONS__BakeCtx *bctx, CONS__PathNode *dir, String8 sub_dir); -static CONS__PathNode* cons__paths_node_from_path(CONS__BakeCtx *bctx, String8 path); -static U32 cons__paths_idx_from_path(CONS__BakeCtx *bctx, String8 path); -static CONS__SrcNode* cons__paths_new_src_node(CONS__BakeCtx *bctx); -static CONS__SrcNode* cons__paths_src_node_from_path_node(CONS__BakeCtx *bctx, CONS__PathNode *path_node); +static String8 cons_normal_string_from_path_node(Arena *arena, CONS_PathNode *node); +static void cons_normal_string_from_path_node_build(Arena *arena, CONS_PathNode *node, String8List *out); +static CONS_PathNode* cons_paths_new_node(CONS_BakeCtx *bctx); +static CONS_PathNode* cons_paths_sub_path(CONS_BakeCtx *bctx, CONS_PathNode *dir, String8 sub_dir); +static CONS_PathNode* cons_paths_node_from_path(CONS_BakeCtx *bctx, String8 path); +static U32 cons_paths_idx_from_path(CONS_BakeCtx *bctx, String8 path); +static CONS_SrcNode* cons_paths_new_src_node(CONS_BakeCtx *bctx); +static CONS_SrcNode* cons_paths_src_node_from_path_node(CONS_BakeCtx *bctx, CONS_PathNode *path_node); //- rjf: per-unit line info baking -static CONS__UnitLinesCombined* cons__unit_combine_lines(Arena *arena, CONS__BakeCtx *bctx, CONS_LineSequenceNode *first_seq); +static CONS_UnitLinesCombined* cons_unit_combine_lines(Arena *arena, CONS_BakeCtx *bctx, CONS_LineSequenceNode *first_seq); //- rjf: per-src line info baking -static CONS__SrcLinesCombined* cons__source_combine_lines(Arena *arena, CONS__LineMapFragment *first); +static CONS_SrcLinesCombined* cons_source_combine_lines(Arena *arena, CONS_LineMapFragment *first); //- rjf: vmap baking -static CONS__VMap* cons__vmap_from_markers(Arena *arena, CONS__VMapMarker *markers, CONS__SortKey *keys, U64 marker_count); -static CONS__VMap* cons__vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count); +static CONS_VMap* cons_vmap_from_markers(Arena *arena, CONS_VMapMarker *markers, CONS_SortKey *keys, U64 marker_count); +static CONS_VMap* cons_vmap_from_unit_ranges(Arena *arena, CONS_UnitVMapRange *first, U64 count); //- rjf: type info baking -static U32* cons__idx_run_from_types(Arena *arena, CONS_Type **types, U32 count); -static CONS__TypeData* cons__type_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx); +static U32* cons_idx_run_from_types(Arena *arena, CONS_Type **types, U32 count); +static CONS_TypeData* cons_type_data_combine(Arena *arena, CONS_Root *root, CONS_BakeCtx *bctx); //- rjf: symbol data baking -static CONS__SymbolData* cons__symbol_data_combine(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx); +static CONS_SymbolData* cons_symbol_data_combine(Arena *arena, CONS_Root *root, CONS_BakeCtx *bctx); //- rjf: name map baking -static CONS__NameMapBaked* cons__name_map_bake(Arena *arena, CONS_Root *root, CONS__BakeCtx *bctx, CONS__NameMap *map); +static CONS_NameMapBaked* cons_name_map_bake(Arena *arena, CONS_Root *root, CONS_BakeCtx *bctx, CONS_NameMap *map); //- rjf: top-level baking entry point static void cons_bake_file(Arena *arena, CONS_Root *root, String8List *out);