mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
d2r2: built-in types, move rdi variadic type -> built-in
This commit is contained in:
+2
-2
@@ -203,6 +203,7 @@ case RDI_TypeKind_ComplexF128: {result = (RDI_U8*)"ComplexF128"; *size_out = siz
|
|||||||
case RDI_TypeKind_Decimal32: {result = (RDI_U8*)"Decimal32"; *size_out = sizeof("Decimal32")-1;}break;
|
case RDI_TypeKind_Decimal32: {result = (RDI_U8*)"Decimal32"; *size_out = sizeof("Decimal32")-1;}break;
|
||||||
case RDI_TypeKind_Decimal64: {result = (RDI_U8*)"Decimal64"; *size_out = sizeof("Decimal64")-1;}break;
|
case RDI_TypeKind_Decimal64: {result = (RDI_U8*)"Decimal64"; *size_out = sizeof("Decimal64")-1;}break;
|
||||||
case RDI_TypeKind_Decimal128: {result = (RDI_U8*)"Decimal128"; *size_out = sizeof("Decimal128")-1;}break;
|
case RDI_TypeKind_Decimal128: {result = (RDI_U8*)"Decimal128"; *size_out = sizeof("Decimal128")-1;}break;
|
||||||
|
case RDI_TypeKind_Variadic: {result = (RDI_U8*)"Variadic"; *size_out = sizeof("Variadic")-1;}break;
|
||||||
case RDI_TypeKind_Modifier: {result = (RDI_U8*)"Modifier"; *size_out = sizeof("Modifier")-1;}break;
|
case RDI_TypeKind_Modifier: {result = (RDI_U8*)"Modifier"; *size_out = sizeof("Modifier")-1;}break;
|
||||||
case RDI_TypeKind_Ptr: {result = (RDI_U8*)"Ptr"; *size_out = sizeof("Ptr")-1;}break;
|
case RDI_TypeKind_Ptr: {result = (RDI_U8*)"Ptr"; *size_out = sizeof("Ptr")-1;}break;
|
||||||
case RDI_TypeKind_LRef: {result = (RDI_U8*)"LRef"; *size_out = sizeof("LRef")-1;}break;
|
case RDI_TypeKind_LRef: {result = (RDI_U8*)"LRef"; *size_out = sizeof("LRef")-1;}break;
|
||||||
@@ -221,8 +222,7 @@ case RDI_TypeKind_IncompleteUnion: {result = (RDI_U8*)"IncompleteUnion"; *size_o
|
|||||||
case RDI_TypeKind_IncompleteClass: {result = (RDI_U8*)"IncompleteClass"; *size_out = sizeof("IncompleteClass")-1;}break;
|
case RDI_TypeKind_IncompleteClass: {result = (RDI_U8*)"IncompleteClass"; *size_out = sizeof("IncompleteClass")-1;}break;
|
||||||
case RDI_TypeKind_IncompleteEnum: {result = (RDI_U8*)"IncompleteEnum"; *size_out = sizeof("IncompleteEnum")-1;}break;
|
case RDI_TypeKind_IncompleteEnum: {result = (RDI_U8*)"IncompleteEnum"; *size_out = sizeof("IncompleteEnum")-1;}break;
|
||||||
case RDI_TypeKind_Bitfield: {result = (RDI_U8*)"Bitfield"; *size_out = sizeof("Bitfield")-1;}break;
|
case RDI_TypeKind_Bitfield: {result = (RDI_U8*)"Bitfield"; *size_out = sizeof("Bitfield")-1;}break;
|
||||||
case RDI_TypeKind_Variadic: {result = (RDI_U8*)"Variadic"; *size_out = sizeof("Variadic")-1;}break;
|
case RDI_TypeKind_COUNT: {result = (RDI_U8*)"COUNT"; *size_out = sizeof("COUNT")-1;}break;
|
||||||
case RDI_TypeKind_Count: {result = (RDI_U8*)"Count"; *size_out = sizeof("Count")-1;}break;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -315,6 +315,7 @@ RDI_TypeKind_ComplexF128 = 0x0025,
|
|||||||
RDI_TypeKind_Decimal32 = 0x0026,
|
RDI_TypeKind_Decimal32 = 0x0026,
|
||||||
RDI_TypeKind_Decimal64 = 0x0027,
|
RDI_TypeKind_Decimal64 = 0x0027,
|
||||||
RDI_TypeKind_Decimal128 = 0x0028,
|
RDI_TypeKind_Decimal128 = 0x0028,
|
||||||
|
RDI_TypeKind_Variadic = 0x0029,
|
||||||
RDI_TypeKind_Modifier = 0x1000,
|
RDI_TypeKind_Modifier = 0x1000,
|
||||||
RDI_TypeKind_Ptr = 0x1001,
|
RDI_TypeKind_Ptr = 0x1001,
|
||||||
RDI_TypeKind_LRef = 0x1002,
|
RDI_TypeKind_LRef = 0x1002,
|
||||||
@@ -333,10 +334,9 @@ RDI_TypeKind_IncompleteUnion = 0x2006,
|
|||||||
RDI_TypeKind_IncompleteClass = 0x2007,
|
RDI_TypeKind_IncompleteClass = 0x2007,
|
||||||
RDI_TypeKind_IncompleteEnum = 0x2008,
|
RDI_TypeKind_IncompleteEnum = 0x2008,
|
||||||
RDI_TypeKind_Bitfield = 0xF000,
|
RDI_TypeKind_Bitfield = 0xF000,
|
||||||
RDI_TypeKind_Variadic = 0xF001,
|
RDI_TypeKind_COUNT = 0xF002,
|
||||||
RDI_TypeKind_Count = 0xF002,
|
|
||||||
RDI_TypeKind_FirstBuiltIn = RDI_TypeKind_Void,
|
RDI_TypeKind_FirstBuiltIn = RDI_TypeKind_Void,
|
||||||
RDI_TypeKind_LastBuiltIn = RDI_TypeKind_Decimal128,
|
RDI_TypeKind_LastBuiltIn = RDI_TypeKind_Variadic,
|
||||||
RDI_TypeKind_FirstConstructed = RDI_TypeKind_Modifier,
|
RDI_TypeKind_FirstConstructed = RDI_TypeKind_Modifier,
|
||||||
RDI_TypeKind_LastConstructed = RDI_TypeKind_MemberPtr,
|
RDI_TypeKind_LastConstructed = RDI_TypeKind_MemberPtr,
|
||||||
RDI_TypeKind_FirstUserDefined = RDI_TypeKind_Struct,
|
RDI_TypeKind_FirstUserDefined = RDI_TypeKind_Struct,
|
||||||
@@ -810,6 +810,7 @@ X(ComplexF128)\
|
|||||||
X(Decimal32)\
|
X(Decimal32)\
|
||||||
X(Decimal64)\
|
X(Decimal64)\
|
||||||
X(Decimal128)\
|
X(Decimal128)\
|
||||||
|
X(Variadic)\
|
||||||
X(Modifier)\
|
X(Modifier)\
|
||||||
X(Ptr)\
|
X(Ptr)\
|
||||||
X(LRef)\
|
X(LRef)\
|
||||||
@@ -828,8 +829,7 @@ X(IncompleteUnion)\
|
|||||||
X(IncompleteClass)\
|
X(IncompleteClass)\
|
||||||
X(IncompleteEnum)\
|
X(IncompleteEnum)\
|
||||||
X(Bitfield)\
|
X(Bitfield)\
|
||||||
X(Variadic)\
|
X(COUNT)\
|
||||||
X(Count)\
|
|
||||||
|
|
||||||
#define RDI_TypeModifierFlags_XList \
|
#define RDI_TypeModifierFlags_XList \
|
||||||
X(Const)\
|
X(Const)\
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ typedef struct RDIB_UDT
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RDI_TypeKindExt_Lo = RDI_TypeKind_Count,
|
RDI_TypeKindExt_Lo = RDI_TypeKind_COUNT,
|
||||||
RDI_TypeKindExt_VirtualTable,
|
RDI_TypeKindExt_VirtualTable,
|
||||||
RDI_TypeKindExt_StaticMethod,
|
RDI_TypeKindExt_StaticMethod,
|
||||||
RDI_TypeKindExt_Members,
|
RDI_TypeKindExt_Members,
|
||||||
|
|||||||
@@ -415,6 +415,12 @@ few_params1(Pair *pairs, int count, Function_No_Params_Type *no_params_type){
|
|||||||
typedef char MyByte;
|
typedef char MyByte;
|
||||||
raddbg_type_view(MyByte *, no_string($));
|
raddbg_type_view(MyByte *, no_string($));
|
||||||
|
|
||||||
|
static void
|
||||||
|
variadic_params(char *fmt, ...)
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
type_coverage_eval_tests(void)
|
type_coverage_eval_tests(void)
|
||||||
{
|
{
|
||||||
@@ -709,6 +715,8 @@ type_coverage_eval_tests(void)
|
|||||||
|
|
||||||
SizedKind sized_kind = SizedKind_C;
|
SizedKind sized_kind = SizedKind_C;
|
||||||
|
|
||||||
|
variadic_params("foo", 123, 456);
|
||||||
|
|
||||||
int x = (int)(Anonymous_D);
|
int x = (int)(Anonymous_D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -759,7 +759,8 @@ RDI_TypeKindTable:
|
|||||||
{ComplexF128 0x0025 32 }
|
{ComplexF128 0x0025 32 }
|
||||||
{Decimal32 0x0026 4 }
|
{Decimal32 0x0026 4 }
|
||||||
{Decimal64 0x0027 8 }
|
{Decimal64 0x0027 8 }
|
||||||
{Decimal128 0x0028 16 LastBuiltIn }
|
{Decimal128 0x0028 16 }
|
||||||
|
{Variadic 0x0029 0 LastBuiltIn }
|
||||||
//-
|
//-
|
||||||
{Modifier 0x1000 0 FirstConstructed }
|
{Modifier 0x1000 0 FirstConstructed }
|
||||||
{Ptr 0x1001 0 }
|
{Ptr 0x1001 0 }
|
||||||
@@ -781,8 +782,7 @@ RDI_TypeKindTable:
|
|||||||
{IncompleteEnum 0x2008 0 LastIncomplete LastUserDefined}
|
{IncompleteEnum 0x2008 0 LastIncomplete LastUserDefined}
|
||||||
//-
|
//-
|
||||||
{Bitfield 0xF000 0 }
|
{Bitfield 0xF000 0 }
|
||||||
{Variadic 0xF001 0 }
|
{COUNT 0xF002 0 }
|
||||||
{Count 0xF002 0 }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@table(name value)
|
@table(name value)
|
||||||
|
|||||||
@@ -3004,7 +3004,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
|||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
RDIM_Type *builtin_types[RDI_TypeKind_Count] = {0};
|
RDIM_Type *builtin_types[RDI_TypeKind_COUNT] = {0};
|
||||||
for (RDI_TypeKind type_kind = RDI_TypeKind_FirstBuiltIn; type_kind <= RDI_TypeKind_LastBuiltIn; type_kind += 1) {
|
for (RDI_TypeKind type_kind = RDI_TypeKind_FirstBuiltIn; type_kind <= RDI_TypeKind_LastBuiltIn; type_kind += 1) {
|
||||||
RDIM_Type *type = rdim_type_chunk_list_push(arena, &g_d2r_shared.types, D2R_TYPE_CHUNK_CAP);
|
RDIM_Type *type = rdim_type_chunk_list_push(arena, &g_d2r_shared.types, D2R_TYPE_CHUNK_CAP);
|
||||||
type->kind = type_kind;
|
type->kind = type_kind;
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params)
|
|||||||
unit_line_tables[unit_idx] = dst_line_table;
|
unit_line_tables[unit_idx] = dst_line_table;
|
||||||
|
|
||||||
//- rjf: set up per-unit file sequence map
|
//- rjf: set up per-unit file sequence map
|
||||||
unit_file_seq_maps[unit_idx].slots_count = line_table_header->files.count;
|
unit_file_seq_maps[unit_idx].slots_count = line_table_header->files.count + 1;
|
||||||
unit_file_seq_maps[unit_idx].slots = push_array(scratch.arena, FileSeqNode *, unit_file_seq_maps[unit_idx].slots_count);
|
unit_file_seq_maps[unit_idx].slots = push_array(scratch.arena, FileSeqNode *, unit_file_seq_maps[unit_idx].slots_count);
|
||||||
|
|
||||||
//- rjf: set up vm registers
|
//- rjf: set up vm registers
|
||||||
@@ -705,7 +705,7 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: sequence ended explicitly, or file change, or end of stream? -> push to line table
|
//- rjf: sequence ended explicitly, or file change, or end of stream? -> push to line table
|
||||||
if(vm_regs.end_sequence || (src_file != line_seq_src_file && first_line_seq_chunk != 0) || off >= unit_line_table_data.size)
|
if(line_seq_src_file != 0 && (vm_regs.end_sequence || (src_file != line_seq_src_file && first_line_seq_chunk != 0) || off >= unit_line_table_data.size))
|
||||||
{
|
{
|
||||||
// rjf: combine voffs/lines/cols
|
// rjf: combine voffs/lines/cols
|
||||||
U64 seq_line_count = total_line_seq_count;
|
U64 seq_line_count = total_line_seq_count;
|
||||||
@@ -839,6 +839,30 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params)
|
|||||||
}
|
}
|
||||||
lane_sync_u64(&all_line_tables, 0);
|
lane_sync_u64(&all_line_tables, 0);
|
||||||
|
|
||||||
|
////////////////////////////
|
||||||
|
//- rjf: build built-in types
|
||||||
|
//
|
||||||
|
RDIM_TypeChunkList *builtin_types = 0;
|
||||||
|
RDIM_Type **builtin_type_from_kind_map = 0; // [RDI_TypeKind_LastBuiltIn - RDI_TypeKind_FirstBuiltIn + 1]
|
||||||
|
U64 builtin_type_count = RDI_TypeKind_LastBuiltIn - RDI_TypeKind_FirstBuiltIn + 1;
|
||||||
|
ProfScope("build built-in types") if(lane_idx() == 0)
|
||||||
|
{
|
||||||
|
builtin_types = push_array(scratch.arena, RDIM_TypeChunkList, 1);
|
||||||
|
builtin_type_from_kind_map = push_array(scratch.arena, RDIM_Type *, builtin_type_count);
|
||||||
|
for(RDI_TypeKind k = RDI_TypeKind_FirstBuiltIn; k <= RDI_TypeKind_LastBuiltIn; k += 1)
|
||||||
|
{
|
||||||
|
RDIM_Type *type = rdim_type_chunk_list_push(arena, builtin_types, builtin_type_count);
|
||||||
|
type->kind = k;
|
||||||
|
type->name.str = rdi_string_from_type_kind(k, &type->name.size);
|
||||||
|
type->byte_size = rdi_size_from_basic_type_kind(k);
|
||||||
|
if(type->byte_size == max_U32) { type->byte_size = byte_size_from_arch(arch); }
|
||||||
|
builtin_type_from_kind_map[k - RDI_TypeKind_FirstBuiltIn] = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lane_sync_u64(&builtin_types, 0);
|
||||||
|
lane_sync_u64(&builtin_type_from_kind_map, 0);
|
||||||
|
#define d2r2_type_from_builtin_kind(k) ((RDI_TypeKind_FirstBuiltIn <= (k) && (k) <= RDI_TypeKind_LastBuiltIn) ? builtin_types[k - RDI_TypeKind_FirstBuiltIn] : 0)
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: fill result
|
//- rjf: fill result
|
||||||
//
|
//
|
||||||
@@ -847,6 +871,7 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params)
|
|||||||
// TODO(rjf)
|
// TODO(rjf)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef d2r2_type_from_builtin_kind
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user