@@ -794,11 +794,9 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
794
794
CV_InlineRangeKind range_kind = 0 ;
795
795
U32 code_length = 0 ;
796
796
U32 code_offset = 0 ;
797
- U32 last_code_offset = code_offset ;
798
797
String8 file_name = inlinee_lines_parsed -> file_name ;
799
- String8 last_file_name = file_name ;
798
+ String8 last_file_name = { 0 } ;
800
799
S32 line = (S32 )inlinee_lines_parsed -> first_source_ln ;
801
- S32 last_line = line ;
802
800
S32 column = 1 ;
803
801
S32 last_column = column ;
804
802
@@ -821,6 +819,9 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
821
819
CV_C13SubSectionNode * file_chksms = unit_c13 -> file_chksms_sub_section ;
822
820
823
821
// rjf: decode loop
822
+ B32 line_num_emitted = 0 ;
823
+ B32 code_off_emitted = 0 ;
824
+ B32 code_len_emitted = 0 ;
824
825
U64 read_off = 0 ;
825
826
U64 read_off_opl = binary_annots .size ;
826
827
for (B32 good = 1 ; read_off < read_off_opl && good ;)
@@ -840,6 +841,7 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
840
841
case CV_InlineBinaryAnnotation_CodeOffset :
841
842
{
842
843
read_off += cv_decode_inline_annot_u32 (binary_annots , read_off , & code_offset );
844
+ code_off_emitted = 1 ;
843
845
}break ;
844
846
case CV_InlineBinaryAnnotation_ChangeCodeOffsetBase :
845
847
{
@@ -857,11 +859,13 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
857
859
U32 delta = 0 ;
858
860
read_off += cv_decode_inline_annot_u32 (binary_annots , read_off , & delta );
859
861
code_offset += delta ;
862
+ code_off_emitted = 1 ;
860
863
}break ;
861
864
case CV_InlineBinaryAnnotation_ChangeCodeLength :
862
865
{
863
866
code_length = 0 ;
864
867
read_off += cv_decode_inline_annot_u32 (binary_annots , read_off , & code_length );
868
+ code_len_emitted = 1 ;
865
869
}break ;
866
870
case CV_InlineBinaryAnnotation_ChangeFile :
867
871
{
@@ -881,6 +885,7 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
881
885
S32 delta = 0 ;
882
886
read_off += cv_decode_inline_annot_s32 (binary_annots , read_off , & delta );
883
887
line += delta ;
888
+ line_num_emitted = 1 ;
884
889
}break ;
885
890
case CV_InlineBinaryAnnotation_ChangeLineEndDelta :
886
891
{
@@ -923,13 +928,17 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
923
928
S32 line_delta = cv_inline_annot_signed_from_unsigned_operand (code_offset_and_line_offset >> 4 );
924
929
code_offset += code_delta ;
925
930
line += line_delta ;
931
+ code_off_emitted = 1 ;
932
+ line_num_emitted = 1 ;
926
933
}break ;
927
934
case CV_InlineBinaryAnnotation_ChangeCodeLengthAndCodeOffset :
928
935
{
929
936
U32 offset_delta = 0 ;
930
937
read_off += cv_decode_inline_annot_u32 (binary_annots , read_off , & code_length );
931
938
read_off += cv_decode_inline_annot_u32 (binary_annots , read_off , & offset_delta );
932
939
code_offset += offset_delta ;
940
+ code_len_emitted = 1 ;
941
+ code_off_emitted = 1 ;
933
942
}break ;
934
943
case CV_InlineBinaryAnnotation_ChangeColumnEnd :
935
944
{
@@ -941,7 +950,7 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
941
950
}
942
951
943
952
// rjf: gather new lines
944
- if (!good || line != last_line || code_offset != last_code_offset )
953
+ if (!good || ( line_num_emitted && code_off_emitted && code_len_emitted ) )
945
954
{
946
955
LineChunk * chunk = last_line_chunk ;
947
956
if (chunk == 0 || chunk -> count + 1 >= chunk -> cap )
@@ -957,6 +966,15 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
957
966
chunk -> line_nums [chunk -> count ] = (U32 )line ;
958
967
chunk -> count += 1 ;
959
968
total_line_chunk_line_count += 1 ;
969
+ line_num_emitted = 0 ;
970
+ code_off_emitted = 0 ;
971
+ code_len_emitted = 0 ;
972
+ }
973
+
974
+ // rjf: advance code offset by the code length
975
+ {
976
+ code_offset += code_length ;
977
+ code_length = 0 ;
960
978
}
961
979
962
980
// rjf: push line sequence to line table & source file
@@ -1029,12 +1047,6 @@ ASYNC_WORK_DEF(p2r_units_convert_work)
1029
1047
first_line_chunk = last_line_chunk = 0 ;
1030
1048
total_line_chunk_line_count = 0 ;
1031
1049
}
1032
-
1033
- // rjf: update prev/current states
1034
- last_file_name = file_name ;
1035
- last_line = line ;
1036
- last_column = column ;
1037
- last_code_offset = code_offset ;
1038
1050
}
1039
1051
}
1040
1052
}break ;
0 commit comments