diff options
author | Sergey Andreenko <seandree@microsoft.com> | 2017-10-11 14:50:23 -0700 |
---|---|---|
committer | Sergey Andreenko <seandree@microsoft.com> | 2017-10-17 10:57:05 -0700 |
commit | 5e75298cc22c406d44aa95f400bac656dce55c71 (patch) | |
tree | f09e0ec486dbab0ed708e83f21462fb367fc059d /src/jit/flowgraph.cpp | |
parent | 5ff5873bfd4b7e15833121908cdcafded73c0a17 (diff) | |
download | coreclr-5e75298cc22c406d44aa95f400bac656dce55c71.tar.gz coreclr-5e75298cc22c406d44aa95f400bac656dce55c71.tar.bz2 coreclr-5e75298cc22c406d44aa95f400bac656dce55c71.zip |
extract fgDebugCheckStmtsList
Diffstat (limited to 'src/jit/flowgraph.cpp')
-rw-r--r-- | src/jit/flowgraph.cpp | 115 |
1 files changed, 67 insertions, 48 deletions
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index 057de240f5..2f20e0b0be 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -21599,72 +21599,91 @@ void Compiler::fgDebugCheckLinks(bool morphTrees) fgDebugCheckBlockLinks(); /* For each basic block check the bbTreeList links */ - for (BasicBlock* block = fgFirstBB; block; block = block->bbNext) + for (BasicBlock* block = fgFirstBB; block != nullptr; block = block->bbNext) { - PROCESS_BLOCK_AGAIN:; if (block->IsLIR()) { LIR::AsRange(block).CheckLIR(this); } else { - for (GenTreeStmt* stmt = block->firstStmt(); stmt; stmt = stmt->gtNextStmt) - { - /* Verify that bbTreeList is threaded correctly */ - /* Note that for the GT_STMT list, the gtPrev list is circular. The gtNext list is not: gtNext of the - * last GT_STMT in a block is nullptr. */ + fgDebugCheckStmtsList(block, morphTrees); + } + } +} - noway_assert(stmt->gtPrev); +//------------------------------------------------------------------------------ +// fgDebugCheckStmtsList : Perfoms the set of checks: +// - all statements in the block are linked correctly +// - check statements flags +// - check nodes gtNext and gtPrev values, if the node list is threaded +// +// Arguments: +// block - the block to check statements in +// morphTrees - try to morph trees in the checker +// +// Note: +// Checking that all bits that are set in treeFlags are also set in chkFlags is currently disabled. - if (stmt == block->bbTreeList) - { - noway_assert(stmt->gtPrev->gtNext == nullptr); - } - else - { - noway_assert(stmt->gtPrev->gtNext == stmt); - } +void Compiler::fgDebugCheckStmtsList(BasicBlock* block, bool morphTrees) +{ + for (GenTreeStmt* stmt = block->firstStmt(); stmt != nullptr; stmt = stmt->gtNextStmt) + { + /* Verify that bbTreeList is threaded correctly */ + /* Note that for the GT_STMT list, the gtPrev list is circular. The gtNext list is not: gtNext of the + * last GT_STMT in a block is nullptr. */ - if (stmt->gtNext) - { - noway_assert(stmt->gtNext->gtPrev == stmt); - } - else - { - noway_assert(block->lastStmt() == stmt); - } + noway_assert(stmt->gtPrev); - /* For each statement check that the exception flags are properly set */ + if (stmt == block->bbTreeList) + { + noway_assert(stmt->gtPrev->gtNext == nullptr); + } + else + { + noway_assert(stmt->gtPrev->gtNext == stmt); + } - noway_assert(stmt->gtStmtExpr); + if (stmt->gtNext) + { + noway_assert(stmt->gtNext->gtPrev == stmt); + } + else + { + noway_assert(block->lastStmt() == stmt); + } - if (verbose && 0) - { - gtDispTree(stmt->gtStmtExpr); - } + /* For each statement check that the exception flags are properly set */ - fgDebugCheckFlags(stmt->gtStmtExpr); + noway_assert(stmt->gtStmtExpr); - // Not only will this stress fgMorphBlockStmt(), but we also get all the checks - // done by fgMorphTree() + if (verbose && 0) + { + gtDispTree(stmt->gtStmtExpr); + } - if (morphTrees) - { - // If 'stmt' is removed from the block, restart - if (fgMorphBlockStmt(block, stmt DEBUGARG("test morphing"))) - { - goto PROCESS_BLOCK_AGAIN; - } - } + fgDebugCheckFlags(stmt->gtStmtExpr); - /* For each GT_STMT node check that the nodes are threaded correcly - gtStmtList */ + // Not only will this stress fgMorphBlockStmt(), but we also get all the checks + // done by fgMorphTree() - if (fgStmtListThreaded) - { - fgDebugCheckNodeLinks(block, stmt); - } + if (morphTrees) + { + // If 'stmt' is removed from the block, start a new check for the current block, + // break the current check. + if (fgMorphBlockStmt(block, stmt DEBUGARG("test morphing"))) + { + fgDebugCheckStmtsList(block, morphTrees); + break; } } + + /* For each GT_STMT node check that the nodes are threaded correcly - gtStmtList */ + + if (fgStmtListThreaded) + { + fgDebugCheckNodeLinks(block, stmt); + } } } @@ -21673,7 +21692,7 @@ void Compiler::fgDebugCheckBlockLinks() { assert(fgFirstBB->bbPrev == nullptr); - for (BasicBlock* block = fgFirstBB; block; block = block->bbNext) + for (BasicBlock* block = fgFirstBB; block != nullptr; block = block->bbNext) { if (block->bbNext) { @@ -21743,7 +21762,7 @@ void Compiler::fgDebugCheckBlockLinks() // // Likewise the depth limit is a policy consideration, and serves mostly // as a safeguard to prevent runaway inlining of small methods. - +// unsigned Compiler::fgCheckInlineDepthAndRecursion(InlineInfo* inlineInfo) { BYTE* candidateCode = inlineInfo->inlineCandidateInfo->methInfo.ILCode; |