UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
syms_type_graph.c
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#ifndef SYMS_TYPE_GRAPH_C
4#define SYMS_TYPE_GRAPH_C
5
7//~ allen: Type Graph Setup Functions
8
9SYMS_API void
12 SYMS_U64 address_size){
13 SYMS_ProfBegin("syms_type_graph_init");
14
15 graph->arena = graph_arena;
16 graph->string_cons = graph_string_cons;
17 graph->address_size = address_size;
18
19 graph->content_buckets.buckets =
21
22 graph->usid_buckets.buckets =
24
25 graph->usid_buckets.bucket_counts =
27
28 graph->name_buckets.buckets =
30
32}
33
35//~ allen: Type Name Lookup Functions
36
39 SYMS_String8 result = syms_string_cons(graph->arena, graph->string_cons, name);
40 return(result);
41}
42
45 SYMS_TypeNode *result = syms_type_from_usid_buckets(&graph->usid_buckets, usid);
46 return(result);
47}
48
51 SYMS_TypeChain result = {0};
54 if (chain != 0){
55 syms_memmove(&result, chain, sizeof(*chain));
56 }
57 return(result);
58}
59
61//~ allen: Type Node Info Getters
62
65 SYMS_TypeMemberArray result = {0};
66 if (node->lazy_ptr != 0 && syms_type_kind_is_record(node->kind)){
67 result = *(SYMS_TypeMemberArray*)node->lazy_ptr;
68 }
69 return(result);
70}
71
74 SYMS_EnumMemberArray result = {0};
75 if (node->lazy_ptr != 0 && syms_type_kind_is_enum(node->kind)){
76 result = *(SYMS_EnumMemberArray*)node->lazy_ptr;
77 }
78 return(result);
79}
80
83 SYMS_B32 result = 0;
84 if (node->kind == SYMS_TypeKind_Struct ||
85 node->kind == SYMS_TypeKind_Union ||
86 node->kind == SYMS_TypeKind_Class ||
87 node->kind == SYMS_TypeKind_Enum){
88 result = (node->lazy_ptr != 0);
89 }
90 return(result);
91}
92
94//~ allen: Type Node Basic Type Getters
95
98 SYMS_TypeNode *result = graph->type_void;
99 if (result == 0){
101 graph->type_void = result;
102 }
103 return(result);
104}
105
108 SYMS_TypeNode *result = graph->type_bool;
109 if (result == 0){
111 graph->type_bool = result;
112 }
113 return(result);
114}
115
118 SYMS_TypeNode *result = graph->type_u8;
119 if (result == 0){
121 graph->type_u8 = result;
122 }
123 return(result);
124}
125
128 SYMS_TypeNode *result = graph->type_u16;
129 if (result == 0){
131 graph->type_u16 = result;
132 }
133 return(result);
134}
135
138 SYMS_TypeNode *result = graph->type_u32;
139 if (result == 0){
141 graph->type_u32 = result;
142 }
143 return(result);
144}
145
148 SYMS_TypeNode *result = graph->type_u64;
149 if (result == 0){
151 graph->type_u64 = result;
152 }
153 return(result);
154}
155
158 SYMS_TypeNode *result = graph->type_u128;
159 if (result == 0){
161 graph->type_u128 = result;
162 }
163 return(result);
164}
165
168 SYMS_TypeNode *result = graph->type_s8;
169 if (result == 0){
171 graph->type_s8 = result;
172 }
173 return(result);
174}
175
178 SYMS_TypeNode *result = graph->type_s16;
179 if (result == 0){
181 graph->type_s16 = result;
182 }
183 return(result);
184}
185
188 SYMS_TypeNode *result = graph->type_s32;
189 if (result == 0){
191 graph->type_s32 = result;
192 }
193 return(result);
194}
195
198 SYMS_TypeNode *result = graph->type_s64;
199 if (result == 0){
201 graph->type_s64 = result;
202 }
203 return(result);
204}
205
208 SYMS_TypeNode *result = graph->type_s64;
209 if (result == 0){
211 graph->type_s128 = result;
212 }
213 return(result);
214}
215
218 SYMS_TypeNode *result = graph->type_f32;
219 if (result == 0){
221 graph->type_f32 = result;
222 }
223 return(result);
224}
225
228 SYMS_TypeNode *result = graph->type_f64;
229 if (result == 0){
231 graph->type_f64 = result;
232 }
233 return(result);
234}
235
237//~ allen: Type Node Constructors
238
241 SYMS_ProfBegin("syms_type_cons_basic");
242
244
245 SYMS_U64 content[3];
246 content[0] = basic_kind;
247 content[1] = size;
248 content[2] = (SYMS_U64)name_cons.str;
249 SYMS_String8 data = {(SYMS_U8*)content, sizeof(content)};
250 SYMS_TypeNode *result = syms_type_from_content_buckets(&graph->content_buckets, data);
251
252 if (result == 0){
253 result = syms_push_array_zero(graph->arena, SYMS_TypeNode, 1);
254 syms_type_content_insert(graph->arena, &graph->content_buckets, data, result);
255 syms_type_name_insert(graph->arena, &graph->name_buckets, name_cons.str, result);
256
257 result->kind = basic_kind;
258 result->name = name_cons;
259 result->byte_size = size;
261 result->this_type = &syms_type_node_nil;
262 }
263
264 SYMS_ProfEnd();
265 return(result);
266}
267
270 SYMS_ProfBegin("syms_type_cons_mod");
271
272 SYMS_U64 content[3];
274 content[1] = mods;
275 content[2] = (SYMS_U64)type;
276 SYMS_String8 data = {(SYMS_U8*)content, sizeof(content)};
277 SYMS_TypeNode *result = syms_type_from_content_buckets(&graph->content_buckets, data);
278
279 if (result == 0){
280 result = syms_push_array_zero(graph->arena, SYMS_TypeNode, 1);
281 syms_type_content_insert(graph->arena, &graph->content_buckets, data, result);
282
284 result->byte_size = type->byte_size;
285 result->direct_type = type;
286 result->this_type = &syms_type_node_nil;
287 result->mods = mods;
288 }
289
290 SYMS_ProfEnd();
291 return(result);
292}
293
296 SYMS_ProfBegin("syms_type_cons_ptr");
297
298 SYMS_U64 content[2];
299 content[0] = ptr_kind;
300 content[1] = (SYMS_U64)type;
301 SYMS_String8 data = {(SYMS_U8*)content, sizeof(content)};
302 SYMS_TypeNode *result = syms_type_from_content_buckets(&graph->content_buckets, data);
303
304 if (result == 0){
305 result = syms_push_array_zero(graph->arena, SYMS_TypeNode, 1);
306 syms_type_content_insert(graph->arena, &graph->content_buckets, data, result);
307
308 result->kind = ptr_kind;
309 result->byte_size = graph->address_size;
310 result->direct_type = type;
311 result->this_type = &syms_type_node_nil;
312 }
313
314 SYMS_ProfEnd();
315 return(result);
316}
317
320 SYMS_ProfBegin("syms_type_cons_array");
321
322 SYMS_U64 content[3];
324 content[1] = count;
325 content[2] = (SYMS_U64)type;
326 SYMS_String8 data = {(SYMS_U8*)content, sizeof(content)};
327 SYMS_TypeNode *result = syms_type_from_content_buckets(&graph->content_buckets, data);
328
329 if (result == 0){
330 result = syms_push_array_zero(graph->arena, SYMS_TypeNode, 1);
331 syms_type_content_insert(graph->arena, &graph->content_buckets, data, result);
332
333 result->kind = SYMS_TypeKind_Array;
334 result->byte_size = count*type->byte_size;
335 result->direct_type = type;
336 result->this_type = &syms_type_node_nil;
337 result->array_count = count;
338 }
339
340 SYMS_ProfEnd();
341 return(result);
342}
343
346 SYMS_TypeNode **param_types, SYMS_U64 param_count){
347 SYMS_ProfBegin("syms_type_cons_proc");
348
349 SYMS_String8 params_as_string = {(SYMS_U8*)param_types, sizeof(*param_types)*param_count};
351
352 SYMS_U64 content[4];
355 content[2] = (SYMS_U64)this_type;
356 content[3] = (SYMS_U64)params_cons.str;
357 SYMS_String8 data = {(SYMS_U8*)content, sizeof(content)};
358 SYMS_TypeNode *result = syms_type_from_content_buckets(&graph->content_buckets, data);
359
360 if (result == 0){
361 result = syms_push_array_zero(graph->arena, SYMS_TypeNode, 1);
362 syms_type_content_insert(graph->arena, &graph->content_buckets, data, result);
363
364 result->kind = SYMS_TypeKind_Proc;
365 result->byte_size = 0;
366 result->direct_type = ret_type;
367 result->this_type = this_type;
368 result->proc.params = (SYMS_TypeNode**)(params_cons.str);
369 result->proc.param_count = param_count;
370 }
371
372 SYMS_ProfEnd();
373 return(result);
374}
375
378 SYMS_ProfBegin("syms_type_cons_mem_ptr");
379
380 SYMS_U64 content[3];
382 content[1] = (SYMS_U64)container;
383 content[2] = (SYMS_U64)type;
384 SYMS_String8 data = {(SYMS_U8*)content, sizeof(content)};
385 SYMS_TypeNode *result = syms_type_from_content_buckets(&graph->content_buckets, data);
386
387 if (result == 0){
388 result = syms_push_array_zero(graph->arena, SYMS_TypeNode, 1);
389 syms_type_content_insert(graph->arena, &graph->content_buckets, data, result);
390
391 SYMS_U64 byte_size = graph->address_size;
392 if (type->kind == SYMS_TypeKind_Proc){
393 byte_size *= 2;
394 }
395
397 result->byte_size = byte_size;
398 result->direct_type = type;
399 result->this_type = container;
400 }
401
402 SYMS_ProfEnd();
403 return(result);
404}
405
418
427
428SYMS_API void
430 SYMS_String8 name, SYMS_TypeNode *type){
432 SYMS_QueuePush(list->first, list->last, member);
433 list->count += 1;
434 member->name = name;
435 member->type = type;
436}
437
438SYMS_API void
440 SYMS_TypeKind kind, SYMS_String8 name,
444 kind == SYMS_TypeKind_Union ||
445 kind == SYMS_TypeKind_Class);
446
447 // setup members memory now (so we can fill it)
449
450 SYMS_U64 member_count = list->count;
452
453 array->mems = members;
454 array->count = member_count;
455
456 // fill members (fused compute layout & format to output)
457 SYMS_U64 byte_size = 0;
458 switch (kind){
461 {
463 SYMS_TypeMember *mem = members;
464 for (SYMS_TypeConsMember *node = list->first;
465 node != 0;
466 node = node->next, mem += 1){
467 // update layout w/ alignment (guess work - we don't know for sure the align of this type)
468 SYMS_U64 member_byte_size = node->type->byte_size;
470 if (member_byte_size >= 8 && (member_byte_size & 0x7) == 0){
472 }
473 else if (member_byte_size >= 4 && (member_byte_size & 0x3) == 0){
475 }
476 else if (member_byte_size >= 2 && (member_byte_size & 0x1) == 0){
478 }
480 byte_size = SYMS_AlignPow2(byte_size, member_byte_align);
481
482 // fill this member
485 mem->flags = 0;
486 mem->name = syms_type_string_cons(graph, node->name);
487 mem->off = byte_size;
488 mem->virtual_off = 0;
489 mem->type = node->type;
490
491 // update layout position
492 byte_size += node->type->byte_size;
493 }
494 byte_size = SYMS_AlignPow2(byte_size, byte_align);
495 }break;
496
498 {
500 SYMS_TypeMember *mem = members;
501 for (SYMS_TypeConsMember *node = list->first;
502 node != 0;
503 node = node->next, mem += 1){
504 // fill this member
507 mem->flags = 0;
508 mem->name = syms_type_string_cons(graph, node->name);
509 mem->off = 0;
510 mem->virtual_off = 0;
511 mem->type = node->type;
512
513 // update layout computation
514 SYMS_U64 member_byte_size = node->type->byte_size;
516 if (member_byte_size >= 8 && (member_byte_size & 0x7) == 0){
518 }
519 else if (member_byte_size >= 4 && (member_byte_size & 0x3) == 0){
521 }
522 else if (member_byte_size >= 2 && (member_byte_size & 0x1) == 0){
524 }
525 byte_size = SYMS_MAX(byte_size, member_byte_size);
527 }
528 byte_size = SYMS_AlignPow2(byte_size, byte_align);
529 }break;
530 }
531
532 // fill the node
534 node->kind = kind;
535 node->name = name_cons;
536 node->byte_size = byte_size;
537 node->lazy_ptr = array;
538}
539
542 SYMS_TypeKind kind, SYMS_String8 name, SYMS_U64 byte_size,
546
548 result->kind = kind;
549 result->name = name_cons;
550 result->byte_size = byte_size;
551 result->unique = unique;
553 result->this_type = &syms_type_node_nil;
554
555 syms_type_name_insert(graph->arena, &graph->name_buckets, name_cons.str, result);
556
557 return(result);
558}
559
566
568 result->kind = SYMS_TypeKind_Enum;
569 result->name = name_cons;
570 result->byte_size = underlying_type->byte_size;
571 result->unique = unique;
573 result->this_type = &syms_type_node_nil;
574
575 syms_type_name_insert(graph->arena, &graph->name_buckets, name_cons.str, result);
576
577 return(result);
578}
579
582 SYMS_String8 name, SYMS_TypeNode *type,
586
588 result->kind = SYMS_TypeKind_Typedef;
589 result->name = name_cons;
590 result->byte_size = type->byte_size;
591 result->unique = unique;
592 result->direct_type = type;
593 result->this_type = &syms_type_node_nil;
594
595 syms_type_name_insert(graph->arena, &graph->name_buckets, name_cons.str, result);
596
597 return(result);
598}
599
602 SYMS_TypeKind kind, SYMS_String8 name, SYMS_TypeNode *type,
606
608 result->kind = kind;
609 result->name = name_cons;
610 result->byte_size = type->byte_size;
611 result->unique = unique;
612 result->direct_type = type;
613 result->this_type = &syms_type_node_nil;
614
615 return(result);
616}
617
618// constructor usid place holders
619
622 SYMS_TypeUSIDPlaceHolder result = {0};
623 result.usid_node = syms_type_usid_insert(graph->arena, &graph->usid_buckets, usid, &syms_type_node_nil);
624 return(result);
625}
626
627SYMS_API void
629 SYMS_TypeNode *node){
630 place->usid_node->type = node;
631 syms_memzero_struct(place);
632}
633
634// artificial records helpers
635
638 SYMS_TypeMember *result = 0;
639 if (node->lazy_ptr == 0 && syms_type_kind_is_record(node->kind)){
642 array->mems = members;
643 array->count = member_count;
644 node->lazy_ptr = array;
645 result = members;
646 }
647 return(result);
648}
649
650
651// artificial enums helpers
652
655 SYMS_EnumMember *result = 0;
656 if (node->lazy_ptr == 0 && syms_type_kind_is_enum(node->kind)){
659 array->enum_members = members;
660 array->count = member_count;
661 node->lazy_ptr = array;
662 result = members;
663 }
664 return(result);
665}
666
667
668// constructor helpers
669
672 SYMS_TypeUniqueInfo *result = 0;
673 if (unique_opt != 0){
674 result = syms_push_array_zero(arena, SYMS_TypeUniqueInfo, 1);
675 *result = *unique_opt;
676 }
677 return(result);
678}
679
682 SYMS_TypeUniqueInfo result = {0};
683 result.usid = usid;
684 if (src_coord_opt != 0){
685 result.src_coord = *src_coord_opt;
686 }
687 return(result);
688}
689
690
692//~ allen: Type Info Operators
693
696 SYMS_TypeNode *result = type;
697 for (;syms_type_kind_is_forward(result->kind) ||
698 result->kind == SYMS_TypeKind_Modifier ||
699 result->kind == SYMS_TypeKind_Typedef;){
700 result = result->direct_type;
701 }
702 return(result);
703}
704
707 SYMS_B32 result = syms_false;
708
709 // resolve forward references
712
713 if (lres == rres){
714 result = syms_true;
715 }
716 else{
717 if (lres->kind == rres->kind){
718 switch (lres->kind){
719 default:
720 {
721 result = syms_true;
722 }break;
723
728 {
729 if (lres->unique != 0 && rres->unique != 0){
730 SYMS_USID lusid = lres->unique->usid;
731 SYMS_USID rusid = rres->unique->usid;
732 if (lusid.uid == rusid.uid && lusid.sid == rusid.sid){
733 result = syms_true;
734 }
735 }
736 }break;
737
741 {
742 if (syms_type_node_match(lres->direct_type, rres->direct_type)){
743 result = syms_true;
744 }
745 }break;
746
748 {
749 if (syms_type_node_match(lres->direct_type, rres->direct_type) &&
750 syms_type_node_match(lres->this_type, rres->this_type)){
751 result = syms_true;
752 }
753 }break;
754
756 {
757 if (lres->array_count == rres->array_count &&
758 syms_type_node_match(lres->direct_type, rres->direct_type)){
759 result = syms_true;
760 }
761 }break;
762
764 {
765 if (lres->proc.param_count == rres->proc.param_count &&
766 syms_type_node_match(lres->direct_type, rres->direct_type) &&
767 syms_type_node_match(lres->this_type, rres->this_type)){
772 for (SYMS_U64 i = 0; i < count; i += 1, lp += 1, rp += 1){
773 if (!syms_type_node_match(*lp, *rp)){
775 break;
776 }
777 }
778 result = params_match;
779 }
780 }break;
781 }
782 }
783 }
784 return(result);
785}
786
789 SYMS_TypeNode *result = t;
790 if (t->kind == SYMS_TypeKind_Enum){
791 result = t->direct_type;
792 }
793 return(result);
794}
795
798 SYMS_TypeNode *result = c;
799 SYMS_TypeKind kind = c->kind;
800 if (kind == SYMS_TypeKind_Bool ||
801 kind == SYMS_TypeKind_Int8 ||
802 kind == SYMS_TypeKind_Int16 ||
803 kind == SYMS_TypeKind_UInt8 ||
804 kind == SYMS_TypeKind_UInt16){
806 }
807 return(result);
808}
809
814
815 // replace enums with corresponding ints
818
819 // first promote each
822 SYMS_TypeKind lk = lp->kind;
823 SYMS_TypeKind rk = rp->kind;
824
825 // pick the type with higher rank
826 static SYMS_TypeKind type_table[] = {
832 };
834 for (SYMS_U64 i = 0; i < SYMS_ARRAY_SIZE(type_table); i += 1){
836 if (check == lk || check == rk){
837 k = check;
838 break;
839 }
840 }
841
842 // construct the output type
844 if (k == lk){
845 result = l;
846 }
847 else if (k == rk){
848 result = r;
849 }
850 else{
853 SYMS_U64 byte_size = bit_size >> 3;
854 result = syms_type_cons_basic(graph, k, byte_size, name);
855 }
856
857 return(result);
858}
859
861//~ allen: Type Stringizing
862
865 SYMS_ProfBegin("syms_type_string_from_type");
870 SYMS_String8 result = syms_string_list_join(arena, &list, 0);
872 SYMS_ProfEnd();
873 return(result);
874}
875
876SYMS_API void
882
883SYMS_API void
885 SYMS_ProfBegin("syms_type_rhs_string_from_type");
887 SYMS_ProfEnd();
888}
889
890SYMS_API void
892 SYMS_ProfBegin("syms_type_lhs_string_from_type_skip_return");
894 SYMS_ProfEnd();
895}
896
897SYMS_API void
900 switch (type->kind){
901 default:
902 {
903 syms_string_list_push(arena, out, type->name);
905 }break;
906
908 {
910 }break;
911
913 {
914 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 1, skip_return);
915 if (type->mods & SYMS_TypeModifier_Const){
916 syms_string_list_push(arena, out, syms_str8_lit("const "));
917 }
918 if (type->mods & SYMS_TypeModifier_Restrict){
919 syms_string_list_push(arena, out, syms_str8_lit("restrict "));
920 }
921 if (type->mods & SYMS_TypeModifier_Volatile){
922 syms_string_list_push(arena, out, syms_str8_lit("volatile "));
923 }
924 }break;
925
927 {
929 }break;
930
932 {
933 // TODO(allen): ???
934 }break;
935
941 {
942 syms_string_list_push(arena, out, type->name);
944 }break;
945
950 {
954 syms_string_list_push(arena, out, type->name);
956 }break;
957
959 {
960 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 2, skip_return);
961 if (precedence_level == 1){
963 }
964 }break;
965
967 {
968 if (!skip_return){
969 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 2, syms_false);
970 }
971 if (precedence_level == 1){
973 }
974 }break;
975
977 {
978 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 1, skip_return);
980 }break;
981
983 {
984 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 1, skip_return);
986 }break;
987
989 {
990 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 1, skip_return);
992 }break;
993
995 {
996 syms_type_lhs_string_from_type__internal(arena, type->direct_type, out, 1, skip_return);
997 SYMS_TypeNode *container = type->this_type;
998 if (container != 0){
999 syms_string_list_push(arena, out, container->name);
1000 }
1001 else{
1002 syms_string_list_push(arena, out, syms_str8_lit("<unknown-class>"));
1003 }
1004 syms_string_list_push(arena, out, syms_str8_lit("::*"));
1005 }break;
1006 }
1007}
1008
1009SYMS_API void
1012 switch (type->kind){
1013 default:break;
1014
1016 {
1018 }break;
1019
1021 case SYMS_TypeKind_Ptr:
1025 {
1026 syms_type_rhs_string_from_type__internal(arena, type->direct_type, out, 1);
1027 }break;
1028
1030 {
1031 if (precedence_level == 1){
1033 }
1034
1035 SYMS_String8 count_str = syms_string_from_u64(arena, type->array_count);
1039
1040 syms_type_rhs_string_from_type__internal(arena, type->direct_type, out, 2);
1041 }break;
1042
1043 case SYMS_TypeKind_Proc:
1044 {
1045 if (precedence_level == 1){
1047 }
1048
1049 // parameters
1050 if (type->proc.param_count == 0){
1051 syms_string_list_push(arena, out, syms_str8_lit("(void)"));
1052 }
1053 else{
1055 SYMS_U64 param_count = type->proc.param_count;
1056 SYMS_TypeNode **param = type->proc.params;
1057 for (SYMS_U64 i = 0; i < param_count; i += 1, param += 1){
1061 if (i + 1 < param_count){
1063 }
1064 }
1066 }
1067
1068 syms_type_rhs_string_from_type__internal(arena, type->direct_type, out, 2);
1069 }break;
1070
1072 {
1073 // TODO(allen): ???
1074 }break;
1075 }
1076}
1077
1079//~ allen: Type Info Construct From Dbg Info
1080
1083 SYMS_ProfBegin("syms_type_from_dbg_sid");
1084 //- look at unit features
1086 SYMS_UnitInfo info = syms_unit_info_from_uid(params->unit_set, params->uid);
1087 if (info.features & SYMS_UnitFeature_Types){
1088 result = syms_type_from_dbg_sid__rec(graph, params, sid);
1089 }
1090 SYMS_ProfEnd();
1091 return(result);
1092}
1093
1096 SYMS_USID usid = {params->uid, sid};
1097
1098 //- get cached version of type
1100
1101 //- when the cache is empty, immediately put in a place holder to stop data cycles from
1102 // becoming infinite recusion - later, if we successfully finish constructing a type,
1103 // we'll replace the place holder - otherwise it can sit there forever.
1105 if (type_from_cache == 0){
1107 }
1108
1109 //- setup for constructing new type
1111 if (type_from_cache == 0){
1112 kind = syms_symbol_kind_from_sid(params->data, params->dbg, params->unit, sid);
1113 }
1114
1115 //- construct new type node
1117 if (type_from_cache == 0 && kind == SYMS_SymbolKind_Type){
1119
1120 SYMS_TypeInfo type_info = syms_type_info_from_sid(params->data, params->dbg, params->unit, sid);
1121
1123 SYMS_String8 name = syms_symbol_name_from_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1124 new_type = syms_type_cons_basic(graph, type_info.kind, type_info.reported_size, name);
1125 }
1126 else{
1127 switch (type_info.kind){
1131 {
1132 // get name
1133 SYMS_String8 name = syms_symbol_name_from_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1134
1135 // get size
1136 SYMS_U64 byte_size = 0;
1137 if (type_info.reported_size_interp == SYMS_SizeInterpretation_ByteCount){
1138 byte_size = type_info.reported_size;
1139 }
1140
1141 // unique info
1143
1144 // construct type
1145 new_type = syms_type_cons_record_defer_members(graph, type_info.kind, name, byte_size, &unique);
1146 }break;
1147
1148 case SYMS_TypeKind_Enum:
1149 {
1150 // get name
1151 SYMS_String8 name = syms_symbol_name_from_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1152
1153 // get direct type
1155 if (type_info.direct_type.uid == params->uid){
1156 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1157 }
1158
1159 // unique info
1161
1162 // construct type
1164 }break;
1165
1167 {
1168 // get name
1169 SYMS_String8 name = syms_symbol_name_from_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1170
1171 // get direct type
1173 if (type_info.direct_type.uid == params->uid){
1174 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1175 }
1176
1177 // unique info
1179
1180 // construct type
1181 new_type = syms_type_cons_typedef(graph, name, direct, &unique);
1182 }break;
1183
1188 {
1189 // get name
1190 SYMS_String8 name = syms_symbol_name_from_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1191
1192 // resolve references
1196
1197 SYMS_USID match_usid = {0};
1198 if (params->type_map != 0){
1200 params->type_map, name);
1201 for (SYMS_USIDNode *node = matches.first;
1202 node != 0;
1203 node = node->next){
1204 if (node->usid.uid == params->uid){
1205 SYMS_TypeInfo check_info = syms_type_info_from_sid(params->data, params->dbg, params->unit,
1206 node->usid.sid);
1207 if (check_info.kind == match_kind){
1208 match_usid = node->usid;
1209 break;
1210 }
1211 }
1212 }
1213 }
1214
1215 if (match_usid.uid == params->uid){
1217 }
1218 }
1219
1220 // unique info
1222
1223 // construct type
1225 }break;
1226
1228 {
1229 // get direct type
1231 if (type_info.direct_type.uid == params->uid){
1232 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1233 }
1234
1235 // TODO(allen): get actual bit off & count
1236
1237 // construct type
1239 }break;
1240
1242 {
1243 // get direct type
1245 if (type_info.direct_type.uid == params->uid){
1246 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1247 }
1248
1249 // construct type
1251 }break;
1252
1253 case SYMS_TypeKind_Ptr:
1256 {
1257 // get direct type
1259 if (type_info.direct_type.uid == params->uid){
1260 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1261 }
1262
1263 // construct type
1265 }break;
1266
1268 {
1269 // get direct type
1271 if (type_info.direct_type.uid == params->uid){
1272 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1273 }
1274
1275 // determine array count
1276 SYMS_U64 array_count = type_info.reported_size;
1277 if (type_info.reported_size_interp == SYMS_SizeInterpretation_ByteCount){
1278 SYMS_U64 next_size = 1;
1279 if (direct->byte_size != 0){
1280 next_size = direct->byte_size;
1281 }
1282 array_count = type_info.reported_size/next_size;
1283 }
1284
1285 // construct type
1286 new_type = syms_type_cons_array(graph, direct, array_count);
1287 }break;
1288
1289 case SYMS_TypeKind_Proc:
1290 {
1291 // get direct type
1293 if (type_info.direct_type.uid == params->uid){
1294 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1295 }
1296
1297 // read signature
1299 syms_sig_info_from_type_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1300
1301 SYMS_U64 param_count = sig_info.param_type_ids.count;
1303
1304 {
1306 SYMS_TypeNode **param_opl = param_types + param_count;
1307 SYMS_SymbolID *sid_ptr = sig_info.param_type_ids.ids;
1308 for (;param_ptr < param_opl; sid_ptr += 1, param_ptr += 1){
1311 if (param_usid.uid == params->uid){
1313 }
1314 *param_ptr = param;
1315 }
1316 }
1317
1318 SYMS_USID this_usid = syms_make_usid(sig_info.uid, sig_info.this_type_id);
1319 SYMS_TypeNode *this_type = &syms_type_node_nil;
1320 if (type_info.direct_type.uid == params->uid){
1321 this_type = syms_type_from_dbg_sid__rec(graph, params, this_usid.sid);
1322 }
1323
1324 // construct type
1325 new_type = syms_type_cons_proc(graph, direct, this_type, param_types, param_count);
1326 }break;
1327
1329 {
1330 // get direct type
1332 if (type_info.direct_type.uid == params->uid){
1333 direct = syms_type_from_dbg_sid__rec(graph, params, type_info.direct_type.sid);
1334 }
1335
1336 // get container type
1337 SYMS_TypeNode *container = &syms_type_node_nil;
1338 if (type_info.containing_type.uid == params->uid){
1339 container = syms_type_from_dbg_sid__rec(graph, params, type_info.containing_type.sid);
1340 }
1341
1342 // construct type
1344 // TODO(allen): better flow here
1345 if (type_info.reported_size_interp == SYMS_SizeInterpretation_ByteCount){
1346 new_type->byte_size = type_info.reported_size;
1347 }
1348 }break;
1349
1351 {
1352 // TODO(allen): ?
1353 }break;
1354
1356 {
1357 // TODO(allen): ?
1358 }break;
1359 }
1360 }
1361
1362 //- split out modifiers into stand alone nodes
1363 if (type_info.mods != 0 && type_info.kind != SYMS_TypeKind_Modifier){
1366 }
1367
1368 // save this type as the final value for this usid
1370
1372 }
1373
1374 //- set result
1376 if (result == 0){
1377 result = new_type;
1378 }
1379
1380 //- null -> nil
1381 if (result == 0){
1382 result = &syms_type_node_nil;
1383 }
1384
1385 return(result);
1386}
1387
1388SYMS_API void
1390 SYMS_ProfBegin("syms_type_equip_members_from_dbg");
1391
1392 if ((syms_type_kind_is_record(node->kind) ||
1393 syms_type_kind_is_enum(node->kind)) &&
1395 SYMS_SymbolID sid = 0;
1396 if (node->unique != 0){
1397 sid = node->unique->usid.sid;
1398 }
1399
1400 if (sid != 0){
1401 switch (node->kind){
1405 {
1407
1409 syms_mems_accel_from_sid(scratch.arena, params->data, params->dbg, params->unit, sid);
1412
1413 SYMS_TypeMember *mem_ptr = mems;
1414 for (SYMS_U64 n = 1; n <= mem_count; n += 1, mem_ptr += 1){
1416
1418 syms_mem_info_from_number(graph->arena, params->data, params->dbg, params->unit, mems_accel, n);
1419
1420 // determine the member's type
1422 switch (mem_info.kind){
1423 case SYMS_MemKind_VTablePtr: /*no type*/ break;
1424
1427 {
1428 // TODO(allen): here we lose access to the fast path from StaticData to a virtual offset.
1429 // This path is only available from the DWARF backend, but there are a few ways we could
1430 // preserve it.
1431 SYMS_USID type_usid = syms_type_from_mem_number(params->data, params->dbg, params->unit, mems_accel, n);
1432 if (type_usid.uid == params->uid){
1433 type = syms_type_from_dbg_sid(graph, params, type_usid.sid);
1434 }
1435 }break;
1436
1440 {
1441 // directly get type from member id
1442 SYMS_USID type_usid = syms_type_from_mem_number(params->data, params->dbg, params->unit, mems_accel, n);
1443 if (type_usid.uid == params->uid){
1444 type = syms_type_from_dbg_sid(graph, params, type_usid.sid);
1445 }
1446 }break;
1447
1450 {
1451 // TODO(allen): here we lose access to the fast path to a procedure symbol.
1452 // This path is only available from the DWARF backend, but there are a few ways we could
1453 // preserve it.
1454 SYMS_SigInfo sig =
1455 syms_sig_info_from_mem_number(scratch.arena, params->data, params->dbg, params->unit, mems_accel, n);
1456
1458 SYMS_TypeNode *this_type = &syms_type_node_nil;
1459 if (sig.uid == params->uid){
1461 this_type = syms_type_from_dbg_sid(graph, params, sig.this_type_id);
1462 }
1463
1464 SYMS_U64 param_count = sig.param_type_ids.count;
1465 SYMS_TypeNode **param_types = syms_push_array(graph->arena, SYMS_TypeNode*, param_count);
1466 {
1468 SYMS_TypeNode **param_opl = param_types + param_count;
1470 for (; param_ptr < param_opl; param_id_ptr += 1, param_ptr += 1){
1472 }
1473 }
1474
1475 type = syms_type_cons_proc(graph, ret_type, this_type, param_types, param_count);
1476 }break;
1477 }
1478
1479 // fill the member slot
1480 mem_ptr->kind = mem_info.kind;
1481 mem_ptr->visibility = mem_info.visibility;
1482 mem_ptr->flags = mem_info.flags;
1484 mem_ptr->off = mem_info.off;
1485 mem_ptr->virtual_off = mem_info.virtual_off;
1486 mem_ptr->type = type;
1487
1489 }
1490
1492 }break;
1493
1494 case SYMS_TypeKind_Enum:
1495 {
1497
1499 params->unit, sid);
1500
1501 SYMS_U64 mem_count = array.count;
1503 SYMS_EnumMember *dst_ptr = mems;
1504 SYMS_EnumMember *src_ptr = array.enum_members;
1505 for (SYMS_U64 i = 0; i < mem_count; i += 1, src_ptr += 1, dst_ptr += 1){
1507 dst_ptr->val = src_ptr->val;
1508 }
1509
1511 }break;
1512 }
1513 }
1514 }
1515
1516 SYMS_ProfEnd();
1517}
1518
1520//~ allen: Type Content Table Functions
1521
1524 SYMS_U64 result = syms_hash_djb2(data);
1525 return(result);
1526}
1527
1530 SYMS_ProfBegin("syms_type_from_content");
1531 SYMS_TypeNode *result = 0;
1532 if (buckets->buckets != 0){
1533 SYMS_U64 hash = syms_type_content_hash(data);
1535 for (SYMS_TypeContentNode *node = buckets->buckets[bucket_index];
1536 node != 0;
1537 node = node->next){
1538 if (node->hash == hash && syms_string_match(node->key, data, 0)){
1539 result = node->type;
1540 break;
1541 }
1542 }
1543 }
1544 SYMS_ProfEnd();
1545 return(result);
1546}
1547
1550 SYMS_String8 key, SYMS_TypeNode *type){
1551 SYMS_ProfBegin("syms_type_content_insert");
1552 SYMS_U64 hash = syms_type_content_hash(key);
1553 SYMS_String8 result = {0};
1554 if (buckets->buckets != 0){
1556
1557 result = syms_push_string_copy(arena, key);
1558
1561 new_node->key = result;
1562 new_node->hash = hash;
1563 new_node->type = type;
1564 }
1565 SYMS_ProfEnd();
1566 return(result);
1567}
1568
1570//~ allen: Type USID Table Functions
1571
1574 SYMS_U64 result = syms_hash_djb2(syms_str8((SYMS_U8 *)&usid, sizeof(usid)));
1575 return(result);
1576}
1577
1580 SYMS_ProfBegin("syms_type_from_usid");
1581 SYMS_TypeNode *result = 0;
1582 if (buckets->buckets != 0){
1583 SYMS_U64 hash = syms_type_usid_hash(usid);
1585 for (SYMS_TypeUSIDNode *node = buckets->buckets[bucket_index];
1586 node != 0;
1587 node = node->next){
1588 SYMS_USID key = node->key;
1589 if (key.uid == usid.uid && key.sid == usid.sid){
1590 result = node->type;
1591 break;
1592 }
1593 }
1594 }
1595 SYMS_ProfEnd();
1596 return(result);
1597}
1598
1601 SYMS_TypeUSIDNode *result = 0;
1602
1603 SYMS_ProfBegin("syms_type_usid_insert");
1604 if (buckets->buckets != 0){
1605 SYMS_U64 hash = syms_type_usid_hash(key);
1609 new_node->key = key;
1610 new_node->type = type;
1611
1612 result = new_node;
1613 buckets->bucket_counts[bucket_index] += 1;
1614 }
1615 SYMS_ProfEnd();
1616
1617 return(result);
1618}
1619
1621//~ allen: Type Name Table Functions
1622
1625 SYMS_U64 u64 = (SYMS_U64)(ptr);
1626 SYMS_U64 bits = u64 >> 3;
1627 SYMS_U64 result = bits ^ (bits << 32);
1628 return(result);
1629}
1630
1633 SYMS_TypeChain *result = 0;
1634 SYMS_ProfBegin("syms_type_chain_from_name");
1635 if (buckets->buckets != 0){
1636 SYMS_U64 hash = syms_type_name_hash(name_ptr);
1638 for (SYMS_TypeNameNode *node = buckets->buckets[bucket_index];
1639 node != 0;
1640 node = node->next){
1641 if (node->name_ptr == name_ptr){
1642 result = &node->chain;
1643 break;
1644 }
1645 }
1646 }
1647 SYMS_ProfEnd();
1648 return(result);
1649}
1650
1651SYMS_API void
1653 SYMS_ProfBegin("syms_type_name_insert");
1654 if (buckets->buckets != 0){
1655 // find existing name node
1657 SYMS_U64 hash = syms_type_name_hash(name_ptr);
1659 for (SYMS_TypeNameNode *node = buckets->buckets[bucket_index];
1660 node != 0;
1661 node = node->next){
1662 if (node->name_ptr == name_ptr){
1663 match = node;
1664 break;
1665 }
1666 }
1667
1668 // new name node if necessary
1669 if (match == 0){
1672 new_node->name_ptr = name_ptr;
1673
1674 match = new_node;
1675 }
1676
1677 // new type chain node
1678 {
1680 SYMS_QueuePush(match->chain.first, match->chain.last, new_chain);
1681 match->chain.count += 1;
1682 new_chain->type = type;
1683 }
1684 }
1685 SYMS_ProfEnd();
1686}
1687
1688#endif //SYMS_TYPE_GRAPH_C
#define check(expr)
Definition AssertionMacros.h:314
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition syms_base.h:402
Definition syms_debug_info.h:346
Definition syms_debug_info.h:341
SYMS_String8 name
Definition syms_debug_info.h:342
Definition syms_debug_info.h:325
Definition syms_debug_info.h:334
SYMS_SymbolIDArray param_type_ids
Definition syms_debug_info.h:336
SYMS_SymbolID this_type_id
Definition syms_debug_info.h:338
SYMS_SymbolID return_type_id
Definition syms_debug_info.h:337
SYMS_UnitID uid
Definition syms_debug_info.h:335
Definition syms_debug_info.h:130
Definition syms_base.h:306
Definition syms_base.h:296
Definition syms_data_structures.h:20
SYMS_SymbolID * ids
Definition syms_debug_info.h:229
SYMS_U64 count
Definition syms_debug_info.h:230
Definition syms_type_graph.h:63
Definition syms_type_graph.h:68
Definition syms_type_graph.h:18
Definition syms_type_graph.h:12
Definition syms_type_graph.h:46
SYMS_TypeContentNode ** buckets
Definition syms_type_graph.h:47
Definition syms_type_graph.h:39
Definition syms_type_graph.h:153
Definition syms_debug_info.h:264
Definition syms_type_graph.h:103
Definition syms_type_graph.h:88
SYMS_U32 off
Definition syms_type_graph.h:93
SYMS_MemKind kind
Definition syms_type_graph.h:89
struct SYMS_TypeNode * type
Definition syms_type_graph.h:95
SYMS_String8 name
Definition syms_type_graph.h:92
SYMS_U32 virtual_off
Definition syms_type_graph.h:94
SYMS_MemFlags flags
Definition syms_type_graph.h:91
SYMS_MemVisibility visibility
Definition syms_type_graph.h:90
Definition syms_type_graph.h:80
SYMS_TypeNameNode ** buckets
Definition syms_type_graph.h:81
Definition syms_type_graph.h:74
Definition syms_type_graph.h:108
SYMS_U64 param_count
Definition syms_type_graph.h:144
struct SYMS_TypeNode::@2314::@2316 bits
SYMS_U32 count
Definition syms_type_graph.h:138
struct SYMS_TypeNode::@2314::@2317 proc
struct SYMS_TypeNode * direct_type
Definition syms_type_graph.h:121
void * lazy_ptr
Definition syms_type_graph.h:149
SYMS_U64 array_count
Definition syms_type_graph.h:133
SYMS_U64 byte_size
Definition syms_type_graph.h:114
struct SYMS_TypeNode ** params
Definition syms_type_graph.h:143
struct SYMS_TypeNode * this_type
Definition syms_type_graph.h:126
SYMS_TypeModifiers mods
Definition syms_type_graph.h:130
SYMS_String8 name
Definition syms_type_graph.h:113
SYMS_TypeUniqueInfo * unique
Definition syms_type_graph.h:117
SYMS_TypeKind kind
Definition syms_type_graph.h:112
SYMS_U32 off
Definition syms_type_graph.h:137
Definition syms_type_graph.h:180
SYMS_MapAndUnit * type_map
Definition syms_type_graph.h:188
SYMS_UnitSetAccel * unit_set
Definition syms_type_graph.h:183
SYMS_UnitID uid
Definition syms_type_graph.h:185
SYMS_DbgAccel * dbg
Definition syms_type_graph.h:182
SYMS_UnitAccel * unit
Definition syms_type_graph.h:184
SYMS_String8 data
Definition syms_type_graph.h:181
Definition syms_type_graph.h:57
SYMS_U64 * bucket_counts
Definition syms_type_graph.h:59
SYMS_TypeUSIDNode ** buckets
Definition syms_type_graph.h:58
Definition syms_type_graph.h:51
Definition syms_type_graph.h:29
struct SYMS_TypeUSIDNode * usid_node
Definition syms_type_graph.h:30
Definition syms_type_graph.h:98
SYMS_USID usid
Definition syms_type_graph.h:99
SYMS_SrcCoord src_coord
Definition syms_type_graph.h:100
Definition syms_debug_info.h:244
Definition syms_debug_info.h:239
Definition syms_debug_info.h:234
SYMS_UnitID uid
Definition syms_debug_info.h:235
SYMS_SymbolID sid
Definition syms_debug_info.h:236
Definition syms_debug_info.h:79
SYMS_UnitFeatures features
Definition syms_debug_info.h:80
SYMS_API SYMS_String8 syms_string_list_join(SYMS_Arena *arena, SYMS_String8List *list, SYMS_StringJoin *join_ptr)
Definition syms_base.c:315
SYMS_API SYMS_ArenaTemp syms_get_scratch(SYMS_Arena **conflicts, SYMS_U64 conflict_count)
Definition syms_base.c:694
SYMS_API SYMS_B32 syms_string_match(SYMS_String8 a, SYMS_String8 b, SYMS_StringMatchFlags flags)
Definition syms_base.c:210
SYMS_API SYMS_U64 syms_hash_djb2(SYMS_String8 string)
Definition syms_base.c:40
SYMS_API void syms_arena_temp_end(SYMS_ArenaTemp temp)
Definition syms_base.c:689
SYMS_API SYMS_String8 syms_str8(SYMS_U8 *str, SYMS_U64 size)
Definition syms_base.c:169
SYMS_API SYMS_String8 syms_push_string_copy(SYMS_Arena *arena, SYMS_String8 string)
Definition syms_base.c:353
SYMS_API void syms_string_list_push(SYMS_Arena *arena, SYMS_String8List *list, SYMS_String8 string)
Definition syms_base.c:282
SYMS_API SYMS_String8 syms_string_from_u64(SYMS_Arena *arena, SYMS_U64 x)
Definition syms_base.c:521
SYMS_API SYMS_String8 syms_str8_skip_chop_whitespace(SYMS_String8 str)
Definition syms_base.c:190
SYMS_API SYMS_ArenaTemp syms_arena_temp_begin(SYMS_Arena *arena)
Definition syms_base.c:682
#define syms_true
Definition syms_base.h:105
#define SYMS_StackPush(f, n)
Definition syms_base.h:227
#define syms_push_array(a, T, c)
Definition syms_base.h:561
#define syms_memzero_struct(s)
Definition syms_base.h:161
#define SYMS_AlignPow2(a, b)
Definition syms_base.h:187
#define syms_false
Definition syms_base.h:104
#define SYMS_API
Definition syms_base.h:29
#define SYMS_ARRAY_SIZE(x)
Definition syms_base.h:144
#define SYMS_ASSERT(x)
Definition syms_base.h:125
SYMS_S32 SYMS_B32
Definition syms_base.h:99
#define syms_push_array_zero(a, T, c)
Definition syms_base.h:564
#define SYMS_MAX(a, b)
Definition syms_base.h:180
#define syms_string_from_enum_value(enum_type, value)
Definition syms_base.h:461
#define syms_str8_lit(s)
Definition syms_base.h:483
#define SYMS_QueuePush(f, l, n)
Definition syms_base.h:220
#define syms_release_scratch
Definition syms_base.h:567
uint32_t SYMS_U32
Definition syms_crt_overrides.h:38
uint64_t SYMS_U64
Definition syms_crt_overrides.h:39
#define syms_memmove
Definition syms_crt_overrides.h:65
#define SYMS_U64
Definition syms_crt_overrides.h:54
uint8_t SYMS_U8
Definition syms_crt_overrides.h:36
SYMS_API SYMS_String8 syms_string_cons(SYMS_Arena *arena, SYMS_StringCons *cons, SYMS_String8 string)
Definition syms_data_structures.c:10
SYMS_API SYMS_USID syms_make_usid(SYMS_UnitID uid, SYMS_SymbolID sid)
Definition syms_debug_info.c:22
SYMS_API SYMS_B32 syms_type_kind_is_enum(SYMS_TypeKind kind)
Definition syms_debug_info.c:103
SYMS_API SYMS_B32 syms_type_kind_is_forward(SYMS_TypeKind kind)
Definition syms_debug_info.c:109
SYMS_API SYMS_TypeKind syms_type_kind_main_from_fwd(SYMS_TypeKind kind)
Definition syms_debug_info.c:48
SYMS_API SYMS_B32 syms_type_kind_is_basic(SYMS_TypeKind kind)
Definition syms_debug_info.c:60
SYMS_API SYMS_B32 syms_type_kind_is_basic_or_enum(SYMS_TypeKind kind)
Definition syms_debug_info.c:66
SYMS_API SYMS_B32 syms_type_kind_is_record(SYMS_TypeKind kind)
Definition syms_debug_info.c:97
@ SYMS_SizeInterpretation_ByteCount
Definition syms_debug_info.h:207
@ SYMS_SizeInterpretation_ResolveForwardReference
Definition syms_debug_info.h:209
SYMS_U64 SYMS_SymbolID
Definition syms_debug_info.h:215
@ SYMS_MemKind_VTablePtr
Definition syms_debug_info.h:312
@ SYMS_MemKind_StaticMethod
Definition syms_debug_info.h:311
@ SYMS_MemKind_VBaseClassPtr
Definition syms_debug_info.h:314
@ SYMS_MemKind_StaticData
Definition syms_debug_info.h:309
@ SYMS_MemKind_NestedType
Definition syms_debug_info.h:315
@ SYMS_MemKind_Method
Definition syms_debug_info.h:310
@ SYMS_MemKind_DataField
Definition syms_debug_info.h:308
@ SYMS_MemKind_BaseClass
Definition syms_debug_info.h:313
#define SYMS_Arena
Definition syms_default_arena.h:61
#define SYMS_ProfEnd()
Definition syms_dev.h:212
#define SYMS_ProfBegin(str)
Definition syms_dev.h:209
SYMS_API SYMS_U32 syms_bit_size_from_type_kind(SYMS_TypeKind v)
Definition syms_meta_debug_info.c:7
@ SYMS_MemVisibility_Public
Definition syms_meta_debug_info.h:95
SYMS_U32 SYMS_TypeModifiers
Definition syms_meta_debug_info.h:81
SYMS_TypeKind
Definition syms_meta_debug_info.h:27
@ SYMS_TypeKind_Int128
Definition syms_meta_debug_info.h:35
@ SYMS_TypeKind_ForwardUnion
Definition syms_meta_debug_info.h:67
@ SYMS_TypeKind_Int32
Definition syms_meta_debug_info.h:33
@ SYMS_TypeKind_UInt128
Definition syms_meta_debug_info.h:42
@ SYMS_TypeKind_Void
Definition syms_meta_debug_info.h:57
@ SYMS_TypeKind_Int8
Definition syms_meta_debug_info.h:31
@ SYMS_TypeKind_ForwardClass
Definition syms_meta_debug_info.h:66
@ SYMS_TypeKind_Union
Definition syms_meta_debug_info.h:61
@ SYMS_TypeKind_Float64
Definition syms_meta_debug_info.h:50
@ SYMS_TypeKind_Int64
Definition syms_meta_debug_info.h:34
@ SYMS_TypeKind_Float32
Definition syms_meta_debug_info.h:47
@ SYMS_TypeKind_Int16
Definition syms_meta_debug_info.h:32
@ SYMS_TypeKind_Label
Definition syms_meta_debug_info.h:78
@ SYMS_TypeKind_Modifier
Definition syms_meta_debug_info.h:69
@ SYMS_TypeKind_ForwardEnum
Definition syms_meta_debug_info.h:68
@ SYMS_TypeKind_Struct
Definition syms_meta_debug_info.h:59
@ SYMS_TypeKind_Enum
Definition syms_meta_debug_info.h:62
@ SYMS_TypeKind_Bitfield
Definition syms_meta_debug_info.h:76
@ SYMS_TypeKind_Stub
Definition syms_meta_debug_info.h:29
@ SYMS_TypeKind_Typedef
Definition syms_meta_debug_info.h:63
@ SYMS_TypeKind_Bool
Definition syms_meta_debug_info.h:45
@ SYMS_TypeKind_ForwardStruct
Definition syms_meta_debug_info.h:65
@ SYMS_TypeKind_LValueReference
Definition syms_meta_debug_info.h:71
@ SYMS_TypeKind_Proc
Definition syms_meta_debug_info.h:75
@ SYMS_TypeKind_MemberPtr
Definition syms_meta_debug_info.h:73
@ SYMS_TypeKind_UInt8
Definition syms_meta_debug_info.h:38
@ SYMS_TypeKind_Array
Definition syms_meta_debug_info.h:74
@ SYMS_TypeKind_UInt16
Definition syms_meta_debug_info.h:39
@ SYMS_TypeKind_Variadic
Definition syms_meta_debug_info.h:77
@ SYMS_TypeKind_RValueReference
Definition syms_meta_debug_info.h:72
@ SYMS_TypeKind_UInt64
Definition syms_meta_debug_info.h:41
@ SYMS_TypeKind_Class
Definition syms_meta_debug_info.h:60
@ SYMS_TypeKind_UInt32
Definition syms_meta_debug_info.h:40
@ SYMS_TypeKind_Ptr
Definition syms_meta_debug_info.h:70
@ SYMS_TypeModifier_Volatile
Definition syms_meta_debug_info.h:87
@ SYMS_TypeModifier_Restrict
Definition syms_meta_debug_info.h:85
@ SYMS_TypeModifier_Const
Definition syms_meta_debug_info.h:83
SYMS_SymbolKind
Definition syms_meta_debug_info.h:15
@ SYMS_SymbolKind_Type
Definition syms_meta_debug_info.h:17
@ SYMS_SymbolKind_Null
Definition syms_meta_debug_info.h:16
@ SYMS_UnitFeature_Types
Definition syms_meta_debug_info.h:9
SYMS_API SYMS_USIDList syms_usid_list_from_string(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_MapAndUnit *map_and_unit, SYMS_String8 string)
Definition syms_parser.c:1452
SYMS_API SYMS_SymbolKind syms_symbol_kind_from_sid(SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_SymbolID sid)
Definition syms_parser.c:749
SYMS_API SYMS_U64 syms_mem_count_from_mems(SYMS_MemsAccel *mems)
Definition syms_parser.c:980
SYMS_API SYMS_UnitInfo syms_unit_info_from_uid(SYMS_UnitSetAccel *unit_set, SYMS_UnitID uid)
Definition syms_parser.c:542
SYMS_API SYMS_SigInfo syms_sig_info_from_type_sid(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_SymbolID sid)
Definition syms_parser.c:1300
SYMS_API SYMS_SigInfo syms_sig_info_from_mem_number(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_MemsAccel *mems, SYMS_U64 n)
Definition syms_parser.c:1046
SYMS_API SYMS_MemsAccel * syms_mems_accel_from_sid(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_SymbolID id)
Definition syms_parser.c:957
SYMS_API SYMS_USID syms_type_from_mem_number(SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_MemsAccel *mems, SYMS_U64 n)
Definition syms_parser.c:1023
SYMS_API SYMS_String8 syms_symbol_name_from_sid(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_SymbolID sid)
Definition syms_parser.c:771
SYMS_API SYMS_TypeInfo syms_type_info_from_sid(SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_SymbolID id)
Definition syms_parser.c:794
SYMS_API SYMS_MemInfo syms_mem_info_from_number(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_MemsAccel *mems, SYMS_U64 n)
Definition syms_parser.c:1000
SYMS_API SYMS_EnumMemberArray syms_enum_member_array_from_sid(SYMS_Arena *arena, SYMS_String8 data, SYMS_DbgAccel *dbg, SYMS_UnitAccel *unit, SYMS_SymbolID sid)
Definition syms_parser.c:1137
SYMS_API SYMS_U64 syms_type_content_hash(SYMS_String8 data)
Definition syms_type_graph.c:1523
SYMS_API SYMS_U64 syms_type_name_hash(SYMS_U8 *ptr)
Definition syms_type_graph.c:1624
SYMS_API SYMS_TypeNode * syms_type_auto_casted_from_type_nodes(SYMS_TypeGraph *graph, SYMS_TypeNode *l, SYMS_TypeNode *r)
Definition syms_type_graph.c:811
SYMS_API SYMS_TypeNode * syms_type_u8(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:117
SYMS_API SYMS_EnumMemberArray syms_type_enum_members_from_type(SYMS_TypeGraph *graph, SYMS_TypeNode *node)
Definition syms_type_graph.c:73
SYMS_API SYMS_TypeNode * syms_type_void(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:97
SYMS_API SYMS_TypeMember * syms_type_equip_mems_pre_allocate(SYMS_TypeGraph *graph, SYMS_TypeNode *node, SYMS_U64 member_count)
Definition syms_type_graph.c:637
SYMS_API SYMS_TypeNode * syms_type_u32(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:137
SYMS_API SYMS_TypeNode * syms_type_promoted_from_type_node(SYMS_TypeGraph *graph, SYMS_TypeNode *c)
Definition syms_type_graph.c:797
SYMS_API SYMS_EnumMember * syms_type_equip_enum_mems_pre_allocate(SYMS_TypeGraph *graph, SYMS_TypeNode *node, SYMS_U64 member_count)
Definition syms_type_graph.c:654
SYMS_API SYMS_TypeNode * syms_type_cons_mod(SYMS_TypeGraph *graph, SYMS_TypeNode *type, SYMS_TypeModifiers mods)
Definition syms_type_graph.c:269
SYMS_API void syms_type_cons_record_with_members(SYMS_TypeGraph *graph, SYMS_TypeNode *node, SYMS_TypeKind kind, SYMS_String8 name, SYMS_TypeConsMemberList *list)
Definition syms_type_graph.c:439
SYMS_API void syms_type_rhs_string_from_type__internal(SYMS_Arena *arena, SYMS_TypeNode *type, SYMS_String8List *out, SYMS_U32 precedence_level)
Definition syms_type_graph.c:1010
SYMS_API SYMS_TypeNode * syms_type_cons_array(SYMS_TypeGraph *graph, SYMS_TypeNode *type, SYMS_U64 count)
Definition syms_type_graph.c:319
SYMS_API SYMS_TypeNode * syms_type_from_usid_buckets(SYMS_TypeUSIDBuckets *buckets, SYMS_USID usid)
Definition syms_type_graph.c:1579
SYMS_API SYMS_B32 syms_type_members_are_equipped(SYMS_TypeGraph *graph, SYMS_TypeNode *node)
Definition syms_type_graph.c:82
SYMS_API void syms_type_lhs_string_from_type(SYMS_Arena *arena, SYMS_TypeNode *type, SYMS_String8List *out)
Definition syms_type_graph.c:877
SYMS_API SYMS_TypeNode * syms_type_s128(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:207
SYMS_API SYMS_TypeNode * syms_type_cons_typedef(SYMS_TypeGraph *graph, SYMS_String8 name, SYMS_TypeNode *type, SYMS_TypeUniqueInfo *unique_opt)
Definition syms_type_graph.c:581
SYMS_API SYMS_TypeNode * syms_type_f32(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:217
SYMS_API SYMS_TypeUniqueInfo syms_type_unique_from_usid_src_coord(SYMS_USID usid, SYMS_SrcCoord *src_coord_opt)
Definition syms_type_graph.c:681
SYMS_API SYMS_U64 syms_type_usid_hash(SYMS_USID usid)
Definition syms_type_graph.c:1573
SYMS_API SYMS_TypeNode * syms_type_cons_basic(SYMS_TypeGraph *graph, SYMS_TypeKind basic_kind, SYMS_U64 size, SYMS_String8 name)
Definition syms_type_graph.c:240
SYMS_API SYMS_TypeNode * syms_type_from_dbg_sid(SYMS_TypeGraph *graph, SYMS_TypeParseParams *params, SYMS_SymbolID sid)
Definition syms_type_graph.c:1082
SYMS_API void syms_type_lhs_string_from_type_skip_return(SYMS_Arena *arena, SYMS_TypeNode *type, SYMS_String8List *out)
Definition syms_type_graph.c:891
SYMS_API SYMS_TypeNode * syms_type_cons_record_defer_members(SYMS_TypeGraph *graph, SYMS_TypeKind kind, SYMS_String8 name, SYMS_U64 byte_size, SYMS_TypeUniqueInfo *unique_opt)
Definition syms_type_graph.c:541
SYMS_API void syms_type_graph_init(SYMS_TypeGraph *graph, SYMS_Arena *graph_arena, SYMS_StringCons *graph_string_cons, SYMS_U64 address_size)
Definition syms_type_graph.c:10
SYMS_API void syms_type_cons_mem_push(SYMS_Arena *arena, SYMS_TypeConsMemberList *list, SYMS_String8 name, SYMS_TypeNode *type)
Definition syms_type_graph.c:429
SYMS_API SYMS_String8 syms_type_content_insert(SYMS_Arena *arena, SYMS_TypeContentBuckets *buckets, SYMS_String8 key, SYMS_TypeNode *type)
Definition syms_type_graph.c:1549
SYMS_API SYMS_String8 syms_type_string_from_type(SYMS_Arena *arena, SYMS_TypeNode *type)
Definition syms_type_graph.c:864
SYMS_API SYMS_TypeNode * syms_type_resolve_enum_to_basic(SYMS_TypeGraph *graph, SYMS_TypeNode *t)
Definition syms_type_graph.c:788
SYMS_API SYMS_TypeUSIDPlaceHolder syms_type_usid_place_holder_insert(SYMS_TypeGraph *graph, SYMS_USID usid)
Definition syms_type_graph.c:621
SYMS_API SYMS_TypeChain * syms_type_chain_from_name_buckets(SYMS_TypeNameBuckets *buckets, SYMS_U8 *name_ptr)
Definition syms_type_graph.c:1632
SYMS_API SYMS_TypeNode * syms_type_s8(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:167
SYMS_API SYMS_TypeNode * syms_type_u64(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:147
SYMS_API SYMS_TypeNode * syms_type_from_dbg_sid__rec(SYMS_TypeGraph *graph, SYMS_TypeParseParams *params, SYMS_SymbolID sid)
Definition syms_type_graph.c:1095
SYMS_API SYMS_TypeNode * syms_type_cons_enum_defer_members(SYMS_TypeGraph *graph, SYMS_String8 name, SYMS_TypeNode *underlying_type, SYMS_TypeUniqueInfo *unique_opt)
Definition syms_type_graph.c:561
SYMS_API SYMS_TypeNode * syms_type_from_usid(SYMS_TypeGraph *graph, SYMS_USID usid)
Definition syms_type_graph.c:44
SYMS_API SYMS_TypeNode * syms_type_cons_mem_ptr(SYMS_TypeGraph *graph, SYMS_TypeNode *container, SYMS_TypeNode *type)
Definition syms_type_graph.c:377
SYMS_API SYMS_TypeNode * syms_type_u128(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:157
SYMS_API SYMS_TypeUSIDNode * syms_type_usid_insert(SYMS_Arena *arena, SYMS_TypeUSIDBuckets *buckets, SYMS_USID key, SYMS_TypeNode *type)
Definition syms_type_graph.c:1600
SYMS_API SYMS_TypeNode * syms_type_cons_proc(SYMS_TypeGraph *graph, SYMS_TypeNode *ret_type, SYMS_TypeNode *this_type, SYMS_TypeNode **param_types, SYMS_U64 param_count)
Definition syms_type_graph.c:345
SYMS_API SYMS_TypeUniqueInfo * syms_type_unique_copy(SYMS_Arena *arena, SYMS_TypeUniqueInfo *unique_opt)
Definition syms_type_graph.c:671
SYMS_API SYMS_TypeNode * syms_type_s64(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:197
SYMS_API SYMS_TypeNode * syms_type_bool(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:107
SYMS_API void syms_type_name_insert(SYMS_Arena *arena, SYMS_TypeNameBuckets *buckets, SYMS_U8 *name_ptr, SYMS_TypeNode *type)
Definition syms_type_graph.c:1652
SYMS_API SYMS_TypeNode * syms_type_cons_fwd(SYMS_TypeGraph *graph, SYMS_TypeKind kind, SYMS_String8 name, SYMS_TypeNode *type, SYMS_TypeUniqueInfo *unique_opt)
Definition syms_type_graph.c:601
SYMS_API SYMS_TypeNode * syms_type_s16(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:177
SYMS_API SYMS_TypeNode * syms_type_from_content_buckets(SYMS_TypeContentBuckets *buckets, SYMS_String8 data)
Definition syms_type_graph.c:1529
SYMS_API SYMS_TypeMemberArray syms_type_members_from_type(SYMS_TypeGraph *graph, SYMS_TypeNode *node)
Definition syms_type_graph.c:64
SYMS_API void syms_type_rhs_string_from_type(SYMS_Arena *arena, SYMS_TypeNode *type, SYMS_String8List *out)
Definition syms_type_graph.c:884
SYMS_API SYMS_TypeNode * syms_type_s32(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:187
SYMS_API SYMS_TypeNode * syms_type_u16(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:127
SYMS_API SYMS_TypeNode * syms_type_cons_ptr(SYMS_TypeGraph *graph, SYMS_TypeKind ptr_kind, SYMS_TypeNode *type)
Definition syms_type_graph.c:295
SYMS_API SYMS_TypeNode * syms_type_resolved(SYMS_TypeNode *type)
Definition syms_type_graph.c:695
SYMS_API void syms_type_equip_members_from_dbg(SYMS_TypeGraph *graph, SYMS_TypeParseParams *params, SYMS_TypeNode *node)
Definition syms_type_graph.c:1389
SYMS_API void syms_type_lhs_string_from_type__internal(SYMS_Arena *arena, SYMS_TypeNode *type, SYMS_String8List *out, SYMS_U32 precedence_level, SYMS_B32 skip_return)
Definition syms_type_graph.c:898
SYMS_API SYMS_TypeNode * syms_type_f64(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:227
SYMS_API SYMS_TypeNode * syms_type_cons_record_stub(SYMS_TypeGraph *graph)
Definition syms_type_graph.c:420
SYMS_API SYMS_TypeNode * syms_type_cons_bitfield(SYMS_TypeGraph *graph, SYMS_TypeNode *underlying_type, SYMS_U32 bitoff, SYMS_U32 bitcount)
Definition syms_type_graph.c:407
SYMS_API SYMS_B32 syms_type_node_match(SYMS_TypeNode *l, SYMS_TypeNode *r)
Definition syms_type_graph.c:706
SYMS_API void syms_type_usid_place_holder_replace(SYMS_TypeGraph *graph, SYMS_TypeUSIDPlaceHolder *place, SYMS_TypeNode *node)
Definition syms_type_graph.c:628
SYMS_API SYMS_String8 syms_type_string_cons(SYMS_TypeGraph *graph, SYMS_String8 name)
Definition syms_type_graph.c:38
SYMS_API SYMS_TypeChain syms_type_from_name(SYMS_TypeGraph *graph, SYMS_String8 name)
Definition syms_type_graph.c:50
SYMS_READ_ONLY SYMS_GLOBAL SYMS_TypeNode syms_type_node_nil
Definition syms_type_graph.h:194
#define SYMS_TYPE_GRAPH_TABLE_BUCKET_COUNT
Definition syms_type_graph.h:36
Definition syms_parser.h:48