Skip to content

Commit 4704d9d

Browse files
author
Sergey Andreenko
committed
a few test work.
1 parent 2a8b594 commit 4704d9d

File tree

7 files changed

+122
-56
lines changed

7 files changed

+122
-56
lines changed

src/coreclr/src/jit/codegenxarch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5518,7 +5518,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
55185518
}
55195519
else
55205520
{
5521-
assert(!varTypeIsStruct(call));
5521+
//assert(!varTypeIsStruct(call));
55225522

55235523
if (call->gtType == TYP_REF)
55245524
{

src/coreclr/src/jit/compiler.hpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,10 +2016,18 @@ inline
20162016
bool fConservative = false;
20172017
if (varNum >= 0)
20182018
{
2019-
LclVarDsc* varDsc;
2020-
20212019
assert((unsigned)varNum < lvaCount);
2022-
varDsc = lvaTable + varNum;
2020+
2021+
LclVarDsc* varDsc = lvaGetDesc(varNum);
2022+
if (varDsc->lvRefCnt() == 0 && !varDsc->lvOnFrame && varDsc->lvPromotedStruct())
2023+
{
2024+
unsigned promotedLclVarNum = varDsc->lvFieldLclStart;
2025+
LclVarDsc* firstPromotedField = lvaGetDesc(promotedLclVarNum);
2026+
assert(firstPromotedField->lvOnFrame);
2027+
varDsc->lvOnFrame = true;
2028+
varDsc->lvStkOffs = firstPromotedField->lvStkOffs;
2029+
}
2030+
20232031
bool isPrespilledArg = false;
20242032
#if defined(_TARGET_ARM_) && defined(PROFILING_SUPPORTED)
20252033
isPrespilledArg = varDsc->lvIsParam && compIsProfilerHookNeeded() &&
@@ -2042,6 +2050,7 @@ inline
20422050
#endif // !_TARGET_AMD64_
20432051
}
20442052

2053+
20452054
FPbased = varDsc->lvFramePointerBased;
20462055

20472056
#ifdef DEBUG

src/coreclr/src/jit/ee_il_dll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* jitHost)
8181
const WCHAR* jitStdOutFile = JitConfig.JitStdOutFile();
8282
if (jitStdOutFile != nullptr)
8383
{
84-
jitstdout = _wfopen(jitStdOutFile, W("a"));
84+
jitstdout = _wfopen(jitStdOutFile, W("w"));
8585
assert(jitstdout != nullptr);
8686
}
8787
#endif // DEBUG

src/coreclr/src/jit/gentree.cpp

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5313,6 +5313,10 @@ bool GenTree::OperRequiresAsgFlag()
53135313
{
53145314
return true;
53155315
}
5316+
if (OperIs(GT_STORE_LCL_VAR, GT_STORE_LCL_FLD))
5317+
{
5318+
return true;
5319+
}
53165320
#ifdef FEATURE_HW_INTRINSICS
53175321
if (gtOper == GT_HWINTRINSIC)
53185322
{
@@ -6759,10 +6763,57 @@ GenTree* Compiler::gtNewBlkOpNode(GenTree* dst, GenTree* srcOrFillVal, bool isVo
67596763
}
67606764
}
67616765
}
6766+
assert(dst->OperIsLocal());
67626767

6763-
GenTree* result = gtNewAssignNode(dst, srcOrFillVal);
6764-
gtBlockOpInit(result, dst, srcOrFillVal, isVolatile);
6765-
return result;
6768+
GenTreeLclVar* dstLcl = dst->AsLclVar();
6769+
6770+
//if (dst->OperIsLocal())
6771+
//{
6772+
// dstLcl = dst->AsLclVar();
6773+
//}
6774+
//else
6775+
//{
6776+
// assert(dst->OperIsBlk());
6777+
// GenTree* addr = dst->AsBlk()->Addr();
6778+
// assert(addr->OperIs(GT_ADDR));
6779+
// dstLcl = addr->AsOp()->gtOp1->AsLclVar();
6780+
//}
6781+
6782+
unsigned lclNum = dstLcl->GetLclNum();
6783+
LclVarDsc* varDsc = lvaGetDesc(lclNum);
6784+
unsigned int size = varDsc->lvExactSize;
6785+
6786+
if (isCopyBlock)
6787+
{
6788+
GenTree* result = new (this, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, varDsc->TypeGet(), lclNum);
6789+
result->gtFlags |= GTF_ASG;
6790+
result->gtFlags |= GTF_VAR_DEF;
6791+
result->AsOp()->gtOp1 = srcOrFillVal;
6792+
return result;
6793+
6794+
}
6795+
else // init
6796+
{
6797+
GenTreeBlk* storeBlk = nullptr;
6798+
dstLcl->ChangeOper(GT_LCL_VAR_ADDR);
6799+
dstLcl->ChangeType(TYP_BYREF);
6800+
if (varDsc->HasGCPtr())
6801+
{
6802+
CORINFO_CLASS_HANDLE structHnd = varDsc->lvVerTypeInfo.GetClassHandle();
6803+
GenTreeObj* objNode = gtNewObjNode(structHnd, dstLcl);
6804+
objNode->ChangeOper(GT_STORE_OBJ);
6805+
objNode->SetData(srcOrFillVal);
6806+
storeBlk = objNode;
6807+
}
6808+
else
6809+
{
6810+
storeBlk = new (this, GT_STORE_BLK)
6811+
GenTreeBlk(GT_STORE_BLK, TYP_STRUCT, dstLcl, srcOrFillVal, typGetBlkLayout(size));
6812+
}
6813+
storeBlk->gtFlags |= GTF_ASG;
6814+
storeBlk->gtFlags |= ((dstLcl->gtFlags | srcOrFillVal->gtFlags) & GTF_ALL_EFFECT);
6815+
return storeBlk;
6816+
}
67666817
}
67676818

