Skip to content

Commit

Permalink
Merge dotnet/main into feature/sdk-update/9.0-previ
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed May 24, 2024
2 parents 62de123 + bbcde65 commit dc3f120
Show file tree
Hide file tree
Showing 40 changed files with 269 additions and 151 deletions.
28 changes: 12 additions & 16 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -360,17 +360,17 @@
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>c185f58a7f75bd824a3cd820634cddf27e791d91</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.11.0-2.24271.11">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.11.0-2.24273.9">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>40e6b96cad11400acb5b8999057ac8ba748df940</Sha>
<Sha>ec93266ae18214bc9b67c5d9d8e6c001b9179789</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis" Version="4.11.0-2.24271.11">
<Dependency Name="Microsoft.CodeAnalysis" Version="4.11.0-2.24273.9">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>40e6b96cad11400acb5b8999057ac8ba748df940</Sha>
<Sha>ec93266ae18214bc9b67c5d9d8e6c001b9179789</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.11.0-2.24271.11">
<Dependency Name="Microsoft.CodeAnalysis.CSharp" Version="4.11.0-2.24273.9">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>40e6b96cad11400acb5b8999057ac8ba748df940</Sha>
<Sha>ec93266ae18214bc9b67c5d9d8e6c001b9179789</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.24225.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
Expand All @@ -381,19 +381,19 @@
<Sha>8dccccec1ce3bd2fb532ec77d7e092ab9d684db7</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.11.0-2.24271.11">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.11.0-2.24273.9">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>40e6b96cad11400acb5b8999057ac8ba748df940</Sha>
<Sha>ec93266ae18214bc9b67c5d9d8e6c001b9179789</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="9.0.100-preview.5.24263.1">
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="9.0.100-preview.5.24272.19">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>190723c80d85721cdc58fd906e645c4029b947bb</Sha>
<Sha>a134a94cfb1209e4181072719d554eb232b51317</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.sdk" Version="9.0.100-preview.5.24263.1">
<Dependency Name="Microsoft.SourceBuild.Intermediate.sdk" Version="9.0.100-preview.5.24272.19">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>190723c80d85721cdc58fd906e645c4029b947bb</Sha>
<Sha>a134a94cfb1209e4181072719d554eb232b51317</Sha>
<SourceBuild RepoName="sdk" ManagedOnly="true" />
</Dependency>
<Dependency Name="optimization.windows_nt-arm64.MIBC.Runtime" Version="1.0.0-prerelease.24223.3">
Expand All @@ -410,10 +410,6 @@
<Uri>https://github.com/NuGet/NuGet.Client</Uri>
<Sha>8fef55f5a55a3b4f2c96cd1a9b5ddc51d4b927f8</Sha>
</Dependency>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.5.24253.16">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>fa261b952d702c6bd604728fcbdb58ac071a22b1</Sha>
</Dependency>
<Dependency Name="runtime.linux-arm64.Microsoft.NETCore.Runtime.Wasm.Node.Transport" Version="9.0.0-alpha.1.24175.1">
<Uri>https://github.com/dotnet/node</Uri>
<Sha>308c7d0f1fa19bd1e7b768ad13646f5206133cdb</Sha>
Expand Down
15 changes: 7 additions & 8 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure
they do not break the local dev experience.
-->
<MicrosoftCodeAnalysisCSharpVersion>4.11.0-2.24271.11</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisVersion>4.11.0-2.24271.11</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>4.11.0-2.24271.11</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCodeAnalysisCSharpVersion>4.11.0-2.24273.9</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisVersion>4.11.0-2.24273.9</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>4.11.0-2.24273.9</MicrosoftNetCompilersToolsetVersion>
</PropertyGroup>
<!--
For source generator support we need to target multiple versions of Roslyn in order to be able to run on older versions of Roslyn.
Expand Down Expand Up @@ -80,8 +80,8 @@
</PropertyGroup>
<PropertyGroup>
<StaticCsVersion>0.2.0</StaticCsVersion>
<!-- SDK dependencies -->
<MicrosoftDotNetApiCompatTaskVersion>9.0.100-preview.5.24263.1</MicrosoftDotNetApiCompatTaskVersion>
<!-- SDK dependencies (also used in wasm build tests -->
<MicrosoftDotNetApiCompatTaskVersion>9.0.100-preview.5.24272.19</MicrosoftDotNetApiCompatTaskVersion>
<!-- Arcade dependencies -->
<MicrosoftDotNetBuildTasksFeedVersion>9.0.0-beta.24272.5</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetCodeAnalysisVersion>9.0.0-beta.24272.5</MicrosoftDotNetCodeAnalysisVersion>
Expand Down Expand Up @@ -253,9 +253,8 @@
<!-- BrowserDebugProxy libs -->
<MicrosoftExtensionsLoggingVersion>3.1.7</MicrosoftExtensionsLoggingVersion>
<MicrosoftSymbolStoreVersion>1.0.406601</MicrosoftSymbolStoreVersion>
<!-- installer version, for testing workloads -->
<MicrosoftDotnetSdkInternalVersion>9.0.100-preview.5.24253.16</MicrosoftDotnetSdkInternalVersion>
<SdkVersionForWorkloadTesting>$(MicrosoftDotnetSdkInternalVersion)</SdkVersionForWorkloadTesting>
<!-- sdk version, for testing workloads -->
<SdkVersionForWorkloadTesting>$(MicrosoftDotNetApiCompatTaskVersion)</SdkVersionForWorkloadTesting>
<runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion>9.0.0-alpha.1.24175.1</runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion>
<EmsdkPackageVersion>$(MicrosoftNETRuntimeEmscriptenVersion)</EmsdkPackageVersion>
<NodePackageVersion>$(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion)</NodePackageVersion>
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/lsra.h
Original file line number Diff line number Diff line change
Expand Up @@ -2014,11 +2014,11 @@ class LinearScan : public LinearScanInterface
void BuildDefs(GenTree* tree, int dstCount, regMaskTP dstCandidates = RBM_NONE);
void BuildCallDefs(GenTree* tree, int dstCount, regMaskTP dstCandidates);
void BuildKills(GenTree* tree, regMaskTP killMask);
#if defined(TARGET_ARMARCH) || defined(TARGET_RISCV64)
#if defined(TARGET_ARMARCH) || defined(TARGET_RISCV64) || defined(TARGET_LOONGARCH64)
void BuildDefWithKills(GenTree* tree, regMaskTP dstCandidates, regMaskTP killMask);
#else
void BuildDefWithKills(GenTree* tree, int dstCount, regMaskTP dstCandidates, regMaskTP killMask);
#endif // TARGET_ARMARCH || TARGET_RISCV64
#endif // TARGET_ARMARCH || TARGET_RISCV64 || TARGET_LOONGARCH64
void BuildCallDefsWithKills(GenTree* tree, int dstCount, regMaskTP dstCandidates, regMaskTP killMask);

int BuildReturn(GenTree* tree);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/lsrabuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3240,7 +3240,7 @@ void LinearScan::BuildKills(GenTree* tree, regMaskTP killMask)
}
}

