From d17bce2d3404af1ac0125bfeca0bacc0ee6bccaa Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Mon, 16 Oct 2017 19:46:37 -0700 Subject: [PATCH] move ReplaceWith to cpp to make DEBUG_DESTROY_NODE visible. --- src/jit/compiler.hpp | 39 --------------------------------------- src/jit/gentree.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 7263718..4007b4a 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -1456,45 +1456,6 @@ inline void GenTree::SetOper(genTreeOps oper, ValueNumberUpdate vnUpdate) } } -//------------------------------------------------------------------------ -// ReplaceWith: replace this with the src node. The source must be an isolated node -// and cannot be used after the replacement. -// -// Arguments: -// src - source tree, that replaces this. -// comp - the compiler instance to transfer annotations for arrays. -// -inline void GenTree::ReplaceWith(GenTree* src, Compiler* comp) -{ - // The source may be big only if the target is also a big node - assert((gtDebugFlags & GTF_DEBUG_NODE_LARGE) || GenTree::s_gtNodeSizes[src->gtOper] == TREE_NODE_SZ_SMALL); - - // The check is effective only if nodes have been already threaded. - assert((src->gtPrev == nullptr) && (src->gtNext == nullptr)); - - RecordOperBashing(OperGet(), src->OperGet()); // nop unless NODEBASH_STATS is enabled - - GenTreePtr prev = gtPrev; - GenTreePtr next = gtNext; - // The VTable pointer is copied intentionally here - memcpy((void*)this, (void*)src, src->GetNodeSize()); - this->gtPrev = prev; - this->gtNext = next; - -#ifdef DEBUG - gtSeqNum = 0; -#endif - // Transfer any annotations. - if (src->OperGet() == GT_IND && src->gtFlags & GTF_IND_ARR_INDEX) - { - ArrayInfo arrInfo; - bool b = comp->GetArrayInfoMap()->Lookup(src, &arrInfo); - assert(b); - comp->GetArrayInfoMap()->Set(this, arrInfo); - } - DEBUG_DESTROY_NODE(src); -} - inline GenTreePtr Compiler::gtNewCastNode(var_types typ, GenTreePtr op1, var_types castType) { GenTreePtr res = new (this, GT_CAST) GenTreeCast(typ, op1, castType); diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp index 31ac910..b2ddc80 100644 --- a/src/jit/gentree.cpp +++ b/src/jit/gentree.cpp @@ -429,6 +429,48 @@ bool GenTree::IsNodeProperlySized() const } #endif +#if SMALL_TREE_NODES +//------------------------------------------------------------------------ +// ReplaceWith: replace this with the src node. The source must be an isolated node +// and cannot be used after the replacement. +// +// Arguments: +// src - source tree, that replaces this. +// comp - the compiler instance to transfer annotations for arrays. +// +void GenTree::ReplaceWith(GenTree* src, Compiler* comp) +{ + // The source may be big only if the target is also a big node + assert((gtDebugFlags & GTF_DEBUG_NODE_LARGE) || GenTree::s_gtNodeSizes[src->gtOper] == TREE_NODE_SZ_SMALL); + + // The check is effective only if nodes have been already threaded. + assert((src->gtPrev == nullptr) && (src->gtNext == nullptr)); + + RecordOperBashing(OperGet(), src->OperGet()); // nop unless NODEBASH_STATS is enabled + + GenTreePtr prev = gtPrev; + GenTreePtr next = gtNext; + // The VTable pointer is copied intentionally here + memcpy((void*)this, (void*)src, src->GetNodeSize()); + this->gtPrev = prev; + this->gtNext = next; + +#ifdef DEBUG + gtSeqNum = 0; +#endif + // Transfer any annotations. + if (src->OperGet() == GT_IND && src->gtFlags & GTF_IND_ARR_INDEX) + { + ArrayInfo arrInfo; + bool b = comp->GetArrayInfoMap()->Lookup(src, &arrInfo); + assert(b); + comp->GetArrayInfoMap()->Set(this, arrInfo); + } + DEBUG_DESTROY_NODE(src); +} + +#endif + /***************************************************************************** * * When 'NODEBASH_STATS' is enabled in "jit.h" we record all instances of -- 2.7.4