[ARMeilleure] Address dotnet-format issues (#5357)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address or silence dotnet format CA2208 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Silence CA1806 and CA1834 issues * Address dotnet format CA1401 warnings * Fix new dotnet-format issues after rebase * Address review comments * Address dotnet format CA2208 warnings properly * Fix formatting for switch expressions * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for OpCodeTable.cs * Enable formatting for a few cases again * Format if-blocks correctly * Enable formatting for a few more cases again * Fix inline comment alignment * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Adjust namespaces * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Remove unnecessary formatting exclusion * Add unsafe dotnet format changes * Change visibility of JitSupportDarwin to internal
This commit is contained in:
@@ -2,14 +2,14 @@ namespace ARMeilleure.State
|
||||
{
|
||||
enum Aarch32Mode
|
||||
{
|
||||
User = 0b10000,
|
||||
Fiq = 0b10001,
|
||||
Irq = 0b10010,
|
||||
User = 0b10000,
|
||||
Fiq = 0b10001,
|
||||
Irq = 0b10010,
|
||||
Supervisor = 0b10011,
|
||||
Monitor = 0b10110,
|
||||
Abort = 0b10111,
|
||||
Monitor = 0b10110,
|
||||
Abort = 0b10111,
|
||||
Hypervisor = 0b11010,
|
||||
Undefined = 0b11011,
|
||||
System = 0b11111
|
||||
Undefined = 0b11011,
|
||||
System = 0b11111,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ namespace ARMeilleure.State
|
||||
{
|
||||
public delegate void ExceptionCallbackNoArgs(ExecutionContext context);
|
||||
public delegate void ExceptionCallback(ExecutionContext context, ulong address, int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace ARMeilleure.State
|
||||
{
|
||||
private const int MinCountForCheck = 4000;
|
||||
|
||||
private NativeContext _nativeContext;
|
||||
private readonly NativeContext _nativeContext;
|
||||
|
||||
internal IntPtr NativeContextPtr => _nativeContext.BasePtr;
|
||||
|
||||
@@ -17,8 +17,10 @@ namespace ARMeilleure.State
|
||||
|
||||
public ulong Pc => _nativeContext.GetPc();
|
||||
|
||||
#pragma warning disable CA1822 // Mark member as static
|
||||
public uint CtrEl0 => 0x8444c004;
|
||||
public uint DczidEl0 => 0x00000004;
|
||||
#pragma warning restore CA1822
|
||||
|
||||
public ulong CntfrqEl0 => _counter.Frequency;
|
||||
public ulong CntpctEl0 => _counter.Counter;
|
||||
@@ -170,4 +172,4 @@ namespace ARMeilleure.State
|
||||
_nativeContext.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace ARMeilleure.State
|
||||
{
|
||||
Aarch32Arm = 0,
|
||||
Aarch32Thumb = 1,
|
||||
Aarch64 = 2
|
||||
Aarch64 = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace ARMeilleure.State
|
||||
Ide = 1u << 15,
|
||||
RMode0 = 1u << 22,
|
||||
RMode1 = 1u << 23,
|
||||
Fz = 1u << 24,
|
||||
Dn = 1u << 25,
|
||||
Fz = 1u << 24,
|
||||
Dn = 1u << 25,
|
||||
Ahp = 1u << 26,
|
||||
|
||||
Mask = Ahp | Dn | Fz | RMode1 | RMode0 | Ide | Ixe | Ufe | Ofe | Dze | Ioe // 0x07C09F00u
|
||||
Mask = Ahp | Dn | Fz | RMode1 | RMode0 | Ide | Ixe | Ufe | Ofe | Dze | Ioe, // 0x07C09F00u
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ namespace ARMeilleure.State
|
||||
{
|
||||
enum FPException
|
||||
{
|
||||
InvalidOp = 0,
|
||||
InvalidOp = 0,
|
||||
DivideByZero = 1,
|
||||
Overflow = 2,
|
||||
Underflow = 3,
|
||||
Inexact = 4,
|
||||
InputDenorm = 7
|
||||
Overflow = 2,
|
||||
Underflow = 3,
|
||||
Inexact = 4,
|
||||
InputDenorm = 7,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ namespace ARMeilleure.State
|
||||
{
|
||||
public enum FPRoundingMode
|
||||
{
|
||||
ToNearest = 0, // With ties to even.
|
||||
TowardsPlusInfinity = 1,
|
||||
ToNearest = 0, // With ties to even.
|
||||
TowardsPlusInfinity = 1,
|
||||
TowardsMinusInfinity = 2,
|
||||
TowardsZero = 3,
|
||||
ToNearestAway = 4 // With ties to away.
|
||||
TowardsZero = 3,
|
||||
ToNearestAway = 4, // With ties to away.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,6 @@ namespace ARMeilleure.State
|
||||
Z = 1u << 30,
|
||||
N = 1u << 31,
|
||||
|
||||
Mask = N | Z | C | V | FPSR.Mask | FPCR.Mask // 0xFFC09F9Fu
|
||||
Mask = N | Z | C | V | FPSR.Mask | FPCR.Mask, // 0xFFC09F9Fu
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ namespace ARMeilleure.State
|
||||
Idc = 1u << 7,
|
||||
Qc = 1u << 27,
|
||||
|
||||
Mask = Qc | Idc | Ixc | Ufc | Ofc | Dzc | Ioc // 0x0800009Fu
|
||||
Mask = Qc | Idc | Ixc | Ufc | Ofc | Dzc | Ioc, // 0x0800009Fu
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
RMode1Flag = 23,
|
||||
FzFlag = 24,
|
||||
DnFlag = 25,
|
||||
AhpFlag = 26
|
||||
AhpFlag = 26,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace ARMeilleure.State
|
||||
Zero,
|
||||
Infinity,
|
||||
QNaN,
|
||||
SNaN
|
||||
SNaN,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
ulong Counter { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ARMeilleure.State
|
||||
public int Running;
|
||||
}
|
||||
|
||||
private static NativeCtxStorage _dummyStorage = new NativeCtxStorage();
|
||||
private static NativeCtxStorage _dummyStorage = new();
|
||||
|
||||
private readonly IJitMemoryBlock _block;
|
||||
|
||||
@@ -266,4 +266,4 @@ namespace ARMeilleure.State
|
||||
|
||||
public void Dispose() => _block.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace ARMeilleure.State
|
||||
VFlag = 28,
|
||||
CFlag = 29,
|
||||
ZFlag = 30,
|
||||
NFlag = 31
|
||||
NFlag = 31,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ namespace ARMeilleure.State
|
||||
{
|
||||
static class RegisterAlias
|
||||
{
|
||||
public const int R8Usr = 8;
|
||||
public const int R9Usr = 9;
|
||||
public const int R8Usr = 8;
|
||||
public const int R9Usr = 9;
|
||||
public const int R10Usr = 10;
|
||||
public const int R11Usr = 11;
|
||||
public const int R12Usr = 12;
|
||||
public const int SpUsr = 13;
|
||||
public const int LrUsr = 14;
|
||||
public const int SpUsr = 13;
|
||||
public const int LrUsr = 14;
|
||||
|
||||
public const int SpHyp = 15;
|
||||
|
||||
@@ -24,13 +24,13 @@ namespace ARMeilleure.State
|
||||
public const int LrUnd = 22;
|
||||
public const int SpUnd = 23;
|
||||
|
||||
public const int R8Fiq = 24;
|
||||
public const int R9Fiq = 25;
|
||||
public const int R8Fiq = 24;
|
||||
public const int R9Fiq = 25;
|
||||
public const int R10Fiq = 26;
|
||||
public const int R11Fiq = 27;
|
||||
public const int R12Fiq = 28;
|
||||
public const int SpFiq = 29;
|
||||
public const int LrFiq = 30;
|
||||
public const int SpFiq = 29;
|
||||
public const int LrFiq = 30;
|
||||
|
||||
public const int Aarch32Sp = 13;
|
||||
public const int Aarch32Lr = 14;
|
||||
@@ -39,4 +39,4 @@ namespace ARMeilleure.State
|
||||
public const int Lr = 30;
|
||||
public const int Zr = 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ namespace ARMeilleure.State
|
||||
{
|
||||
static class RegisterConsts
|
||||
{
|
||||
public const int IntRegsCount = 32;
|
||||
public const int VecRegsCount = 32;
|
||||
public const int FlagsCount = 32;
|
||||
public const int FpFlagsCount = 32;
|
||||
public const int IntRegsCount = 32;
|
||||
public const int VecRegsCount = 32;
|
||||
public const int FlagsCount = 32;
|
||||
public const int FpFlagsCount = 32;
|
||||
public const int IntAndVecRegsCount = IntRegsCount + VecRegsCount;
|
||||
public const int FpFlagsOffset = IntRegsCount + VecRegsCount + FlagsCount;
|
||||
public const int TotalCount = IntRegsCount + VecRegsCount + FlagsCount + FpFlagsCount;
|
||||
public const int FpFlagsOffset = IntRegsCount + VecRegsCount + FlagsCount;
|
||||
public const int TotalCount = IntRegsCount + VecRegsCount + FlagsCount + FpFlagsCount;
|
||||
|
||||
public const int ZeroIndex = 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ARMeilleure.State
|
||||
/// <summary>
|
||||
/// Gets a new <see cref="V128"/> with all bits set to zero.
|
||||
/// </summary>
|
||||
public static V128 Zero => new V128(0, 0);
|
||||
public static V128 Zero => new(0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="V128"/> struct with the specified <see cref="double"/> value
|
||||
@@ -55,9 +55,9 @@ namespace ARMeilleure.State
|
||||
/// <param name="e3">Element 3</param>
|
||||
public V128(float e0, float e1, float e2, float e3)
|
||||
{
|
||||
_e0 = (ulong)(uint)BitConverter.SingleToInt32Bits(e0) << 0;
|
||||
_e0 = (ulong)(uint)BitConverter.SingleToInt32Bits(e0) << 0;
|
||||
_e0 |= (ulong)(uint)BitConverter.SingleToInt32Bits(e1) << 32;
|
||||
_e1 = (ulong)(uint)BitConverter.SingleToInt32Bits(e2) << 0;
|
||||
_e1 = (ulong)(uint)BitConverter.SingleToInt32Bits(e2) << 0;
|
||||
_e1 |= (ulong)(uint)BitConverter.SingleToInt32Bits(e3) << 32;
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace ARMeilleure.State
|
||||
/// <param name="e3">Element 3</param>
|
||||
public V128(uint e0, uint e1, uint e2, uint e3)
|
||||
{
|
||||
_e0 = (ulong)e0 << 0;
|
||||
_e0 = (ulong)e0 << 0;
|
||||
_e0 |= (ulong)e1 << 32;
|
||||
_e1 = (ulong)e2 << 0;
|
||||
_e1 = (ulong)e2 << 0;
|
||||
_e1 |= (ulong)e3 << 32;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,9 @@ namespace ARMeilleure.State
|
||||
public T Extract<T>(int index) where T : unmanaged
|
||||
{
|
||||
if ((uint)index >= GetElementCount<T>())
|
||||
{
|
||||
ThrowIndexOutOfRange();
|
||||
}
|
||||
|
||||
// Performs:
|
||||
// return *((*T)this + index);
|
||||
@@ -156,7 +158,9 @@ namespace ARMeilleure.State
|
||||
public void Insert<T>(int index, T value) where T : unmanaged
|
||||
{
|
||||
if ((uint)index >= GetElementCount<T>())
|
||||
{
|
||||
ThrowIndexOutOfRange();
|
||||
}
|
||||
|
||||
// Performs:
|
||||
// *((*T)this + index) = value;
|
||||
@@ -167,13 +171,13 @@ namespace ARMeilleure.State
|
||||
/// Returns a new <see cref="byte"/> array which represents the <see cref="V128"/>.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="byte"/> array which represents the <see cref="V128"/></returns>
|
||||
public byte[] ToArray()
|
||||
public readonly byte[] ToArray()
|
||||
{
|
||||
byte[] data = new byte[16];
|
||||
byte[] data = new byte[16];
|
||||
Span<byte> span = data;
|
||||
|
||||
BitConverter.TryWriteBytes(span, _e0);
|
||||
BitConverter.TryWriteBytes(span.Slice(8), _e1);
|
||||
BitConverter.TryWriteBytes(span[8..], _e1);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -225,7 +229,7 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
/// <param name="x">Target <see cref="V128"/></param>
|
||||
/// <returns>Result of not operation</returns>
|
||||
public static V128 operator ~(V128 x) => new V128(~x._e0, ~x._e1);
|
||||
public static V128 operator ~(V128 x) => new(~x._e0, ~x._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a bitwise and on the specified <see cref="V128"/> instances.
|
||||
@@ -233,7 +237,7 @@ namespace ARMeilleure.State
|
||||
/// <param name="x">First instance</param>
|
||||
/// <param name="y">Second instance</param>
|
||||
/// <returns>Result of and operation</returns>
|
||||
public static V128 operator &(V128 x, V128 y) => new V128(x._e0 & y._e0, x._e1 & y._e1);
|
||||
public static V128 operator &(V128 x, V128 y) => new(x._e0 & y._e0, x._e1 & y._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a bitwise or on the specified <see cref="V128"/> instances.
|
||||
@@ -241,7 +245,7 @@ namespace ARMeilleure.State
|
||||
/// <param name="x">First instance</param>
|
||||
/// <param name="y">Second instance</param>
|
||||
/// <returns>Result of or operation</returns>
|
||||
public static V128 operator |(V128 x, V128 y) => new V128(x._e0 | y._e0, x._e1 | y._e1);
|
||||
public static V128 operator |(V128 x, V128 y) => new(x._e0 | y._e0, x._e1 | y._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a bitwise exlusive or on the specified <see cref="V128"/> instances.
|
||||
@@ -249,7 +253,7 @@ namespace ARMeilleure.State
|
||||
/// <param name="x">First instance</param>
|
||||
/// <param name="y">Second instance</param>
|
||||
/// <returns>Result of exclusive or operation</returns>
|
||||
public static V128 operator ^(V128 x, V128 y) => new V128(x._e0 ^ y._e0, x._e1 ^ y._e1);
|
||||
public static V128 operator ^(V128 x, V128 y) => new(x._e0 ^ y._e0, x._e1 ^ y._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the specified <see cref="V128"/> instances are equal.
|
||||
@@ -272,7 +276,7 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
/// <param name="other">Other <see cref="V128"/> instance</param>
|
||||
/// <returns>true if equal; otherwise false</returns>
|
||||
public bool Equals(V128 other)
|
||||
public readonly bool Equals(V128 other)
|
||||
{
|
||||
return other._e0 == _e0 && other._e1 == _e1;
|
||||
}
|
||||
@@ -282,24 +286,24 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
/// <param name="obj">Other <see cref="object"/> instance</param>
|
||||
/// <returns>true if equal; otherwise false</returns>
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is V128 vector && Equals(vector);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(_e0, _e1);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return $"0x{_e1:X16}{_e0:X16}";
|
||||
}
|
||||
|
||||
private uint GetElementCount<T>() where T : unmanaged
|
||||
private static uint GetElementCount<T>() where T : unmanaged
|
||||
{
|
||||
return (uint)(Unsafe.SizeOf<V128>() / Unsafe.SizeOf<T>());
|
||||
}
|
||||
@@ -309,4 +313,4 @@ namespace ARMeilleure.State
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user