From 9136897d4a0aabed7e12f9756bc9a50e4bdbea72 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Fri, 8 Jun 2018 23:49:53 -0300 Subject: [PATCH] Do not inline the scalar vector load methods as a workaround to a .net JIT bug --- ChocolArm64/Memory/AMemory.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ChocolArm64/Memory/AMemory.cs b/ChocolArm64/Memory/AMemory.cs index 7e9a358aba..7af288a602 100644 --- a/ChocolArm64/Memory/AMemory.cs +++ b/ChocolArm64/Memory/AMemory.cs @@ -387,12 +387,14 @@ namespace ChocolArm64.Memory } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public Vector128 ReadVector32Unchecked(long Position) { if (Sse.IsSupported) { - return Sse.LoadScalarVector128((float*)(RamPtr + (uint)Position)); + byte* Address = RamPtr + (uint)Position; + + return Sse.LoadScalarVector128((float*)Address); } else { @@ -400,7 +402,7 @@ namespace ChocolArm64.Memory } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public Vector128 ReadVector64Unchecked(long Position) { if (Sse2.IsSupported) @@ -418,7 +420,9 @@ namespace ChocolArm64.Memory { if (Sse.IsSupported) { - return Sse.LoadVector128((float*)(RamPtr + (uint)Position)); + byte* Address = RamPtr + (uint)Position; + + return Sse.LoadVector128((float*)Address); } else { @@ -620,7 +624,7 @@ namespace ChocolArm64.Memory } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public void WriteVector32Unchecked(long Position, Vector128 Value) { if (Sse.IsSupported) @@ -633,7 +637,7 @@ namespace ChocolArm64.Memory } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] public void WriteVector64Unchecked(long Position, Vector128 Value) { if (Sse2.IsSupported)