#if defined(TARGET_ARMARCH) || defined(TARGET_RISCV64)
#if defined(TARGET_ARMARCH) || defined(TARGET_RISCV64) || defined(TARGET_LOONGARCH64)

//------------------------------------------------------------------------
// BuildDefWithKills: Build one RefTypeDef RefPositions for the given node,
Expand Down
64 changes: 40 additions & 24 deletions src/coreclr/jit/lsraloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ int LinearScan::BuildNode(GenTree* tree)
srcCount = 0;
assert(dstCount == 0);
killMask = getKillSetForProfilerHook();
BuildDefsWithKills(tree, 0, RBM_NONE, killMask);
BuildKills(tree, killMask);
break;

case GT_START_PREEMPTGC:
// This kills GC refs in callee save regs
srcCount = 0;
assert(dstCount == 0);
BuildDefsWithKills(tree, 0, RBM_NONE, RBM_NONE);
BuildKills(tree, RBM_NONE);
break;

case GT_CNS_DBL:
Expand Down Expand Up @@ -170,7 +170,7 @@ int LinearScan::BuildNode(GenTree* tree)
case GT_RETURN:
srcCount = BuildReturn(tree);
killMask = getKillSetForReturn();
BuildDefsWithKills(tree, 0, RBM_NONE, killMask);
BuildKills(tree, killMask);
break;

case GT_RETFILT:
Expand Down Expand Up @@ -267,7 +267,7 @@ int LinearScan::BuildNode(GenTree* tree)
srcCount = 1;
assert(dstCount == 0);
killMask = compiler->compHelperCallKillSet(CORINFO_HELP_STOP_FOR_GC);
BuildDefsWithKills(tree, 0, RBM_NONE, killMask);
BuildKills(tree, killMask);
break;

case GT_MUL:
Expand Down Expand Up @@ -679,9 +679,9 @@ int LinearScan::BuildIndir(GenTreeIndir* indirTree)
//
int LinearScan::BuildCall(GenTreeCall* call)
{
bool hasMultiRegRetVal = false;
const ReturnTypeDesc* retTypeDesc = nullptr;
regMaskTP dstCandidates = RBM_NONE;
bool hasMultiRegRetVal = false;
const ReturnTypeDesc* retTypeDesc = nullptr;
regMaskTP singleDstCandidates = RBM_NONE;

int srcCount = 0;
int dstCount = 0;
Expand Down Expand Up @@ -745,22 +745,20 @@ int LinearScan::BuildCall(GenTreeCall* call)

// Set destination candidates for return value of the call.

if (hasMultiRegRetVal)
if (!hasMultiRegRetVal)
{
assert(retTypeDesc != nullptr);
dstCandidates = retTypeDesc->GetABIReturnRegs(call->GetUnmanagedCallConv());
}
else if (varTypeUsesFloatArgReg(registerType))
{
dstCandidates = RBM_FLOATRET;
}
else if (registerType == TYP_LONG)
{
dstCandidates = RBM_LNGRET;
}
else
{
dstCandidates = RBM_INTRET;
if (varTypeUsesFloatArgReg(registerType))
{
singleDstCandidates = RBM_FLOATRET;
}
else if (registerType == TYP_LONG)
{
singleDstCandidates = RBM_LNGRET;
}
else
{
singleDstCandidates = RBM_INTRET;
}
}

// First, count reg args
Expand Down Expand Up @@ -872,7 +870,25 @@ int LinearScan::BuildCall(GenTreeCall* call)

// Now generate defs and kills.
regMaskTP killMask = getKillSetForCall(call);
BuildDefsWithKills(call, dstCount, dstCandidates, killMask);
if (dstCount > 0)
{
if (hasMultiRegRetVal)
{
assert(retTypeDesc != nullptr);
regMaskTP multiDstCandidates = retTypeDesc->GetABIReturnRegs(call->GetUnmanagedCallConv());
assert(genCountBits(multiDstCandidates) > 0);
BuildCallDefsWithKills(call, dstCount, multiDstCandidates, killMask);
}
else
{
assert(dstCount == 1);
BuildDefWithKills(call, singleDstCandidates, killMask);
}
}
else
{
BuildKills(call, killMask);
}

// No args are placed in registers anymore.
placedArgRegs = RBM_NONE;
Expand Down Expand Up @@ -1189,7 +1205,7 @@ int LinearScan::BuildBlockStore(GenTreeBlk* blkNode)

buildInternalRegisterUses();
regMaskTP killMask = getKillSetForBlockStore(blkNode);
BuildDefsWithKills(blkNode, 0, RBM_NONE, killMask);
BuildKills(blkNode, killMask);
return useCount;
}

Expand Down
9 changes: 2 additions & 7 deletions src/coreclr/jit/regset.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,8 @@ class RegSet
bool rsModifiedRegsMaskInitialized; // Has rsModifiedRegsMask been initialized? Guards against illegal use.
#endif // DEBUG

#ifdef SWIFT_SUPPORT
regMaskTP rsAllCalleeSavedMask;
regMaskTP rsIntCalleeSavedMask;
#else // !SWIFT_SUPPORT
static constexpr regMaskTP rsAllCalleeSavedMask = RBM_CALLEE_SAVED;
static constexpr regMaskTP rsIntCalleeSavedMask = RBM_INT_CALLEE_SAVED;
#endif // !SWIFT_SUPPORT
regMaskTP rsAllCalleeSavedMask = RBM_CALLEE_SAVED;
regMaskTP rsIntCalleeSavedMask = RBM_INT_CALLEE_SAVED;

public:
regMaskTP rsGetModifiedRegsMask() const
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/minipal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include_directories(.)
include_directories(${CLR_SRC_NATIVE_DIR})
if (CLR_CMAKE_HOST_UNIX)
add_subdirectory(Unix)
else (CLR_CMAKE_HOST_UNIX)
Expand Down
33 changes: 10 additions & 23 deletions src/coreclr/minipal/Unix/doublemapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,13 @@
#define memfd_create(...) syscall(__NR_memfd_create, __VA_ARGS__)
#endif // TARGET_LINUX && !MFD_CLOEXEC
#include "minipal.h"
#include "minipal/cpufeatures.h"

#if defined(TARGET_OSX) && defined(TARGET_AMD64)
#include <mach/mach.h>
#include <sys/sysctl.h>
#ifdef TARGET_OSX

bool IsProcessTranslated()
{
int ret = 0;
size_t size = sizeof(ret);
if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == -1)
{
return false;
}
return ret == 1;
}
#endif // TARGET_OSX && TARGET_AMD64
#include <mach/mach.h>

#ifndef TARGET_OSX
#else // TARGET_OSX

