move ReplaceWith to cpp
authorSergey Andreenko <seandree@microsoft.com>
Tue, 17 Oct 2017 02:46:37 +0000 (19:46 -0700)
committerSergey Andreenko <seandree@microsoft.com>
Tue, 17 Oct 2017 17:57:05 +0000 (10:57 -0700)
to make DEBUG_DESTROY_NODE visible.

src/jit/compiler.hpp
src/jit/gentree.cpp

index 7263718..4007b4a 100644 (file)
@@ -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);
index 31ac910..b2ddc80 100644 (file)
@@ -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