Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARM64</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'loongarch64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_LOONGARCH64</DefineConstants>
</PropertyGroup>

<!-- Configuration specific properties -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3638,6 +3638,14 @@
"any",
"base"
],
"linux-loongarch64": [
"linux-loongarch64",
"linux",
"unix-loongarch64",
"unix",
"any",
"base"
],
"linux-mips64": [
"linux-mips64",
"linux",
Expand Down Expand Up @@ -8100,6 +8108,12 @@
"any",
"base"
],
"unix-loongarch64": [
"unix-loongarch64",
"unix",
"any",
"base"
],
"unix-mips64": [
"unix-mips64",
"unix",
Expand Down Expand Up @@ -8754,4 +8768,4 @@
"any",
"base"
]
}
}
13 changes: 12 additions & 1 deletion src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,12 @@
"unix-armel"
]
},
"linux-loongarch64": {
"#import": [
"linux",
"unix-loongarch64"
]
},
"linux-mips64": {
"#import": [
"linux",
Expand Down Expand Up @@ -3399,6 +3405,11 @@
"unix"
]
},
"unix-loongarch64": {
"#import": [
"unix"
]
},
"unix-mips64": {
"#import": [
"unix"
Expand Down Expand Up @@ -3743,4 +3754,4 @@
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<ItemGroup>
<RuntimeGroup Include="unix">
<Parent>any</Parent>
<Architectures>x64;x86;arm;armel;arm64;mips64;s390x</Architectures>
<Architectures>x64;x86;arm;armel;arm64;loongarch64;mips64;s390x</Architectures>
</RuntimeGroup>
<RuntimeGroup Include="linux">
<Parent>unix</Parent>
<Architectures>x64;x86;arm;armel;arm64;mips64;s390x</Architectures>
<Architectures>x64;x86;arm;armel;arm64;loongarch64;mips64;s390x</Architectures>
</RuntimeGroup>
<RuntimeGroup Include="linux-musl">
<Parent>linux</Parent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Internal
internal static class PaddingHelpers
{
/// <summary>A size greater than or equal to the size of the most common CPU cache lines.</summary>
#if TARGET_ARM64
#if TARGET_ARM64 || TARGET_LOONGARCH64
internal const int CACHE_LINE_SIZE = 128;
#else
internal const int CACHE_LINE_SIZE = 64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x64' or ('$(Platform)' == 'x86' and '$(TargetsUnix)' != 'true')">true</SupportsX86Intrinsics>
<ILLinkSharedDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkSharedDirectory>
<IsBigEndian Condition="'$(Platform)' == 's390x'">true</IsBigEndian>
<Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x'">true</Is64Bit>
<Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x' or '$(Platform)' == 'loongarch64'">true</Is64Bit>
<UseMinimalGlobalizationData Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsBrowser)' == 'true'">true</UseMinimalGlobalizationData>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace System
{
public static partial class Buffer
{
#if TARGET_ARM64
#if TARGET_ARM64 || TARGET_LOONGARCH64
// Managed code is currently faster than glibc unoptimized memmove
// TODO-ARM64-UNIX-OPT revisit when glibc optimized memmove is in Linux distros
// https://github.com/dotnet/runtime/issues/8897
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Private.CoreLib/src/System/Buffer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if TARGET_AMD64 || TARGET_ARM64 || (TARGET_32BIT && !TARGET_ARM)
#if TARGET_AMD64 || TARGET_ARM64 || (TARGET_32BIT && !TARGET_ARM) || TARGET_LOONGARCH64
#define HAS_CUSTOM_BLOCKS
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public enum Architecture
Arm,
Arm64,
Wasm,
S390x
S390x,
LoongArch64
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public static Architecture ProcessArchitecture
=> Architecture.Wasm;
#elif TARGET_S390X
=> Architecture.S390x;
#elif TARGET_LOONGARCH64
=> Architecture.LoongArch64;
#else
#error Unknown Architecture
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static unsafe void ClearWithoutReferences(ref byte b, nuint byteLength)
if (byteLength == 0)
return;

#if TARGET_AMD64 || TARGET_ARM64
#if TARGET_AMD64 || TARGET_ARM64 || TARGET_LOONGARCH64
// The exact matrix on when ZeroMemory is faster than InitBlockUnaligned is very complex. The factors to consider include
// type of hardware and memory alignment. This threshold was chosen as a good balance across different configurations.
if (byteLength > 768)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal sealed partial class PortableThreadPool
private static class WorkerThread
{
private const int SemaphoreSpinCountDefaultBaseline = 70;
#if !TARGET_ARM64 && !TARGET_ARM
#if !TARGET_ARM64 && !TARGET_ARM && !TARGET_LOONGARCH64
private const int SemaphoreSpinCountDefault = SemaphoreSpinCountDefaultBaseline;
#else
// On systems with ARM processors, more spin-waiting seems to be necessary to avoid perf regressions from incurring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3271,6 +3271,8 @@ public enum Machine : ushort
Amd64 = (ushort)34404,
M32R = (ushort)36929,
Arm64 = (ushort)43620,
LoongArch32 = (ushort)25138,
LoongArch64 = (ushort)25188,
}
public partial class ManagedPEBuilder : System.Reflection.PortableExecutable.PEBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,15 @@ public enum Machine : ushort
/// ARM64
/// </summary>
Arm64 = 0xAA64,

/// <summary>
/// LOONGARCH32
/// </summary>
LoongArch32 = 0x6232,

/// <summary>
/// LOONGARCH64
/// </summary>
LoongArch64 = 0x6264,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public void VerifyArchitecture()
Assert.Equal(Architecture.S390x, processArch);
break;

case Architecture.LoongArch64:
Assert.Equal(Architecture.LoongArch64, processArch);
break;

default:
Assert.False(true, "Unexpected Architecture.");
break;
Expand Down
1 change: 1 addition & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13431,6 +13431,7 @@ public enum Architecture
Arm64 = 3,
Wasm = 4,
S390x = 5,
LoongArch64 = 6,
}
public enum CharSet
{
Expand Down
2 changes: 2 additions & 0 deletions src/native/corehost/bundle/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#if defined(TARGET_ARM64)
#define TARGET_CPU_TYPE CPU_TYPE_ARM64
#elif defined(TARGET_LOONGARCH64)
#define TARGET_CPU_TYPE CPU_TYPE_LOONGARCH64
#else
#define TARGET_CPU_TYPE CPU_TYPE_X86_64
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/native/corehost/hostmisc/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ const pal::char_t* get_arch()
return _X("arm");
#elif defined(TARGET_ARM64)
return _X("arm64");
#elif defined(TARGET_LOONGARCH64)
return _X("loongarch64");
#elif defined(TARGET_S390X)
return _X("s390x");
#else
Expand Down
2 changes: 2 additions & 0 deletions src/native/eventpipe/ep-event-source.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const ep_char8_t* _ep_arch_info = "arm32";
const ep_char8_t* _ep_arch_info = "arm64";
#elif defined(TARGET_S390X)
const ep_char8_t* _ep_arch_info = "s390x";
#elif defined(TARGET_LOONGARCH64)
const ep_char8_t* _ep_arch_info = "loongarch64";
#else
const ep_char8_t* _ep_arch_info = "Unknown";
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/native/libs/System.Native/pal_runtimeinformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ enum
ARCH_ARM,
ARCH_ARM64,
ARCH_WASM,
ARCH_S390X
ARCH_S390X,
ARCH_LOONGARCH64
};