Fix stack manager references after Quetzal restore
QuetzalParser._parse_stks() creates a new ZStackManager and sets it on zmachine._stackmanager, but ZCpu._stackmanager and ZOpDecoder._stack still pointed to the old empty stack. After restore, all stack ops (local var reads, routine returns, stack pops) used the wrong stack, causing the interpreter to crash on the first command.
This commit is contained in:
parent
15e1d807aa
commit
65a080608a
1 changed files with 6 additions and 0 deletions
|
|
@ -248,6 +248,12 @@ class QuetzalParser:
|
||||||
raise QuetzalStackFrameOverflow
|
raise QuetzalStackFrameOverflow
|
||||||
|
|
||||||
self._zmachine._stackmanager = stackmanager
|
self._zmachine._stackmanager = stackmanager
|
||||||
|
# Update cached references in subsystems that store the stack manager
|
||||||
|
# (they cache the stack at init time and won't see the replacement)
|
||||||
|
if hasattr(self._zmachine, "_cpu"):
|
||||||
|
self._zmachine._cpu._stackmanager = stackmanager
|
||||||
|
if hasattr(self._zmachine, "_opdecoder"):
|
||||||
|
self._zmachine._opdecoder._stack = stackmanager
|
||||||
log(" Successfully installed all stack frames.")
|
log(" Successfully installed all stack frames.")
|
||||||
|
|
||||||
def _parse_intd(self, data):
|
def _parse_intd(self, data):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue