[pypy-svn] r23166 - pypy/dist/pypy/rpython/l3interp

mwh at codespeak.net mwh at codespeak.net
Thu Feb 9 13:45:22 CET 2006


Author: mwh
Date: Thu Feb  9 13:45:20 2006
New Revision: 23166

Modified:
   pypy/dist/pypy/rpython/l3interp/convertgraph.py
   pypy/dist/pypy/rpython/l3interp/l3interp.py
   pypy/dist/pypy/rpython/l3interp/model.py
Log:
some old changes, awaiting a fixed version of genc with boehm on my machine:
now that offsets are annotated as integers, we don't need a separate table of
constant offsets in l3interp.



Modified: pypy/dist/pypy/rpython/l3interp/convertgraph.py
==============================================================================
--- pypy/dist/pypy/rpython/l3interp/convertgraph.py	(original)
+++ pypy/dist/pypy/rpython/l3interp/convertgraph.py	Thu Feb  9 13:45:20 2006
@@ -65,8 +65,7 @@
                            'ptr': 0}
         self.constants = {'int': [],
                           'dbl': [],
-                          'ptr': [],
-                          'offset':[]}
+                          'ptr': []}
         self.var2stack = {}
 
     def push(self, v):
@@ -94,7 +93,7 @@
             return position - self.stacksizes[kind]    # < 0
 
     def getoffset(self, offset):
-        clist = self.constants['offset']
+        clist = self.constants['int']
         try:
             res = clist.index(offset)
         except ValueError:
@@ -166,8 +165,6 @@
         if self.constants['int']: l3block.constants_int = self.constants['int']
         if self.constants['dbl']: l3block.constants_dbl = self.constants['dbl']
         if self.constants['ptr']: l3block.constants_ptr = self.constants['ptr']
-        if self.constants['offset']:
-            l3block.constants_offset = self.constants['offset']
 
         return l3block
 

Modified: pypy/dist/pypy/rpython/l3interp/l3interp.py
==============================================================================
--- pypy/dist/pypy/rpython/l3interp/l3interp.py	(original)
+++ pypy/dist/pypy/rpython/l3interp/l3interp.py	Thu Feb  9 13:45:20 2006
@@ -61,9 +61,6 @@
         if self.block.constants_ptr is None:
             self.block.constants_ptr = [constant_fakeaddress]
             self.block.constants_ptr = None
-        if self.block.constants_offset is None:
-            self.block.constants_offset = [constant_offset]
-            self.block.constants_offset = None
         self.i = 0
         self.stack_int = stack_int
         self.stack_dbl = stack_dbl
@@ -133,11 +130,6 @@
         if op >= 0: return self.block.constants_ptr[op]
         else:       return self.stack_ptr[op]
 
-    def getoffset(self):
-        op = self.nextop()
-        assert op >= 0
-        return self.block.constants_offset[op]
-
     def restorestacks(self):
         del self.stack_int[self.base_int:]
         del self.stack_dbl[self.base_dbl:]
@@ -190,49 +182,49 @@
 
     def op_getfield_int(self):
         p = self.getptr()
-        o = self.getoffset()
+        o = self.getint()
         self.stack_int.append((p + o).signed[0])
 
     def op_getfield_ptr(self):
         p = self.getptr()
-        o = self.getoffset()
+        o = self.getint()
         self.stack_ptr.append((p + o).address[0])
 
     def op_setfield_int(self):
         p = self.getptr()
-        o = self.getoffset()
+        o = self.getint()
         v = self.getint()
         (p + o).signed[0] = v
 
     def op_getarrayitem_int(self):
         a = self.getptr()
         i = self.getint()
-        items_offset = self.getoffset()
-        s = self.getoffset()
+        items_offset = self.getint()
+        s = self.getint()
         v = (a + items_offset + s * i).signed[0]
         self.stack_int.append(v)
         
     def op_getarrayitem_ptr(self):
         a = self.getptr()
         i = self.getint()
-        items_offset = self.getoffset()
-        s = self.getoffset()
+        items_offset = self.getint()
+        s = self.getint()
         v = (a + items_offset + s * i).address[0]
         self.stack_ptr.append(v)
         
     def op_setarrayitem_int(self):
         a = self.getptr()
         i = self.getint()
-        items_offset = self.getoffset()
-        s = self.getoffset()
+        items_offset = self.getint()
+        s = self.getint()
         v = self.getint()
         (a + items_offset + s * i).signed[0] = v
         
     def op_setarrayitem_ptr(self):
         a = self.getptr()
         i = self.getint()
-        items_offset = self.getoffset()
-        s = self.getoffset()
+        items_offset = self.getint()
+        s = self.getint()
         v = self.getptr()
         (a + items_offset + s * i).address[0] = v
         
@@ -253,7 +245,7 @@
         frame.execute()
 
     def op_malloc(self):
-        size = self.getoffset()
+        size = self.getint()
         self.stack_ptr.append(malloc(size))
         
     # ____________________________________________________________

Modified: pypy/dist/pypy/rpython/l3interp/model.py
==============================================================================
--- pypy/dist/pypy/rpython/l3interp/model.py	(original)
+++ pypy/dist/pypy/rpython/l3interp/model.py	Thu Feb  9 13:45:20 2006
@@ -107,7 +107,6 @@
                               constants_int=None,
                               constants_dbl=None,
                               constants_ptr=None,
-                              constants_offset=None,
                               called_graphs=None):
         self.insns = insns
         self.exit0 = exit0
@@ -116,7 +115,6 @@
         self.constants_dbl = constants_dbl
         self.constants_ptr = constants_ptr
         
-        self.constants_offset = constants_offset
         self.called_graphs = called_graphs
 
 class Link(object):



More information about the Pypy-commit mailing list