[pypy-svn] r31732 - in pypy/dist/pypy/jit: codegen/llgraph timeshifter

ac at codespeak.net ac at codespeak.net
Sun Aug 27 15:43:52 CEST 2006


Author: ac
Date: Sun Aug 27 15:43:52 2006
New Revision: 31732

Modified:
   pypy/dist/pypy/jit/codegen/llgraph/rgenop.py
   pypy/dist/pypy/jit/timeshifter/rcontainer.py
Log:
(pedronis, arre)

Check that accessed fields exist in the struct.
Fix bugs exposed by thish check.



Modified: pypy/dist/pypy/jit/codegen/llgraph/rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llgraph/rgenop.py	(original)
+++ pypy/dist/pypy/jit/codegen/llgraph/rgenop.py	Sun Aug 27 15:43:52 2006
@@ -79,6 +79,7 @@
     placeholder = staticmethod(placeholder)
 
     def constFieldName(T, name):
+        assert name in T._flds
         return LLConst(llimpl.constFieldName(name))
     constFieldName._annspecialcase_ = 'specialize:memo'
     constFieldName = staticmethod(constFieldName)

Modified: pypy/dist/pypy/jit/timeshifter/rcontainer.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rcontainer.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/rcontainer.py	Sun Aug 27 15:43:52 2006
@@ -97,12 +97,12 @@
         FieldDesc.__init__(self, RGenOp, PTRTYPE, getattr(PTRTYPE.TO, name))
         self.structdepth = 0
         T = self.PTRTYPE.TO
+        self.fieldname = name
+        self.gv_fieldname = RGenOp.constFieldName(T, name)
         while (T._names and
                isinstance(getattr(T, T._names[0]), lltype.ContainerType)):
             self.structdepth += 1
             T = getattr(T, T._names[0])
-        self.fieldname = name
-        self.gv_fieldname = RGenOp.constFieldName(T, name)
 
 class ArrayFieldDesc(FieldDesc):
     def __init__(self, RGenOp, PTRTYPE):



More information about the Pypy-commit mailing list