eliminate all old conversion/baking code

This commit is contained in:
Ryan Fleury
2025-09-05 17:02:56 -07:00
parent 78530fb10d
commit 51ef166e60
17 changed files with 3149 additions and 10431 deletions
+109 -2408
View File
File diff suppressed because it is too large Load Diff
+26 -210
View File
@@ -656,7 +656,7 @@ struct RDIM_UnitChunkList
//~ rjf: Type System Node Types
typedef RDI_U32 RDIM_DataModel;
enum RDIM_DataModelEnum
typedef enum RDIM_DataModelEnum
{
RDIM_DataModel_Null,
RDIM_DataModel_ILP32,
@@ -664,7 +664,8 @@ enum RDIM_DataModelEnum
RDIM_DataModel_LP64,
RDIM_DataModel_ILP64,
RDIM_DataModel_SILP64
};
}
RDIM_DataModelEnum;
typedef struct RDIM_Type RDIM_Type;
struct RDIM_Type
@@ -814,8 +815,8 @@ struct RDIM_LocationInfo
RDIM_EvalBytecode bytecode;
};
typedef struct RDIM_Location2 RDIM_Location2;
struct RDIM_Location2
typedef struct RDIM_Location RDIM_Location;
struct RDIM_Location
{
struct RDIM_LocationChunkNode *chunk;
RDIM_LocationInfo info;
@@ -826,7 +827,7 @@ typedef struct RDIM_LocationChunkNode RDIM_LocationChunkNode;
struct RDIM_LocationChunkNode
{
RDIM_LocationChunkNode *next;
RDIM_Location2 *v;
RDIM_Location *v;
RDI_U64 count;
RDI_U64 cap;
RDI_U64 base_idx;
@@ -846,51 +847,22 @@ struct RDIM_LocationChunkList
//- rjf: location cases
typedef struct RDIM_LocationCase2 RDIM_LocationCase2;
struct RDIM_LocationCase2
typedef struct RDIM_LocationCase RDIM_LocationCase;
struct RDIM_LocationCase
{
RDIM_LocationCase2 *next;
RDIM_Location2 *location;
RDIM_LocationCase *next;
RDIM_Location *location;
RDIM_Rng1U64 voff_range;
};
typedef struct RDIM_LocationCaseList RDIM_LocationCaseList;
struct RDIM_LocationCaseList
{
RDIM_LocationCase2 *first;
RDIM_LocationCase2 *last;
RDIM_LocationCase *first;
RDIM_LocationCase *last;
RDI_U64 count;
};
//- rjf: locations (OLD)
typedef struct RDIM_Location RDIM_Location;
struct RDIM_Location
{
RDI_LocationKind kind;
RDI_U8 reg_code;
RDI_U16 offset;
RDIM_EvalBytecode bytecode;
};
//- rjf: location case types (location * voff range) (OLD)
typedef struct RDIM_LocationCase RDIM_LocationCase;
struct RDIM_LocationCase
{
RDIM_LocationCase *next;
RDIM_Rng1U64 voff_range;
RDIM_Location *location;
};
typedef struct RDIM_LocationSet RDIM_LocationSet;
struct RDIM_LocationSet
{
RDIM_LocationCase *first_location_case;
RDIM_LocationCase *last_location_case;
RDI_U64 location_case_count;
};
////////////////////////////////
//~ rjf: Symbol Info Types
@@ -906,7 +878,6 @@ struct RDIM_Symbol
RDIM_Symbol *container_symbol;
RDIM_Type *container_type;
struct RDIM_Scope *root_scope;
RDIM_LocationSet frame_base;
RDIM_LocationCaseList location_cases;
RDIM_String8 value_data;
};
@@ -973,7 +944,6 @@ struct RDIM_Local
RDI_LocalKind kind;
RDIM_String8 name;
RDIM_Type *type;
RDIM_LocationSet locset;
RDIM_LocationCaseList location_cases;
};
@@ -1163,39 +1133,14 @@ struct RDIM_BakeIdxRunMapLoose
RDI_U64 *slots_idx_counts;
};
typedef struct RDIM_BakeIdxRunMap2 RDIM_BakeIdxRunMap2;
struct RDIM_BakeIdxRunMap2
typedef struct RDIM_BakeIdxRunMap RDIM_BakeIdxRunMap;
struct RDIM_BakeIdxRunMap
{
RDIM_BakeIdxRunChunkList *slots;
RDI_U64 *slots_base_idxs; // NOTE(rjf): [slots_count+1], [slots_count] holds total count
RDI_U64 slots_count;
};
//- rjf: index runs (OLD)
typedef struct RDIM_BakeIdxRunNode RDIM_BakeIdxRunNode;
struct RDIM_BakeIdxRunNode
{
RDIM_BakeIdxRunNode *hash_next;
RDIM_BakeIdxRunNode *order_next;
RDI_U32 *idx_run;
RDI_U64 hash;
RDI_U32 count;
RDI_U32 first_idx;
};
typedef struct RDIM_BakeIdxRunMap RDIM_BakeIdxRunMap;
struct RDIM_BakeIdxRunMap
{
RDIM_BakeIdxRunNode *order_first;
RDIM_BakeIdxRunNode *order_last;
RDIM_BakeIdxRunNode **slots;
RDI_U64 slots_count;
RDI_U64 slot_collision_count;
RDI_U32 count;
RDI_U32 idx_count;
};
//- rjf: source info & path tree
typedef struct RDIM_BakePathNode RDIM_BakePathNode;
@@ -1262,41 +1207,10 @@ struct RDIM_BakeNameMapTopology
RDI_U64 slots_count;
};
typedef struct RDIM_BakeNameMap2 RDIM_BakeNameMap2;
struct RDIM_BakeNameMap2
{
RDIM_BakeNameChunkList **slots;
};
//- rjf: name maps (OLD)
typedef struct RDIM_BakeNameMapValNode RDIM_BakeNameMapValNode;
struct RDIM_BakeNameMapValNode
{
RDIM_BakeNameMapValNode *next;
RDI_U32 val[6];
};
typedef struct RDIM_BakeNameMapNode RDIM_BakeNameMapNode;
struct RDIM_BakeNameMapNode
{
RDIM_BakeNameMapNode *slot_next;
RDIM_BakeNameMapNode *order_next;
RDIM_String8 string;
RDIM_BakeNameMapValNode *val_first;
RDIM_BakeNameMapValNode *val_last;
RDI_U64 val_count;
};
typedef struct RDIM_BakeNameMap RDIM_BakeNameMap;
struct RDIM_BakeNameMap
{
RDIM_BakeNameMapNode **slots;
RDI_U64 slots_count;
RDI_U64 slot_collision_count;
RDIM_BakeNameMapNode *first;
RDIM_BakeNameMapNode *last;
RDI_U64 name_count;
RDIM_BakeNameChunkList **slots;
};
//- rjf: vmaps
@@ -1645,7 +1559,7 @@ RDI_PROC void rdim_rng1u64_list_push(RDIM_Arena *arena, RDIM_Rng1U64List *list,
RDI_PROC void rdim_rng1u64_chunk_list_push(RDIM_Arena *arena, RDIM_Rng1U64ChunkList *list, RDI_U64 chunk_cap, RDIM_Rng1U64 r);
////////////////////////////////
//~ Data Model
//~ rjf: [Building] Data Model
RDI_PROC RDI_TypeKind rdim_short_type_kind_from_data_model(RDIM_DataModel data_model);
RDI_PROC RDI_TypeKind rdim_unsigned_short_type_kind_from_data_model(RDIM_DataModel data_model);
@@ -1726,40 +1640,19 @@ RDI_PROC void rdim_bytecode_concat_in_place(RDIM_EvalBytecode *left_dst, RDIM_Ev
//- rjf: locations
RDI_PROC RDI_U64 rdim_encoded_size_from_location_info(RDIM_LocationInfo *info);
RDI_PROC RDIM_Location2 *rdim_location_chunk_list_push_new(RDIM_Arena *arena, RDIM_LocationChunkList *list, RDI_U64 cap, RDIM_LocationInfo *info);
RDI_PROC RDI_U64 rdim_idx_from_location(RDIM_Location2 *location);
RDI_PROC RDI_U64 rdim_off_from_location(RDIM_Location2 *location);
RDI_PROC RDIM_Location *rdim_location_chunk_list_push_new(RDIM_Arena *arena, RDIM_LocationChunkList *list, RDI_U64 cap, RDIM_LocationInfo *info);
RDI_PROC RDI_U64 rdim_off_from_location(RDIM_Location *location);
RDI_PROC void rdim_location_chunk_list_concat_in_place(RDIM_LocationChunkList *dst, RDIM_LocationChunkList *to_push);
////////////////////////////////
//~ rjf: [Building] Scope Info Building
//- rjf: scopes
RDI_PROC RDIM_Scope *rdim_scope_chunk_list_push(RDIM_Arena *arena, RDIM_ScopeChunkList *list, RDI_U64 cap);
RDI_PROC RDI_U64 rdim_idx_from_scope(RDIM_Scope *scope);
RDI_PROC void rdim_scope_chunk_list_concat_in_place(RDIM_ScopeChunkList *dst, RDIM_ScopeChunkList *to_push);
RDI_PROC void rdim_scope_push_voff_range(RDIM_Arena *arena, RDIM_ScopeChunkList *list, RDIM_Scope *scope, RDIM_Rng1U64 range);
RDI_PROC RDIM_Local *rdim_scope_push_local(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *scope);
RDI_PROC RDIM_LocationCase2 *rdim_local_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location2 *location, RDIM_Rng1U64 voff_range);
//- rjf: individual locations
RDI_PROC RDIM_Location *rdim_push_location_addr_bytecode_stream(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode);
RDI_PROC RDIM_Location *rdim_push_location_val_bytecode_stream(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode);
RDI_PROC RDIM_Location *rdim_push_location_addr_reg_plus_u16(RDIM_Arena *arena, RDI_U8 reg_code, RDI_U16 offset);
RDI_PROC RDIM_Location *rdim_push_location_addr_addr_reg_plus_u16(RDIM_Arena *arena, RDI_U8 reg_code, RDI_U16 offset);
RDI_PROC RDIM_Location *rdim_push_location_val_reg(RDIM_Arena *arena, RDI_U8 reg_code);
//- rjf: location sets
RDI_PROC void rdim_location_set_push_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationSet *locset, RDIM_Rng1U64 voff_range, RDIM_Location *location);
//- rjf: location block chunk list
RDI_PROC RDI_LocationBlock *rdim_location_block_chunk_list_push_array(RDIM_Arena *arena, RDIM_String8List *list, RDI_U32 count);
RDI_PROC RDI_U32 rdim_count_from_location_block_chunk_list(RDIM_String8List *list);
////////////////////////////////
//~ rjf: [Baking Helpers] Baked VMap Building
RDI_PROC RDIM_BakeVMap rdim_bake_vmap_from_markers(RDIM_Arena *arena, RDIM_VMapMarker *markers, RDIM_SortKey *keys, RDI_U64 marker_count);
RDI_PROC RDIM_LocationCase *rdim_local_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *location, RDIM_Rng1U64 voff_range);
////////////////////////////////
//~ rjf: [Baking Helpers] Deduplicated String Baking Map
@@ -1772,16 +1665,17 @@ RDI_PROC RDIM_BakeStringChunkList rdim_bake_string_chunk_list_sorted_from_unsort
//- rjf: loose map
RDI_PROC RDIM_BakeStringMapLoose *rdim_bake_string_map_loose_make(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top);
RDI_PROC void rdim_bake_string_map_loose_insert(RDIM_Arena *arena, RDIM_BakeStringMapTopology *map_topology, RDIM_BakeStringMapLoose *map, RDI_U64 chunk_cap, RDIM_String8 string);
RDI_PROC void rdim_bake_string_map_loose_join_in_place(RDIM_BakeStringMapTopology *map_topology, RDIM_BakeStringMapLoose *dst, RDIM_BakeStringMapLoose *src);
RDI_PROC RDIM_BakeStringMapBaseIndices rdim_bake_string_map_base_indices_from_map_loose(RDIM_Arena *arena, RDIM_BakeStringMapTopology *map_topology, RDIM_BakeStringMapLoose *map);
//- rjf: finalized / tight map
RDI_PROC RDIM_BakeStringMapTight rdim_bake_string_map_tight_from_loose(RDIM_Arena *arena, RDIM_BakeStringMapTopology *map_topology, RDIM_BakeStringMapBaseIndices *map_base_indices, RDIM_BakeStringMapLoose *map);
RDI_PROC RDI_U32 rdim_bake_idx_from_string(RDIM_BakeStringMapTight *map, RDIM_String8 string);
////////////////////////////////
//~ rjf: [Baking Helpers] Deduplicated Index Run Baking Map
//- rjf: bake idx run map reading/writing
RDI_PROC RDI_U64 rdim_hash_from_idx_run(RDI_U32 *idx_run, RDI_U32 count);
//- rjf: chunk lists
RDI_PROC RDIM_BakeIdxRun *rdim_bake_idx_run_chunk_list_push(RDIM_Arena *arena, RDIM_BakeIdxRunChunkList *list, RDI_U64 cap);
RDI_PROC void rdim_bake_idx_run_chunk_list_concat_in_place(RDIM_BakeIdxRunChunkList *dst, RDIM_BakeIdxRunChunkList *to_push);
@@ -1792,7 +1686,7 @@ RDI_PROC RDIM_BakeIdxRunMapLoose *rdim_bake_idx_run_map_loose_make(RDIM_Arena *a
RDI_PROC void rdim_bake_idx_run_map_loose_insert(RDIM_Arena *arena, RDIM_BakeIdxRunMapTopology *map_topology, RDIM_BakeIdxRunMapLoose *map, RDI_U64 chunk_cap, RDI_U32 *idxes, RDI_U32 count);
//- rjf: finalized / tight map
RDI_PROC RDI_U32 rdim_bake_idx_from_idx_run_2(RDIM_BakeIdxRunMap2 *map, RDI_U32 *idxes, RDI_U32 count);
RDI_PROC RDI_U32 rdim_bake_idx_from_idx_run(RDIM_BakeIdxRunMap *map, RDI_U32 *idxes, RDI_U32 count);
////////////////////////////////
//~ rjf: [Baking Helpers] Deduplicated Name Map Baking Map
@@ -1803,26 +1697,16 @@ RDI_PROC void rdim_bake_name_chunk_list_concat_in_place(RDIM_BakeNameChunkList *
RDI_PROC RDIM_BakeNameChunkList rdim_bake_name_chunk_list_sorted_from_unsorted(RDIM_Arena *arena, RDIM_BakeNameChunkList *src);
//- rjf: bake name chunk list maps
RDI_PROC RDIM_BakeNameMap2 *rdim_bake_name_map_2_make(RDIM_Arena *arena, RDIM_BakeNameMapTopology *top);
RDI_PROC void rdim_bake_name_map_2_insert(RDIM_Arena *arena, RDIM_BakeNameMapTopology *map_topology, RDIM_BakeNameMap2 *map, RDI_U64 chunk_cap, RDIM_String8 string, RDI_U64 idx);
RDI_PROC RDIM_BakeNameMap *rdim_bake_name_map_make(RDIM_Arena *arena, RDIM_BakeNameMapTopology *top);
RDI_PROC void rdim_bake_name_map_insert(RDIM_Arena *arena, RDIM_BakeNameMapTopology *map_topology, RDIM_BakeNameMap *map, RDI_U64 chunk_cap, RDIM_String8 string, RDI_U64 idx);
////////////////////////////////
//~ rjf: [Baking Helpers] Interned / Deduplicated Blob Data Structure Helpers
//~ rjf: [Baking Helpers] Deduplicated Path Baking Tree
//- rjf: bake idx run map reading/writing
RDI_PROC RDI_U64 rdim_hash_from_idx_run(RDI_U32 *idx_run, RDI_U32 count);
RDI_PROC RDI_U32 rdim_bake_idx_from_idx_run(RDIM_BakeIdxRunMap *map, RDI_U32 *idx_run, RDI_U32 count);
RDI_PROC RDI_U32 rdim_bake_idx_run_map_insert(RDIM_Arena *arena, RDIM_BakeIdxRunMap *map, RDI_U32 *idx_run, RDI_U32 count);
//- rjf: bake path tree reading/writing
RDI_PROC RDIM_BakePathNode *rdim_bake_path_node_from_string(RDIM_BakePathTree *tree, RDIM_String8 string);
RDI_PROC RDI_U32 rdim_bake_path_node_idx_from_string(RDIM_BakePathTree *tree, RDIM_String8 string);
RDI_PROC RDIM_BakePathNode *rdim_bake_path_tree_insert(RDIM_Arena *arena, RDIM_BakePathTree *tree, RDIM_String8 string);
//- rjf: bake name maps writing
RDI_PROC RDIM_BakeNameMap *rdim_bake_name_map_make(RDIM_Arena *arena, RDI_U64 expected_count);
RDI_PROC void rdim_bake_name_map_push(RDIM_Arena *arena, RDIM_BakeNameMap *map, RDIM_String8 string, RDI_U32 idx);
////////////////////////////////
//~ rjf: [Baking Helpers] Data Section List Building Helpers
@@ -1830,74 +1714,6 @@ RDI_PROC RDIM_BakeSection *rdim_bake_section_list_push(RDIM_Arena *arena, RDIM_B
RDI_PROC RDIM_BakeSection *rdim_bake_section_list_push_new_unpacked(RDIM_Arena *arena, RDIM_BakeSectionList *list, void *data, RDI_U64 size, RDI_SectionKind tag, RDI_U64 tag_idx);
RDI_PROC void rdim_bake_section_list_concat_in_place(RDIM_BakeSectionList *dst, RDIM_BakeSectionList *to_push);
////////////////////////////////
//~ rjf: [Baking] Build Artifacts -> Interned/Deduplicated Data Structures
//- rjf: basic bake string gathering passes
RDI_PROC void rdim_bake_string_map_loose_push_top_level_info(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_TopLevelInfo *tli);
RDI_PROC void rdim_bake_string_map_loose_push_binary_sections(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_BinarySectionList *secs);
RDI_PROC void rdim_bake_string_map_loose_push_path_tree(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_BakePathTree *path_tree);
//- rjf: slice-granularity bake string gathering passes
RDI_PROC void rdim_bake_string_map_loose_push_src_file_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_SrcFile *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_unit_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_Unit *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_type_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_Type *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_udt_member_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_UDTMember *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_udt_enum_val_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_UDTEnumVal *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_udt_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_UDT *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_symbol_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_Symbol *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_inline_site_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_InlineSite *v, RDI_U64 count);
RDI_PROC void rdim_bake_string_map_loose_push_scope_slice(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_Scope *v, RDI_U64 count);
//- rjf: list-granularity bake string gathering passes
RDI_PROC void rdim_bake_string_map_loose_push_src_files(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_SrcFileChunkList *list);
RDI_PROC void rdim_bake_string_map_loose_push_units(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_UnitChunkList *list);
RDI_PROC void rdim_bake_string_map_loose_push_types(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_TypeChunkList *list);
RDI_PROC void rdim_bake_string_map_loose_push_udts(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_UDTChunkList *list);
RDI_PROC void rdim_bake_string_map_loose_push_symbols(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_SymbolChunkList *list);
RDI_PROC void rdim_bake_string_map_loose_push_scopes(RDIM_Arena *arena, RDIM_BakeStringMapTopology *top, RDIM_BakeStringMapLoose *map, RDIM_ScopeChunkList *list);
//- rjf: bake name map building
RDI_PROC RDIM_BakeNameMap *rdim_bake_name_map_from_kind_params(RDIM_Arena *arena, RDI_NameMapKind kind, RDIM_BakeParams *params);
//- rjf: bake idx run map building
RDI_PROC RDIM_BakeIdxRunMap *rdim_bake_idx_run_map_from_params(RDIM_Arena *arena, RDIM_BakeNameMap *name_maps[RDI_NameMapKind_COUNT], RDIM_BakeParams *params);
//- rjf: bake path tree building
RDI_PROC RDIM_BakePathTree *rdim_bake_path_tree_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
////////////////////////////////
//~ rjf: [Baking] Build Artifacts -> Baked Versions
//- rjf: partial/joinable baking functions
RDI_PROC RDIM_NameMapBakeResult rdim_bake_name_map(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeNameMap *src);
//- rjf: partial bakes -> final bake functions
RDI_PROC RDIM_NameMapBakeResult rdim_name_map_bake_results_combine(RDIM_Arena *arena, RDIM_NameMapBakeResult *results, RDI_U64 results_count);
//- rjf: independent (top-level, global) baking functions
RDI_PROC RDIM_TopLevelInfoBakeResult rdim_bake_top_level_info(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_TopLevelInfo *src);
RDI_PROC RDIM_BinarySectionBakeResult rdim_bake_binary_sections(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BinarySectionList *src);
RDI_PROC RDIM_UnitBakeResult rdim_bake_units(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree, RDIM_UnitChunkList *src);
RDI_PROC RDIM_UnitVMapBakeResult rdim_bake_unit_vmap(RDIM_Arena *arena, RDIM_UnitChunkList *units);
RDI_PROC RDIM_SrcFileBakeResult rdim_bake_src_files(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree, RDIM_SrcFileChunkList *src);
RDI_PROC RDIM_LineTableBakeResult rdim_bake_line_tables(RDIM_Arena *arena, RDIM_LineTableChunkList *src);
RDI_PROC RDIM_TypeNodeBakeResult rdim_bake_types(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_TypeChunkList *src);
RDI_PROC RDIM_UDTBakeResult rdim_bake_udts(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_UDTChunkList *src);
RDI_PROC RDIM_GlobalVariableBakeResult rdim_bake_global_variables(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_SymbolChunkList *src);
RDI_PROC RDIM_GlobalVMapBakeResult rdim_bake_global_vmap(RDIM_Arena *arena, RDIM_SymbolChunkList *src);
RDI_PROC RDIM_ThreadVariableBakeResult rdim_bake_thread_variables(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_SymbolChunkList *src);
RDI_PROC RDIM_ConstantsBakeResult rdim_bake_constants(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_SymbolChunkList *src);
RDI_PROC RDIM_ProcedureBakeResult rdim_bake_procedures(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_String8List *location_blocks, RDIM_String8List *location_data_blobs, RDIM_SymbolChunkList *src);
RDI_PROC RDIM_ScopeBakeResult rdim_bake_scopes(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_String8List *location_blocks, RDIM_String8List *location_data_blobs, RDIM_ScopeChunkList *src);
RDI_PROC RDIM_ScopeVMapBakeResult rdim_bake_scope_vmap(RDIM_Arena *arena, RDIM_ScopeChunkList *src);
RDI_PROC RDIM_InlineSiteBakeResult rdim_bake_inline_sites(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_InlineSiteChunkList *src);
RDI_PROC RDIM_TopLevelNameMapBakeResult rdim_bake_name_maps_top_level(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeNameMap *name_maps[RDI_NameMapKind_COUNT]);
RDI_PROC RDIM_FilePathBakeResult rdim_bake_file_paths(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree);
RDI_PROC RDIM_StringBakeResult rdim_bake_strings(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings);
RDI_PROC RDIM_IndexRunBakeResult rdim_bake_index_runs(RDIM_Arena *arena, RDIM_BakeIdxRunMap *idx_runs);
////////////////////////////////
//~ rjf: [Serializing] Bake Results -> String Blobs
+2 -85
View File
@@ -596,7 +596,7 @@ rb_thread_entry_point(void *p)
}break;
case OutputKind_Breakpad:
{
subset_flags = RDIM_SubsetFlag_All & ~(RDIM_SubsetFlag_Types|RDIM_SubsetFlag_UDTs);
subset_flags = (RDIM_SubsetFlag_Units|RDIM_SubsetFlag_Procedures|RDIM_SubsetFlag_Scopes|RDIM_SubsetFlag_LineInfo|RDIM_SubsetFlag_InlineLineInfo);
}break;
}
@@ -727,7 +727,7 @@ rb_thread_entry_point(void *p)
convert_params.subset_flags = subset_flags;
convert_params.deterministic = cmd_line_has_flag(cmdline, str8_lit("deterministic"));
}
ProfScope("convert") bake_params = p2r2_convert(arena, &convert_params);
ProfScope("convert") bake_params = p2r_convert(arena, &convert_params);
// rjf: no output path? -> pick one based on PDB
if(output_path.size == 0) switch(output_kind)
@@ -915,89 +915,6 @@ rb_thread_entry_point(void *p)
}
lane_sync();
output_blobs = p2b_shared->dump;
#if 0
//- rjf: kick off unit vmap baking
P2B_BakeUnitVMapIn bake_unit_vmap_in = {&bake_params.units};
ASYNC_Task *bake_unit_vmap_task = async_task_launch(arena, p2b_bake_unit_vmap_work, .input = &bake_unit_vmap_in);
//- rjf: kick off line-table baking
P2B_BakeLineTablesIn bake_line_tables_in = {&bake_params.line_tables};
ASYNC_Task *bake_line_tables_task = async_task_launch(arena, p2b_bake_line_table_work, .input = &bake_line_tables_in);
//- rjf: build unit -> line table idx array
U64 unit_count = bake_params.units.total_count;
U32 *unit_line_table_idxs = push_array(arena, U32, unit_count+1);
{
U64 dst_idx = 1;
for(RDIM_UnitChunkNode *n = bake_params.units.first; n != 0; n = n->next)
{
for(U64 n_idx = 0; n_idx < n->count; n_idx += 1, dst_idx += 1)
{
unit_line_table_idxs[dst_idx] = rdim_idx_from_line_table(n->v[n_idx].line_table);
}
}
}
//- rjf: dump MODULE record
str8_list_pushf(arena, &dump, "MODULE windows x86_64 %I64x %S\n", bake_params.top_level_info.exe_hash, bake_params.top_level_info.exe_name);
//- rjf: dump FILE records
ProfScope("dump FILE records")
{
for(RDIM_SrcFileChunkNode *n = bake_params.src_files.first; n != 0; n = n->next)
{
for(U64 idx = 0; idx < n->count; idx += 1)
{
U64 file_idx = rdim_idx_from_src_file(&n->v[idx]);
String8 src_path = n->v[idx].path;
str8_list_pushf(arena, &dump, "FILE %I64u %S\n", file_idx, src_path);
}
}
}
//- rjf: join unit vmap
ProfBegin("join unit vmap");
RDIM_UnitVMapBakeResult *bake_unit_vmap_out = async_task_join_struct(bake_unit_vmap_task, RDIM_UnitVMapBakeResult);
RDI_VMapEntry *unit_vmap = bake_unit_vmap_out->vmap.vmap;
U32 unit_vmap_count = bake_unit_vmap_out->vmap.count;
ProfEnd();
//- rjf: join line tables
ProfBegin("join line table");
RDIM_LineTableBakeResult *bake_line_tables_out = async_task_join_struct(bake_line_tables_task, RDIM_LineTableBakeResult);
ProfEnd();
//- rjf: kick off FUNC & line record dump tasks
P2B_DumpProcChunkIn *dump_proc_chunk_in = push_array(arena, P2B_DumpProcChunkIn, bake_params.procedures.chunk_count);
ASYNC_Task **dump_proc_chunk_tasks = push_array(arena, ASYNC_Task *, bake_params.procedures.chunk_count);
ProfScope("kick off FUNC & line record dump tasks")
{
U64 task_idx = 0;
for(RDIM_SymbolChunkNode *n = bake_params.procedures.first; n != 0; n = n->next, task_idx += 1)
{
dump_proc_chunk_in[task_idx].unit_vmap = unit_vmap;
dump_proc_chunk_in[task_idx].unit_vmap_count = unit_vmap_count;
dump_proc_chunk_in[task_idx].unit_line_table_idxs = unit_line_table_idxs;
dump_proc_chunk_in[task_idx].unit_count = unit_count;
dump_proc_chunk_in[task_idx].line_tables_bake = bake_line_tables_out;
dump_proc_chunk_in[task_idx].chunk = n;
dump_proc_chunk_tasks[task_idx] = async_task_launch(arena, p2b_dump_proc_chunk_work, .input = &dump_proc_chunk_in[task_idx]);
}
}
//- rjf: join FUNC & line record dump tasks
ProfScope("join FUNC & line record dump tasks")
{
for(U64 idx = 0; idx < bake_params.procedures.chunk_count; idx += 1)
{
String8List *out = async_task_join_struct(dump_proc_chunk_tasks[idx], String8List);
str8_list_concat_in_place(&dump, out);
}
}
str8_list_concat_in_place(&output_blobs, &dump);
#endif
}break;
}
}break;
-6
View File
@@ -17,7 +17,6 @@
#include "async/async.h"
#include "rdi/rdi_local.h"
#include "rdi_make/rdi_make_local.h"
#include "rdi_make/rdi_make_local_2.h"
#include "coff/coff_inc.h"
#include "pe/pe.h"
#include "elf/elf.h"
@@ -33,8 +32,6 @@
#include "rdi_from_coff/rdi_from_coff.h"
#include "rdi_from_elf/rdi_from_elf.h"
#include "rdi_from_pdb/rdi_from_pdb.h"
#include "rdi_from_pdb/rdi_from_pdb_2.h"
#include "rdi_breakpad_from_pdb/rdi_breakpad_from_pdb.h"
#include "rdi_from_dwarf/rdi_from_dwarf.h"
#include "radbin/radbin.h"
@@ -45,7 +42,6 @@
#include "async/async.c"
#include "rdi/rdi_local.c"
#include "rdi_make/rdi_make_local.c"
#include "rdi_make/rdi_make_local_2.c"
#include "coff/coff_inc.c"
#include "pe/pe.c"
#include "elf/elf.c"
@@ -61,8 +57,6 @@
#include "rdi_from_coff/rdi_from_coff.c"
#include "rdi_from_elf/rdi_from_elf.c"
#include "rdi_from_pdb/rdi_from_pdb.c"
#include "rdi_from_pdb/rdi_from_pdb_2.c"
#include "rdi_breakpad_from_pdb/rdi_breakpad_from_pdb.c"
#include "rdi_from_dwarf/rdi_from_dwarf.c"
#include "radbin/radbin.c"
-6
View File
@@ -224,7 +224,6 @@
#include "async/async.h"
#include "rdi/rdi_local.h"
#include "rdi_make/rdi_make_local.h"
#include "rdi_make/rdi_make_local_2.h"
#include "mdesk/mdesk.h"
#include "hash_store/hash_store.h"
#include "file_stream/file_stream.h"
@@ -246,9 +245,7 @@
#include "rdi_from_coff/rdi_from_coff.h"
#include "rdi_from_elf/rdi_from_elf.h"
#include "rdi_from_pdb/rdi_from_pdb.h"
#include "rdi_from_pdb/rdi_from_pdb_2.h"
#include "rdi_from_dwarf/rdi_from_dwarf.h"
#include "rdi_breakpad_from_pdb/rdi_breakpad_from_pdb.h"
#include "radbin/radbin.h"
#include "regs/regs.h"
#include "regs/rdi/regs_rdi.h"
@@ -276,7 +273,6 @@
#include "async/async.c"
#include "rdi/rdi_local.c"
#include "rdi_make/rdi_make_local.c"
#include "rdi_make/rdi_make_local_2.c"
#include "mdesk/mdesk.c"
#include "hash_store/hash_store.c"
#include "file_stream/file_stream.c"
@@ -298,9 +294,7 @@
#include "rdi_from_coff/rdi_from_coff.c"
#include "rdi_from_elf/rdi_from_elf.c"
#include "rdi_from_pdb/rdi_from_pdb.c"
#include "rdi_from_pdb/rdi_from_pdb_2.c"
#include "rdi_from_dwarf/rdi_from_dwarf.c"
#include "rdi_breakpad_from_pdb/rdi_breakpad_from_pdb.c"
#include "radbin/radbin.c"
#include "regs/regs.c"
#include "regs/rdi/regs_rdi.c"
@@ -1,106 +0,0 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Baking Tasks
//- rjf: unit vmap baking
ASYNC_WORK_DEF(p2b_bake_unit_vmap_work)
{
ProfBeginFunction();
Arena *arena = async_root_thread_arena(p2b_async_root);
P2B_BakeUnitVMapIn *in = (P2B_BakeUnitVMapIn *)input;
RDIM_UnitVMapBakeResult *out = push_array(arena, RDIM_UnitVMapBakeResult, 1);
*out = rdim_bake_unit_vmap(arena, in->units);
ProfEnd();
return out;
}
//- rjf: line table baking
ASYNC_WORK_DEF(p2b_bake_line_table_work)
{
ProfBeginFunction();
Arena *arena = async_root_thread_arena(p2b_async_root);
P2B_BakeLineTablesIn *in = (P2B_BakeLineTablesIn *)input;
RDIM_LineTableBakeResult *out = push_array(arena, RDIM_LineTableBakeResult, 1);
*out = rdim_bake_line_tables(arena, in->line_tables);
ProfEnd();
return out;
}
//- rjf: per-procedure chunk dumping
ASYNC_WORK_DEF(p2b_dump_proc_chunk_work)
{
ProfBeginFunction();
Arena *arena = async_root_thread_arena(p2b_async_root);
P2B_DumpProcChunkIn *in = (P2B_DumpProcChunkIn *)input;
String8List *out = push_array(arena, String8List, 1);
RDI_LineTable *line_tables = in->line_tables_bake->line_tables;
RDI_U64 line_tables_count = in->line_tables_bake->line_tables_count;
RDI_U64 *line_table_voffs = in->line_tables_bake->line_table_voffs;
RDI_U64 line_table_voffs_count = in->line_tables_bake->line_table_voffs_count;
RDI_Line *line_table_lines = in->line_tables_bake->line_table_lines;
RDI_U64 line_table_lines_count = in->line_tables_bake->line_table_lines_count;
for(U64 idx = 0; idx < in->chunk->count; idx += 1)
{
// NOTE(rjf): breakpad does not support multiple voff ranges per procedure.
RDIM_Symbol *proc = &in->chunk->v[idx];
RDIM_Scope *root_scope = proc->root_scope;
if(root_scope != 0 && root_scope->voff_ranges.first != 0)
{
// rjf: dump function record
RDIM_Rng1U64 voff_range = root_scope->voff_ranges.first->v;
str8_list_pushf(arena, out, "FUNC %I64x %I64x %I64x %S\n", voff_range.min, voff_range.max-voff_range.min, 0ull, proc->name);
// rjf: dump function lines
U64 unit_idx = rdi_vmap_idx_from_voff(in->unit_vmap, in->unit_vmap_count, voff_range.min);
if(0 < unit_idx && unit_idx <= in->unit_count)
{
U32 line_table_idx = in->unit_line_table_idxs[unit_idx];
if(0 < line_table_idx && line_table_idx <= line_tables_count)
{
// rjf: unpack unit line info
RDI_LineTable *line_table = &line_tables[line_table_idx];
RDI_ParsedLineTable line_info =
{
line_table_voffs + line_table->voffs_base_idx,
line_table_lines + line_table->lines_base_idx,
0,
line_table->lines_count,
0
};
for(U64 voff = voff_range.min, last_voff = 0;
voff < voff_range.max && voff > last_voff;)
{
RDI_U64 line_info_idx = rdi_line_info_idx_from_voff(&line_info, voff);
if(line_info_idx < line_info.count)
{
RDI_Line *line = &line_info.lines[line_info_idx];
U64 line_voff_min = line_info.voffs[line_info_idx];
U64 line_voff_opl = line_info.voffs[line_info_idx+1];
if(line->file_idx != 0)
{
str8_list_pushf(arena, out, "%I64x %I64x %I64u %I64u\n",
line_voff_min,
line_voff_opl-line_voff_min,
(U64)line->line_num,
(U64)line->file_idx);
}
last_voff = voff;
voff = line_voff_opl;
}
else
{
break;
}
}
}
}
}
}
ProfEnd();
return out;
}
@@ -1,47 +0,0 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef RDI_BREAKPAD_FROM_PDB_H
#define RDI_BREAKPAD_FROM_PDB_H
////////////////////////////////
//~ rjf: Baking Tasks
//- rjf: unit vmap baking
typedef struct P2B_BakeUnitVMapIn P2B_BakeUnitVMapIn;
struct P2B_BakeUnitVMapIn
{
RDIM_UnitChunkList *units;
};
ASYNC_WORK_DEF(p2b_bake_unit_vmap_work);
//- rjf: line table baking
typedef struct P2B_BakeLineTablesIn P2B_BakeLineTablesIn;
struct P2B_BakeLineTablesIn
{
RDIM_LineTableChunkList *line_tables;
};
ASYNC_WORK_DEF(p2b_bake_line_table_work);
//- rjf: per-procedure chunk dumping
typedef struct P2B_DumpProcChunkIn P2B_DumpProcChunkIn;
struct P2B_DumpProcChunkIn
{
RDI_VMapEntry *unit_vmap;
U32 unit_vmap_count;
U32 *unit_line_table_idxs;
U64 unit_count;
RDIM_LineTableBakeResult *line_tables_bake;
RDIM_SymbolChunkNode *chunk;
};
ASYNC_WORK_DEF(p2b_dump_proc_chunk_work);
////////////////////////////////
//~ rjf: Globals
global ASYNC_Root *p2b_async_root = 0;
#endif // RDI_BREAKPAD_FROM_PDB_H
+25 -21
View File
@@ -871,9 +871,9 @@ d2r_transpile_expression(Arena *arena, DW_Input *input, U64 image_base, U64 addr
B32 is_addr = 0;
RDIM_EvalBytecode bytecode = d2r_bytecode_from_expression(arena, input, image_base, address_size, arch, addr_lu, expr, cu, &is_addr);
loc = push_array(arena, RDIM_Location, 1);
loc->kind = is_addr ? RDI_LocationKind_AddrBytecodeStream : RDI_LocationKind_ValBytecodeStream;
loc->bytecode = bytecode;
loc = push_array(arena, RDIM_Location, 1);
loc->info.kind = is_addr ? RDI_LocationKind_AddrBytecodeStream : RDI_LocationKind_ValBytecodeStream;
loc->info.bytecode = bytecode;
}
return loc;
}
@@ -886,7 +886,7 @@ d2r_location_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 ima
return location;
}
internal RDIM_LocationSet
internal RDIM_LocationCaseList
d2r_locset_from_attrib(Arena *arena,
DW_Input *input,
DW_CompUnit *cu,
@@ -897,7 +897,7 @@ d2r_locset_from_attrib(Arena *arena,
DW_Tag tag,
DW_AttribKind kind)
{
RDIM_LocationSet locset = {0};
RDIM_LocationCaseList locset = {0};
// extract attrib from tag
DW_Attrib *attrib = dw_attrib_from_tag(input, cu, tag, kind);
@@ -913,7 +913,8 @@ d2r_locset_from_attrib(Arena *arena,
for (DW_LocNode *loc_n = loclist.first; loc_n != 0; loc_n = loc_n->next) {
RDIM_Location *location = d2r_transpile_expression(arena, input, image_base, cu->address_size, arch, cu->addr_lu, cu, loc_n->v.expr);
RDIM_Rng1U64 voff_range = { .min = loc_n->v.range.min - image_base, .max = loc_n->v.range.max - image_base };
rdim_location_set_push_case(arena, scopes, &locset, voff_range, location);
// rdim_location_set_push_case(arena, scopes, &locset, voff_range, location);
// TODO(rjf): need to use rdim_local_push_location_case here
}
scratch_end(scratch);
@@ -924,7 +925,8 @@ d2r_locset_from_attrib(Arena *arena,
// convert expression and inherit life-time ranges from enclosed scope
RDIM_Location *location = d2r_transpile_expression(arena, input, image_base, cu->address_size, arch, cu->addr_lu, cu, expr);
for (RDIM_Rng1U64Node *range_n = curr_scope->voff_ranges.first; range_n != 0; range_n = range_n->next) {
rdim_location_set_push_case(arena, scopes, &locset, range_n->v, location);
// rdim_location_set_push_case(arena, scopes, &locset, range_n->v, location);
// TODO(rjf): need to use rdim_local_push_location_case here
}
} else if (attrib_class != DW_AttribClass_Null) {
AssertAlways(!"unexpected attrib class");
@@ -933,7 +935,7 @@ d2r_locset_from_attrib(Arena *arena,
return locset;
}
internal RDIM_LocationSet
internal RDIM_LocationCaseList
d2r_var_locset_from_tag(Arena *arena,
DW_Input *input,
DW_CompUnit *cu,
@@ -943,7 +945,7 @@ d2r_var_locset_from_tag(Arena *arena,
Arch arch,
DW_Tag tag)
{
RDIM_LocationSet locset = {0};
RDIM_LocationCaseList locset = {0};
B32 has_const_value = dw_tag_has_attrib(input, cu, tag, DW_AttribKind_ConstValue);
B32 has_location = dw_tag_has_attrib(input, cu, tag, DW_AttribKind_Location);
@@ -962,13 +964,15 @@ d2r_var_locset_from_tag(Arena *arena,
rdim_bytecode_push_uconst(arena, &bc, const_value);
// fill out location
// TODO(rjf): these need to be pushed into a RDIM_LocationChunkList
RDIM_Location *loc = push_array(arena, RDIM_Location, 1);
loc->kind = RDI_LocationKind_ValBytecodeStream;
loc->bytecode = bc;
loc->info.kind = RDI_LocationKind_ValBytecodeStream;
loc->info.bytecode = bc;
// push location cases
for (RDIM_Rng1U64Node *range_n = curr_scope->voff_ranges.first; range_n != 0; range_n = range_n->next) {
rdim_location_set_push_case(arena, scopes, &locset, range_n->v, loc);
// rdim_location_set_push_case(arena, scopes, &locset, range_n->v, loc);
// TODO(rjf): need to use rdim_local_push_location_case here
}
} else if (has_location) {
locset = d2r_locset_from_attrib(arena, input, cu, scopes, curr_scope, image_base, arch, tag, DW_AttribKind_Location);
@@ -1871,7 +1875,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
proc->container_symbol = 0;
proc->container_type = container_type;
proc->root_scope = root_scope;
proc->frame_base = d2r_locset_from_attrib(arena, &input, cu, &scopes, root_scope, image_base, arch, tag, DW_AttribKind_FrameBase);
proc->location_cases = d2r_locset_from_attrib(arena, &input, cu, &scopes, root_scope, image_base, arch, tag, DW_AttribKind_FrameBase);
// sub program with user-defined parent tag is a method
DW_TagKind parent_tag_kind = tag_stack->next->cur_node->tag.kind;
@@ -1947,10 +1951,10 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
parent_tag_kind == DW_TagKind_LexicalBlock) {
RDIM_Scope *scope = tag_stack->next->scope;
RDIM_Local *local = rdim_scope_push_local(arena, &scopes, tag_stack->next->scope);
local->kind = RDI_LocalKind_Variable;
local->name = name;
local->type = type;
local->locset = d2r_var_locset_from_tag(arena, &input, cu, &scopes, scope, image_base, arch, tag);
local->kind = RDI_LocalKind_Variable;
local->name = name;
local->type = type;
local->location_cases = d2r_var_locset_from_tag(arena, &input, cu, &scopes, scope, image_base, arch, tag);
} else {
// NOTE: due to a bug in clang in stb_sprint.h local variables
@@ -1974,10 +1978,10 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
if (parent_tag_kind == DW_TagKind_SubProgram || parent_tag_kind == DW_TagKind_InlinedSubroutine) {
RDIM_Scope *scope = tag_stack->next->scope;
RDIM_Local *param = rdim_scope_push_local(arena, &scopes, scope);
param->kind = RDI_LocalKind_Parameter;
param->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
param->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
param->locset = d2r_var_locset_from_tag(arena, &input, cu, &scopes, scope, image_base, arch, tag);
param->kind = RDI_LocalKind_Parameter;
param->name = dw_string_from_tag_attrib_kind(&input, cu, tag, DW_AttribKind_Name);
param->type = d2r_type_from_attrib(arena, type_table, &input, cu, tag, DW_AttribKind_Type);
param->location_cases = d2r_var_locset_from_tag(arena, &input, cu, &scopes, scope, image_base, arch, tag);
} else {
// TODO: error handling
AssertAlways(!"this is a local variable");
+17 -17
View File
@@ -73,23 +73,23 @@ d2r_bytecode_from_expression(Arena *arena,
B32 *is_addr_out);
internal RDIM_Location *d2r_transpile_expression(Arena *arena, DW_Input *input, U64 image_base, U64 address_size, Arch arch, DW_ListUnit *addr_lu, DW_CompUnit *cu, String8 expr);
internal RDIM_Location *d2r_location_from_attrib(Arena *arena, DW_Input *input, DW_CompUnit *cu, U64 image_base, Arch arch, DW_Tag tag, DW_AttribKind kind);
internal RDIM_LocationSet d2r_locset_from_attrib(Arena *arena,
DW_Input *input,
DW_CompUnit *cu,
RDIM_ScopeChunkList *scopes,
RDIM_Scope *curr_scope,
U64 image_base,
Arch arch,
DW_Tag tag,
DW_AttribKind kind);
internal RDIM_LocationSet d2r_var_locset_from_tag(Arena *arena,
DW_Input *input,
DW_CompUnit *cu,
RDIM_ScopeChunkList *scopes,
RDIM_Scope *curr_scope,
U64 image_base,
Arch arch,
DW_Tag tag);
internal RDIM_LocationCaseList d2r_locset_from_attrib(Arena *arena,
DW_Input *input,
DW_CompUnit *cu,
RDIM_ScopeChunkList *scopes,
RDIM_Scope *curr_scope,
U64 image_base,
Arch arch,
DW_Tag tag,
DW_AttribKind kind);
internal RDIM_LocationCaseList d2r_var_locset_from_tag(Arena *arena,
DW_Input *input,
DW_CompUnit *cu,
RDIM_ScopeChunkList *scopes,
RDIM_Scope *curr_scope,
U64 image_base,
Arch arch,
DW_Tag tag);
////////////////////////////////
//~ rjf: Compilation Unit / Scope Conversion Helpers
File diff suppressed because it is too large Load Diff
+87 -254
View File
@@ -19,88 +19,7 @@ struct P2R_ConvertParams
};
////////////////////////////////
//~ rjf: Initial PDB Information Extraction & Conversion Preparation Task Types
//- rjf: tpi hash parsing
typedef struct P2R_TPIHashParseIn P2R_TPIHashParseIn;
struct P2R_TPIHashParseIn
{
PDB_Strtbl *strtbl;
PDB_TpiParsed *tpi;
String8 hash_data;
String8 aux_data;
};
//- rjf: tpi leaves parsing
typedef struct P2R_TPILeafParseIn P2R_TPILeafParseIn;
struct P2R_TPILeafParseIn
{
String8 leaf_data;
CV_TypeId itype_first;
};
//- rjf: exe hashing
typedef struct P2R_EXEHashIn P2R_EXEHashIn;
struct P2R_EXEHashIn
{
String8 exe_data;
};
//- rjf: symbol stream parsing
typedef struct P2R_SymbolStreamParseIn P2R_SymbolStreamParseIn;
struct P2R_SymbolStreamParseIn
{
String8 data;
};
//- rjf: c13 line info stream parsing
typedef struct P2R_C13StreamParseIn P2R_C13StreamParseIn;
struct P2R_C13StreamParseIn
{
String8 data;
String8 strtbl;
COFF_SectionHeaderArray coff_sections;
};
//- rjf: comp unit parsing
typedef struct P2R_CompUnitParseIn P2R_CompUnitParseIn;
struct P2R_CompUnitParseIn
{
String8 data;
};
//- rjf: comp unit contribution table parsing
typedef struct P2R_CompUnitContributionsParseIn P2R_CompUnitContributionsParseIn;
struct P2R_CompUnitContributionsParseIn
{
String8 data;
COFF_SectionHeaderArray coff_sections;
};
//- rjf: comp unit contribution table bucketing by unit
typedef struct P2R_CompUnitContributionsBucketIn P2R_CompUnitContributionsBucketIn;
struct P2R_CompUnitContributionsBucketIn
{
U64 comp_unit_count;
PDB_CompUnitContributionArray contributions;
};
typedef struct P2R_CompUnitContributionsBucketOut P2R_CompUnitContributionsBucketOut;
struct P2R_CompUnitContributionsBucketOut
{
RDIM_Rng1U64ChunkList *unit_ranges;
};
////////////////////////////////
//~ rjf: Conversion Data Structure & Task Types
//~ rjf: Shared Conversion State
//- rjf: link name map (voff -> string)
@@ -137,79 +56,7 @@ struct P2R_SrcFileMap
U64 slots_count;
};
//- rjf: per-unit source files conversion tasks
typedef struct P2R_GatherUnitSrcFilesIn P2R_GatherUnitSrcFilesIn;
struct P2R_GatherUnitSrcFilesIn
{
PDB_Strtbl *pdb_strtbl;
COFF_SectionHeaderArray coff_sections;
PDB_CompUnit *comp_unit;
CV_SymParsed *comp_unit_syms;
CV_C13Parsed *comp_unit_c13s;
};
typedef struct P2R_GatherUnitSrcFilesOut P2R_GatherUnitSrcFilesOut;
struct P2R_GatherUnitSrcFilesOut
{
String8Array src_file_paths;
};
//- rjf: unit conversion tasks
typedef struct P2R_UnitConvertIn P2R_UnitConvertIn;
struct P2R_UnitConvertIn
{
U64 comp_unit_idx;
PDB_Strtbl *pdb_strtbl;
COFF_SectionHeaderArray coff_sections;
PDB_CompUnit *comp_unit;
RDIM_Rng1U64ChunkList comp_unit_ranges;
CV_SymParsed *comp_unit_syms;
CV_C13Parsed *comp_unit_c13s;
P2R_SrcFileMap *src_file_map;
};
typedef struct P2R_UnitConvertOut P2R_UnitConvertOut;
struct P2R_UnitConvertOut
{
RDIM_UnitChunkList units;
RDIM_LineTableChunkList line_tables;
RDIM_LineTable *unit_first_inline_site_line_table;
};
//- rjf: src file sequence equipping task
typedef struct P2R_SrcFileSeqEquipIn P2R_SrcFileSeqEquipIn;
struct P2R_SrcFileSeqEquipIn
{
RDIM_SrcFileChunkList src_files;
RDIM_LineTableChunkList line_tables;
};
//- rjf: link name map building tasks
typedef struct P2R_LinkNameMapBuildIn P2R_LinkNameMapBuildIn;
struct P2R_LinkNameMapBuildIn
{
CV_SymParsed *sym;
COFF_SectionHeaderArray coff_sections;
P2R_LinkNameMap *link_name_map;
};
//- rjf: type forward resolution map build
typedef struct P2R_ITypeFwdMapFillIn P2R_ITypeFwdMapFillIn;
struct P2R_ITypeFwdMapFillIn
{
PDB_TpiHashParsed *tpi_hash;
CV_LeafParsed *tpi_leaf;
CV_TypeId itype_first;
CV_TypeId itype_opl;
CV_TypeId *itype_fwd_map;
};
//- rjf: itype chain build
//- rjf: itype chains
typedef struct P2R_TypeIdChain P2R_TypeIdChain;
struct P2R_TypeIdChain
@@ -218,64 +65,101 @@ struct P2R_TypeIdChain
CV_TypeId itype;
};
typedef struct P2R_ITypeChainBuildIn P2R_ITypeChainBuildIn;
struct P2R_ITypeChainBuildIn
//- rjf: main state bundle
typedef struct P2R2_Shared P2R2_Shared;
struct P2R2_Shared
{
CV_LeafParsed *tpi_leaf;
CV_TypeId itype_first;
CV_TypeId itype_opl;
CV_TypeId *itype_fwd_map;
P2R_TypeIdChain **itype_chains;
};
//- rjf: udt conversion
typedef struct P2R_UDTConvertIn P2R_UDTConvertIn;
struct P2R_UDTConvertIn
{
CV_LeafParsed *tpi_leaf;
CV_TypeId itype_first;
CV_TypeId itype_opl;
CV_TypeId *itype_fwd_map;
RDIM_Type **itype_type_ptrs;
};
//- rjf: symbol stream conversion
typedef struct P2R_SymbolStreamConvertIn P2R_SymbolStreamConvertIn;
struct P2R_SymbolStreamConvertIn
{
B32 parsing_global_stream;
RDI_Arch arch;
MSF_RawStreamTable *msf_raw_stream_table;
U64 msf_stream_lane_counter;
MSF_Parsed *msf;
PDB_Info *pdb_info;
PDB_NamedStreamTable *named_streams;
PDB_Strtbl *strtbl;
String8 raw_strtbl;
PDB_DbiParsed *dbi;
PDB_TpiParsed *tpi;
PDB_TpiParsed *ipi;
COFF_SectionHeaderArray coff_sections;
PDB_GsiParsed *gsi;
PDB_GsiParsed *psi_gsi_part;
U64 exe_hash;
PDB_TpiHashParsed *tpi_hash;
CV_LeafParsed *tpi_leaf;
PDB_TpiHashParsed *ipi_hash;
CV_LeafParsed *ipi_leaf;
CV_SymParsed *sym;
U64 sym_ranges_first;
U64 sym_ranges_opl;
PDB_CompUnitArray *comp_units;
PDB_CompUnitContributionArray *comp_unit_contributions;
RDIM_Rng1U64ChunkList *unit_ranges;
U64 sym_c13_unit_lane_counter;
U64 all_syms_count;
CV_SymParsed **all_syms; // [0] -> global; rest are unit nums
CV_C13Parsed **all_c13s; // [0] -> blank (global); rest are unit nums
U64 exe_voff_max;
RDI_Arch arch;
U64 symbol_count_prediction;
P2R_LinkNameMap link_name_map;
U64 sym_lane_take_counter;
String8Array *unit_file_paths;
U64Array *unit_file_paths_hashes;
U64 total_path_count;
RDIM_SrcFileChunkList all_src_files__sequenceless;
P2R_SrcFileMap src_file_map;
RDIM_UnitChunkList all_units;
RDIM_LineTableChunkList *units_line_tables;
RDIM_LineTable **units_first_inline_site_line_tables;
RDIM_LineTableChunkList all_line_tables;
CV_TypeId *itype_fwd_map;
CV_TypeId itype_first;
CV_TypeId itype_opl;
P2R_TypeIdChain **itype_chains;
RDIM_Type **itype_type_ptrs;
P2R_LinkNameMap *link_name_map;
RDIM_LineTable *first_inline_site_line_table;
};
typedef struct P2R_SymbolStreamConvertOut P2R_SymbolStreamConvertOut;
struct P2R_SymbolStreamConvertOut
{
RDIM_SymbolChunkList procedures;
RDIM_SymbolChunkList global_variables;
RDIM_SymbolChunkList thread_variables;
RDIM_SymbolChunkList constants;
RDIM_ScopeChunkList scopes;
RDIM_InlineSiteChunkList inline_sites;
RDIM_TypeChunkList typedefs;
RDIM_Type **basic_type_ptrs;
RDIM_TypeChunkList all_types__pre_typedefs;
RDIM_UDTChunkList *lanes_udts;
RDIM_UDTChunkList all_udts;
RDIM_LocationChunkList *syms_locations;
RDIM_SymbolChunkList *syms_procedures;
RDIM_SymbolChunkList *syms_global_variables;
RDIM_SymbolChunkList *syms_thread_variables;
RDIM_SymbolChunkList *syms_constants;
RDIM_ScopeChunkList *syms_scopes;
RDIM_InlineSiteChunkList *syms_inline_sites;
RDIM_TypeChunkList *syms_typedefs;
RDIM_LocationChunkList all_locations;
RDIM_SymbolChunkList all_procedures;
RDIM_SymbolChunkList all_global_variables;
RDIM_SymbolChunkList all_thread_variables;
RDIM_SymbolChunkList all_constants;
RDIM_ScopeChunkList all_scopes;
RDIM_InlineSiteChunkList all_inline_sites;
RDIM_TypeChunkList all_types;
};
////////////////////////////////
//~ rjf: Globals
global ASYNC_Root *p2r_async_root = 0;
global P2R2_Shared *p2r2_shared = 0;
////////////////////////////////
//~ rjf: Basic Helpers
@@ -299,64 +183,13 @@ internal RDI_TypeKind p2r_rdi_type_kind_from_cv_basic_type(CV_BasicType basic_ty
////////////////////////////////
//~ rjf: Location Info Building Helpers
internal RDIM_Location *p2r_location_from_addr_reg_off(Arena *arena, RDI_Arch arch, RDI_RegCode reg_code, U32 reg_byte_size, U32 reg_byte_pos, S64 offset, B32 extra_indirection);
internal RDI_RegCode p2r_reg_code_from_arch_encoded_fp_reg(RDI_Arch arch, CV_EncodedFramePtrReg encoded_reg);
internal void p2r_location_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationSet *locset, RDIM_Location *location, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count);
internal RDIM_LocationInfo p2r2_location_info_from_addr_reg_off(Arena *arena, RDI_Arch arch, RDI_RegCode reg_code, U32 reg_byte_size, U32 reg_byte_pos, S64 offset, B32 extra_indirection);
internal void p2r2_local_push_location_cases_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location2 *loc, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count);
////////////////////////////////
//~ rjf: Initial Parsing & Preparation Pass Tasks
ASYNC_WORK_DEF(p2r_exe_hash_work);
ASYNC_WORK_DEF(p2r_tpi_hash_parse_work);
ASYNC_WORK_DEF(p2r_tpi_leaf_work);
ASYNC_WORK_DEF(p2r_symbol_stream_parse_work);
ASYNC_WORK_DEF(p2r_c13_stream_parse_work);
ASYNC_WORK_DEF(p2r_comp_unit_parse_work);
ASYNC_WORK_DEF(p2r_comp_unit_contributions_parse_work);
ASYNC_WORK_DEF(p2r_comp_unit_contributions_bucket_work);
////////////////////////////////
//~ rjf: Unit Source File Gathering Tasks
ASYNC_WORK_DEF(p2r_gather_unit_src_file_work);
////////////////////////////////
//~ rjf: Unit Conversion Tasks
ASYNC_WORK_DEF(p2r_unit_convert_work);
////////////////////////////////
//~ rjf: Source File Sequence Equipping Task
ASYNC_WORK_DEF(p2r_src_file_seq_equip_work);
////////////////////////////////
//~ rjf: Link Name Map Building Tasks
ASYNC_WORK_DEF(p2r_link_name_map_build_work);
////////////////////////////////
//~ rjf: Type Parsing/Conversion Tasks
ASYNC_WORK_DEF(p2r_itype_fwd_map_fill_work);
ASYNC_WORK_DEF(p2r_itype_chain_build_work);
////////////////////////////////
//~ rjf: UDT Conversion Tasks
ASYNC_WORK_DEF(p2r_udt_convert_work);
////////////////////////////////
//~ rjf: Symbol Stream Conversion Tasks
ASYNC_WORK_DEF(p2r_symbol_stream_convert_work);
internal void p2r2_local_push_location_cases_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *loc, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count);
////////////////////////////////
//~ rjf: Top-Level Conversion Entry Point
internal RDIM_BakeParams p2r2_convert(Arena *arena, P2R_ConvertParams *params);
internal RDIM_BakeParams p2r_convert(Arena *arena, P2R_ConvertParams *params);
#endif // RDI_FROM_PDB_H
-2
View File
@@ -1,2 +0,0 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
-111
View File
@@ -1,111 +0,0 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef RDI_FROM_PDB_2_H
#define RDI_FROM_PDB_2_H
typedef struct P2R2_ConvertThreadParams P2R2_ConvertThreadParams;
struct P2R2_ConvertThreadParams
{
Arena *arena;
LaneCtx lane_ctx;
String8 input_exe_name;
String8 input_exe_data;
String8 input_pdb_name;
String8 input_pdb_data;
B32 deterministic;
RDIM_BakeParams *out_bake_params;
};
typedef struct P2R2_Shared P2R2_Shared;
struct P2R2_Shared
{
MSF_RawStreamTable *msf_raw_stream_table;
U64 msf_stream_lane_counter;
MSF_Parsed *msf;
PDB_Info *pdb_info;
PDB_NamedStreamTable *named_streams;
PDB_Strtbl *strtbl;
String8 raw_strtbl;
PDB_DbiParsed *dbi;
PDB_TpiParsed *tpi;
PDB_TpiParsed *ipi;
COFF_SectionHeaderArray coff_sections;
PDB_GsiParsed *gsi;
PDB_GsiParsed *psi_gsi_part;
U64 exe_hash;
PDB_TpiHashParsed *tpi_hash;
CV_LeafParsed *tpi_leaf;
PDB_TpiHashParsed *ipi_hash;
CV_LeafParsed *ipi_leaf;
PDB_CompUnitArray *comp_units;
PDB_CompUnitContributionArray *comp_unit_contributions;
RDIM_Rng1U64ChunkList *unit_ranges;
U64 sym_c13_unit_lane_counter;
U64 all_syms_count;
CV_SymParsed **all_syms; // [0] -> global; rest are unit nums
CV_C13Parsed **all_c13s; // [0] -> blank (global); rest are unit nums
U64 exe_voff_max;
RDI_Arch arch;
U64 symbol_count_prediction;
P2R_LinkNameMap link_name_map;
U64 sym_lane_take_counter;
String8Array *unit_file_paths;
U64Array *unit_file_paths_hashes;
U64 total_path_count;
RDIM_SrcFileChunkList all_src_files__sequenceless;
P2R_SrcFileMap src_file_map;
RDIM_UnitChunkList all_units;
RDIM_LineTableChunkList *units_line_tables;
RDIM_LineTable **units_first_inline_site_line_tables;
RDIM_LineTableChunkList all_line_tables;
CV_TypeId *itype_fwd_map;
CV_TypeId itype_first;
CV_TypeId itype_opl;
P2R_TypeIdChain **itype_chains;
RDIM_Type **itype_type_ptrs;
RDIM_Type **basic_type_ptrs;
RDIM_TypeChunkList all_types__pre_typedefs;
RDIM_UDTChunkList *lanes_udts;
RDIM_UDTChunkList all_udts;
RDIM_LocationChunkList *syms_locations;
RDIM_SymbolChunkList *syms_procedures;
RDIM_SymbolChunkList *syms_global_variables;
RDIM_SymbolChunkList *syms_thread_variables;
RDIM_SymbolChunkList *syms_constants;
RDIM_ScopeChunkList *syms_scopes;
RDIM_InlineSiteChunkList *syms_inline_sites;
RDIM_TypeChunkList *syms_typedefs;
RDIM_LocationChunkList all_locations;
RDIM_SymbolChunkList all_procedures;
RDIM_SymbolChunkList all_global_variables;
RDIM_SymbolChunkList all_thread_variables;
RDIM_SymbolChunkList all_constants;
RDIM_ScopeChunkList all_scopes;
RDIM_InlineSiteChunkList all_inline_sites;
RDIM_TypeChunkList all_types;
};
global P2R2_Shared *p2r2_shared = 0;
#endif // RDI_FROM_PDB_2_H
+2744 -1006
View File
File diff suppressed because it is too large Load Diff
+123 -322
View File
@@ -48,340 +48,141 @@
//- rjf: main library
#include "lib_rdi_make/rdi_make.h"
//- rjf: line table baking task types
//- rjf: unsorted joined line table info
typedef struct RDIM_BakeLineTablesIn RDIM_BakeLineTablesIn;
struct RDIM_BakeLineTablesIn
typedef struct RDIM_UnsortedJoinedLineTable RDIM_UnsortedJoinedLineTable;
struct RDIM_UnsortedJoinedLineTable
{
RDIM_LineTableChunkList *line_tables;
RDI_U64 line_count;
RDI_U64 seq_count;
RDI_U64 key_count;
RDIM_SortKey *line_keys;
RDIM_LineRec *line_recs;
};
//- rjf: string map baking task types
//- rjf: shared state bundle
typedef struct RDIM_BakeSrcFilesStringsIn RDIM_BakeSrcFilesStringsIn;
struct RDIM_BakeSrcFilesStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_SrcFileChunkList *list;
};
typedef struct RDIM_BakeUnitsStringsIn RDIM_BakeUnitsStringsIn;
struct RDIM_BakeUnitsStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_UnitChunkList *list;
};
typedef struct RDIM_BakeUDTsStringsInNode RDIM_BakeUDTsStringsInNode;
struct RDIM_BakeUDTsStringsInNode
{
RDIM_BakeUDTsStringsInNode *next;
RDIM_UDT *v;
RDI_U64 count;
};
typedef struct RDIM_BakeTypesStringsInNode RDIM_BakeTypesStringsInNode;
struct RDIM_BakeTypesStringsInNode
{
RDIM_BakeTypesStringsInNode *next;
RDIM_Type *v;
RDI_U64 count;
};
typedef struct RDIM_BakeTypesStringsIn RDIM_BakeTypesStringsIn;
struct RDIM_BakeTypesStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_BakeTypesStringsInNode *first;
RDIM_BakeTypesStringsInNode *last;
};
typedef struct RDIM_BakeUDTsStringsIn RDIM_BakeUDTsStringsIn;
struct RDIM_BakeUDTsStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_BakeUDTsStringsInNode *first;
RDIM_BakeUDTsStringsInNode *last;
};
typedef struct RDIM_BakeSymbolsStringsInNode RDIM_BakeSymbolsStringsInNode;
struct RDIM_BakeSymbolsStringsInNode
{
RDIM_BakeSymbolsStringsInNode *next;
RDIM_Symbol *v;
RDI_U64 count;
};
typedef struct RDIM_BakeSymbolsStringsIn RDIM_BakeSymbolsStringsIn;
struct RDIM_BakeSymbolsStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_BakeSymbolsStringsInNode *first;
RDIM_BakeSymbolsStringsInNode *last;
};
typedef struct RDIM_BakeInlineSiteStringsInNode RDIM_BakeInlineSiteStringsInNode;
struct RDIM_BakeInlineSiteStringsInNode
{
RDIM_BakeInlineSiteStringsInNode *next;
RDIM_InlineSite *v;
RDI_U64 count;
};
typedef struct RDIM_BakeInlineSiteStringsIn RDIM_BakeInlineSiteStringsIn;
struct RDIM_BakeInlineSiteStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_BakeInlineSiteStringsInNode *first;
RDIM_BakeInlineSiteStringsInNode *last;
};
typedef struct RDIM_BakeScopesStringsInNode RDIM_BakeScopesStringsInNode;
struct RDIM_BakeScopesStringsInNode
{
RDIM_BakeScopesStringsInNode *next;
RDIM_Scope *v;
RDI_U64 count;
};
typedef struct RDIM_BakeScopesStringsIn RDIM_BakeScopesStringsIn;
struct RDIM_BakeScopesStringsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **maps;
RDIM_BakeScopesStringsInNode *first;
RDIM_BakeScopesStringsInNode *last;
};
//- rjf: OLD string map baking types
typedef struct RDIM_BuildBakeStringMapIn RDIM_BuildBakeStringMapIn;
struct RDIM_BuildBakeStringMapIn
typedef struct RDIM2_Shared RDIM2_Shared;
struct RDIM2_Shared
{
RDI_U64 scope_vmap_count;
RDIM_SortKey *scope_vmap_keys;
RDIM_SortKey *scope_vmap_keys__swap;
RDIM_VMapMarker *scope_vmap_markers;
RDI_U64 unit_vmap_count;
RDIM_SortKey *unit_vmap_keys;
RDIM_SortKey *unit_vmap_keys__swap;
RDIM_VMapMarker *unit_vmap_markers;
RDI_U64 global_vmap_count;
RDIM_SortKey *global_vmap_keys;
RDIM_SortKey *global_vmap_keys__swap;
RDIM_VMapMarker *global_vmap_markers;
U32 **lane_digit_counts;
U32 **lane_digit_offsets;
RDIM_ScopeVMapBakeResult baked_scope_vmap;
RDIM_UnitVMapBakeResult baked_unit_vmap;
RDIM_GlobalVMapBakeResult baked_global_vmap;
RDIM_BakePathTree *path_tree;
RDIM_BakeParams *params;
RDI_U64 line_tables_count;
RDI_U64 line_table_block_take_counter;
RDIM_LineTable **src_line_tables;
RDIM_UnsortedJoinedLineTable *unsorted_joined_line_tables;
RDIM_SortKey **sorted_line_table_keys;
RDIM_LineTableBakeResult baked_line_tables;
RDIM_BakeStringMapTopology bake_string_map_topology;
RDIM_BakeStringMapLoose **lane_bake_string_maps__loose;
RDIM_BakeStringMapLoose *bake_string_map__loose;
RDIM_BakeStringMapTight bake_strings;
RDIM_BakeNameMapTopology bake_name_map_topology[RDI_NameMapKind_COUNT];
RDIM_BakeNameMap **lane_bake_name_maps[RDI_NameMapKind_COUNT];
RDIM_BakeNameMap *bake_name_maps[RDI_NameMapKind_COUNT];
RDIM_BakeIdxRunMapTopology bake_idx_run_map_topology;
RDIM_BakeIdxRunMapLoose **lane_bake_idx_run_maps__loose;
RDIM_BakeIdxRunMapLoose *bake_idx_run_map__loose;
RDIM_BakeIdxRunMap bake_idx_runs;
RDIM_StringBakeResult baked_strings;
RDIM_IndexRunBakeResult baked_idx_runs;
RDI_U64 *lane_name_map_node_counts[RDI_NameMapKind_COUNT];
RDI_U64 *lane_name_map_node_offs[RDI_NameMapKind_COUNT];
RDI_U64 name_map_node_counts[RDI_NameMapKind_COUNT];
RDI_U64 total_name_map_node_count;
RDIM_TopLevelNameMapBakeResult baked_top_level_name_maps;
RDIM_NameMapBakeResult baked_name_maps;
RDIM_BakeSrcLineMap *bake_src_line_maps;
RDI_U64 bake_src_line_map_take_counter;
RDIM_SortKey **bake_src_line_map_keys;
RDI_U64 *lane_chunk_src_file_num_counts; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_voff_counts; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_map_counts; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_num_offs; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_voff_offs; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_map_offs; // [lane_count * src_file_chunk_count]
RDI_U64 total_src_map_line_count;
RDI_U64 total_src_map_voff_count;
RDIM_SrcFileBakeResult baked_src_files;
RDI_U64 *member_chunk_lane_counts; // [lane_count * udt_chunk_count]
RDI_U64 *member_chunk_lane_offs; // [lane_count * udt_chunk_count]
RDI_U64 *enum_val_chunk_lane_counts; // [lane_count * udt_chunk_count]
RDI_U64 *enum_val_chunk_lane_offs; // [lane_count * udt_chunk_count]
RDIM_UDTBakeResult baked_udts;
RDI_U64 *location_case_chunk_lane_counts; // [lane_count * (scope_chunk_count + procedure_chunk_count)
RDI_U64 *location_case_chunk_lane_offs; // [lane_count * (scope_chunk_count + procedure_chunk_count)
RDI_U64 total_location_case_count;
RDIM_LocationBlockBakeResult baked_location_blocks;
RDIM_LocationBakeResult baked_locations;
RDI_U64 *scope_local_chunk_lane_counts; // [lane_count * scope_chunk_count]
RDI_U64 *scope_local_chunk_lane_offs; // [lane_count * scope_chunk_count]
RDI_U64 *scope_voff_chunk_lane_counts; // [lane_count * scope_chunk_count]
RDI_U64 *scope_voff_chunk_lane_offs; // [lane_count * scope_chunk_count]
RDIM_ScopeBakeResult baked_scopes;
RDIM_ProcedureBakeResult baked_procedures;
RDI_U64 *constant_data_chunk_lane_counts; // [lane_count * constant_chunk_count]
RDI_U64 *constant_data_chunk_lane_offs; // [lane_count * constant_chunk_count]
RDIM_ConstantsBakeResult baked_constants;
RDIM_UnitBakeResult baked_units;
RDIM_TypeNodeBakeResult baked_type_nodes;
RDIM_GlobalVariableBakeResult baked_global_variables;
RDIM_ThreadVariableBakeResult baked_thread_variables;
RDIM_InlineSiteBakeResult baked_inline_sites;
RDIM_BakePathNode **baked_file_path_src_nodes;
RDIM_FilePathBakeResult baked_file_paths;
RDIM_TopLevelInfoBakeResult baked_top_level_info;
RDIM_BinarySectionBakeResult baked_binary_sections;
};
typedef struct RDIM_BuildBakeNameMapIn RDIM_BuildBakeNameMapIn;
struct RDIM_BuildBakeNameMapIn
{
RDI_NameMapKind k;
RDIM_BakeParams *params;
};
//- rjf: string map joining task types
typedef struct RDIM_JoinBakeStringMapSlotsIn RDIM_JoinBakeStringMapSlotsIn;
struct RDIM_JoinBakeStringMapSlotsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose **src_maps;
U64 src_maps_count;
RDIM_BakeStringMapLoose *dst_map;
Rng1U64 slot_idx_range;
};
//- rjf: string map sorting task types
typedef struct RDIM_SortBakeStringMapSlotsIn RDIM_SortBakeStringMapSlotsIn;
struct RDIM_SortBakeStringMapSlotsIn
{
RDIM_BakeStringMapTopology *top;
RDIM_BakeStringMapLoose *src_map;
RDIM_BakeStringMapLoose *dst_map;
U64 slot_idx;
U64 slot_count;
};
//- rjf: debug info baking task types
typedef struct RDIM_BakeUnitsIn RDIM_BakeUnitsIn;
struct RDIM_BakeUnitsIn
{
RDIM_BakeStringMapTight *strings;
RDIM_BakePathTree *path_tree;
RDIM_UnitChunkList *units;
};
typedef struct RDIM_BakeUnitVMapIn RDIM_BakeUnitVMapIn;
struct RDIM_BakeUnitVMapIn
{
RDIM_UnitChunkList *units;
};
typedef struct RDIM_BakeSrcFilesIn RDIM_BakeSrcFilesIn;
struct RDIM_BakeSrcFilesIn
{
RDIM_BakeStringMapTight *strings;
RDIM_BakePathTree *path_tree;
RDIM_SrcFileChunkList *src_files;
};
typedef struct RDIM_BakeUDTsIn RDIM_BakeUDTsIn;
struct RDIM_BakeUDTsIn
{
RDIM_BakeStringMapTight *strings;
RDIM_UDTChunkList *udts;
};
typedef struct RDIM_BakeGlobalVariablesIn RDIM_BakeGlobalVariablesIn;
struct RDIM_BakeGlobalVariablesIn
{
RDIM_BakeStringMapTight *strings;
RDIM_SymbolChunkList *global_variables;
};
typedef struct RDIM_BakeConstantsIn RDIM_BakeConstantsIn;
struct RDIM_BakeConstantsIn
{
RDIM_BakeStringMapTight *strings;
RDIM_SymbolChunkList *constants;
};
typedef struct RDIM_BakeGlobalVMapIn RDIM_BakeGlobalVMapIn;
struct RDIM_BakeGlobalVMapIn
{
RDIM_SymbolChunkList *global_variables;
};
typedef struct RDIM_BakeThreadVariablesIn RDIM_BakeThreadVariablesIn;
struct RDIM_BakeThreadVariablesIn
{
RDIM_BakeStringMapTight *strings;
RDIM_SymbolChunkList *thread_variables;
};
typedef struct RDIM_BakeProceduresIn RDIM_BakeProceduresIn;
struct RDIM_BakeProceduresIn
{
RDIM_BakeStringMapTight *strings;
RDIM_SymbolChunkList *procedures;
RDIM_String8List *location_blocks;
RDIM_String8List *location_data_blobs;
};
typedef struct RDIM_BakeScopesIn RDIM_BakeScopesIn;
struct RDIM_BakeScopesIn
{
RDIM_BakeStringMapTight *strings;
RDIM_ScopeChunkList *scopes;
RDIM_String8List *location_blocks;
RDIM_String8List *location_data_blobs;
};
typedef struct RDIM_BakeScopeVMapIn RDIM_BakeScopeVMapIn;
struct RDIM_BakeScopeVMapIn
{
RDIM_ScopeChunkList *scopes;
};
typedef struct RDIM_BakeInlineSitesIn RDIM_BakeInlineSitesIn;
struct RDIM_BakeInlineSitesIn
{
RDIM_BakeStringMapTight *strings;
RDIM_InlineSiteChunkList *inline_sites;
};
typedef struct RDIM_BakeFilePathsIn RDIM_BakeFilePathsIn;
struct RDIM_BakeFilePathsIn
{
RDIM_BakeStringMapTight *strings;
RDIM_BakePathTree *path_tree;
};
typedef struct RDIM_BakeStringsIn RDIM_BakeStringsIn;
struct RDIM_BakeStringsIn
{
RDIM_BakeStringMapTight *strings;
};
typedef struct RDIM_BakeTypeNodesIn RDIM_BakeTypeNodesIn;
struct RDIM_BakeTypeNodesIn
{
RDIM_BakeStringMapTight *strings;
RDIM_BakeIdxRunMap *idx_runs;
RDIM_TypeChunkList *types;
};
typedef struct RDIM_BakeNameMapIn RDIM_BakeNameMapIn;
struct RDIM_BakeNameMapIn
{
RDIM_BakeStringMapTight *strings;
RDIM_BakeIdxRunMap *idx_runs;
RDIM_BakeNameMap *map;
RDI_NameMapKind kind;
};
typedef struct RDIM_BakeIdxRunsIn RDIM_BakeIdxRunsIn;
struct RDIM_BakeIdxRunsIn
{
RDIM_BakeIdxRunMap *idx_runs;
};
////////////////////////////////
global RDIM2_Shared *rdim2_shared = 0;
internal RDIM_DataModel rdim_data_model_from_os_arch(OperatingSystem os, RDI_Arch arch);
////////////////////////////////
//~ rjf: Baking Stage Tasks
//- rjf: unsorted bake string map building
ASYNC_WORK_DEF(rdim_bake_src_files_strings_work);
ASYNC_WORK_DEF(rdim_bake_units_strings_work);
ASYNC_WORK_DEF(rdim_bake_types_strings_work);
ASYNC_WORK_DEF(rdim_bake_udts_strings_work);
ASYNC_WORK_DEF(rdim_bake_symbols_strings_work);
ASYNC_WORK_DEF(rdim_bake_scopes_strings_work);
ASYNC_WORK_DEF(rdim_bake_line_tables_work);
//- rjf: bake string map joining
ASYNC_WORK_DEF(rdim_bake_string_map_join_work);
//- rjf: bake string map sorting
ASYNC_WORK_DEF(rdim_bake_string_map_sort_work);
//- rjf: pass 1: interner/deduper map builds
ASYNC_WORK_DEF(rdim_build_bake_name_map_work);
//- rjf: pass 2: string-map-dependent debug info stream builds
ASYNC_WORK_DEF(rdim_bake_units_work);
ASYNC_WORK_DEF(rdim_bake_unit_vmap_work);
ASYNC_WORK_DEF(rdim_bake_src_files_work);
ASYNC_WORK_DEF(rdim_bake_udts_work);
ASYNC_WORK_DEF(rdim_bake_global_variables_work);
ASYNC_WORK_DEF(rdim_bake_global_vmap_work);
ASYNC_WORK_DEF(rdim_bake_thread_variables_work);
ASYNC_WORK_DEF(rdim_bake_constants_work);
ASYNC_WORK_DEF(rdim_bake_procedures_work);
ASYNC_WORK_DEF(rdim_bake_scopes_work);
ASYNC_WORK_DEF(rdim_bake_scope_vmap_work);
ASYNC_WORK_DEF(rdim_bake_file_paths_work);
ASYNC_WORK_DEF(rdim_bake_strings_work);
//- rjf: pass 3: idx-run-map-dependent debug info stream builds
ASYNC_WORK_DEF(rdim_bake_type_nodes_work);
ASYNC_WORK_DEF(rdim_bake_name_map_work);
ASYNC_WORK_DEF(rdim_bake_idx_runs_work);
////////////////////////////////
//~ rjf: Globals
global ASYNC_Root *rdim_local_async_root = 0;
////////////////////////////////
internal RDIM_DataModel rdim_data_model_from_os_arch(OperatingSystem os, RDI_Arch arch);
internal RDIM_TopLevelInfo rdim_make_top_level_info(String8 image_name, Arch arch, U64 exe_hash, RDIM_BinarySectionList sections);
////////////////////////////////
internal RDIM_BakeResults rdim_bake(Arena *arena, ASYNC_Root *async_root, RDIM_BakeParams *in);
internal RDIM_BakeResults rdim2_bake(Arena *arena, RDIM_BakeParams *params);
internal RDIM_SerializedSectionBundle rdim_compress(Arena *arena, RDIM_SerializedSectionBundle *in);
#endif // RDI_MAKE_LOCAL_H
File diff suppressed because it is too large Load Diff
-141
View File
@@ -1,141 +0,0 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
#ifndef RDI_MAKE_LOCAL_2_H
#define RDI_MAKE_LOCAL_2_H
//- rjf: unsorted joined line table info
typedef struct RDIM_UnsortedJoinedLineTable RDIM_UnsortedJoinedLineTable;
struct RDIM_UnsortedJoinedLineTable
{
RDI_U64 line_count;
RDI_U64 seq_count;
RDI_U64 key_count;
RDIM_SortKey *line_keys;
RDIM_LineRec *line_recs;
};
//- rjf: shared state bundle
typedef struct RDIM2_Shared RDIM2_Shared;
struct RDIM2_Shared
{
RDI_U64 scope_vmap_count;
RDIM_SortKey *scope_vmap_keys;
RDIM_SortKey *scope_vmap_keys__swap;
RDIM_VMapMarker *scope_vmap_markers;
RDI_U64 unit_vmap_count;
RDIM_SortKey *unit_vmap_keys;
RDIM_SortKey *unit_vmap_keys__swap;
RDIM_VMapMarker *unit_vmap_markers;
RDI_U64 global_vmap_count;
RDIM_SortKey *global_vmap_keys;
RDIM_SortKey *global_vmap_keys__swap;
RDIM_VMapMarker *global_vmap_markers;
U32 **lane_digit_counts;
U32 **lane_digit_offsets;
RDIM_ScopeVMapBakeResult baked_scope_vmap;
RDIM_UnitVMapBakeResult baked_unit_vmap;
RDIM_GlobalVMapBakeResult baked_global_vmap;
RDIM_BakePathTree *path_tree;
RDI_U64 line_tables_count;
RDI_U64 line_table_block_take_counter;
RDIM_LineTable **src_line_tables;
RDIM_UnsortedJoinedLineTable *unsorted_joined_line_tables;
RDIM_SortKey **sorted_line_table_keys;
RDIM_LineTableBakeResult baked_line_tables;
RDIM_BakeStringMapTopology bake_string_map_topology;
RDIM_BakeStringMapLoose **lane_bake_string_maps__loose;
RDIM_BakeStringMapLoose *bake_string_map__loose;
RDIM_BakeStringMapTight bake_strings;
RDIM_BakeNameMapTopology bake_name_map_topology[RDI_NameMapKind_COUNT];
RDIM_BakeNameMap2 **lane_bake_name_maps[RDI_NameMapKind_COUNT];
RDIM_BakeNameMap2 *bake_name_maps[RDI_NameMapKind_COUNT];
RDIM_BakeIdxRunMapTopology bake_idx_run_map_topology;
RDIM_BakeIdxRunMapLoose **lane_bake_idx_run_maps__loose;
RDIM_BakeIdxRunMapLoose *bake_idx_run_map__loose;
RDIM_BakeIdxRunMap2 bake_idx_runs;
RDIM_StringBakeResult baked_strings;
RDIM_IndexRunBakeResult baked_idx_runs;
RDI_U64 *lane_name_map_node_counts[RDI_NameMapKind_COUNT];
RDI_U64 *lane_name_map_node_offs[RDI_NameMapKind_COUNT];
RDI_U64 name_map_node_counts[RDI_NameMapKind_COUNT];
RDI_U64 total_name_map_node_count;
RDIM_TopLevelNameMapBakeResult baked_top_level_name_maps;
RDIM_NameMapBakeResult baked_name_maps;
RDIM_BakeSrcLineMap *bake_src_line_maps;
RDI_U64 bake_src_line_map_take_counter;
RDIM_SortKey **bake_src_line_map_keys;
RDI_U64 *lane_chunk_src_file_num_counts; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_voff_counts; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_map_counts; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_num_offs; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_voff_offs; // [lane_count * src_file_chunk_count]
RDI_U64 *lane_chunk_src_file_map_offs; // [lane_count * src_file_chunk_count]
RDI_U64 total_src_map_line_count;
RDI_U64 total_src_map_voff_count;
RDIM_SrcFileBakeResult baked_src_files;
RDI_U64 *member_chunk_lane_counts; // [lane_count * udt_chunk_count]
RDI_U64 *member_chunk_lane_offs; // [lane_count * udt_chunk_count]
RDI_U64 *enum_val_chunk_lane_counts; // [lane_count * udt_chunk_count]
RDI_U64 *enum_val_chunk_lane_offs; // [lane_count * udt_chunk_count]
RDIM_UDTBakeResult baked_udts;
RDI_U64 *location_case_chunk_lane_counts; // [lane_count * (scope_chunk_count + procedure_chunk_count)
RDI_U64 *location_case_chunk_lane_offs; // [lane_count * (scope_chunk_count + procedure_chunk_count)
RDI_U64 total_location_case_count;
RDIM_LocationBlockBakeResult baked_location_blocks;
RDIM_LocationBakeResult baked_locations;
RDI_U64 *scope_local_chunk_lane_counts; // [lane_count * scope_chunk_count]
RDI_U64 *scope_local_chunk_lane_offs; // [lane_count * scope_chunk_count]
RDI_U64 *scope_voff_chunk_lane_counts; // [lane_count * scope_chunk_count]
RDI_U64 *scope_voff_chunk_lane_offs; // [lane_count * scope_chunk_count]
RDIM_ScopeBakeResult baked_scopes;
RDIM_ProcedureBakeResult baked_procedures;
RDI_U64 *constant_data_chunk_lane_counts; // [lane_count * constant_chunk_count]
RDI_U64 *constant_data_chunk_lane_offs; // [lane_count * constant_chunk_count]
RDIM_ConstantsBakeResult baked_constants;
RDIM_UnitBakeResult baked_units;
RDIM_TypeNodeBakeResult baked_type_nodes;
RDIM_GlobalVariableBakeResult baked_global_variables;
RDIM_ThreadVariableBakeResult baked_thread_variables;
RDIM_InlineSiteBakeResult baked_inline_sites;
RDIM_BakePathNode **baked_file_path_src_nodes;
RDIM_FilePathBakeResult baked_file_paths;
RDIM_TopLevelInfoBakeResult baked_top_level_info;
RDIM_BinarySectionBakeResult baked_binary_sections;
};
global RDIM2_Shared *rdim2_shared = 0;
internal RDIM_BakeResults rdim2_bake(Arena *arena, RDIM_BakeParams *params);
#endif // RDI_MAKE_LOCAL_2_H