mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-09 17:35:41 +00:00
checkpoint on new simplified location info baking. plug in constant data baking, bytecode baking
This commit is contained in:
@@ -976,8 +976,6 @@ rdim_inline_site_chunk_list_concat_in_place(RDIM_InlineSiteChunkList *dst, RDIM_
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Location Info Building
|
||||
|
||||
//- rjf: bytecode
|
||||
|
||||
RDI_PROC RDIM_EvalBytecodeOp *
|
||||
rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp op, RDI_U64 p)
|
||||
{
|
||||
@@ -1082,71 +1080,6 @@ rdim_is_bytecode_tls_dependent(RDIM_EvalBytecode bytecode)
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: locations
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdim_encoded_size_from_location_info(RDIM_LocationInfo *info)
|
||||
{
|
||||
RDI_U64 result = 0;
|
||||
switch((RDI_LocationKindEnum)info->kind)
|
||||
{
|
||||
case RDI_LocationKind_NULL:{}break;
|
||||
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
{
|
||||
result = sizeof(RDI_LocationBytecodeStream) + info->bytecode.encoded_size + 1;
|
||||
}break;
|
||||
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
result = sizeof(RDI_LocationRegPlusU16);
|
||||
}break;
|
||||
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
result = sizeof(RDI_LocationReg);
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDIM_Location *
|
||||
rdim_location_chunk_list_push_new(RDIM_Arena *arena, RDIM_LocationChunkList *list, RDI_U64 cap, RDIM_LocationInfo *info)
|
||||
{
|
||||
RDIM_IdxedChunkListPush(arena, list, RDIM_LocationChunkNode, RDIM_Location, cap, result, n->base_encoding_off = list->total_encoded_size);
|
||||
{
|
||||
RDI_U64 encoded_size = rdim_encoded_size_from_location_info(info);
|
||||
rdim_memcpy_struct(&result->info, info);
|
||||
result->relative_encoding_off = list->last->encoded_size;
|
||||
list->last->encoded_size += encoded_size;
|
||||
list->total_encoded_size += encoded_size;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdim_off_from_location(RDIM_Location *location)
|
||||
{
|
||||
RDI_U64 off = 0;
|
||||
if(location != 0 && location->chunk != 0)
|
||||
{
|
||||
off = location->chunk->base_encoding_off + location->relative_encoding_off + 1;
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
RDI_PROC void
|
||||
rdim_location_chunk_list_concat_in_place(RDIM_LocationChunkList *dst, RDIM_LocationChunkList *to_push)
|
||||
{
|
||||
for(RDIM_LocationChunkNode *n = to_push->first; n != 0; n = n->next)
|
||||
{
|
||||
n->base_encoding_off += dst->total_encoded_size;
|
||||
}
|
||||
RDIM_IdxedChunkListConcatInPlace(RDIM_LocationChunkNode, dst, to_push, dst->total_encoded_size += to_push->total_encoded_size);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Scope Info Building
|
||||
|
||||
@@ -1196,7 +1129,7 @@ rdim_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Loc
|
||||
RDIM_LocationCase *n = rdim_push_array(arena, RDIM_LocationCase, 1);
|
||||
RDIM_SLLQueuePush(list->first, list->last, n);
|
||||
list->count += 1;
|
||||
n->location = location;
|
||||
n->location = *location;
|
||||
n->voff_range = voff_range;
|
||||
scopes->location_case_count += 1;
|
||||
return n;
|
||||
@@ -1287,7 +1220,6 @@ rdim_bake_params_concat_in_place(RDIM_BakeParams *dst, RDIM_BakeParams *src)
|
||||
rdim_udt_chunk_list_concat_in_place(&dst->udts, &src->udts);
|
||||
rdim_src_file_chunk_list_concat_in_place(&dst->src_files, &src->src_files);
|
||||
rdim_line_table_chunk_list_concat_in_place(&dst->line_tables, &src->line_tables);
|
||||
rdim_location_chunk_list_concat_in_place(&dst->locations, &src->locations);
|
||||
rdim_symbol_chunk_list_concat_in_place(&dst->global_variables, &src->global_variables);
|
||||
rdim_symbol_chunk_list_concat_in_place(&dst->thread_variables, &src->thread_variables);
|
||||
rdim_symbol_chunk_list_concat_in_place(&dst->constants, &src->constants);
|
||||
|
||||
@@ -850,52 +850,21 @@ struct RDIM_EvalBytecode
|
||||
|
||||
//- rjf: location types
|
||||
|
||||
typedef struct RDIM_LocationInfo RDIM_LocationInfo;
|
||||
struct RDIM_LocationInfo
|
||||
typedef struct RDIM_Location RDIM_Location;
|
||||
struct RDIM_Location
|
||||
{
|
||||
RDI_LocationKind kind;
|
||||
RDI_U8 reg_code;
|
||||
RDI_U64 offset;
|
||||
RDIM_EvalBytecode bytecode;
|
||||
String8 value_data;
|
||||
};
|
||||
|
||||
typedef struct RDIM_Location RDIM_Location;
|
||||
struct RDIM_Location
|
||||
{
|
||||
struct RDIM_LocationChunkNode *chunk;
|
||||
RDIM_LocationInfo info;
|
||||
RDI_U64 relative_encoding_off;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LocationChunkNode RDIM_LocationChunkNode;
|
||||
struct RDIM_LocationChunkNode
|
||||
{
|
||||
RDIM_LocationChunkNode *next;
|
||||
RDIM_Location *v;
|
||||
RDI_U64 count;
|
||||
RDI_U64 cap;
|
||||
RDI_U64 base_idx;
|
||||
RDI_U64 base_encoding_off;
|
||||
RDI_U64 encoded_size;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LocationChunkList RDIM_LocationChunkList;
|
||||
struct RDIM_LocationChunkList
|
||||
{
|
||||
RDIM_LocationChunkNode *first;
|
||||
RDIM_LocationChunkNode *last;
|
||||
RDI_U64 chunk_count;
|
||||
RDI_U64 total_count;
|
||||
RDI_U64 total_encoded_size;
|
||||
};
|
||||
|
||||
//- rjf: location cases
|
||||
|
||||
typedef struct RDIM_LocationCase RDIM_LocationCase;
|
||||
struct RDIM_LocationCase
|
||||
{
|
||||
RDIM_LocationCase *next;
|
||||
RDIM_Location *location;
|
||||
RDIM_Location location;
|
||||
RDIM_Rng1U64 voff_range;
|
||||
};
|
||||
|
||||
@@ -1047,7 +1016,6 @@ struct RDIM_BakeParams
|
||||
RDIM_UDTChunkList udts;
|
||||
RDIM_SrcFileChunkList src_files;
|
||||
RDIM_LineTableChunkList line_tables;
|
||||
RDIM_LocationChunkList locations;
|
||||
RDIM_SymbolChunkList global_variables;
|
||||
RDIM_SymbolChunkList thread_variables;
|
||||
RDIM_SymbolChunkList constants;
|
||||
@@ -1707,20 +1675,13 @@ RDI_PROC void rdim_inline_site_chunk_list_concat_in_place(RDIM_InlineSiteChunkLi
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Location Info Building
|
||||
|
||||
//- rjf: bytecode
|
||||
RDI_PROC RDIM_EvalBytecodeOp * rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp op, RDI_U64 p);
|
||||
RDI_PROC RDIM_EvalBytecodeOp *rdim_bytecode_push_op(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalOp op, RDI_U64 p);
|
||||
RDI_PROC void rdim_bytecode_push_uconst(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_U64 x);
|
||||
RDI_PROC void rdim_bytecode_push_sconst(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_S64 x);
|
||||
RDI_PROC void rdim_bytecode_push_convert(RDIM_Arena *arena, RDIM_EvalBytecode *bytecode, RDI_EvalTypeGroup in, RDI_EvalTypeGroup out);
|
||||
RDI_PROC void rdim_bytecode_concat_in_place(RDIM_EvalBytecode *left_dst, RDIM_EvalBytecode *right_destroyed);
|
||||
RDI_PROC B32 rdim_is_bytecode_tls_dependent(RDIM_EvalBytecode bytecode);
|
||||
|
||||
//- rjf: locations
|
||||
RDI_PROC RDI_U64 rdim_encoded_size_from_location_info(RDIM_LocationInfo *info);
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user