GP-2715: Call modifier.initialExecuteCallback only once per thread

This commit is contained in:
Dan
2023-01-17 13:29:44 -05:00
parent 942d60eeac
commit 043a6aa3bb

View File

@@ -113,7 +113,15 @@ public class ModifiedPcodeThread<T> extends DefaultPcodeThread<T> {
}
}
// Part of the glue that makes existing state modifiers work in new emulation framework
/**
* Part of the glue that makes existing state modifiers work in new emulation framework
*
* <p>
* <b>NOTE:</b> These are instantiated one per thread, rather than sharing one across the
* machine, because some of the modifiers are stateful and assume a single-threaded model. The
* best way to mitigate that assumption is to ensure a modifier is responsible for only a single
* thread, even though a machine may have multiple threads.
*/
protected final EmulateInstructionStateModifier modifier;
protected final Emulate emulate;
@@ -194,7 +202,8 @@ public class ModifiedPcodeThread<T> extends DefaultPcodeThread<T> {
}
@Override
protected void preExecuteInstruction() {
public void reInitialize() {
super.reInitialize();
if (modifier != null) {
savedCounter = getCounter();
modifier.initialExecuteCallback(emulate, savedCounter, getContext());