@@ -932,50 +932,65 @@ private int writeMethodLocations(DebugContext context, ClassEntry classEntry, bo
932932 if (range .isDeoptTarget () != deoptTargets ) {
933933 continue ;
934934 }
935- if (range .withInlinedChildren ()) {
936- /*
937- * Go through the subranges and generate abstract debug entries for inlined methods.
938- */
939- for (Range subrange : primaryEntry .getSubranges ()) {
940- if (!subrange .isInlined ()) {
941- continue ;
942- }
943- final String symbolName = subrange .getSymbolName ();
944- if (primaryMap .get (symbolName ) == null ) {
945- primaryMap .put (symbolName , pos );
946- ClassEntry inlinedClassEntry = (ClassEntry ) lookupType (subrange .getClassName ());
947- pos = writeMethodLocation (context , inlinedClassEntry , subrange , buffer , pos );
948- pos = writeAttrNull (buffer , pos );
949- }
950- }
951- }
935+ pos = maybeGenerateAbstractDebugEntriesForInlinedMethods (context , primaryMap , primaryEntry , buffer , pos );
952936 primaryMap .put (range .getSymbolName (), pos );
953937 pos = writeMethodLocation (context , classEntry , range , buffer , pos );
954- if (range .withInlinedChildren ()) {
955- int depth = 0 ;
956- /*
957- * Go through the subranges and generate concrete debug entries for inlined methods.
958- */
959- for (Range subrange : primaryEntry .getSubranges ()) {
960- if (!subrange .isInlined ()) {
961- continue ;
962- }
963- Integer subprogramPos = primaryMap .get (subrange .getSymbolName ());
964- assert subprogramPos != null ;
965- int previousPos = pos ;
966- pos = writeInlineSubroutine (context , classEntry , subrange , buffer , pos , subprogramPos - getCUIndex (classEntry ), depth );
967- if (!subrange .withChildren ()) {
968- while (depth > 0 ) {
969- pos = writeAttrNull (buffer , pos );
970- depth --;
971- }
972- } else if (previousPos != pos ) {
973- depth ++;
974- }
938+ pos = maybeGenerateConcreteDebugEntriesForInlinedMethods (context , classEntry , primaryMap , primaryEntry , buffer , pos );
939+ pos = writeAttrNull (buffer , pos );
940+ }
941+ return pos ;
942+ }
943+
944+ /**
945+ * Go through the subranges and generate concrete debug entries for inlined methods.
946+ */
947+ private int maybeGenerateConcreteDebugEntriesForInlinedMethods (DebugContext context , ClassEntry classEntry ,
948+ HashMap <String , Integer > primaryMap , PrimaryEntry primaryEntry , byte [] buffer , int pos ) {
949+ if (!primaryEntry .getPrimary ().withInlinedChildren ()) {
950+ return pos ;
951+ }
952+ int depth = 0 ;
953+ for (Range subrange : primaryEntry .getSubranges ()) {
954+ if (!subrange .isInlined ()) {
955+ continue ;
956+ }
957+ Integer subprogramPos = primaryMap .get (subrange .getSymbolName ());
958+ assert subprogramPos != null ;
959+ int previousPos = pos ;
960+ int subprogramOffset = subprogramPos - getCUIndex (classEntry );
961+ pos = writeInlineSubroutine (context , classEntry , subrange , buffer , pos , subprogramOffset , depth );
962+ if (!subrange .withChildren ()) {
963+ while (depth > 0 ) {
964+ pos = writeAttrNull (buffer , pos );
965+ depth --;
975966 }
976- assert depth == 0 : depth ;
967+ } else if (previousPos != pos ) {
968+ depth ++;
969+ }
970+ }
971+ assert depth == 0 : depth ;
972+ return pos ;
973+ }
974+
975+ /**
976+ * Go through the subranges and generate abstract debug entries for inlined methods.
977+ */
978+ private int maybeGenerateAbstractDebugEntriesForInlinedMethods (DebugContext context ,
979+ HashMap <String , Integer > primaryMap , PrimaryEntry primaryEntry , byte [] buffer , int pos ) {
980+ if (!primaryEntry .getPrimary ().withInlinedChildren ()) {
981+ return pos ;
982+ }
983+ for (Range subrange : primaryEntry .getSubranges ()) {
984+ if (!subrange .isInlined ()) {
985+ continue ;
986+ }
987+ final String symbolName = subrange .getSymbolName ();
988+ if (primaryMap .get (symbolName ) == null ) {
989+ primaryMap .put (symbolName , pos );
990+ ClassEntry inlinedClassEntry = (ClassEntry ) lookupType (subrange .getClassName ());
991+ pos = writeMethodLocation (context , inlinedClassEntry , subrange , buffer , pos );
992+ pos = writeAttrNull (buffer , pos );
977993 }
978- pos = writeAttrNull (buffer , pos );
979994 }
980995 return pos ;
981996 }
0 commit comments