Skip to content

Commit 2854140

Browse files
committed
Merge branch 'main' into browser_test_mt
2 parents e6a337e + 4c9db8a commit 2854140

214 files changed

Lines changed: 4628 additions & 4033 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static partial class Marshal
2121
/// <summary>
2222
/// IUnknown is {00000000-0000-0000-C000-000000000046}
2323
/// </summary>
24-
internal static Guid IID_IUnknown = new Guid(0, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
24+
internal static readonly Guid IID_IUnknown = new Guid(0, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
2525
#endif //FEATURE_COMINTEROP
2626

2727
internal static int SizeOfHelper(RuntimeType t, [MarshalAs(UnmanagedType.Bool)] bool throwIfNotMarshalable)
@@ -929,7 +929,7 @@ public static object BindToMoniker(string monikerName)
929929
ThrowExceptionForHR(MkParseDisplayName(bindctx, monikerName, out _, out IntPtr pmoniker));
930930
try
931931
{
932-
ThrowExceptionForHR(BindMoniker(pmoniker, 0, ref IID_IUnknown, out IntPtr ptr));
932+
ThrowExceptionForHR(BindMoniker(pmoniker, 0, in IID_IUnknown, out IntPtr ptr));
933933
try
934934
{
935935
return GetObjectForIUnknown(ptr);
@@ -956,7 +956,7 @@ public static object BindToMoniker(string monikerName)
956956
private static partial int MkParseDisplayName(IntPtr pbc, [MarshalAs(UnmanagedType.LPWStr)] string szUserName, out uint pchEaten, out IntPtr ppmk);
957957

958958
[LibraryImport(Interop.Libraries.Ole32)]
959-
private static partial int BindMoniker(IntPtr pmk, uint grfOpt, ref Guid iidResult, out IntPtr ppvResult);
959+
private static partial int BindMoniker(IntPtr pmk, uint grfOpt, in Guid iidResult, out IntPtr ppvResult);
960960

961961
[SupportedOSPlatform("windows")]
962962
public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak)

src/coreclr/gcdump/i386/gcdumpx86.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,10 @@ size_t GCDump::DumpGCTable(PTR_CBYTE table,
456456
/* non-ptr arg push */
457457

458458
curOffs += (val & 0x07);
459-
#ifndef UNIX_X86_ABI
460-
// For x86/Linux, non-ptr arg pushes can be reported even for EBP frames
459+
#ifndef FEATURE_EH_FUNCLETS
460+
// For funclets, non-ptr arg pushes can be reported even for EBP frames
461461
_ASSERTE(!header.ebpFrame);
462-
#endif // UNIX_X86_ABI
462+
#endif // FEATURE_EH_FUNCLETS
463463
argCnt++;
464464

465465
DumpEncoding(bp, table-bp); bp = table;

src/coreclr/interop/comwrappers.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,9 @@ HRESULT ManagedObjectWrapper::QueryInterface(
736736
return E_NOINTERFACE;
737737

738738
default:
739+
#if !defined(__clang__) || (__clang_major__ > 13) // Workaround bug in old clang
739740
_ASSERTE(false && "Unknown result value");
741+
#endif
740742
FALLTHROUGH;
741743
case TryInvokeICustomQueryInterfaceResult::FailedToInvoke:
742744
// Set the 'lacks' flag since our attempt to use ICustomQueryInterface

src/coreclr/jit/abi.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ regMaskTP ABIPassingSegment::GetRegisterMask() const
7070
// Return Value:
7171
// Offset relative to the first stack argument.
7272
//
73+
// Remarks:
74+
// On x86, where arguments are pushed in order and thus come in reverse order
75+
// in the callee, this is the offset to subtract from the top of the stack to
76+
// get the argument's address. By top of the stack is meant esp on entry + 4
77+
// for the return address + total size of stack arguments. In varargs methods
78+
// the varargs cookie contains the information required to allow the
79+
// computation of the total size of stack arguments.
80+
//
81+
// Outside x86 this is the offset to add to the first argument's address.
82+
//
7383
unsigned ABIPassingSegment::GetStackOffset() const
7484
{
7585
assert(IsPassedOnStack());
@@ -208,6 +218,18 @@ bool ABIPassingInformation::HasAnyStackSegment() const
208218
return false;
209219
}
210220

221+
//-----------------------------------------------------------------------------
222+
// HasExactlyOneRegisterSegment:
223+
// Check if this value is passed as a single register segment.
224+
//
225+
// Return Value:
226+
// True if so.
227+
//
228+
bool ABIPassingInformation::HasExactlyOneRegisterSegment() const
229+
{
230+
return (NumSegments == 1) && Segments[0].IsPassedInRegister();
231+
}
232+
211233
//-----------------------------------------------------------------------------
212234
// HasExactlyOneStackSegment:
213235
// Check if this value is passed as a single stack segment.

src/coreclr/jit/abi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ABIPassingSegment
2828
regMaskTP GetRegisterMask() const;
2929

3030
// If this segment is passed on the stack then return the particular stack
31-
// offset, relative to the first stack argument's offset.
31+
// offset, relative to the base of stack arguments.
3232
unsigned GetStackOffset() const;
3333

3434
var_types GetRegisterStoreType() const;
@@ -53,6 +53,7 @@ struct ABIPassingInformation
5353

5454
bool HasAnyRegisterSegment() const;
5555
bool HasAnyStackSegment() const;
56+
bool HasExactlyOneRegisterSegment() const;
5657
bool HasExactlyOneStackSegment() const;
5758
bool IsSplitAcrossRegistersAndStack() const;
5859

src/coreclr/jit/codegencommon.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4988,7 +4988,7 @@ void CodeGen::genHomeSwiftStructParameters(bool handleStack)
49884988
}
49894989

49904990
JITDUMP("Homing Swift parameter V%02u: ", lclNum);
4991-
const ABIPassingInformation& abiInfo = compiler->lvaParameterPassingInfo[lclNum];
4991+
const ABIPassingInformation& abiInfo = compiler->lvaGetParameterABIInfo(lclNum);
49924992
DBEXEC(VERBOSE, abiInfo.Dump());
49934993

49944994
for (unsigned i = 0; i < abiInfo.NumSegments; i++)
@@ -6520,7 +6520,8 @@ void CodeGen::genFnProlog()
65206520
noway_assert(compiler->info.compArgsCount > 0);
65216521

65226522
// MOV EAX, <VARARGS HANDLE>
6523-
GetEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_EAX, compiler->info.compArgsCount - 1, 0);
6523+
assert(compiler->lvaVarargsHandleArg == compiler->info.compArgsCount - 1);
6524+
GetEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_EAX, compiler->lvaVarargsHandleArg, 0);
65246525
regSet.verifyRegUsed(REG_EAX);
65256526

65266527
// MOV EAX, [EAX]
@@ -6529,7 +6530,7 @@ void CodeGen::genFnProlog()
65296530
// EDX might actually be holding something here. So make sure to only use EAX for this code
65306531
// sequence.
65316532

6532-
const LclVarDsc* lastArg = compiler->lvaGetDesc(compiler->info.compArgsCount - 1);
6533+
const LclVarDsc* lastArg = compiler->lvaGetDesc(compiler->lvaVarargsHandleArg);
65336534
noway_assert(!lastArg->lvRegister);
65346535
signed offset = lastArg->GetStackOffset();
65356536
assert(offset != BAD_STK_OFFS);

src/coreclr/jit/compiler.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,7 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
30313031
codeGen->setVerbose(true);
30323032
}
30333033

3034-
treesBeforeAfterMorph = (JitConfig.TreesBeforeAfterMorph() == 1);
3034+
treesBeforeAfterMorph = (JitConfig.JitDumpBeforeAfterMorph() == 1);
30353035
morphNum = 0; // Initialize the morphed-trees counting.
30363036

30373037
expensiveDebugCheckLevel = JitConfig.JitExpensiveDebugCheckLevel();
@@ -4623,6 +4623,11 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
46234623
fgFixEntryFlowForOSR();
46244624
}
46254625

4626+
// Drop back to just checking profile likelihoods.
4627+
//
4628+
activePhaseChecks &= ~PhaseChecks::CHECK_PROFILE;
4629+
activePhaseChecks |= PhaseChecks::CHECK_LIKELIHOODS;
4630+
46264631
// Enable the post-phase checks that use internal logic to decide when checking makes sense.
46274632
//
46284633
activePhaseChecks |=

src/coreclr/jit/compiler.h

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,8 +1530,9 @@ enum class PhaseChecks : unsigned int
15301530
CHECK_FG = 1 << 2, // flow graph integrity
15311531
CHECK_EH = 1 << 3, // eh table integrity
15321532
CHECK_LOOPS = 1 << 4, // loop integrity/canonicalization
1533-
CHECK_PROFILE = 1 << 5, // profile data integrity
1534-
CHECK_LINKED_LOCALS = 1 << 6, // check linked list of locals
1533+
CHECK_LIKELIHOODS = 1 << 5, // profile data likelihood integrity
1534+
CHECK_PROFILE = 1 << 6, // profile data full integrity
1535+
CHECK_LINKED_LOCALS = 1 << 7, // check linked list of locals
15351536
};
15361537

15371538
inline constexpr PhaseChecks operator ~(PhaseChecks a)
@@ -1563,6 +1564,12 @@ inline PhaseChecks& operator ^=(PhaseChecks& a, PhaseChecks b)
15631564
{
15641565
return a = (PhaseChecks)((unsigned int)a ^ (unsigned int)b);
15651566
}
1567+
1568+
inline bool hasFlag(const PhaseChecks& flagSet, const PhaseChecks& flag)
1569+
{
1570+
return ((flagSet & flag) == flag);
1571+
}
1572+
15661573
// clang-format on
15671574

