Skip to content

Commit

Permalink
Merge branch 'main' into simplify-stack-probing
Browse files Browse the repository at this point in the history
  • Loading branch information
sirntar authored Feb 20, 2025
2 parents 9ea1331 + da4f0a3 commit 9275f78
Show file tree
Hide file tree
Showing 155 changed files with 3,724 additions and 1,493 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageVersionNet7>7.0.20</PackageVersionNet7>
<PackageVersionNet6>6.0.$([MSBuild]::Add($([System.Version]::Parse('$(PackageVersionNet8)').Build),25))</PackageVersionNet6>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration>2</PreReleaseVersionIteration>
<PreReleaseVersionIteration>3</PreReleaseVersionIteration>
<!-- Enable to remove prerelease label. -->
<StabilizePackageVersion Condition="'$(StabilizePackageVersion)' == ''">false</StabilizePackageVersion>
<DotNetFinalVersionKind Condition="'$(StabilizePackageVersion)' == 'true'">release</DotNetFinalVersionKind>
Expand Down
17 changes: 1 addition & 16 deletions eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,6 @@ jobs:
scenarios:
- WasmTestOnChrome

# Library tests with full threading
- template: /eng/pipelines/common/templates/wasm-library-tests.yml
parameters:
platforms:
- browser_wasm
#- browser_wasm_win
nameSuffix: _Threading
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
extraHelixArguments: /p:WasmEnableThreads=true
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
alwaysRun: ${{ parameters.isWasmOnlyBuild }}
shouldRunSmokeOnly: onLibrariesAndIllinkChanges
scenarios:
- WasmTestOnChrome

# EAT Library tests - only run on linux
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
parameters:
Expand Down Expand Up @@ -178,6 +162,7 @@ jobs:
- browser_wasm_win
nameSuffix: MultiThreaded
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
condition: ne(variables['wasmMultiThreadedBuildOnlyNeededOnDefaultPipeline'], true)
publishArtifactsForWorkload: true
publishWBT: false

Expand Down
25 changes: 25 additions & 0 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,20 @@ extends:
scenarios:
- WasmTestOnChrome

# Library tests with full threading
- template: /eng/pipelines/common/templates/wasm-library-tests.yml
parameters:
platforms:
- browser_wasm
#- browser_wasm_win
nameSuffix: _Threading
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
extraHelixArguments: /p:WasmEnableThreads=true
alwaysRun: ${{ variables.isRollingBuild }}
shouldRunSmokeOnly: onLibrariesAndIllinkChanges
scenarios:
- WasmTestOnChrome

# EAT Library tests - only run on linux
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
parameters:
Expand Down Expand Up @@ -857,6 +871,17 @@ extends:
publishArtifactsForWorkload: true
publishWBT: true

- template: /eng/pipelines/common/templates/wasm-build-only.yml
parameters:
platforms:
- browser_wasm
- browser_wasm_win
condition: or(eq(variables.isRollingBuild, true), eq(variables.wasmSingleThreadedBuildOnlyNeededOnDefaultPipeline, true))
nameSuffix: MultiThreaded
extraBuildArgs: /p:WasmEnableThreads=true /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
publishArtifactsForWorkload: true
publishWBT: false

# Browser Wasm.Build.Tests
- template: /eng/pipelines/common/templates/browser-wasm-build-tests.yml
parameters:
Expand Down
21 changes: 0 additions & 21 deletions src/coreclr/debug/daccess/dacfn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ DacGetHostVtPtrs(void)
return S_OK;
}

const WCHAR *g_dacFrameStrings[] =
{
#define FRAME_TYPE_NAME(name) W(#name),
#include "FrameTypes.h"
#undef FRAME_TYPE_NAME
};

bool
DacExceptionFilter(Exception* ex, ClrDataAccess* access,
HRESULT* status)
Expand Down Expand Up @@ -1133,20 +1126,6 @@ DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx)
#endif // !_PREFIX_
}

