8000 [main] Source code updates from dotnet/runtime by dotnet-maestro[bot] · Pull Request #344 · dotnet/dotnet · GitHub
[go: up one dir, main page]

Skip to content

[main] Source code updates from dotnet/runtime #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions prereqs/git-info/runtime.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<GitCommitHash>6ee6d40609b14602c20e762fac07c0da544ea1b8</GitCommitHash>
<OfficialBuildId>20250430.7</OfficialBuildId>
<OutputPackageVersion>10.0.0-preview.5.25230.7</OutputPackageVersion>
<GitCommitHash>27604b57bd2e9c9aa46d005db7c4e387d461b5b6</GitCommitHash>
<OfficialBuildId>20250501.7</OfficialBuildId>
<OutputPackageVersion>10.0.0-preview.5.25251.7</OutputPackageVersion>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion src/runtime/src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,7 @@ class FlowGraphNaturalLoops
FlowGraphNaturalLoops(const FlowGraphDfsTree* dfs);

static bool FindNaturalLoopBlocks(FlowGraphNaturalLoop* loop, ArrayStack<BasicBlock*>& worklist);
static bool IsLoopCanonicalizable(FlowGraphNaturalLoop* loop);

public:
const FlowGraphDfsTree* GetDfsTree()
Expand Down Expand Up @@ -2200,7 +2201,7 @@ class FlowGraphNaturalLoops
static FlowGraphNaturalLoops* Find(const FlowGraphDfsTree* dfs);