67686819
//------------------------------------------------------------------------

src/coreclr/src/jit/importer.cpp

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ GenTreeCall::Use* Compiler::impPopCallArgs(unsigned count, CORINFO_SIG_INFO* sig
864864
{
865865
assert(sig == nullptr || count == sig->numArgs);
866866

867-
CORINFO_CLASS_HANDLE structType;
868867
GenTreeCall::Use* argList;
869868

870869
if (Target::g_tgtArgOrder == Target::ARG_ORDER_R2L)
@@ -882,41 +881,41 @@ GenTreeCall::Use* Compiler::impPopCallArgs(unsigned count, CORINFO_SIG_INFO* sig
882881
typeInfo ti = se.seTypeInfo;
883882
GenTree* temp = se.val;
884883

885-
if (varTypeIsStruct(temp))
886-
{
887-
// Morph trees that aren't already OBJs or MKREFANY to be OBJs
888-
assert(ti.IsType(TI_STRUCT));
889-
structType = ti.GetClassHandleForValueClass();
890-
891-
bool forceNormalization = false;
892-
if (varTypeIsSIMD(temp))
893-
{
894-
// We need to ensure that fgMorphArgs will use the correct struct handle to ensure proper
895-
// ABI handling of this argument.
896-
// Note that this can happen, for example, if we have a SIMD intrinsic that returns a SIMD type
897-
// with a different baseType than we've seen.
898-
// TODO-Cleanup: Consider whether we can eliminate all of these cases.
899-
if (gtGetStructHandleIfPresent(temp) != structType)
900-
{
901-
forceNormalization = true;
902-
}
903-
}
904-
#ifdef DEBUG
905-
if (verbose)
906-
{
907-
printf("Calling impNormStructVal on:\n");
908-
gtDispTree(temp);
909-
}
910-
#endif
911-
temp = impNormStructVal(temp, structType, (unsigned)CHECK_SPILL_ALL, forceNormalization);
912-
#ifdef DEBUG
913-
if (verbose)
914-
{
915-
printf("resulting tree:\n");
916-
gtDispTree(temp);
917-
}
918-
#endif
919-
}
884+
// if (varTypeIsStruct(temp))
885+
// {
886+
// // Morph trees that aren't already OBJs or MKREFANY to be OBJs
887+
// assert(ti.IsType(TI_STRUCT));
888+
// CORINFO_CLASS_HANDLE structType = ti.GetClassHandleForValueClass();
889+
//
890+
// bool forceNormalization = false;
891+
// if (varTypeIsSIMD(temp))
892+
// {
893+
// // We need to ensure that fgMorphArgs will use the correct struct handle to ensure proper
894+
// // ABI handling of this argument.
895+
// // Note that this can happen, for example, if we have a SIMD intrinsic that returns a SIMD type
896+
// // with a different baseType than we've seen.
897+
// // TODO-Cleanup: Consider whether we can eliminate all of these cases.
898+
// if (gtGetStructHandleIfPresent(temp) != structType)
899+
// {
900+
// forceNormalization = true;
901+
// }
902+
// }
903+
//#ifdef DEBUG
904+
// if (verbose)
905+
// {
906+
// printf("Calling impNormStructVal on:\n");
907+
// gtDispTree(temp);
908+
// }
909+
//#endif
910+
// temp = impNormStructVal(temp, structType, (unsigned)CHECK_SPILL_ALL, forceNormalization);
911+
//#ifdef DEBUG
912+
// if (verbose)
913+
// {
914+
// printf("resulting tree:\n");
915+
// gtDispTree(temp);
916+
// }
917+
//#endif
918+
// }
920919

921920
/* NOTE: we defer bashing the type for I_IMPL to fgMorphArgs */
922921
argList = gtPrependNewCallArg(temp, argList);
@@ -15589,7 +15588,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
1558915588
goto EVAL_APPEND;
1559015589

1559115590
case CEE_INITOBJ:
15592-
15591+
{
1559315592
assertImp(sz == sizeof(unsigned));
1559415593

1559515594
_impResolveToken(CORINFO_TOKENKIND_Class);
@@ -15598,22 +15597,23 @@ void Compiler::impImportBlockCode(BasicBlock* block)
1559815597

1559915598
if (tiVerificationNeeded)
1560015599
{
15601-
typeInfo tiTo = impStackTop().seTypeInfo;
15600+
typeInfo tiTo = impStackTop().seTypeInfo;
1560215601
typeInfo tiInstr = verMakeTypeInfo(resolvedToken.hClass);
1560315602

1560415603
Verify(tiTo.IsByRef(), "byref expected");
1560515604
Verify(!tiTo.IsReadonlyByRef(), "write to readonly byref");
1560615605

1560715606
Verify(tiCompatibleWith(tiInstr, tiTo.DereferenceByRef(), false),
15608-
"type operand incompatible with type of address");
15607+
"type operand incompatible with type of address");
1560915608
}
1561015609

1561115610
size = info.compCompHnd->getClassSize(resolvedToken.hClass); // Size
15612-
op2 = gtNewIconNode(0); // Value
15613-
op1 = impPopStack().val; // Dest
15614-
op1 = gtNewBlockVal(op1, size);
15615-
op1 = gtNewBlkOpNode(op1, op2, (prefixFlags & PREFIX_VOLATILE) != 0, false);
15611+
op2 = gtNewIconNode(0); // Value
15612+
GenTree* dstAddr = impPopStack().val; // Dest
15613+
GenTree* blockVal = gtNewBlockVal(dstAddr, size);
15614+
op1 = gtNewBlkOpNode(blockVal, op2, (prefixFlags & PREFIX_VOLATILE) != 0, /* is copy */ false);
1561615615
goto SPILL_APPEND;
15616+
}
1561715617

1561815618
case CEE_INITBLK:
1561915619

src/coreclr/src/jit/morph.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4953,7 +4953,10 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call,
49534953

49544954
// Copy the valuetype to the temp
49554955
GenTree* copyBlk = gtNewBlkOpNode(dest, argx, false /* not volatile */, true /* copyBlock */);
4956-
copyBlk = fgMorphCopyBlock(copyBlk);
4956+
#ifdef DEBUG
4957+
dest->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
4958+
copyBlk->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED;
4959+
#endif
49574960

49584961
#if FEATURE_FIXED_OUT_ARGS
49594962

@@ -14831,7 +14834,7 @@ void Compiler::fgMorphTreeDone(GenTree* tree,
1483114834
//
1483214835
// But we shouldn't be running local assertion prop on these,
1483314836
// as local prop gets disabled when we run global prop.
14834-
assert(!tree->OperIs(GT_STORE_LCL_VAR, GT_STORE_LCL_FLD));
14837+
//assert(!tree->OperIs(GT_STORE_LCL_VAR, GT_STORE_LCL_FLD));
1483514838

1483614839
// DefinesLocal can return true for some BLK op uses, so
1483714840
// check what gets assigned only when we're at an assignment.

src/coreclr/src/jit/simd.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,9 +3178,12 @@ GenTree* Compiler::impSIMDIntrinsic(OPCODE opcode,
31783178
// block ops.
31793179
if (doCopyBlk)
31803180
{
3181-
GenTree* dest = new (this, GT_BLK)
3182-
GenTreeBlk(GT_BLK, simdType, copyBlkDst, typGetBlkLayout(getSIMDTypeSizeInBytes(clsHnd)));
3183-
dest->gtFlags |= GTF_GLOB_REF;
3181+
//GenTree* dest = new (this, GT_BLK)
3182+
// GenTreeBlk(GT_BLK, simdType, copyBlkDst, typGetBlkLayout(getSIMDTypeSizeInBytes(clsHnd)));
3183+
//dest->gtFlags |= GTF_GLOB_REF;
3184+
assert(copyBlkDst->OperIs(GT_ADDR));
3185+
GenTree* dest = copyBlkDst->AsOp()->gtOp1;
3186+
assert(dest->OperIsLocal());
31843187
retVal = gtNewBlkOpNode(dest, simdTree,
31853188
false, // not volatile
31863189
true); // copyBlock

0 commit comments

Comments
 (0)