mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
sketch out new location representation
This commit is contained in:
+25
-8
@@ -940,13 +940,11 @@ X(RDI_U32, container_idx)\
|
|||||||
#define RDI_Symbol_XList \
|
#define RDI_Symbol_XList \
|
||||||
X(RDI_U32, name_string_idx)\
|
X(RDI_U32, name_string_idx)\
|
||||||
X(RDI_SymbolFlags, symbol_flags)\
|
X(RDI_SymbolFlags, symbol_flags)\
|
||||||
X(RDI_LocationKind, location_kind)\
|
|
||||||
X(RDI_ContainerFlags, container_flags)\
|
X(RDI_ContainerFlags, container_flags)\
|
||||||
X(RDI_U8, reserved_0)\
|
X(RDI_U16, reserved_0)\
|
||||||
X(RDI_U32, reserved_1)\
|
X(RDI_Location, location)\
|
||||||
X(RDI_U32, container_idx)\
|
X(RDI_U32, container_idx)\
|
||||||
X(RDI_U32, type_idx)\
|
X(RDI_U32, type_idx)\
|
||||||
X(RDI_U32, location_idx)\
|
|
||||||
X(RDI_U32, root_scope_idx)\
|
X(RDI_U32, root_scope_idx)\
|
||||||
X(RDI_U32, link_name_string_idx)\
|
X(RDI_U32, link_name_string_idx)\
|
||||||
|
|
||||||
@@ -1236,6 +1234,27 @@ typedef RDI_U32_Table RDI_U32_NameMapBuckets;
|
|||||||
typedef RDI_U32_Table RDI_U32_NameMapNodes;
|
typedef RDI_U32_Table RDI_U32_NameMapNodes;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef RDI_U64 RDI_Location;
|
||||||
|
#define RDI_Location_KindMask 0xff00000000000000ull
|
||||||
|
#define RDI_Location_KindShift 56
|
||||||
|
#define RDI_Location_OffMask 0x00ffffffffffffffull
|
||||||
|
#define RDI_Location_OffShift 0
|
||||||
|
#define RDI_Location_SetFirstIndexMask 0x00000000ffffffffull
|
||||||
|
#define RDI_Location_SetFirstIndexShift 0
|
||||||
|
#define RDI_Location_SetCountMask 0x00ffffff00000000ull
|
||||||
|
#define RDI_Location_SetCountShift 32
|
||||||
|
#define RDI_Location_RegCodeMask 0x00ff000000000000ull
|
||||||
|
#define RDI_Location_RegCodeShift 48
|
||||||
|
#define RDI_Location_RegOffMask 0x0000ffff00000000ull
|
||||||
|
#define RDI_Location_RegOffShift 32
|
||||||
|
#define rdi_kind_from_location(l) ((((l) & RDI_Location_KindMask) >> RDI_Location_KindShift))
|
||||||
|
#define rdi_voff_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_ModuleOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)
|
||||||
|
#define rdi_toff_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_TLSOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)
|
||||||
|
#define rdi_constant_data_off_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_ConstantDataOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)
|
||||||
|
#define rdi_set_first_index_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_Set ? (((l) & RDI_Location_SetFirstIndexMask) >> RDI_Location_SetFirstIndexShift) : 0)
|
||||||
|
#define rdi_set_count_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_Set ? (((l) & RDI_Location_SetCountMask) >> RDI_Location_SetCountShift) : 0)
|
||||||
|
#define rdi_regcode_from_location(l) ((((l) & RDI_Location_RegCodeMask) >> RDI_Location_RegCodeShift))
|
||||||
|
#define rdi_regoff_from_location(l) ((((l) & RDI_Location_RegOffMask) >> RDI_Location_RegOffShift))
|
||||||
#define RDI_EVAL_CTRLBITS(decodeN,popN,pushN) (((decodeN) << 8) | ((popN) << 4) | ((pushN) << 0))
|
#define RDI_EVAL_CTRLBITS(decodeN,popN,pushN) (((decodeN) << 8) | ((popN) << 4) | ((pushN) << 0))
|
||||||
#define RDI_DECODEN_FROM_CTRLBITS(ctrlbits) (((ctrlbits) >> 8) & 0xff)
|
#define RDI_DECODEN_FROM_CTRLBITS(ctrlbits) (((ctrlbits) >> 8) & 0xff)
|
||||||
#define RDI_POPN_FROM_CTRLBITS(ctrlbits) (((ctrlbits) >> 4) & 0xf)
|
#define RDI_POPN_FROM_CTRLBITS(ctrlbits) (((ctrlbits) >> 4) & 0xf)
|
||||||
@@ -1451,13 +1470,11 @@ struct RDI_Symbol
|
|||||||
{
|
{
|
||||||
RDI_U32 name_string_idx;
|
RDI_U32 name_string_idx;
|
||||||
RDI_SymbolFlags symbol_flags;
|
RDI_SymbolFlags symbol_flags;
|
||||||
RDI_LocationKind location_kind;
|
|
||||||
RDI_ContainerFlags container_flags;
|
RDI_ContainerFlags container_flags;
|
||||||
RDI_U8 reserved_0;
|
RDI_U16 reserved_0;
|
||||||
RDI_U32 reserved_1;
|
RDI_Location location;
|
||||||
RDI_U32 container_idx;
|
RDI_U32 container_idx;
|
||||||
RDI_U32 type_idx;
|
RDI_U32 type_idx;
|
||||||
RDI_U32 location_idx;
|
|
||||||
RDI_U32 root_scope_idx;
|
RDI_U32 root_scope_idx;
|
||||||
RDI_U32 link_name_string_idx;
|
RDI_U32 link_name_string_idx;
|
||||||
};
|
};
|
||||||
|
|||||||
+27
-4
@@ -1058,13 +1058,11 @@ RDI_SymbolMemberTable:
|
|||||||
{
|
{
|
||||||
{name_string_idx RDI_U32 ""}
|
{name_string_idx RDI_U32 ""}
|
||||||
{symbol_flags RDI_SymbolFlags ""}
|
{symbol_flags RDI_SymbolFlags ""}
|
||||||
{location_kind RDI_LocationKind ""}
|
|
||||||
{container_flags RDI_ContainerFlags ""}
|
{container_flags RDI_ContainerFlags ""}
|
||||||
{reserved_0 RDI_U8 ""}
|
{reserved_0 RDI_U16 ""}
|
||||||
{reserved_1 RDI_U32 ""}
|
{location RDI_Location ""}
|
||||||
{container_idx RDI_U32 ""}
|
{container_idx RDI_U32 ""}
|
||||||
{type_idx RDI_U32 ""}
|
{type_idx RDI_U32 ""}
|
||||||
{location_idx RDI_U32 ""}
|
|
||||||
{root_scope_idx RDI_U32 ""}
|
{root_scope_idx RDI_U32 ""}
|
||||||
{link_name_string_idx RDI_U32 ""}
|
{link_name_string_idx RDI_U32 ""}
|
||||||
}
|
}
|
||||||
@@ -1231,6 +1229,31 @@ RDI_LocationSetElementMemberTable:
|
|||||||
@expand(RDI_LocationKindTable a) `$(a.name .. =>20) = $(a.value)`
|
@expand(RDI_LocationKindTable a) `$(a.name .. =>20) = $(a.value)`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@gen(enums)
|
||||||
|
{
|
||||||
|
`typedef RDI_U64 RDI_Location;`;
|
||||||
|
`#define RDI_Location_KindMask 0xff00000000000000ull`;
|
||||||
|
`#define RDI_Location_KindShift 56`;
|
||||||
|
`#define RDI_Location_OffMask 0x00ffffffffffffffull`;
|
||||||
|
`#define RDI_Location_OffShift 0`;
|
||||||
|
`#define RDI_Location_SetFirstIndexMask 0x00000000ffffffffull`;
|
||||||
|
`#define RDI_Location_SetFirstIndexShift 0`;
|
||||||
|
`#define RDI_Location_SetCountMask 0x00ffffff00000000ull`;
|
||||||
|
`#define RDI_Location_SetCountShift 32`;
|
||||||
|
`#define RDI_Location_RegCodeMask 0x00ff000000000000ull`;
|
||||||
|
`#define RDI_Location_RegCodeShift 48`;
|
||||||
|
`#define RDI_Location_RegOffMask 0x0000ffff00000000ull`;
|
||||||
|
`#define RDI_Location_RegOffShift 32`;
|
||||||
|
`#define rdi_kind_from_location(l) ((((l) & RDI_Location_KindMask) >> RDI_Location_KindShift))`;
|
||||||
|
`#define rdi_voff_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_ModuleOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)`;
|
||||||
|
`#define rdi_toff_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_TLSOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)`;
|
||||||
|
`#define rdi_constant_data_off_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_ConstantDataOff ? (((l) & RDI_Location_OffMask) >> RDI_Location_OffShift) : 0)`;
|
||||||
|
`#define rdi_set_first_index_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_Set ? (((l) & RDI_Location_SetFirstIndexMask) >> RDI_Location_SetFirstIndexShift) : 0)`;
|
||||||
|
`#define rdi_set_count_from_location(l) (rdi_kind_from_location(l) == RDI_LocationKind_Set ? (((l) & RDI_Location_SetCountMask) >> RDI_Location_SetCountShift) : 0)`;
|
||||||
|
`#define rdi_regcode_from_location(l) ((((l) & RDI_Location_RegCodeMask) >> RDI_Location_RegCodeShift))`;
|
||||||
|
`#define rdi_regoff_from_location(l) ((((l) & RDI_Location_RegOffMask) >> RDI_Location_RegOffShift))`;
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: xlists
|
//- rjf: xlists
|
||||||
|
|
||||||
@xlist RDI_LinkFlags_XList:
|
@xlist RDI_LinkFlags_XList:
|
||||||
|
|||||||
@@ -1709,6 +1709,17 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
|||||||
}
|
}
|
||||||
lane_sync();
|
lane_sync();
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////
|
||||||
|
//- rjf: @rdim_bake_stage build deduplicated location maps
|
||||||
|
//
|
||||||
|
RDIM_BakeStringMapTight *bake_locs__regs = 0;
|
||||||
|
RDIM_BakeStringMapTight *bake_locs__reg_plus_u16 = 0;
|
||||||
|
RDIM_BakeStringMapTight *bake_locs__bytecode = 0;
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
lane_sync();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
//- rjf: @rdim_bake_stage bake strings
|
//- rjf: @rdim_bake_stage bake strings
|
||||||
//
|
//
|
||||||
@@ -3354,30 +3365,30 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
|||||||
}
|
}
|
||||||
lane_sync();
|
lane_sync();
|
||||||
|
|
||||||
|
//////////////////////////////
|
||||||
|
//- rjf: gather all lists which form symbol tables
|
||||||
|
//
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
RDIM_SymbolChunkList *symbols;
|
||||||
|
}
|
||||||
|
symbol_table_lists[] =
|
||||||
|
{
|
||||||
|
{¶ms->global_variables},
|
||||||
|
{¶ms->thread_variables},
|
||||||
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
//- rjf: @rdim_bake_stage bake symbols (NEW)
|
//- rjf: @rdim_bake_stage bake symbols (NEW)
|
||||||
//
|
//
|
||||||
ProfScope("bake symbols")
|
ProfScope("bake symbols")
|
||||||
{
|
{
|
||||||
////////////////////////////
|
|
||||||
//- rjf: set up all symbol table baking tasks
|
|
||||||
//
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
RDIM_SymbolChunkList *symbols;
|
|
||||||
}
|
|
||||||
tasks[] =
|
|
||||||
{
|
|
||||||
{¶ms->global_variables},
|
|
||||||
{¶ms->thread_variables},
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: bake flat symbol tables
|
//- rjf: bake flat symbol tables
|
||||||
//
|
//
|
||||||
for EachElement(task_idx, tasks)
|
for EachElement(symbol_table_list_idx, symbol_table_lists)
|
||||||
{
|
{
|
||||||
RDIM_SymbolChunkList *src_symbols = tasks[task_idx].symbols;
|
RDIM_SymbolChunkList *src_symbols = symbol_table_lists[symbol_table_list_idx].symbols;
|
||||||
U64 dst_symbols_count = src_symbols->total_count + 1;
|
U64 dst_symbols_count = src_symbols->total_count + 1;
|
||||||
RDI_Symbol *dst_symbols = 0;
|
RDI_Symbol *dst_symbols = 0;
|
||||||
if(lane_idx() == 0)
|
if(lane_idx() == 0)
|
||||||
@@ -3414,6 +3425,11 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
|||||||
dst->container_flags |= RDI_ContainerKind_Type;
|
dst->container_flags |= RDI_ContainerKind_Type;
|
||||||
dst->container_idx = rdim_idx_from_udt(src->container_type->udt);
|
dst->container_idx = rdim_idx_from_udt(src->container_type->udt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: fill location
|
||||||
|
{
|
||||||
|
// TODO(rjf)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user