瀏覽代碼

Fixed error with garbage collection

Yentl Van Tendeloo 9 年之前
父節點
當前提交
139d0ccbfa
共有 3 個文件被更改,包括 7 次插入5 次删除
  1. 2 1
      hybrid_server/classes/mvkcontroller.xml
  2. 2 3
      kernel/modelverse_kernel/main.py
  3. 3 1
      state/modelverse_state/main.py

+ 2 - 1
hybrid_server/classes/mvkcontroller.xml

@@ -59,7 +59,6 @@
             while 1:
             while 1:
                 commands = self.mvk.execute_yields(username, operation, params, reply)
                 commands = self.mvk.execute_yields(username, operation, params, reply)
                 if commands is None:
                 if commands is None:
-                    self.mvs.garbage_collect()
                     break
                     break
                 reply = [self.mvs_operations[command[0]](*(command[1]))[0] for command in commands]
                 reply = [self.mvs_operations[command[0]](*(command[1]))[0] for command in commands]
             ]]>
             ]]>
@@ -158,7 +157,9 @@
                                             self.destination = self.output_queue[user].pop(0)
                                             self.destination = self.output_queue[user].pop(0)
                                             self.value = self.mvk.returnvalue
                                             self.value = self.mvk.returnvalue
                                             self.all_failed = False
                                             self.all_failed = False
+
                             else:
                             else:
+                                self.mvs.garbage_collect()
                                 out = self.mvs.read_outgoing(self.root)[0]
                                 out = self.mvs.read_outgoing(self.root)[0]
                                 for m in out:
                                 for m in out:
                                     src, user = self.mvs.read_edge(m)[0]
                                     src, user = self.mvs.read_edge(m)[0]

+ 2 - 3
kernel/modelverse_kernel/main.py

@@ -61,12 +61,12 @@ class ModelverseKernel(object):
             raise Exception("Instruction pointer could not be found!")
             raise Exception("Instruction pointer could not be found!")
         elif isinstance(phase_v, string_types):
         elif isinstance(phase_v, string_types):
             if phase_v == "init" and inst in self.compiled:
             if phase_v == "init" and inst in self.compiled:
-                print("%-30s(%s)" % ("COMPILED " + str(self.compiled[inst]), phase_v))
+                #print("%-30s(%s)" % ("COMPILED " + str(self.compiled[inst]), phase_v))
                 gen = self.execute_primitive(user_root, inst, username)
                 gen = self.execute_primitive(user_root, inst, username)
             elif inst_v is None:
             elif inst_v is None:
                 raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
                 raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
             else:
             else:
-                print("%-30s(%s) -- %s" % (inst_v["value"], phase_v, username))
+                #print("%-30s(%s) -- %s" % (inst_v["value"], phase_v, username))
                 gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
                 gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
         elif inst_v is None:
         elif inst_v is None:
             raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
             raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
@@ -441,7 +441,6 @@ class ModelverseKernel(object):
                                    ("RDE", [user_frame, "returnvalue"]),
                                    ("RDE", [user_frame, "returnvalue"]),
                                    ("CNV", ["finish"]),
                                    ("CNV", ["finish"]),
                                   ]
                                   ]
-        print("Resolved to " + str(variable))
         _, _, _, _ =        yield [("CD", [user_frame, "phase", new_phase]),
         _, _, _, _ =        yield [("CD", [user_frame, "phase", new_phase]),
                                    ("CD", [user_frame, "returnvalue", variable]),
                                    ("CD", [user_frame, "returnvalue", variable]),
                                    ("DE", [phase_link]),
                                    ("DE", [phase_link]),

+ 3 - 1
state/modelverse_state/main.py

@@ -373,4 +373,6 @@ class ModelverseState(object):
 
 
     def garbage_collect(self):  
     def garbage_collect(self):  
         while self.to_delete:
         while self.to_delete:
-            self.delete_node(self.to_delete.pop())
+            t = self.to_delete.pop()
+            if not self.incoming[t]:
+                self.delete_node(t)