#ifdef TARGET_64BIT
static const off_t MaxDoubleMappedSize = 2048ULL*1024*1024*1024;
Expand All @@ -49,6 +38,12 @@ static const off_t MaxDoubleMappedSize = UINT_MAX;

bool VMToOSInterface::CreateDoubleMemoryMapper(void** pHandle, size_t *pMaxExecutableCodeSize)
{
if (minipal_detect_rosetta())
{
// Rosetta doesn't support double mapping correctly
return false;
}

#ifndef TARGET_OSX

#ifdef TARGET_FREEBSD
Expand Down Expand Up @@ -78,14 +73,6 @@ bool VMToOSInterface::CreateDoubleMemoryMapper(void** pHandle, size_t *pMaxExecu
*pHandle = (void*)(size_t)fd;
#else // !TARGET_OSX

#ifdef TARGET_AMD64
if (IsProcessTranslated())
{
// Rosetta doesn't support double mapping correctly
return false;
}
#endif // TARGET_AMD64

*pMaxExecutableCodeSize = SIZE_MAX;
*pHandle = NULL;
#endif // !TARGET_OSX
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/minipal/Windows/doublemapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <inttypes.h>
#include <assert.h>
#include "minipal.h"
#include "minipal/cpufeatures.h"

#define HIDWORD(_qw) ((ULONG)((_qw) >> 32))
#define LODWORD(_qw) ((ULONG)(_qw))
Expand Down Expand Up @@ -60,6 +61,12 @@ inline void *GetBotMemoryAddress(void)

bool VMToOSInterface::CreateDoubleMemoryMapper(void **pHandle, size_t *pMaxExecutableCodeSize)
{
if (minipal_detect_rosetta())
{
// Rosetta doesn't support double mapping correctly. WINE on macOS ARM64 can be running under Rosetta.
return false;
}

*pMaxExecutableCodeSize = (size_t)MaxDoubleMappedSize;
*pHandle = CreateFileMapping(
INVALID_HANDLE_VALUE, // use paging file
Expand Down
15 changes: 10 additions & 5 deletions src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,9 @@ private void ImportFieldAccess(int token, bool isStatic, bool? write, string rea
var field = (FieldDesc)_methodIL.GetObject(token);
var canonField = (FieldDesc)_canonMethodIL.GetObject(token);

if (field.IsLiteral)
ThrowHelper.ThrowMissingFieldException(field.OwningType, field.Name);

_compilation.NodeFactory.MetadataManager.GetDependenciesDueToAccess(ref _dependencies, _compilation.NodeFactory, _canonMethodIL, canonField);

// `write` will be null for ld(s)flda. Consider address loads write unless they were
Expand Down Expand Up @@ -1012,20 +1015,21 @@ private void ImportFieldAccess(int token, bool isStatic, bool? write, string rea
if (field.IsLiteral)
ThrowHelper.ThrowMissingFieldException(field.OwningType, field.Name);

ReadyToRunHelperId helperId;
if (field.HasRva)
{
// We don't care about field RVA data for the usual cases, but if this is one of the
// magic fields the compiler synthetized, the data blob might bring more dependencies
// and we need to scan those.
_dependencies.Add(_compilation.GetFieldRvaData(field), reason);
// RVA static fields in generic types not implemented
Debug.Assert(!field.OwningType.HasInstantiation);
if (_compilation.HasLazyStaticConstructor(field.OwningType))
_dependencies.Add(_factory.TypeNonGCStaticsSymbol((MetadataType)field.OwningType), "Cctor context");
if (_compilation.HasLazyStaticConstructor(canonField.OwningType))
{
helperId = ReadyToRunHelperId.GetNonGCStaticBase;
goto addBase;
}
return;
}

ReadyToRunHelperId helperId;
if (field.IsThreadStatic)
{
helperId = ReadyToRunHelperId.GetThreadStaticBase;
Expand All @@ -1039,6 +1043,7 @@ private void ImportFieldAccess(int token, bool isStatic, bool? write, string rea
helperId = ReadyToRunHelperId.GetNonGCStaticBase;
}

addBase:
TypeDesc owningType = field.OwningType;
if (owningType.IsRuntimeDeterminedSubtype)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public ModuleDesc ResolveModuleID(long handle, bool throwIfNotFound = true)
return null;
}

minfo.Module = _context.ResolveAssembly(new AssemblyNameInfo(minfo.AssemblyName), throwIfNotFound);
minfo.Module = _context.ResolveAssembly(AssemblyNameInfo.Parse(minfo.AssemblyName), throwIfNotFound);
return minfo.Module;
}
else
Expand Down
Loading

0 comments on commit dc3f120

Please sign in to comment.