Skip to content

Commit

Permalink
Merge remote-tracking branch 'dotnet/main' into avx512-2
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Apr 18, 2023
2 parents b4d9a35 + 327c536 commit 55adfca
Show file tree
Hide file tree
Showing 237 changed files with 1,754 additions and 234 deletions.
11 changes: 10 additions & 1 deletion docs/design/features/hybrid-globalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ Hybrid mode does not use ICU data for some functions connected with globalizatio

### WASM

For WebAssembly in Browser we are using Web API instead of some ICU data.
For WebAssembly in Browser we are using Web API instead of some ICU data. Ideally, we would use `System.Runtime.InteropServices.JavaScript` to call JS code from inside of C# but we cannot reference any assemblies from inside of `System.Private.CoreLib`. That is why we are using iCalls instead.

**SortKey**

Affected public APIs:
- CompareInfo.GetSortKey
- CompareInfo.GetSortKeyLength
- CompareInfo.GetHashCode

Web API does not have an equivalent, so they throw `PlatformNotSupportedException`.

**Case change**

Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>d7a4cad21c39e18f3d5e1f7fa7dd3f93668066b4</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.3.5-beta1.23207.2">
<Dependency Name="Microsoft.CodeAnalysis.Analyzers" Version="3.3.5-beta1.23213.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>ccd85bc350c9a994b74642f3b7613d8a98f5be2d</Sha>
<Sha>432aaef704712d79d436a79fafddbd1e9c4409ea</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23207.2">
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23213.1">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>ccd85bc350c9a994b74642f3b7613d8a98f5be2d</Sha>
<Sha>432aaef704712d79d436a79fafddbd1e9c4409ea</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="8.0.100-preview.2.23107.1">
<Uri>https://github.com/dotnet/sdk</Uri>
Expand Down
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</ItemGroup>
<PropertyGroup>
<!-- dotnet/roslyn-analyzers dependencies -->
<MicrosoftCodeAnalysisAnalyzersVersion>3.3.5-beta1.23207.2</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23207.2</MicrosoftCodeAnalysisNetAnalyzersVersion>
<MicrosoftCodeAnalysisAnalyzersVersion>3.3.5-beta1.23213.1</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23213.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<!-- dotnet/roslyn dependencies -->
<!--
These versions should not be used by any project that contributes to the design-time experience in VS, such as an analyzer, code-fix, or generator assembly.
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ extends:
extraStepsTemplate: /eng/pipelines/coreclr/nativeaot-post-build-steps.yml
extraStepsParameters:
creator: dotnet-bot
testBuildArgs: nativeaot tree nativeaot /p:BuildNativeAotFrameworkObjects=true
testBuildArgs: 'nativeaot tree ";nativeaot;Loader;Interop;" /p:BuildNativeAotFrameworkObjects=true'
liveLibrariesBuildConfig: Release
testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
extraVariablesTemplates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,6 @@ public static extern int ExitCode
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void FailFast(string? message, Exception? exception, string? errorMessage);

private static string[]? s_commandLineArgs;

public static string[] GetCommandLineArgs()
{
// There are multiple entry points to a hosted app. The host could
// use ::ExecuteAssembly() or ::CreateDelegate option:
//
// ::ExecuteAssembly() -> In this particular case, the runtime invokes the main
// method based on the arguments set by the host, and we return those arguments
//
// ::CreateDelegate() -> In this particular case, the host is asked to create a
// delegate based on the appDomain, assembly and methodDesc passed to it.
// which the caller uses to invoke the method. In this particular case we do not have
// any information on what arguments would be passed to the delegate.
// So our best bet is to simply use the commandLine that was used to invoke the process.
// in case it is present.

return s_commandLineArgs != null ?
(string[])s_commandLineArgs.Clone() :
GetCommandLineArgsNative();
}

private static unsafe string[] InitializeCommandLineArgs(char* exePath, int argc, char** argv) // invoked from VM
{
string[] commandLineArgs = new string[argc + 1];
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/crossgen-corelib.proj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<CrossDir Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)'">$(BuildArchitecture)</CrossDir>

<BuildDll>true</BuildDll>
<BuildDll Condition="'$(TargetArchitecture)' == 'riscv64'">false</BuildDll>

