瀏覽代碼

Fixed memory protocol (again)

Joeri Exelmans 5 年之前
父節點
當前提交
34fcc4a70a
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/sccd/statechart/dynamic/statechart_instance.py

+ 6 - 3
src/sccd/statechart/dynamic/statechart_instance.py

@@ -129,14 +129,17 @@ class StatechartInstance(Instance):
         instance_frame = memory.current_frame() # this is the stack frame that contains the statechart's "instance" variables
 
         def get_memory_protocol(protocol: MemoryProtocol) -> StatechartMemory:
-            if protocol == MemoryProtocol.SMALL_STEP:
+            if protocol == MemoryProtocol.SMALL_STEP and semantics.concurrency == Concurrency.SINGLE:
                 return StatechartMemory(delegate=memory) # no snapshots
             else:
                 m = SnapshottingStatechartMemory(delegate=memory, frame=instance_frame)
-                if semantics.assignment_memory_protocol == MemoryProtocol.BIG_STEP:
+                # refresh snapshot at end of big/combo/small step:
+                if protocol == MemoryProtocol.BIG_STEP:
                     self._big_step.when_done(m.flush_round)
-                elif semantics.assignment_memory_protocol == MemoryProtocol.COMBO_STEP:
+                elif protocol == MemoryProtocol.COMBO_STEP:
                     combo_step.when_done(m.flush_round)
+                elif protocol == MemoryProtocol.SMALL_STEP:
+                    small_step.when_done(m.flush_round)
                 return m
 
         if semantics.enabledness_memory_protocol == semantics.assignment_memory_protocol: