changeset 1252:c8e3e05b8be9

Fork program counter for preprocessed operations.
author Marcel Keller <mkeller@cs.au.dk>
date Mon, 28 Sep 2009 16:09:04 +0200
parents 2bbab8b5597f
children 8063a78b8ef5
files viff/runtime.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/runtime.py	Mon Sep 28 15:59:57 2009 +0200
+++ b/viff/runtime.py	Mon Sep 28 16:09:04 2009 +0200
@@ -425,6 +425,7 @@
 
         @wrapper(method)
         def preprocess_wrapper(self, *args, **kwargs):
+            self.increment_pc()
             pc = tuple(self.program_counter)
             try:
                 return self._pool.pop(pc)
@@ -432,7 +433,11 @@
                 key = (generator, args)
                 pcs = self._needed_data.setdefault(key, [])
                 pcs.append(pc)
-                return method(self, *args, **kwargs)
+                self.fork_pc()
+                try:
+                    return method(self, *args, **kwargs)
+                finally:
+                    self.unfork_pc()
 
         return preprocess_wrapper
     return preprocess_decorator