<BuildPdb>false</BuildPdb>
<BuildPdb Condition="$(BuildDll) and '$(OS)' == 'Windows_NT' and '$(TargetOS)' == 'windows'">true</BuildPdb>
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/debug/di/loongarch64/cordbregisterset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,14 @@ void CordbRegisterSet::InternalCopyRDToContext(DT_CONTEXT *pInputContext)
*pDest++ = *pSrc++;
}

pInputContext->TP = m_rd->TP;
pInputContext->RA = m_rd->RA;
pInputContext->Tp = m_rd->TP;
pInputContext->Ra = m_rd->RA;
}

if ((pInputContext->ContextFlags & DT_CONTEXT_CONTROL) == DT_CONTEXT_CONTROL)
{
pInputContext->SP = m_rd->SP;
pInputContext->PC = m_rd->PC;
pInputContext->FP = m_rd->FP;
pInputContext->Sp = m_rd->SP;
pInputContext->Pc = m_rd->PC;
pInputContext->Fp = m_rd->FP;
}
}
13 changes: 7 additions & 6 deletions src/coreclr/debug/inc/dbgtargetcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ static_assert(sizeof(DT_CONTEXT) == sizeof(T_CONTEXT), "DT_CONTEXT size must equ
#define DT_LOONGARCH64_MAX_BREAKPOINTS 8
#define DT_LOONGARCH64_MAX_WATCHPOINTS 2

typedef DECLSPEC_ALIGN(16) struct {
typedef struct DECLSPEC_ALIGN(16) {
//
// Control flags.
//
Expand All @@ -498,9 +498,9 @@ typedef DECLSPEC_ALIGN(16) struct {
// Integer registers
//
DWORD64 R0;
DWORD64 RA;
DWORD64 TP;
DWORD64 SP;
DWORD64 Ra;
DWORD64 Tp;
DWORD64 Sp;
DWORD64 A0;
DWORD64 A1;
DWORD64 A2;
Expand All @@ -519,7 +519,7 @@ typedef DECLSPEC_ALIGN(16) struct {
DWORD64 T7;
DWORD64 T8;
DWORD64 X0;
DWORD64 FP;
DWORD64 Fp;
DWORD64 S0;
DWORD64 S1;
DWORD64 S2;
Expand All @@ -529,12 +529,13 @@ typedef DECLSPEC_ALIGN(16) struct {
DWORD64 S6;
DWORD64 S7;
DWORD64 S8;
DWORD64 PC;
DWORD64 Pc;

//
// Floating Point Registers
//
ULONGLONG F[32];
DWORD Fcsr;
} DT_CONTEXT;

static_assert(sizeof(DT_CONTEXT) == sizeof(T_CONTEXT), "DT_CONTEXT size must equal the T_CONTEXT size");
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/debug/inc/loongarch64/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,31 @@ constexpr CorDebugRegister g_JITToCorDbgReg[] =
inline void CORDbgSetIP(DT_CONTEXT *context, LPVOID ip) {
LIMITED_METHOD_CONTRACT;

context->PC = (DWORD64)ip;
context->Pc = (DWORD64)ip;
}

inline LPVOID CORDbgGetSP(const DT_CONTEXT * context) {
LIMITED_METHOD_CONTRACT;

return (LPVOID)(size_t)(context->SP);
return (LPVOID)(size_t)(context->Sp);
}

inline void CORDbgSetSP(DT_CONTEXT *context, LPVOID esp) {
LIMITED_METHOD_CONTRACT;

context->SP = (DWORD64)esp;
context->Sp = (DWORD64)esp;
}

inline LPVOID CORDbgGetFP(const DT_CONTEXT * context) {
LIMITED_METHOD_CONTRACT;

return (LPVOID)(size_t)(context->FP);
return (LPVOID)(size_t)(context->Fp);
}

inline void CORDbgSetFP(DT_CONTEXT *context, LPVOID fp) {
LIMITED_METHOD_CONTRACT;

context->FP = (DWORD64)fp;
context->Fp = (DWORD64)fp;
}


Expand All @@ -119,9 +119,9 @@ inline BOOL CompareControlRegisters(const DT_CONTEXT * pCtx1, const DT_CONTEXT *

// TODO-LoongArch64: Sort out frame registers

if ((pCtx1->PC == pCtx2->PC) &&
(pCtx1->SP == pCtx2->SP) &&
(pCtx1->FP == pCtx2->FP))
if ((pCtx1->Pc == pCtx2->Pc) &&
(pCtx1->Sp == pCtx2->Sp) &&
(pCtx1->Fp == pCtx2->Fp))
{
return TRUE;
}
Expand Down Expand Up @@ -166,7 +166,7 @@ inline LPVOID CORDbgGetIP(DT_CONTEXT *context)
{
LIMITED_METHOD_CONTRACT;

return (LPVOID)(size_t)(context->PC);
return (LPVOID)(size_t)(context->Pc);
}

inline void CORDbgSetInstructionExImpl(CORDB_ADDRESS_TYPE* address,
Expand Down
27 changes: 14 additions & 13 deletions src/coreclr/debug/shared/loongarch64/primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,38 @@ void CORDbgCopyThreadContext(DT_CONTEXT* pDst, const DT_CONTEXT* pSrc)
{
LOG((LF_CORDB, LL_INFO1000000,
"CP::CTC: RA: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
pDst->RA, pSrc->RA, DT_CONTEXT_CONTROL));
pDst->RA = pSrc->RA;
pDst->Ra, pSrc->Ra, DT_CONTEXT_CONTROL));
pDst->Ra = pSrc->Ra;

LOG((LF_CORDB, LL_INFO1000000,
"CP::CTC: SP: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
pDst->SP, pSrc->SP, DT_CONTEXT_CONTROL));
pDst->SP = pSrc->SP;
pDst->Sp, pSrc->Sp, DT_CONTEXT_CONTROL));
pDst->Sp = pSrc->Sp;

LOG((LF_CORDB, LL_INFO1000000,
"CP::CTC: FP: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
pDst->FP, pSrc->FP, DT_CONTEXT_CONTROL));
pDst->FP = pSrc->FP;
pDst->Fp, pSrc->Fp, DT_CONTEXT_CONTROL));
pDst->Fp = pSrc->Fp;

LOG((LF_CORDB, LL_INFO1000000,
"CP::CTC: PC: pDst=0x%lx, pSrc=0x%lx, Flags=0x%x\n",
pDst->PC, pSrc->PC, DT_CONTEXT_CONTROL));
pDst->PC = pSrc->PC;
pDst->Pc, pSrc->Pc, DT_CONTEXT_CONTROL));
pDst->Pc = pSrc->Pc;
}