PWSTR DacGetFrameNameW(TADDR frameIdentifier)
{
PWSTR pszRet = NULL;

FrameIdentifier frameId = static_cast<FrameIdentifier>(frameIdentifier);

if (!(frameId == FrameIdentifier::None || frameId >= FrameIdentifier::CountPlusOne))
{
pszRet = (PWSTR) g_dacFrameStrings[(int)frameId - 1];
}

return pszRet;
}

TADDR
DacGetTargetVtForHostVt(LPCVOID vtHost, bool throwEx)
{
Expand Down
14 changes: 11 additions & 3 deletions src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2143,19 +2143,27 @@ ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_u

SOSDacEnter();

PWSTR pszName = DacGetFrameNameW(CLRDATA_ADDRESS_TO_TADDR(vtable));
LPCSTR pszName = Frame::GetFrameTypeName((FrameIdentifier)CLRDATA_ADDRESS_TO_TADDR(vtable));
if (pszName == NULL)
{
hr = E_INVALIDARG;
}
else
{
// Turn from bytes to wide characters
unsigned int len = (unsigned int)u16_strlen(pszName);
unsigned int len = (unsigned int)strlen(pszName);

if (frameName)
{
wcsncpy_s(frameName, count, pszName, _TRUNCATE);
if (count != 0)
{
unsigned truncatedLength = min(len, count - 1);
for (unsigned i = 0; i < truncatedLength; i++)
{
frameName[i] = pszName[i];
}
frameName[truncatedLength] = '\0';
}

if (pNeeded)
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/inc/daccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ PWSTR DacInstantiateStringW(TADDR addr, ULONG32 maxChars, bool throwEx);
TADDR DacGetTargetAddrForHostAddr(LPCVOID ptr, bool throwEx);
TADDR DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx);
TADDR DacGetTargetVtForHostVt(LPCVOID vtHost, bool throwEx);
PWSTR DacGetFrameNameW(TADDR frameIdentifier);

// Report a region of memory to the debugger
bool DacEnumMemoryRegion(TADDR addr, TSIZE_T size, bool fExpectSuccess = true);
Expand Down
22 changes: 22 additions & 0 deletions src/coreclr/jit/abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,28 @@ unsigned ABIPassingInformation::CountRegsAndStackSlots() const
return numSlots;
}

//-----------------------------------------------------------------------------
// StackBytesConsumes:
// Count the amount of stack bytes consumed by this argument.
//
// Return Value:
// Bytes.
//
unsigned ABIPassingInformation::StackBytesConsumed() const
{
unsigned numBytes = 0;

for (const ABIPassingSegment& seg : Segments())
{
if (seg.IsPassedOnStack())
{
numBytes += seg.GetStackSize();
}
}

return numBytes;
}

//-----------------------------------------------------------------------------
// FromSegment:
// Create ABIPassingInformation from a single segment.
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ struct ABIPassingInformation
bool HasExactlyOneStackSegment() const;
bool IsSplitAcrossRegistersAndStack() const;
unsigned CountRegsAndStackSlots() const;
unsigned StackBytesConsumed() const;

static ABIPassingInformation FromSegment(Compiler* comp, bool passedByRef, const ABIPassingSegment& segment);
static ABIPassingInformation FromSegmentByValue(Compiler* comp, const ABIPassingSegment& segment);
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5193,8 +5193,9 @@ static GCInfo::WriteBarrierForm GetWriteBarrierForm(Compiler* comp, ValueNum vn)
{
if (funcApp.m_func == VNF_PtrToArrElem)
{
// Arrays are always on the heap
return GCInfo::WriteBarrierForm::WBF_BarrierUnchecked;
// Check whether the array is on the heap
ValueNum arrayVN = funcApp.m_args[1];
return GetWriteBarrierForm(comp, arrayVN);
}
if (funcApp.m_func == VNF_PtrToLoc)
{
Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1432,8 +1432,8 @@ bool BasicBlock::endsWithJmpMethod(Compiler* comp) const
//
bool BasicBlock::endsWithTailCallOrJmp(Compiler* comp, bool fastTailCallsOnly /*=false*/) const
{
GenTree* tailCall = nullptr;
bool tailCallsConvertibleToLoopOnly = false;
GenTreeCall* tailCall = nullptr;
bool tailCallsConvertibleToLoopOnly = false;
return endsWithJmpMethod(comp) ||
endsWithTailCall(comp, fastTailCallsOnly, tailCallsConvertibleToLoopOnly, &tailCall);
}
Expand All @@ -1454,10 +1454,10 @@ bool BasicBlock::endsWithTailCallOrJmp(Compiler* comp, bool fastTailCallsOnly /*
// Notes:
// At most one of fastTailCallsOnly and tailCallsConvertibleToLoopOnly flags can be true.
//
bool BasicBlock::endsWithTailCall(Compiler* comp,
bool fastTailCallsOnly,
bool tailCallsConvertibleToLoopOnly,
GenTree** tailCall) const
bool BasicBlock::endsWithTailCall(Compiler* comp,
bool fastTailCallsOnly,
bool tailCallsConvertibleToLoopOnly,
GenTreeCall** tailCall) const
{
assert(!fastTailCallsOnly || !tailCallsConvertibleToLoopOnly);
*tailCall = nullptr;
Expand Down Expand Up @@ -1524,7 +1524,7 @@ bool BasicBlock::endsWithTailCall(Compiler* comp,
// Return Value:
// true if the block ends with a tail call convertible to loop.
//
bool BasicBlock::endsWithTailCallConvertibleToLoop(Compiler* comp, GenTree** tailCall) const
bool BasicBlock::endsWithTailCallConvertibleToLoop(Compiler* comp, GenTreeCall** tailCall) const
{
bool fastTailCallsOnly = false;
bool tailCallsConvertibleToLoopOnly = true;
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -1766,14 +1766,14 @@ struct BasicBlock : private LIR::Range

bool endsWithJmpMethod(Compiler* comp) const;

bool endsWithTailCall(Compiler* comp,
bool fastTailCallsOnly,
bool tailCallsConvertibleToLoopOnly,
GenTree** tailCall) const;
bool endsWithTailCall(Compiler* comp,
bool fastTailCallsOnly,
bool tailCallsConvertibleToLoopOnly,
GenTreeCall** tailCall) const;

bool endsWithTailCallOrJmp(Compiler* comp, bool fastTailCallsOnly = false) const;

bool endsWithTailCallConvertibleToLoop(Compiler* comp, GenTree** tailCall) const;
bool endsWithTailCallConvertibleToLoop(Compiler* comp, GenTreeCall** tailCall) const;

// Returns the first statement in the statement list of "this" that is
// not an SSA definition (a lcl = phi(...) store).
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)

for (CallArg& arg : call->gtArgs.Args())
{
for (const ABIPassingSegment& seg : arg.NewAbiInfo.Segments())
for (const ABIPassingSegment& seg : arg.AbiInfo.Segments())
{
if (seg.IsPassedInRegister() && ((trashedByEpilog & seg.GetRegisterMask()) != 0))
{
Expand Down
23 changes: 14 additions & 9 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4582,9 +4582,10 @@ void CodeGen::genReportGenericContextArg(regNumber initReg, bool* pInitRegZeroed
#endif

// Load from the argument register only if it is not prespilled.
if (compiler->lvaIsRegArgument(contextArg) && !isPrespilledForProfiling)
const ABIPassingInformation& abiInfo = compiler->lvaGetParameterABIInfo(contextArg);
if (abiInfo.HasExactlyOneRegisterSegment() && !isPrespilledForProfiling)
{
reg = varDsc->GetArgReg();
reg = abiInfo.Segment(0).GetRegister();
}
else
{
Expand Down Expand Up @@ -6045,7 +6046,9 @@ regNumber CodeGen::getCallIndirectionCellReg(GenTreeCall* call)
if (call->GetIndirectionCellArgKind() != WellKnownArg::None)
{
CallArg* indirCellArg = call->gtArgs.FindWellKnownArg(call->GetIndirectionCellArgKind());
assert((indirCellArg != nullptr) && (indirCellArg->AbiInfo.GetRegNum() == result));
assert(indirCellArg != nullptr);
assert(indirCellArg->AbiInfo.HasExactlyOneRegisterSegment());
assert(indirCellArg->AbiInfo.Segment(0).GetRegister() == result);
}
#endif

Expand Down Expand Up @@ -6265,13 +6268,15 @@ unsigned CodeGen::getFirstArgWithStackSlot()
// that's passed on the stack.
for (unsigned i = 0; i < compiler->info.compArgsCount; i++)
{
LclVarDsc* varDsc = compiler->lvaGetDesc(i);

// We should have found a stack parameter (and broken out of this loop) before
// we find any non-parameters.
assert(varDsc->lvIsParam);
assert(compiler->lvaGetDesc(i)->lvIsParam);

const ABIPassingInformation& abiInfo = compiler->lvaGetParameterABIInfo(i);
// We do not expect to need this function in ambiguous cases.
assert(!abiInfo.IsSplitAcrossRegistersAndStack());

if (varDsc->GetArgReg() == REG_STK)
if (abiInfo.HasAnyStackSegment())
{
return i;
}
Expand Down Expand Up @@ -7499,7 +7504,7 @@ void CodeGen::genCallPlaceRegArgs(GenTreeCall* call)
// Consume all the arg regs
for (CallArg& arg : call->gtArgs.LateArgs())
{
ABIPassingInformation& abiInfo = arg.NewAbiInfo;
ABIPassingInformation& abiInfo = arg.AbiInfo;
GenTree* argNode = arg.GetLateNode();

#if FEATURE_MULTIREG_ARGS
Expand Down Expand Up @@ -7591,7 +7596,7 @@ void CodeGen::genCallPlaceRegArgs(GenTreeCall* call)
{
for (CallArg& arg : call->gtArgs.Args())
{
for (const ABIPassingSegment& seg : arg.NewAbiInfo.Segments())
for (const ABIPassingSegment& seg : arg.AbiInfo.Segments())
{
if (seg.IsPassedInRegister() && genIsValidFloatReg(seg.GetRegister()))
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6043,9 +6043,9 @@ void CodeGen::genCallInstruction(GenTreeCall* call)

for (CallArg& arg : call->gtArgs.Args())
{
for (unsigned i = 0; i < arg.NewAbiInfo.NumSegments; i++)
for (unsigned i = 0; i < arg.AbiInfo.NumSegments; i++)
{
const ABIPassingSegment& seg = arg.NewAbiInfo.Segment(i);
const ABIPassingSegment& seg = arg.AbiInfo.Segment(i);
if (seg.IsPassedInRegister() && ((trashedByEpilog & seg.GetRegisterMask()) != 0))
{
JITDUMP("Tail call node:\n");
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6082,9 +6082,9 @@ void CodeGen::genCallInstruction(GenTreeCall* call)

for (CallArg& arg : call->gtArgs.Args())
{
for (unsigned i = 0; i < arg.NewAbiInfo.NumSegments; i++)
for (unsigned i = 0; i < arg.AbiInfo.NumSegments; i++)
{
const ABIPassingSegment& seg = arg.NewAbiInfo.Segment(i);
const ABIPassingSegment& seg = arg.AbiInfo.Segment(i);
if (seg.IsPassedInRegister() && ((trashedByEpilog & seg.GetRegisterMask()) != 0))
{
JITDUMP("Tail call node:\n");
Expand Down
Loading

0 comments on commit 9275f78

Please sign in to comment.