15681575
// Specify which dumps should be run after each phase
@@ -4023,6 +4030,12 @@ class Compiler
40234030
return lvaGetDesc(lclVar->GetLclNum());
40244031
}
40254032

4033+
const ABIPassingInformation& lvaGetParameterABIInfo(unsigned lclNum)
4034+
{
4035+
assert(lclNum < info.compArgsCount);
4036+
return lvaParameterPassingInfo[lclNum];
4037+
}
4038+
40264039
unsigned lvaTrackedIndexToLclNum(unsigned trackedIndex)
40274040
{
40284041
assert(trackedIndex < lvaTrackedCount);
@@ -4091,18 +4104,7 @@ class Compiler
40914104
bool lvaIsOriginalThisReadOnly(); // return true if there is no place in the code
40924105
// that writes to arg0
40934106

4094-
#ifdef TARGET_X86
4095-
bool lvaIsArgAccessedViaVarArgsCookie(unsigned lclNum)
4096-
{
4097-
if (!info.compIsVarArgs)
4098-
{
4099-
return false;
4100-
}
4101-
4102-
LclVarDsc* varDsc = lvaGetDesc(lclNum);
4103-
return varDsc->lvIsParam && !varDsc->lvIsRegArg && (lclNum != lvaVarargsHandleArg);
4104-
}
4105-
#endif // TARGET_X86
4107+
bool lvaIsArgAccessedViaVarArgsCookie(unsigned lclNum);
41064108

41074109
bool lvaIsImplicitByRefLocal(unsigned lclNum) const;
41084110
bool lvaIsLocalImplicitlyAccessedByRef(unsigned lclNum) const;
@@ -6136,7 +6138,7 @@ class Compiler
61366138
void fgDebugCheckDispFlags(GenTree* tree, GenTreeFlags dispFlags, GenTreeDebugFlags debugFlags);
61376139
void fgDebugCheckFlagsHelper(GenTree* tree, GenTreeFlags actualFlags, GenTreeFlags expectedFlags);
61386140
void fgDebugCheckTryFinallyExits();
6139-
void fgDebugCheckProfileWeights();
6141+
void fgDebugCheckProfile(PhaseChecks checks = PhaseChecks::CHECK_NONE);
61406142
bool fgDebugCheckProfileWeights(ProfileChecks checks);
61416143
bool fgDebugCheckIncomingProfileData(BasicBlock* block, ProfileChecks checks);
61426144
bool fgDebugCheckOutgoingProfileData(BasicBlock* block, ProfileChecks checks);
@@ -6281,7 +6283,7 @@ class Compiler
62816283
bool fgPgoConsistent;
62826284

62836285
#ifdef DEBUG
6284-
bool fgPgoConsistentCheck;
6286+
bool fgPgoDeferredInconsistency;
62856287
#endif
62866288

62876289

@@ -8022,32 +8024,6 @@ class Compiler
80228024
Lowering* m_pLowering; // Lowering; needed to Lower IR that's added or modified after Lowering.
80238025
LinearScanInterface* m_pLinearScan; // Linear Scan allocator
80248026

8025-
/* raIsVarargsStackArg is called by raMaskStkVars and by
8026-
lvaComputeRefCounts. It identifies the special case
8027-
where a varargs function has a parameter passed on the
8028-
stack, other than the special varargs handle. Such parameters
8029-
require special treatment, because they cannot be tracked
8030-
by the GC (their offsets in the stack are not known
8031-
at compile time).
8032-
*/
8033-
8034-
bool raIsVarargsStackArg(unsigned lclNum)
8035-
{
8036-
#ifdef TARGET_X86
8037-
8038-
LclVarDsc* varDsc = lvaGetDesc(lclNum);
8039-
8040-
assert(varDsc->lvIsParam);
8041-
8042-
return (info.compIsVarArgs && !varDsc->lvIsRegArg && (lclNum != lvaVarargsHandleArg));
8043-
8044-
#else // TARGET_X86
8045-
8046-
return false;
8047-
8048-
#endif // TARGET_X86
8049-
}
8050-
80518027
/*
80528028
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
80538029
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

src/coreclr/jit/emit.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6680,11 +6680,11 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
66806680

66816681
emitFullyInt = fullyInt;
66826682
emitFullGCinfo = fullPtrMap;
6683-
6684-
#ifndef UNIX_X86_ABI
6685-
emitFullArgInfo = !emitHasFramePtr;
6683+
#if TARGET_X86
6684+
// On x86 with funclets we emit full ptr map even for EBP frames
6685+
emitFullArgInfo = comp->UsesFunclets() ? fullPtrMap : !emitHasFramePtr;
66866686
#else
6687-
emitFullArgInfo = fullPtrMap;
6687+
emitFullArgInfo = !emitHasFramePtr;
66886688
#endif
66896689

66906690
#if EMITTER_STATS

0 commit comments

Comments
 (0)