if ((dstFlags & srcFlags & DT_CONTEXT_INTEGER) == DT_CONTEXT_INTEGER)
{
CopyContextChunk(&pDst->A0, &pSrc->A0, &pDst->FP,
CopyContextChunk(&pDst->A0, &pSrc->A0, &pDst->Fp,
DT_CONTEXT_INTEGER);
CopyContextChunk(&pDst->S0, &pSrc->S0, &pDst->PC,
CopyContextChunk(&pDst->S0, &pSrc->S0, &pDst->Pc,
DT_CONTEXT_INTEGER);
}

if ((dstFlags & srcFlags & DT_CONTEXT_FLOATING_POINT) == DT_CONTEXT_FLOATING_POINT)
{
CopyContextChunk(&pDst->F[0], &pSrc->F[0], &pDst->F[32],
DT_CONTEXT_FLOATING_POINT);
pDst->Fcsr = pSrc->Fcsr;
}
}

Expand All @@ -76,13 +77,13 @@ void SetDebuggerREGDISPLAYFromREGDISPLAY(DebuggerREGDISPLAY* pDRD, REGDISPLAY* p
if ((flags & DT_CONTEXT_CONTROL) == DT_CONTEXT_CONTROL)
{
pDRD->FP = (SIZE_T)CORDbgGetFP(pContext);
pDRD->PC = (SIZE_T)pContext->PC;
pDRD->RA = (SIZE_T)pContext->RA;
pDRD->PC = (SIZE_T)pContext->Pc;
pDRD->RA = (SIZE_T)pContext->Ra;
}

if ((flags & DT_CONTEXT_INTEGER) == DT_CONTEXT_INTEGER)
{
pDRD->TP = pContext->TP;
pDRD->TP = pContext->Tp;
memcpy(&pDRD->A0, &pContext->A0, sizeof(pDRD->A0)*(21 - 4 + 1));
memcpy(&pDRD->S0, &pContext->S0, sizeof(pDRD->S0)* 9);
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/hwintrinsiclistxarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
8) Each intrinsic has one category with type of `enum HWIntrinsicCategory`, please see the definition of HWIntrinsicCategory for details
9) Each intrinsic has one or more flags with type of `enum HWIntrinsicFlag`
*/

// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// ISA Function name SIMD size NumArg Instructions Category Flags
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
// Vector128 Intrinsics

HARDWARE_INTRINSIC(Vector128, Abs, 16, 1, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_Helper, HW_Flag_SpecialImport|HW_Flag_NoCodeGen)
HARDWARE_INTRINSIC(Vector128, Add, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_Helper, HW_Flag_SpecialImport|HW_Flag_NoCodeGen)
HARDWARE_INTRINSIC(Vector128, AndNot, 16, 2, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_Helper, HW_Flag_SpecialImport|HW_Flag_NoCodeGen)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal static unsafe void InitializeCommandLineArgsW(int argc, char** argv)
{
args[i] = new string(argv[i]);
}
Environment.SetCommandLineArgs(args);
Environment.s_commandLineArgs = args;
}

