diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-04-26 01:55:12 -0300 |
|---|---|---|
| committer | jduncanator <1518948+jduncanator@users.noreply.github.com> | 2019-04-26 14:55:12 +1000 |
| commit | 8a7d99cdeae2355511d4eb43aefb76d0d886bcf8 (patch) | |
| tree | 655d33f4db5dc3eb21c9c4ff5867b1179913585a /ChocolArm64/State/CpuThreadState.cs | |
| parent | 2b8eac1bcec6d4870776b4f302d9dd7794223642 (diff) | |
Refactoring and optimization on CPU translation (#661)
* Refactoring and optimization on CPU translation
* Remove now unused property
* Rename ilBlock -> block (local)
* Change equality comparison on RegisterMask for consistency
Co-Authored-By: gdkchan <gab.dark.100@gmail.com>
* Add back the aggressive inlining attribute to the Synchronize method
* Implement IEquatable on the Register struct
* Fix identation
Diffstat (limited to 'ChocolArm64/State/CpuThreadState.cs')
| -rw-r--r-- | ChocolArm64/State/CpuThreadState.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ChocolArm64/State/CpuThreadState.cs b/ChocolArm64/State/CpuThreadState.cs index caf73deb..1cbbcf40 100644 --- a/ChocolArm64/State/CpuThreadState.cs +++ b/ChocolArm64/State/CpuThreadState.cs @@ -9,11 +9,11 @@ namespace ChocolArm64.State { public class CpuThreadState { + private const int MinCountForCheck = 40000; + internal const int ErgSizeLog2 = 4; internal const int DczSizeLog2 = 4; - private const int MinInstForCheck = 4000000; - public ulong X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19, X20, X21, X22, X23, @@ -124,13 +124,13 @@ namespace ChocolArm64.State } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal bool Synchronize(int bbWeight) + internal bool Synchronize() { //Firing a interrupt frequently is expensive, so we only //do it after a given number of instructions has executed. - _syncCount += bbWeight; + _syncCount++; - if (_syncCount >= MinInstForCheck) + if (_syncCount >= MinCountForCheck) { CheckInterrupt(); } @@ -138,11 +138,6 @@ namespace ChocolArm64.State return Running; } - internal void RequestInterrupt() - { - _interrupted = true; - } - [MethodImpl(MethodImplOptions.NoInlining)] private void CheckInterrupt() { @@ -156,6 +151,11 @@ namespace ChocolArm64.State } } + internal void RequestInterrupt() + { + _interrupted = true; + } + internal void OnBreak(long position, int imm) { Break?.Invoke(this, new InstExceptionEventArgs(position, imm)); |
