Skip to content

Commit

Permalink
Remove GT_STORE_DYN_BLK (#98905)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Feb 27, 2024
1 parent 173da89 commit 51b51bf
Show file tree
Hide file tree
Showing 39 changed files with 65 additions and 540 deletions.
4 changes: 0 additions & 4 deletions docs/design/coreclr/jit/first-class-structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ encountered by most phases of the JIT:
[#21705](https://github.com/dotnet/coreclr/pull/21705) they are no longer large nodes.
* `GT_STORE_OBJ` and `GT_STORE_BLK` have the same structure as `GT_OBJ` and `GT_BLK`, respectively
* `Data()` is op2
* `GT_STORE_DYN_BLK` (GenTreeStoreDynBlk extends GenTreeBlk)
* Additional child `gtDynamicSize`
* Note that these aren't really struct stores; they represent dynamically sized blocks
of arbitrary data.
* For `GT_LCL_FLD` nodes, we store a pointer to `ClassLayout` in the node.
* For `GT_LCL_VAR` nodes, the `ClassLayout` is obtained from the `LclVarDsc`.

Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5493,7 +5493,6 @@ GenTree* Compiler::optAssertionProp(ASSERT_VALARG_TP assertions, GenTree* tree,
case GT_IND:
case GT_STOREIND:
case GT_NULLCHECK:
case GT_STORE_DYN_BLK:
return optAssertionProp_Ind(assertions, tree, stmt);

case GT_BOUNDS_CHECK:
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
#endif
break;

case GT_STORE_DYN_BLK:
case GT_STORE_BLK:
genCodeForStoreBlk(treeNode->AsBlk());
break;
Expand Down Expand Up @@ -4568,14 +4567,14 @@ void CodeGen::inst_JMP(emitJumpKind jmp, BasicBlock* tgtBlock)
}

//------------------------------------------------------------------------
// genCodeForStoreBlk: Produce code for a GT_STORE_DYN_BLK/GT_STORE_BLK node.
// genCodeForStoreBlk: Produce code for a GT_STORE_BLK node.
//
// Arguments:
// tree - the node
//
void CodeGen::genCodeForStoreBlk(GenTreeBlk* blkOp)
{
assert(blkOp->OperIs(GT_STORE_DYN_BLK, GT_STORE_BLK));
assert(blkOp->OperIs(GT_STORE_BLK));

bool isCopyBlk = blkOp->OperIsCopyBlkOp();

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6546,7 +6546,7 @@ void CodeGen::genDefinePendingCallLabel(GenTreeCall* call)
// For certain indirect calls we may introduce helper calls before that we need to skip:
// - CFG may introduce a call to the validator first
// - Generic virtual methods may compute the target dynamically through a separate helper call
// - memset/memcpy helper calls emitted for GT_STORE_DYN_BLK/GT_STORE_BLK
// - memset/memcpy helper calls emitted for GT_STORE_BLK
if (call->IsHelperCall())
{
switch (compiler->eeGetHelperNum(call->gtCallMethHnd))
Expand Down
21 changes: 3 additions & 18 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,18 +1935,9 @@ void CodeGen::genSetBlockSize(GenTreeBlk* blkNode, regNumber sizeReg)
{
if (sizeReg != REG_NA)
{
unsigned blockSize = blkNode->Size();
if (!blkNode->OperIs(GT_STORE_DYN_BLK))
{
assert((blkNode->gtRsvdRegs & genRegMask(sizeReg)) != 0);
// This can go via helper which takes the size as a native uint.
instGen_Set_Reg_To_Imm(EA_PTRSIZE, sizeReg, blockSize);
}
else
{
GenTree* sizeNode = blkNode->AsStoreDynBlk()->gtDynamicSize;
inst_Mov(sizeNode->TypeGet(), sizeReg, sizeNode->GetRegNum(), /* canSkip */ true);
}
assert((blkNode->gtRsvdRegs & genRegMask(sizeReg)) != 0);
// This can go via helper which takes the size as a native uint.
instGen_Set_Reg_To_Imm(EA_PTRSIZE, sizeReg, blkNode->Size());
}
}

Expand Down Expand Up @@ -2052,12 +2043,6 @@ void CodeGen::genConsumeBlockOp(GenTreeBlk* blkNode, regNumber dstReg, regNumber
genConsumeReg(dstAddr);
// The source may be a local or in a register; 'genConsumeBlockSrc' will check that.
genConsumeBlockSrc(blkNode);
// 'genSetBlockSize' (called below) will ensure that a register has been reserved as needed
// in the case where the size is a constant (i.e. it is not GT_STORE_DYN_BLK).
if (blkNode->OperGet() == GT_STORE_DYN_BLK)
{
genConsumeReg(blkNode->AsStoreDynBlk()->gtDynamicSize);
}

// Next, perform any necessary moves.
genCopyRegIfNeeded(dstAddr, dstReg);
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5022,7 +5022,6 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
emit->emitIns_R_L(INS_ld_d, EA_PTRSIZE, genPendingCallLabel, targetReg);
break;

case GT_STORE_DYN_BLK:
case GT_STORE_BLK:
genCodeForStoreBlk(treeNode->AsBlk());
break;
Expand Down Expand Up @@ -7249,14 +7248,14 @@ void CodeGen::genCreateAndStoreGCInfo(unsigned codeSize,
}

//------------------------------------------------------------------------
// genCodeForStoreBlk: Produce code for a GT_STORE_DYN_BLK/GT_STORE_BLK node.
// genCodeForStoreBlk: Produce code for a GT_STORE_BLK node.
//
// Arguments:
// tree - the node
//
void CodeGen::genCodeForStoreBlk(GenTreeBlk* blkOp)
{
assert(blkOp->OperIs(GT_STORE_DYN_BLK, GT_STORE_BLK));
assert(blkOp->OperIs(GT_STORE_BLK));

if (blkOp->gtBlkOpGcUnsafe)
{
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5102,7 +5102,6 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
emit->emitIns_R_L(INS_ld, EA_PTRSIZE, genPendingCallLabel, targetReg);
break;

case GT_STORE_DYN_BLK:
case GT_STORE_BLK:
genCodeForStoreBlk(treeNode->AsBlk());
break;
Expand Down Expand Up @@ -7246,14 +7245,14 @@ void CodeGen::genCreateAndStoreGCInfo(unsigned codeSize,
}

//------------------------------------------------------------------------
// genCodeForStoreBlk: Produce code for a GT_STORE_DYN_BLK/GT_STORE_BLK node.
// genCodeForStoreBlk: Produce code for a GT_STORE_BLK node.
//
// Arguments:
// tree - the node
//
void CodeGen::genCodeForStoreBlk(GenTreeBlk* blkOp)
{
assert(blkOp->OperIs(GT_STORE_DYN_BLK, GT_STORE_BLK));
assert(blkOp->OperIs(GT_STORE_BLK));

if (blkOp->gtBlkOpGcUnsafe)
{
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,6 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
emit->emitIns_R_L(INS_lea, EA_PTR_DSP_RELOC, genPendingCallLabel, treeNode->GetRegNum());
break;

case GT_STORE_DYN_BLK:
case GT_STORE_BLK:
genCodeForStoreBlk(treeNode->AsBlk());
break;
Expand Down Expand Up @@ -3057,7 +3056,7 @@ void CodeGen::genLclHeap(GenTree* tree)

void CodeGen::genCodeForStoreBlk(GenTreeBlk* storeBlkNode)
{
assert(storeBlkNode->OperIs(GT_STORE_DYN_BLK, GT_STORE_BLK));
assert(storeBlkNode->OperIs(GT_STORE_BLK));

bool isCopyBlk = storeBlkNode->OperIsCopyBlkOp();

Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9920,7 +9920,6 @@ JITDBGAPI void __cdecl cTreeFlags(Compiler* comp, GenTree* tree)

case GT_BLK:
case GT_STORE_BLK:
case GT_STORE_DYN_BLK:

if (tree->gtFlags & GTF_IND_VOLATILE)
{
Expand Down
26 changes: 0 additions & 26 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3364,9 +3364,6 @@ class Compiler
GenTreeBlk* gtNewStoreBlkNode(
ClassLayout* layout, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY);

GenTreeStoreDynBlk* gtNewStoreDynBlkNode(
GenTree* addr, GenTree* data, GenTree* dynamicSize, GenTreeFlags indirFlags = GTF_EMPTY);

GenTreeStoreInd* gtNewStoreIndNode(
var_types type, GenTree* addr, GenTree* data, GenTreeFlags indirFlags = GTF_EMPTY);

Expand Down Expand Up @@ -6463,7 +6460,6 @@ class Compiler
public:
GenTree* fgMorphInitBlock(GenTree* tree);
GenTree* fgMorphCopyBlock(GenTree* tree);
GenTree* fgMorphStoreDynBlock(GenTreeStoreDynBlk* tree);
private:
GenTree* fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optAssertionPropDone = nullptr);
void fgTryReplaceStructLocalWithField(GenTree* tree);
Expand Down Expand Up @@ -11447,28 +11443,6 @@ class GenTreeVisitor
break;
}

case GT_STORE_DYN_BLK:
{
GenTreeStoreDynBlk* const dynBlock = node->AsStoreDynBlk();

result = WalkTree(&dynBlock->gtOp1, dynBlock);
if (result == fgWalkResult::WALK_ABORT)
{
return result;
}
result = WalkTree(&dynBlock->gtOp2, dynBlock);
if (result == fgWalkResult::WALK_ABORT)
{
return result;
}
result = WalkTree(&dynBlock->gtDynamicSize, dynBlock);
if (result == fgWalkResult::WALK_ABORT)
{
return result;
}
break;
}

case GT_CALL:
{
GenTreeCall* const call = node->AsCall();
Expand Down
15 changes: 0 additions & 15 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4362,21 +4362,6 @@ void GenTree::VisitOperands(TVisitor visitor)
return;
}

case GT_STORE_DYN_BLK:
{
GenTreeStoreDynBlk* const dynBlock = this->AsStoreDynBlk();
if (visitor(dynBlock->gtOp1) == VisitResult::Abort)
{
return;
}
if (visitor(dynBlock->gtOp2) == VisitResult::Abort)
{
return;
}
visitor(dynBlock->gtDynamicSize);
return;
}

case GT_CALL:
{
GenTreeCall* const call = this->AsCall();
Expand Down
Loading

0 comments on commit 51b51bf

Please sign in to comment.