diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-04-04 18:17:37 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-04-04 18:17:37 -0300 |
| commit | e16ca561cb32b8d3a12689290dd75e357d28e857 (patch) | |
| tree | 5c23f14bc42bb08b5c759c0186f15a4492518314 /ChocolArm64 | |
| parent | a20d6b34aba1f67944b9772d99fd545bcf13682b (diff) | |
HashSet is not thread safe, hopefully this fixes the CPU issue where it throws a exception on Add
Diffstat (limited to 'ChocolArm64')
| -rw-r--r-- | ChocolArm64/ATranslator.cs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/ChocolArm64/ATranslator.cs b/ChocolArm64/ATranslator.cs index 02c18efd..f1bc2cff 100644 --- a/ChocolArm64/ATranslator.cs +++ b/ChocolArm64/ATranslator.cs @@ -107,25 +107,31 @@ namespace ChocolArm64 ATranslatedSub Subroutine = Context.GetSubroutine(); - if (SubBlocks.Contains(Position)) + lock (SubBlocks) { - SubBlocks.Remove(Position); + if (SubBlocks.Contains(Position)) + { + SubBlocks.Remove(Position); - Subroutine.SetType(ATranslatedSubType.SubBlock); - } - else - { - Subroutine.SetType(ATranslatedSubType.SubTier0); + Subroutine.SetType(ATranslatedSubType.SubBlock); + } + else + { + Subroutine.SetType(ATranslatedSubType.SubTier0); + } } CachedSubs.AddOrUpdate(Position, Subroutine, (Key, OldVal) => Subroutine); AOpCode LastOp = Block.GetLastOp(); - if (LastOp.Emitter != AInstEmit.Ret && - LastOp.Emitter != AInstEmit.Br) + lock (SubBlocks) { - SubBlocks.Add(LastOp.Position + 4); + if (LastOp.Emitter != AInstEmit.Ret && + LastOp.Emitter != AInstEmit.Br) + { + SubBlocks.Add(LastOp.Position + 4); + } } return Subroutine; |