// Number of blocks with DFS backedges that are not natural loop headers
// (indicates presence of "irreducible" loops)
// (indicates presence of "irreducible" or uncanonicalizable loops)
unsigned ImproperLoopHeaders() const
{
return m_improperLoopHeaders;
Expand Down
36 changes: 35 additions & 1 deletion src/runtime/src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4879,7 +4879,7 @@ FlowGraphNaturalLoops* FlowGraphNaturalLoops::Find(const FlowGraphDfsTree* dfsTr
BitVecTraits loopTraits = loop->LoopBlockTraits();
loop->m_blocks = BitVecOps::MakeEmpty(&loopTraits);

if (!FindNaturalLoopBlocks(loop, worklist))
if (!FindNaturalLoopBlocks(loop, worklist) || !IsLoopCanonicalizable(loop))
{
loops->m_improperLoopHeaders++;

Expand Down Expand Up @@ -5077,6 +5077,40 @@ bool FlowGraphNaturalLoops::FindNaturalLoopBlocks(FlowGraphNaturalLoop* loop, Ar
return true;
}

//------------------------------------------------------------------------
// FlowGraphNaturalLoops::IsLoopCanonicalizable:
// Check if a loop will be able to be canonicalized if we record it.
//
// Parameters:
// loop - Loop structure (partially filled by caller)
//
// Returns:
// True if the loop header can be canonicalized:
// - Can have a preheader created
// - Exits can be made unique from the loop
//
bool FlowGraphNaturalLoops::IsLoopCanonicalizable(FlowGraphNaturalLoop* loop)
{
Compiler* comp = loop->GetDfsTree()->GetCompiler();
// The only (known) problematic case is when a backedge is a callfinally edge.
if (!comp->bbIsHandlerBeg(loop->GetHeader()))
{
return true;
}

for (FlowEdge* backedge : loop->BackEdges())
{
if (backedge->getSourceBlock()->KindIs(BBJ_CALLFINALLY))
{
// It would not be possible to create a preheader for this loop
// since this backedge could not be redirected.
return false;
}
}

return true;
}

#ifdef DEBUG

//------------------------------------------------------------------------
Expand Down
54 changes: 54 additions & 0 deletions src/runtime/src/coreclr/jit/objectalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,14 @@ bool ObjectAllocator::CanLclVarEscapeViaParentStack(ArrayStack<GenTree*>* parent
break;
}
}
else if (call->IsDelegateInvoke())
{
if (tree == call->gtArgs.GetThisArg()->GetNode())
{
JITDUMP("Delegate invoke this...\n");
canLclVarEscapeViaParentStack = false;
}
}

// Note there is nothing special here about the parent being a call. We could move all this processing
// up to the caller and handle any sort of tree that could lead to escapes this way.
Expand Down Expand Up @@ -2219,6 +2227,7 @@ void ObjectAllocator::RewriteUses()
}
}
// Make box accesses explicit for UNBOX_HELPER
// Expand delegate invoke for calls where "this" is possibly stack pointing
//
else if (tree->IsCall())
{
Expand Down Expand Up @@ -2267,6 +2276,51 @@ void ObjectAllocator::RewriteUses()
}
}
}
else if (call->IsDelegateInvoke())
{
CallArg* const thisArg = call->gtArgs.GetThisArg();
GenTree* const delegateThis = thisArg->GetNode();

if (delegateThis->OperIs(GT_LCL_VAR))
{
GenTreeLclVarCommon* const lcl = delegateThis->AsLclVarCommon();

if (m_allocator->DoesLclVarPointToStack(lcl->GetLclNum()))
{
JITDUMP("Expanding delegate invoke [%06u]\n", m_compiler->dspTreeID(call));
// Expand the delgate invoke early, so that physical promotion has
// a chance to promote the delegate fields.
//
// Note the instance field may also be stack allocatable (someday)
//
GenTree* const cloneThis = m_compiler->gtClone(lcl);
unsigned const instanceOffset = m_compiler->eeGetEEInfo()->offsetOfDelegateInstance;
GenTree* const newThisAddr =
m_compiler->gtNewOperNode(GT_ADD, TYP_I_IMPL, cloneThis,
m_compiler->gtNewIconNode(instanceOffset, TYP_I_IMPL));

// For now assume the instance is heap...
//
GenTree* const newThis = m_compiler->gtNewIndir(TYP_REF, newThisAddr);
thisArg->SetEarlyNode(newThis);

// the control target is
// [originalThis + firstTgtOffs]
//
unsigned const targetOffset = m_compiler->eeGetEEInfo()->offsetOfDelegateFirstTarget;
GenTree* const targetAddr =
m_compiler->gtNewOperNode(GT_ADD, TYP_I_IMPL, lcl,
m_compiler->gtNewIconNode(targetOffset, TYP_I_IMPL));
GenTree* const target = m_compiler->gtNewIndir(TYP_I_IMPL, targetAddr);

// Update call state -- now an indirect call to the delegate target
//
call->gtCallAddr = target;
call->gtCallType = CT_INDIRECT;
call->gtCallMoreFlags &= ~(GTF_CALL_M_DELEGATE_INV | GTF_CALL_M_WRAPPER_DELEGATE_INV);
}
}
}
}
else if (tree->OperIsIndir())
{
Expand Down
12 changes: 11 additions & 1 deletion src/runtime/src/coreclr/jit/promotiondecomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,17 @@ class DecompositionPlan
numAddrUses++;
}

