Browse Source

Fixed error with garbage collection

Yentl Van Tendeloo 9 years ago
parent
commit
139d0ccbfa

+ 2 - 1
hybrid_server/classes/mvkcontroller.xml

@@ -59,7 +59,6 @@
             while 1:
                 commands = self.mvk.execute_yields(username, operation, params, reply)
                 if commands is None:
-                    self.mvs.garbage_collect()
                     break
                 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.value = self.mvk.returnvalue
                                             self.all_failed = False
+
                             else:
+                                self.mvs.garbage_collect()
                                 out = self.mvs.read_outgoing(self.root)[0]
                                 for m in out:
                                     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!")
         elif isinstance(phase_v, string_types):
             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)
             elif inst_v is None:
                 raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
             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)
         elif inst_v is None:
             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"]),
                                    ("CNV", ["finish"]),
                                   ]
-        print("Resolved to " + str(variable))
         _, _, _, _ =        yield [("CD", [user_frame, "phase", new_phase]),
                                    ("CD", [user_frame, "returnvalue", variable]),
                                    ("DE", [phase_link]),

+ 3 - 1
state/modelverse_state/main.py

@@ -373,4 +373,6 @@ class ModelverseState(object):
 
     def garbage_collect(self):  
         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)