@@ -618,7 +618,7 @@ inline void Compiler::impAppendStmt(Statement* stmt, unsigned chkLevel)
618618 // Once we set the current offset as debug info in an appended tree, we are
619619 // ready to report the following offsets. Note that we need to compare
620620 // offsets here instead of debug info, since we do not set the "is call"
621- // debug in impCurStmtDI.
621+ // bit in impCurStmtDI.
622622
623623 if (impLastStmt->GetDebugInfo().GetLocation().GetOffset() == impCurStmtDI.GetLocation().GetOffset())
624624 {
@@ -3021,11 +3021,6 @@ unsigned Compiler::impInitBlockLineInfo()
30213021 impCurStmtOffsSet(blockOffs);
30223022 }
30233023
3024- if (false && (info.compStmtOffsetsImplicit & ICorDebugInfo::CALL_SITE_BOUNDARIES))
3025- {
3026- impCurStmtOffsSet(blockOffs);
3027- }
3028-
30293024 /* Always report IL offset 0 or some tests get confused.
30303025 Probably a good idea anyways */
30313026
@@ -11721,111 +11716,108 @@ void Compiler::impImportBlockCode(BasicBlock* block)
1172111716 if (opts.compDbgInfo)
1172211717#endif
1172311718 {
11724- if (!compIsForInlining())
11725- {
11726- nxtStmtOffs =
11727- (nxtStmtIndex < info.compStmtOffsetsCount) ? info.compStmtOffsets[nxtStmtIndex] : BAD_IL_OFFSET;
11719+ nxtStmtOffs =
11720+ (nxtStmtIndex < info.compStmtOffsetsCount) ? info.compStmtOffsets[nxtStmtIndex] : BAD_IL_OFFSET;
11721+
11722+ /* Have we reached the next stmt boundary ? */
1172811723
11729- /* Have we reached the next stmt boundary ? */
11724+ if (nxtStmtOffs != BAD_IL_OFFSET && opcodeOffs >= nxtStmtOffs)
11725+ {
11726+ assert(nxtStmtOffs == info.compStmtOffsets[nxtStmtIndex]);
1173011727
11731- if (nxtStmtOffs != BAD_IL_OFFSET && opcodeOffs >= nxtStmtOffs )
11728+ if (verCurrentState.esStackDepth != 0 && opts.compDbgCode )
1173211729 {
11733- assert(nxtStmtOffs == info.compStmtOffsets[nxtStmtIndex]);
11730+ /* We need to provide accurate IP-mapping at this point.
11731+ So spill anything on the stack so that it will form
11732+ gtStmts with the correct stmt offset noted */
1173411733
11735- if (verCurrentState.esStackDepth != 0 && opts.compDbgCode)
11736- {
11737- /* We need to provide accurate IP-mapping at this point.
11738- So spill anything on the stack so that it will form
11739- gtStmts with the correct stmt offset noted */
11734+ impSpillStackEnsure(true);
11735+ }
1174011736
11741- impSpillStackEnsure(true);
11742- }
11737+ // Have we reported debug info for any tree?
1174311738
11744- // Have we reported debug info for any tree?
11739+ if (impCurStmtDI.IsValid() && opts.compDbgCode)
11740+ {
11741+ GenTree* placeHolder = new (this, GT_NO_OP) GenTree(GT_NO_OP, TYP_VOID);
11742+ impAppendTree(placeHolder, (unsigned)CHECK_SPILL_NONE, impCurStmtDI);
1174511743
11746- if (impCurStmtDI.IsValid() && opts.compDbgCode)
11747- {
11748- GenTree* placeHolder = new (this, GT_NO_OP) GenTree(GT_NO_OP, TYP_VOID);
11749- impAppendTree(placeHolder, (unsigned)CHECK_SPILL_NONE, impCurStmtDI);
11744+ assert(!impCurStmtDI.IsValid());
11745+ }
1175011746
11751- assert(!impCurStmtDI.IsValid());
11752- }
11747+ if (!impCurStmtDI.IsValid())
11748+ {
11749+ /* Make sure that nxtStmtIndex is in sync with opcodeOffs.
11750+ If opcodeOffs has gone past nxtStmtIndex, catch up */
1175311751
11754- if (!impCurStmtDI.IsValid())
11752+ while ((nxtStmtIndex + 1) < info.compStmtOffsetsCount &&
11753+ info.compStmtOffsets[nxtStmtIndex + 1] <= opcodeOffs)
1175511754 {
11756- /* Make sure that nxtStmtIndex is in sync with opcodeOffs.
11757- If opcodeOffs has gone past nxtStmtIndex, catch up */
11758-
11759- while ((nxtStmtIndex + 1) < info.compStmtOffsetsCount &&
11760- info.compStmtOffsets[nxtStmtIndex + 1] <= opcodeOffs)
11761- {
11762- nxtStmtIndex++;
11763- }
11755+ nxtStmtIndex++;
11756+ }
1176411757
11765- /* Go to the new stmt */
11758+ /* Go to the new stmt */
1176611759
11767- impCurStmtOffsSet(info.compStmtOffsets[nxtStmtIndex]);
11760+ impCurStmtOffsSet(info.compStmtOffsets[nxtStmtIndex]);
1176811761
11769- /* Update the stmt boundary index */
11762+ /* Update the stmt boundary index */
1177011763
11771- nxtStmtIndex++;
11772- assert(nxtStmtIndex <= info.compStmtOffsetsCount);
11764+ nxtStmtIndex++;
11765+ assert(nxtStmtIndex <= info.compStmtOffsetsCount);
1177311766
11774- /* Are there any more line# entries after this one? */
11767+ /* Are there any more line# entries after this one? */
1177511768
11776- if (nxtStmtIndex < info.compStmtOffsetsCount)
11777- {
11778- /* Remember where the next line# starts */
11769+ if (nxtStmtIndex < info.compStmtOffsetsCount)
11770+ {
11771+ /* Remember where the next line# starts */
1177911772
11780- nxtStmtOffs = info.compStmtOffsets[nxtStmtIndex];
11781- }
11782- else
11783- {
11784- /* No more line# entries */
11773+ nxtStmtOffs = info.compStmtOffsets[nxtStmtIndex];
11774+ }
11775+ else
11776+ {
11777+ /* No more line# entries */
1178511778
11786- nxtStmtOffs = BAD_IL_OFFSET;
11787- }
11779+ nxtStmtOffs = BAD_IL_OFFSET;
1178811780 }
1178911781 }
11790- else if ((info.compStmtOffsetsImplicit & ICorDebugInfo::STACK_EMPTY_BOUNDARIES) &&
11791- (verCurrentState.esStackDepth == 0))
11792- {
11793- /* At stack-empty locations, we have already added the tree to
11794- the stmt list with the last offset. We just need to update
11795- impCurStmtDI
11796- */
11782+ }
11783+ else if ((info.compStmtOffsetsImplicit & ICorDebugInfo::STACK_EMPTY_BOUNDARIES) &&
11784+ (verCurrentState.esStackDepth == 0))
11785+ {
11786+ /* At stack-empty locations, we have already added the tree to
11787+ the stmt list with the last offset. We just need to update
11788+ impCurStmtDI
11789+ */
1179711790
11791+ impCurStmtOffsSet(opcodeOffs);
11792+ }
11793+ else if ((info.compStmtOffsetsImplicit & ICorDebugInfo::CALL_SITE_BOUNDARIES) &&
11794+ impOpcodeIsCallSiteBoundary(prevOpcode))
11795+ {
11796+ /* Make sure we have a type cached */
11797+ assert(callTyp != TYP_COUNT);
11798+
11799+ if (callTyp == TYP_VOID)
11800+ {
1179811801 impCurStmtOffsSet(opcodeOffs);
1179911802 }
11800- else if ((info.compStmtOffsetsImplicit & ICorDebugInfo::CALL_SITE_BOUNDARIES) &&
11801- impOpcodeIsCallSiteBoundary(prevOpcode))
11803+ else if (opts.compDbgCode)
1180211804 {
11803- /* Make sure we have a type cached */
11804- assert(callTyp != TYP_COUNT);
11805-
11806- if (callTyp == TYP_VOID)
11807- {
11808- impCurStmtOffsSet(opcodeOffs);
11809- }
11810- else if (opts.compDbgCode)
11811- {
11812- impSpillStackEnsure(true);
11813- impCurStmtOffsSet(opcodeOffs);
11814- }
11805+ impSpillStackEnsure(true);
11806+ impCurStmtOffsSet(opcodeOffs);
1181511807 }
11816- else if ((info.compStmtOffsetsImplicit & ICorDebugInfo::NOP_BOUNDARIES) && (prevOpcode == CEE_NOP))
11808+ }
11809+ else if ((info.compStmtOffsetsImplicit & ICorDebugInfo::NOP_BOUNDARIES) && (prevOpcode == CEE_NOP))
11810+ {
11811+ if (opts.compDbgCode)
1181711812 {
11818- if (opts.compDbgCode)
11819- {
11820- impSpillStackEnsure(true);
11821- }
11822-
11823- impCurStmtOffsSet(opcodeOffs);
11813+ impSpillStackEnsure(true);
1182411814 }
1182511815
11826- assert(!impCurStmtDI.IsValid() || (nxtStmtOffs == BAD_IL_OFFSET) ||
11827- (impCurStmtDI.GetLocation().GetOffset() <= nxtStmtOffs));
11816+ impCurStmtOffsSet(opcodeOffs);
1182811817 }
11818+
11819+ assert(!impCurStmtDI.IsValid() || (nxtStmtOffs == BAD_IL_OFFSET) ||
11820+ (impCurStmtDI.GetLocation().GetOffset() <= nxtStmtOffs));
1182911821 }
1183011822
1183111823 CORINFO_CLASS_HANDLE clsHnd = DUMMY_INIT(NULL);
0 commit comments