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 wrap: on
line diff
--- a/viff/active.py	Fri Oct 23 13:50:19 2009 +0200
+++ b/viff/active.py	Fri Oct 23 14:56:38 2009 +0200
@@ -487,7 +487,7 @@
 
         # At this point both share_x and share_y must be Share
         # objects. We multiply them via a multiplication triple.
-        a, b, c = self.get_triple(share_x.field)
+        (a, b, c), _ = self.get_triple(share_x.field)
         d = self.open(share_x - a)
         e = self.open(share_y - b)
 
--- a/viff/runtime.py	Fri Oct 23 13:50:19 2009 +0200
+++ b/viff/runtime.py	Fri Oct 23 14:56:38 2009 +0200
@@ -465,7 +465,8 @@
     The decorated method will be replaced with a proxy method which
     first tries to get the data needed from
     :attr:`Runtime._pool`, and if that fails it falls back to the
-    original method.
+    original method. It also returns a flag to indicate whether the
+    data is from the pool.
 
     The *generator* method is only used to record where the data
     should be generated from, the method is not actually called. This
@@ -480,14 +481,14 @@
             self.increment_pc()
             pc = tuple(self.program_counter)
             try:
-                return self._pool.pop(pc)
+                return self._pool.pop(pc), True
             except KeyError:
                 key = (generator, args)
                 pcs = self._needed_data.setdefault(key, [])
                 pcs.append(pc)
                 self.fork_pc()
                 try:
-                    return method(self, *args, **kwargs)
+                    return method(self, *args, **kwargs), False
                 finally:
                     self.unfork_pc()