Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Small fixes around AST nodes. (#24957)
Browse files Browse the repository at this point in the history
* Fix MEASURE_NODE_SIZE and naming mistakes.

* The additional fields were deleted in #14582 (~1.5 years ago).

* Fix  GT_INDEX_ADDR def.

We created them as `new (this, GT_INDEX_ADDR) GenTreeIndexAddr` but used smaller `GenTreeIndex` as nessecary size.

* Use LargeOpOpcode instead of GT_CALL.
  • Loading branch information
Sergey Andreenko committed Jun 5, 2019
1 parent 5593c81 commit d7e49ef
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ inline void GenTree::ChangeOperConst(genTreeOps oper)

inline void GenTree::ChangeOper(genTreeOps oper, ValueNumberUpdate vnUpdate)
{
assert(!OperIsConst(oper)); // use ChangeOperLeaf() instead
assert(!OperIsConst(oper)); // use ChangeOperConst() instead

unsigned mask = GTF_COMMON_MASK;
if (this->OperIsIndirOrArrLength() && OperIsIndirOrArrLength(oper))
Expand Down
7 changes: 4 additions & 3 deletions src/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void GenTree::InitNodeSize()
GenTree::s_gtNodeSizes[GT_FTN_ADDR] = TREE_NODE_SZ_LARGE;
GenTree::s_gtNodeSizes[GT_BOX] = TREE_NODE_SZ_LARGE;
GenTree::s_gtNodeSizes[GT_INDEX] = TREE_NODE_SZ_LARGE;
GenTree::s_gtNodeSizes[GT_INDEX_ADDR] = TREE_NODE_SZ_LARGE;
GenTree::s_gtNodeSizes[GT_INDEX_ADDR] = TREE_NODE_SZ_LARGE;
GenTree::s_gtNodeSizes[GT_ARR_BOUNDS_CHECK] = TREE_NODE_SZ_LARGE;
#ifdef FEATURE_SIMD
GenTree::s_gtNodeSizes[GT_SIMD_CHK] = TREE_NODE_SZ_LARGE;
Expand Down Expand Up @@ -317,6 +317,7 @@ void GenTree::InitNodeSize()
static_assert_no_msg(sizeof(GenTreeQmark) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeIntrinsic) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeIndex) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeIndexAddr) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeArrLen) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeBoundsChk) <= TREE_NODE_SZ_LARGE); // *** large node
static_assert_no_msg(sizeof(GenTreeArrElem) <= TREE_NODE_SZ_LARGE); // *** large node
Expand Down Expand Up @@ -5937,8 +5938,8 @@ GenTree* Compiler::gtNewLclLNode(unsigned lnum, var_types type DEBUGARG(IL_OFFSE
(lvaIsImplicitByRefLocal(lnum) && fgGlobalMorph && (lvaTable[lnum].lvType == TYP_BYREF)));
}
// This local variable node may later get transformed into a large node
assert(GenTree::s_gtNodeSizes[GT_CALL] > GenTree::s_gtNodeSizes[GT_LCL_VAR]);
GenTree* node = new (this, GT_CALL) GenTreeLclVar(type, lnum DEBUGARG(ILoffs) DEBUGARG(/*largeNode*/ true));
assert(GenTree::s_gtNodeSizes[LargeOpOpcode()] > GenTree::s_gtNodeSizes[GT_LCL_VAR]);
GenTree* node = new (this, LargeOpOpcode()) GenTreeLclVar(type, lnum DEBUGARG(ILoffs) DEBUGARG(/*largeNode*/ true));
return node;
}

Expand Down
3 changes: 1 addition & 2 deletions src/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -6519,8 +6519,7 @@ inline bool GenTree::isUsedFromSpillTemp() const

/*****************************************************************************/

// In debug, on some platforms (e.g., when LATE_DISASM is defined), GenTreeIntCon is bigger than GenTreeLclFld.
const size_t TREE_NODE_SZ_SMALL = max(sizeof(GenTreeIntCon), sizeof(GenTreeLclFld));
const size_t TREE_NODE_SZ_SMALL = sizeof(GenTreeLclFld);
const size_t TREE_NODE_SZ_LARGE = sizeof(GenTreeCall);

enum varRefKinds
Expand Down
6 changes: 3 additions & 3 deletions src/jit/gtlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ GTNODE(QMARK , GenTreeQmark ,0,(GTK_BINOP|GTK_EXOP|GTK_NOTLIR))
GTNODE(COLON , GenTreeColon ,0,(GTK_BINOP|GTK_NOTLIR))

GTNODE(INDEX , GenTreeIndex ,0,(GTK_BINOP|GTK_EXOP|GTK_NOTLIR)) // SZ-array-element
GTNODE(INDEX_ADDR , GenTreeIndex ,0,(GTK_BINOP|GTK_EXOP)) // addr of SZ-array-element; used when
// aiming to minimize compile times.
GTNODE(INDEX_ADDR , GenTreeIndexAddr ,0,(GTK_BINOP|GTK_EXOP)) // addr of SZ-array-element;
// used when aiming to minimize compile times.

GTNODE(MKREFANY , GenTreeOp ,0,GTK_BINOP)

Expand Down Expand Up @@ -273,7 +273,7 @@ GTNODE(PHI_ARG , GenTreePhiArg ,0,(GTK_LEAF|GTK_LOCAL)) // phi
// Nodes used by Lower to generate a closer CPU representation of other nodes
//-----------------------------------------------------------------------------

GTNODE(JMPTABLE , GenTreeJumpTable ,0, (GTK_LEAF|GTK_NOCONTAIN)) // Generates the jump table for switches
GTNODE(JMPTABLE , GenTree ,0, (GTK_LEAF|GTK_NOCONTAIN)) // Generates the jump table for switches
GTNODE(SWITCH_TABLE , GenTreeOp ,0, (GTK_BINOP|GTK_NOVALUE)) // Jump Table based switch construct

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/jit/jitstd/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,4 @@ struct make_signed<unsigned __int64>
typedef signed __int64 type;
};

} // namespace jit_std
} // namespace jitstd
2 changes: 1 addition & 1 deletion src/jit/jitstd/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class vector
friend class vector;
};

}// namespace jit_std
}// namespace jitstd



Expand Down

0 comments on commit d7e49ef

Please sign in to comment.