[pypy-svn] r71697 - in pypy/branch/cleanup-warnings/pypy/jit: backend backend/llgraph backend/llsupport metainterp

fijal at codespeak.net fijal at codespeak.net
Wed Mar 3 05:00:56 CET 2010


Author: fijal
Date: Wed Mar  3 05:00:52 2010
New Revision: 71697

Modified:
   pypy/branch/cleanup-warnings/pypy/jit/backend/llgraph/runner.py
   pypy/branch/cleanup-warnings/pypy/jit/backend/llsupport/llmodel.py
   pypy/branch/cleanup-warnings/pypy/jit/backend/model.py
   pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizefindnode.py
   pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizeopt.py
   pypy/branch/cleanup-warnings/pypy/jit/metainterp/resume.py
Log:
Fight a bit harder with annotation warnings - I think they're mostly gone
by now


Modified: pypy/branch/cleanup-warnings/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/cleanup-warnings/pypy/jit/backend/llgraph/runner.py	(original)
+++ pypy/branch/cleanup-warnings/pypy/jit/backend/llgraph/runner.py	Wed Mar  3 05:00:52 2010
@@ -75,6 +75,8 @@
     supports_floats = True
 
     CallDescrClass = Descr
+    ArrayDescrClass = Descr
+    FieldDescrClass = Descr
 
     def __init__(self, rtyper, stats=None, opts=None,
                  translate_support_code=False,
@@ -725,6 +727,8 @@
     def get_extra_info(self):
         return self.extrainfo
 
+OOtypeCPU.CallDescrClass = StaticMethDescr
+
 class MethDescr(history.AbstractMethDescr):
 
     callmeth = None
@@ -844,6 +848,8 @@
     def __repr__(self):
         return '<FieldDescr %r>' % self.fieldname
 
+OOtypeCPU.FieldDescrClass = FieldDescr
+OOtypeCPU.ArrayDescrClass = TypeDescr
 
 # ____________________________________________________________
 

Modified: pypy/branch/cleanup-warnings/pypy/jit/backend/llsupport/llmodel.py
==============================================================================
--- pypy/branch/cleanup-warnings/pypy/jit/backend/llsupport/llmodel.py	(original)
+++ pypy/branch/cleanup-warnings/pypy/jit/backend/llsupport/llmodel.py	Wed Mar  3 05:00:52 2010
@@ -21,6 +21,8 @@
     from pypy.jit.metainterp.typesystem import llhelper as ts
 
     CallDescrClass = BaseCallDescr
+    FieldDescrClass = BaseFieldDescr
+    ArrayDescrClass = BaseArrayDescr
 
     def __init__(self, rtyper, stats, opts, translate_support_code=False,
                  gcdescr=None):

Modified: pypy/branch/cleanup-warnings/pypy/jit/backend/model.py
==============================================================================
--- pypy/branch/cleanup-warnings/pypy/jit/backend/model.py	(original)
+++ pypy/branch/cleanup-warnings/pypy/jit/backend/model.py	Wed Mar  3 05:00:52 2010
@@ -9,6 +9,8 @@
     done_with_this_frame_int_v = -1
 
     CallDescrClass = None # a base class for all CallDescrs
+    ArrayDescrClass = None
+    FieldDescrClass = None
 
     _overflow_flag = False
 

Modified: pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizefindnode.py
==============================================================================
--- pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizefindnode.py	(original)
+++ pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizefindnode.py	Wed Mar  3 05:00:52 2010
@@ -193,7 +193,9 @@
             return     # var-sized arrays are not virtual
         arraynode = InstanceNode()
         arraynode.arraysize = lengthbox.getint()
-        arraynode.arraydescr = op.descr
+        descr = op.descr
+        assert isinstance(descr, self.cpu.ArrayDescrClass)
+        arraynode.arraydescr = descr
         self.nodes[op.result] = arraynode
 
     def find_nodes_ARRAYLEN_GC(self, op):
@@ -223,7 +225,7 @@
             fieldnode.mark_escaped()
             return     # nothing to be gained from tracking the field
         field = op.descr
-        assert isinstance(field, AbstractValue)
+        assert isinstance(field, self.cpu.FieldDescrClass)
         if instnode.curfields is None:
             instnode.curfields = {}
         instnode.curfields[field] = fieldnode
@@ -234,7 +236,7 @@
         if instnode.escaped:
             return     # nothing to be gained from tracking the field
         field = op.descr
-        assert isinstance(field, AbstractValue)
+        assert isinstance(field, self.cpu.FieldDescrClass)
         if instnode.curfields is not None and field in instnode.curfields:
             fieldnode = instnode.curfields[field]
         elif instnode.origfields is not None and field in instnode.origfields:
@@ -384,6 +386,7 @@
                     # uninitialized after a guard failure.
                     node = self.node_fromstart
                 specnode = self.intersect(node, d[ofs])
+                assert isinstance(ofs, self.cpu.FieldDescrClass)
                 fields.append((ofs, specnode))
         return fields
 

Modified: pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizeopt.py	(original)
+++ pypy/branch/cleanup-warnings/pypy/jit/metainterp/optimizeopt.py	Wed Mar  3 05:00:52 2010
@@ -172,6 +172,8 @@
     def _make_virtual(self, modifier):
         raise NotImplementedError("abstract base")
 
+    def _really_force(self):
+        raise NotImplementedError("abstract base")
 
 def get_fielddescrlist_cache(cpu):
     if not hasattr(cpu, '_optimizeopt_fielddescrlist_cache'):
@@ -358,7 +360,7 @@
     def _setup_virtual_node_1(self, optimizer, box):
         raise NotImplementedError
     def teardown_virtual_node(self, optimizer, value, newexitargs):
-        assert value.is_virtual()
+        assert isinstance(value, AbstractVirtualStructValue)
         for ofs, subspecnode in self.fields:
             subvalue = value.getfield(ofs, optimizer.new_const(ofs))
             subspecnode.teardown_virtual_node(optimizer, subvalue, newexitargs)
@@ -381,7 +383,7 @@
             vvalueitem = optimizer.getvalue(subbox)
             vvalue.setitem(index, vvalueitem)
     def teardown_virtual_node(self, optimizer, value, newexitargs):
-        assert value.is_virtual()
+        assert isinstance(value, VArrayValue)
         for index in range(len(self.items)):
             subvalue = value.getitem(index)
             subspecnode = self.items[index]
@@ -455,6 +457,7 @@
         return vvalue
 
     def make_varray(self, arraydescr, size, box, source_op=None):
+        assert isinstance(arraydescr, self.cpu.ArrayDescrClass)
         vvalue = VArrayValue(self, arraydescr, size, box, source_op)
         self.make_equal_to(box, vvalue)
         return vvalue
@@ -819,7 +822,7 @@
         value = self.getvalue(op.args[0])
         if value.is_virtual():
             # optimizefindnode should ensure that fieldvalue is found
-            assert isinstance(value, AbstractVirtualValue)
+            assert isinstance(value, AbstractVirtualStructValue)
             fieldvalue = value.getfield(op.descr, None)
             assert fieldvalue is not None
             self.make_equal_to(op.result, fieldvalue)
@@ -835,6 +838,7 @@
         value = self.getvalue(op.args[0])
         fieldvalue = self.getvalue(op.args[1])
         if value.is_virtual():
+            assert isinstance(value, AbstractVirtualStructValue)
             value.setfield(op.descr, fieldvalue)
         else:
             value.ensure_nonnull()
@@ -861,6 +865,7 @@
     def optimize_ARRAYLEN_GC(self, op):
         value = self.getvalue(op.args[0])
         if value.is_virtual():
+            assert isinstance(value, VArrayValue)
             self.make_constant_int(op.result, value.getlength())
         else:
             value.ensure_nonnull()
@@ -871,6 +876,7 @@
         if value.is_virtual():
             indexbox = self.get_constant_box(op.args[1])
             if indexbox is not None:
+                assert isinstance(value, VArrayValue)
                 itemvalue = value.getitem(indexbox.getint())
                 self.make_equal_to(op.result, itemvalue)
                 return
@@ -884,6 +890,7 @@
     def optimize_SETARRAYITEM_GC(self, op):
         value = self.getvalue(op.args[0])
         if value.is_virtual():
+            assert isinstance(value, VArrayValue)
             indexbox = self.get_constant_box(op.args[1])
             if indexbox is not None:
                 value.setitem(indexbox.getint(), self.getvalue(op.args[2]))
@@ -1032,7 +1039,9 @@
             if opnum == rop.CALL_ASSEMBLER:
                 effectinfo = None
             else:
-                effectinfo = op.descr.get_extra_info()
+                descr = op.descr
+                assert isinstance(descr, self.optimizer.cpu.CallDescrClass)
+                effectinfo = descr.get_extra_info()
             if effectinfo is not None:
                 # XXX we can get the wrong complexity here, if the lists
                 # XXX stored on effectinfo are large

Modified: pypy/branch/cleanup-warnings/pypy/jit/metainterp/resume.py
==============================================================================
--- pypy/branch/cleanup-warnings/pypy/jit/metainterp/resume.py	(original)
+++ pypy/branch/cleanup-warnings/pypy/jit/metainterp/resume.py	Wed Mar  3 05:00:52 2010
@@ -396,7 +396,8 @@
         return tagged_list_eq(self.fieldnums, fieldnums)
     def set_content(self, fieldnums):
         self.fieldnums = fieldnums
-
+    def debug_prints(self):
+        raise NotImplementedError
 
 class AbstractVirtualStructInfo(AbstractVirtualInfo):
     def __init__(self, fielddescrs):



More information about the Pypy-commit mailing list