internal static unsafe void InitializeCommandLineArgs(int argc, sbyte** argv)
Expand All @@ -36,14 +36,16 @@ internal static unsafe void InitializeCommandLineArgs(int argc, sbyte** argv)
{
args[i] = new string(argv[i]);
}
Environment.SetCommandLineArgs(args);
Environment.s_commandLineArgs = args;
}

private static string[] GetMainMethodArguments()
{
// GetCommandLineArgs includes the executable name, Main() arguments do not.
string[] args = Environment.GetCommandLineArgs();
// Environment.s_commandLineArgs includes the executable name, Main() arguments do not.
string[]? args = Environment.s_commandLineArgs;

// Environment.s_commandLineArgs is expected to initialized during startup.
Debug.Assert(args != null);
Debug.Assert(args.Length > 0);

string[] mainArgs = new string[args.Length - 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,5 @@ internal static void ShutdownCore()
}

public static int TickCount => (int)TickCount64;

private static string[]? s_commandLineArgs;

public static string[] GetCommandLineArgs()
{
Debug.Assert(s_commandLineArgs != null, "VM did not properly setup application.");
return (string[])s_commandLineArgs.Clone();
}

internal static void SetCommandLineArgs(string[] cmdLineArgs)
{
s_commandLineArgs = cmdLineArgs;
}
}
}
3 changes: 2 additions & 1 deletion src/coreclr/tools/Common/TypeSystem/Common/MethodDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum EmbeddedSignatureDataKind
{
RequiredCustomModifier = 0,
OptionalCustomModifier = 1,
ArrayShape = 2
ArrayShape = 2,
UnmanagedCallConv = 3,
}

public struct EmbeddedSignatureData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ protected override FunctionPointerType CreateValueFromKey(MethodSignature key)

public FunctionPointerType GetFunctionPointerType(MethodSignature signature)
{
// The type system only distinguishes between unmanaged and managed signatures.
// The caller should have normalized the signature by modifying flags and stripping modopts.
Debug.Assert((signature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask) is 0 or MethodSignatureFlags.UnmanagedCallingConvention);
Debug.Assert(!signature.HasEmbeddedSignatureData);
return _functionPointerTypes.GetOrCreateValue(signature);
}

Expand Down
14 changes: 13 additions & 1 deletion src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,19 @@ private MethodSignature ParseMethodSignatureImpl(bool skipEmbeddedSignatureData)
Debug.Assert((int)MethodSignatureFlags.CallingConventionVarargs == (int)SignatureCallingConvention.VarArgs);
Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConvention == (int)SignatureCallingConvention.Unmanaged);

flags = (MethodSignatureFlags)signatureCallConv;
// If skipEmbeddedSignatureData is true, we're building the signature for the purposes of building a type.
// We normalize unmanaged calling convention into a single value - "unmanaged".
if (skipEmbeddedSignatureData)
{
flags = MethodSignatureFlags.UnmanagedCallingConvention;

// But we still need to remember this signature is different, so add this to the EmbeddedSignatureData of the owner signature.
_embeddedSignatureDataList?.Add(new EmbeddedSignatureData { index = string.Join(".", _indexStack) + "|" + ((int)signatureCallConv).ToString(), kind = EmbeddedSignatureDataKind.UnmanagedCallConv, type = null });
}
else
{
flags = (MethodSignatureFlags)signatureCallConv;
}
}

if (!header.IsInstance)
Expand Down
Loading

0 comments on commit 55adfca

Please sign in to comment.