viff

changeset 1327:75fbb52aea09

runtime: Preprocess decorator indicates whether item is from pool.
author Marcel Keller <mkeller@cs.au.dk>
date Fri, 23 Oct 2009 14:56:38 +0200
parents f933bd327750
children 444954db1fc9
files viff/active.py viff/runtime.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/viff/active.py	Fri Oct 23 13:50:19 2009 +0200
     1.2 +++ b/viff/active.py	Fri Oct 23 14:56:38 2009 +0200
     1.3 @@ -487,7 +487,7 @@
     1.4  
     1.5          # At this point both share_x and share_y must be Share
     1.6          # objects. We multiply them via a multiplication triple.
     1.7 -        a, b, c = self.get_triple(share_x.field)
     1.8 +        (a, b, c), _ = self.get_triple(share_x.field)
     1.9          d = self.open(share_x - a)
    1.10          e = self.open(share_y - b)
    1.11  
     2.1 --- a/viff/runtime.py	Fri Oct 23 13:50:19 2009 +0200
     2.2 +++ b/viff/runtime.py	Fri Oct 23 14:56:38 2009 +0200
     2.3 @@ -465,7 +465,8 @@
     2.4      The decorated method will be replaced with a proxy method which
     2.5      first tries to get the data needed from
     2.6      :attr:`Runtime._pool`, and if that fails it falls back to the
     2.7 -    original method.
     2.8 +    original method. It also returns a flag to indicate whether the
     2.9 +    data is from the pool.
    2.10  
    2.11      The *generator* method is only used to record where the data
    2.12      should be generated from, the method is not actually called. This
    2.13 @@ -480,14 +481,14 @@
    2.14              self.increment_pc()
    2.15              pc = tuple(self.program_counter)
    2.16              try:
    2.17 -                return self._pool.pop(pc)
    2.18 +                return self._pool.pop(pc), True
    2.19              except KeyError:
    2.20                  key = (generator, args)
    2.21                  pcs = self._needed_data.setdefault(key, [])
    2.22                  pcs.append(pc)
    2.23                  self.fork_pc()
    2.24                  try:
    2.25 -                    return method(self, *args, **kwargs)
    2.26 +                    return method(self, *args, **kwargs), False
    2.27                  finally:
    2.28                      self.unfork_pc()
    2.29