viff

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 diff
     1.1 --- a/viff/runtime.py	Mon Sep 28 15:59:57 2009 +0200
     1.2 +++ b/viff/runtime.py	Mon Sep 28 16:09:04 2009 +0200
     1.3 @@ -425,6 +425,7 @@
     1.4  
     1.5          @wrapper(method)
     1.6          def preprocess_wrapper(self, *args, **kwargs):
     1.7 +            self.increment_pc()
     1.8              pc = tuple(self.program_counter)
     1.9              try:
    1.10                  return self._pool.pop(pc)
    1.11 @@ -432,7 +433,11 @@
    1.12                  key = (generator, args)
    1.13                  pcs = self._needed_data.setdefault(key, [])
    1.14                  pcs.append(pc)
    1.15 -                return method(self, *args, **kwargs)
    1.16 +                self.fork_pc()
    1.17 +                try:
    1.18 +                    return method(self, *args, **kwargs)
    1.19 +                finally:
    1.20 +                    self.unfork_pc()
    1.21  
    1.22          return preprocess_wrapper
    1.23      return preprocess_decorator