From 73800e949aed7116a38f2661406c0b20370f613c Mon Sep 17 00:00:00 2001 From: ashaurtaev Date: Fri, 12 Jan 2024 15:32:07 +0300 Subject: [PATCH] Update TODOs for RiscV64 Machine and Architecture in Crossgen2 --- src/coreclr/tools/Common/CommandLineHelpers.cs | 2 +- .../ObjectWriter/TargetExtensions.cs | 2 +- .../ILCompiler.Reflection.ReadyToRun/GCInfoTypes.cs | 10 +++++----- .../ReadyToRunReader.cs | 4 ++-- .../TransitionBlock.cs | 2 +- .../Reflection/PortableExecutable/PEHeaderBuilder.cs | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs index 9dcb7c422de5e..26d59f72d02b3 100644 --- a/src/coreclr/tools/Common/CommandLineHelpers.cs +++ b/src/coreclr/tools/Common/CommandLineHelpers.cs @@ -96,7 +96,7 @@ public static TargetArchitecture GetTargetArchitecture(string token) Architecture.Arm => TargetArchitecture.ARM, Architecture.Arm64 => TargetArchitecture.ARM64, Architecture.LoongArch64 => TargetArchitecture.LoongArch64, - (Architecture)9 => TargetArchitecture.RiscV64, /* TODO: update with Architecture.RiscV64 */ + Architecture.RiscV64 => TargetArchitecture.RiscV64, _ => throw new NotImplementedException() }; } diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/TargetExtensions.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/TargetExtensions.cs index c48c7055de953..59a0567d790f2 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/TargetExtensions.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/TargetExtensions.cs @@ -91,7 +91,7 @@ public static Machine MachineFromTarget(this TargetDetails target) return Machine.LoongArch64; case Internal.TypeSystem.TargetArchitecture.RiscV64: - return (Machine)0x5064; /* TODO: update with RiscV64 */ + return Machine.RiscV64; default: throw new NotImplementedException(target.Architecture.ToString()); diff --git a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/GCInfoTypes.cs b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/GCInfoTypes.cs index b6117dd46eff1..d3adc46240958 100644 --- a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/GCInfoTypes.cs +++ b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/GCInfoTypes.cs @@ -154,7 +154,7 @@ internal GcInfoTypes(Machine machine) STACK_BASE_REGISTER_ENCBASE = 2; NUM_REGISTERS_ENCBASE = 3; break; - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: SIZE_OF_RETURN_KIND_FAT = 4; STACK_BASE_REGISTER_ENCBASE = 2; NUM_REGISTERS_ENCBASE = 3; @@ -170,7 +170,7 @@ internal int DenormalizeCodeLength(int x) return (x << 1); case Machine.Arm64: case Machine.LoongArch64: - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: return (x << 2); } return x; @@ -186,7 +186,7 @@ internal int DenormalizeStackSlot(int x) return (x << 2); case Machine.Arm64: case Machine.LoongArch64: - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: return (x << 3); } return x; @@ -204,7 +204,7 @@ internal uint DenormalizeStackBaseRegister(uint x) return (x ^ 29); case Machine.LoongArch64: return ((x ^ 22) & 0x3); - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: return (x ^ 8); } return x; @@ -220,7 +220,7 @@ internal uint DenormalizeSizeOfStackArea(uint x) return (x << 2); case Machine.Arm64: case Machine.LoongArch64: - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: return (x << 3); } return x; diff --git a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunReader.cs b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunReader.cs index 927c9755f258b..77326d6513628 100644 --- a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunReader.cs +++ b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ReadyToRunReader.cs @@ -633,7 +633,7 @@ private unsafe void EnsureHeader() case Machine.Amd64: case Machine.Arm64: case Machine.LoongArch64: - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: _pointerSize = 8; break; @@ -1417,7 +1417,7 @@ private void EnsureImportSections() case Machine.Amd64: case Machine.Arm64: case Machine.LoongArch64: - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: entrySize = 8; break; diff --git a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/TransitionBlock.cs b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/TransitionBlock.cs index 4687f632f5d56..85d6bda61dbbf 100644 --- a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/TransitionBlock.cs +++ b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/TransitionBlock.cs @@ -34,7 +34,7 @@ public static TransitionBlock FromReader(ReadyToRunReader reader) case Machine.LoongArch64: return LoongArch64TransitionBlock.Instance; - case (Machine)0x5064: /* TODO: update with RiscV64 */ + case Machine.RiscV64: return RiscV64TransitionBlock.Instance; default: diff --git a/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEHeaderBuilder.cs b/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEHeaderBuilder.cs index b32a92677704d..f93b8bc0716de 100644 --- a/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEHeaderBuilder.cs +++ b/src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEHeaderBuilder.cs @@ -105,7 +105,7 @@ public static PEHeaderBuilder CreateLibraryHeader() return new PEHeaderBuilder(imageCharacteristics: Characteristics.ExecutableImage | Characteristics.Dll); } - internal bool Is32Bit => Machine != Machine.Amd64 && Machine != Machine.IA64 && Machine != Machine.Arm64 && Machine != (Machine)0x5064; /* TODO: update with RiscV64 */ + internal bool Is32Bit => Machine != Machine.Amd64 && Machine != Machine.IA64 && Machine != Machine.Arm64 && Machine != Machine.RiscV64; internal int ComputeSizeOfPEHeaders(int sectionCount) => PEBuilder.DosHeaderSize +