if (numAddrUses > 1)
if (numAddrUses == 0)
{
GenTree* sideEffects = nullptr;
m_compiler->gtExtractSideEffList(addr, &sideEffects);

if (sideEffects != nullptr)
{
statements->AddStatement(sideEffects);
}
}
else if (numAddrUses > 1)
{
m_compiler->gtPeelOffsets(&addr, &addrBaseOffs, &addrBaseOffsFldSeq);

Expand Down
31 changes: 31 additions & 0 deletions src/runtime/src/libraries/Common/src/System/ExceptionPolyfills.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,36 @@ public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpres
[DoesNotReturn]
private static void ThrowArgumentNullException(string? paramName) =>
throw new ArgumentNullException(paramName);

extension(ObjectDisposedException)
{
public static void ThrowIf([DoesNotReturnIf(true)] bool condition, object instance)
{
if (condition)
{
ThrowObjectDisposedException(instance);
}
}

public static void ThrowIf([DoesNotReturnIf(true)] bool condition, Type type)
{
if (condition)
{
ThrowObjectDisposedException(type);
}
}
}

[DoesNotReturn]
private static void ThrowObjectDisposedException(object? instance)
{
throw new ObjectDisposedException(instance?.GetType().FullName);
}

[DoesNotReturn]
private static void ThrowObjectDisposedException(Type? type)
{
throw new ObjectDisposedException(type?.FullName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,24 @@ internal static partial class Oids
internal const string SlhDsaSha2_192f = "2.16.840.1.101.3.4.3.23";
internal const string SlhDsaSha2_256s = "2.16.840.1.101.3.4.3.24";
internal const string SlhDsaSha2_256f = "2.16.840.1.101.3.4.3.25";
internal const string SlhDsaShake_128s = "2.16.840.1.101.3.4.3.26";
internal const string SlhDsaShake_128f = "2.16.840.1.101.3.4.3.27";
internal const string SlhDsaShake_192s = "2.16.840.1.101.3.4.3.28";
internal const string SlhDsaShake_192f = "2.16.840.1.101.3.4.3.29";
internal const string SlhDsaShake_256s = "2.16.840.1.101.3.4.3.30";
internal const string SlhDsaShake_256f = "2.16.840.1.101.3.4.3.31";
internal const string SlhDsaShake128s = "2.16.840.1.101.3.4.3.26";
internal const string SlhDsaShake128f = "2.16.840.1.101.3.4.3.27";
internal const string SlhDsaShake192s = "2.16.840.1.101.3.4.3.28";
internal const string SlhDsaShake192f = "2.16.840.1.101.3.4.3.29";
internal const string SlhDsaShake256s = "2.16.840.1.101.3.4.3.30";
internal const string SlhDsaShake256f = "2.16.840.1.101.3.4.3.31";
internal const string SlhDsaSha2_128sPreHashSha256 = "2.16.840.1.101.3.4.3.35";
internal const string SlhDsaSha2_128fPreHashSha256 = "2.16.840.1.101.3.4.3.36";
internal const string SlhDsaSha2_192sPreHashSha512 = "2.16.840.1.101.3.4.3.37";
internal const string SlhDsaSha2_192fPreHashSha512 = "2.16.840.1.101.3.4.3.38";
internal const string SlhDsaSha2_256sPreHashSha512 = "2.16.840.1.101.3.4.3.39";
internal const string SlhDsaSha2_256fPreHashSha512 = "2.16.840.1.101.3.4.3.40";
internal const string SlhDsaShake_128sPreHashShake128 = "2.16.840.1.101.3.4.3.41";
internal const string SlhDsaShake_128fPreHashShake128 = "2.16.840.1.101.3.4.3.42";
internal const string SlhDsaShake_192sPreHashShake256 = "2.16.840.1.101.3.4.3.43";
internal const string SlhDsaShake_192fPreHashShake256 = "2.16.840.1.101.3.4.3.44";
internal const string SlhDsaShake_256sPreHashShake256 = "2.16.840.1.101.3.4.3.45";
internal const string SlhDsaShake_256fPreHashShake256 = "2.16.840.1.101.3.4.3.46";
internal const string SlhDsaShake128sPreHashShake128 = "2.16.840.1.101.3.4.3.41";
internal const string SlhDsaShake128fPreHashShake128 = "2.16.840.1.101.3.4.3.42";
internal const string SlhDsaShake192sPreHashShake256 = "2.16.840.1.101.3.4.3.43";
internal const string SlhDsaShake192fPreHashShake256 = "2.16.840.1.101.3.4.3.44";
internal const string SlhDsaShake256sPreHashShake256 = "2.16.840.1.101.3.4.3.45";
internal const string SlhDsaShake256fPreHashShake256 = "2.16.840.1.101.3.4.3.46";

internal const string Mgf1 = "1.2.840.113549.1.1.8";
internal const string PSpecified = "1.2.840.113549.1.1.9";
Expand Down
Loading
0