[pypy-svn] r52842 - in pypy/branch/jit-hotpath/pypy/jit/rainbow: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Mar 22 21:46:45 CET 2008


Author: cfbolz
Date: Sat Mar 22 21:46:45 2008
New Revision: 52842

Modified:
   pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/dump.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_serializegraph.py
Log:
don't use negative numbers for green keys either


Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/codewriter.py	Sat Mar 22 21:46:45 2008
@@ -691,14 +691,14 @@
 
     def keydesc_position(self, key):    # key is a tuple of TYPEs
         if not key:
-            keyindex = -1 # use prebuilt empty_key
+            return 0 # use prebuilt empty_key
         elif key not in self.keydesc_positions:
             keyindex = len(self.keydesc_positions)
             self.keydesc_positions[key] = keyindex
             self.keydescs.append(KeyDesc(self.RGenOp, *key))
         else:
             keyindex = self.keydesc_positions[key]
-        return keyindex
+        return keyindex + 1
 
     def structtypedesc_position(self, TYPE):
         if TYPE in self.structtypedesc_positions:

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/dump.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/dump.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/dump.py	Sat Mar 22 21:46:45 2008
@@ -61,10 +61,10 @@
 
     def get_greenkey(self):
         keydescnum = self.load_2byte()
-        if keydescnum == -1:
+        if keydescnum == 0:
             return None
         else:
-            keydesc = self.jitcode.keydescs[keydescnum]
+            keydesc = self.jitcode.keydescs[keydescnum - 1]
             return keydesc
 
     def load_4byte(self):     # for jump targets

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/fallback.py	Sat Mar 22 21:46:45 2008
@@ -257,10 +257,10 @@
 
     def get_greenkey(self):
         keydescnum = self.load_2byte()
-        if keydescnum == -1:
+        if keydescnum == 0:
             return empty_key
         else:
-            keydesc = self.bytecode.keydescs[keydescnum]
+            keydesc = self.bytecode.keydescs[keydescnum - 1]
             return GreenKey(self.local_green[:keydesc.nb_vals], keydesc)
 
     def red_result(self, gv):

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/interpreter.py	Sat Mar 22 21:46:45 2008
@@ -414,10 +414,10 @@
 
     def get_greenkey(self):
         keydescnum = self.load_2byte()
-        if keydescnum == -1:
+        if keydescnum == 0:
             return empty_key
         else:
-            keydesc = self.frame.bytecode.keydescs[keydescnum]
+            keydesc = self.frame.bytecode.keydescs[keydescnum - 1]
             return GreenKey(self.frame.local_green[:keydesc.nb_vals], keydesc)
 
     def red_result(self, box):

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_serializegraph.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_serializegraph.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_serializegraph.py	Sat Mar 22 21:46:45 2008
@@ -155,7 +155,7 @@
                             "red_int_add", 0, 1,
                             "make_new_redvars", 1, 2,
                             label("after"),
-                            "local_merge", 0, -1,
+                            "local_merge", 0, 0,
                             "make_redbox", 1, 0,
                             "red_int_add", 1, 0,
                             "make_new_redvars", 1, 2,



More information about the Pypy-commit mailing list