[pypy-svn] r25136 - pypy/dist/pypy/jit

arigo at codespeak.net arigo at codespeak.net
Thu Mar 30 12:32:18 CEST 2006


Author: arigo
Date: Thu Mar 30 12:32:17 2006
New Revision: 25136

Modified:
   pypy/dist/pypy/jit/hintrtyper.py
   pypy/dist/pypy/jit/rtimeshift.py
Log:
Quick fix for a failing test.


Modified: pypy/dist/pypy/jit/hintrtyper.py
==============================================================================
--- pypy/dist/pypy/jit/hintrtyper.py	(original)
+++ pypy/dist/pypy/jit/hintrtyper.py	Thu Mar 30 12:32:17 2006
@@ -335,7 +335,7 @@
     def create(self, hop):
         if self.typedesc is None:
             T = self.original_concretetype.TO
-            self.typedesc = rtimeshift.ContainerTypeDesc.make(T)
+            self.typedesc = rtimeshift.StructTypeDesc.make(T)
         ts = self.timeshifter
         return hop.llops.genmixlevelhelpercall(self.typedesc.ll_factory,
             [], [], ts.s_RedBox)

Modified: pypy/dist/pypy/jit/rtimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/rtimeshift.py	(original)
+++ pypy/dist/pypy/jit/rtimeshift.py	Thu Mar 30 12:32:17 2006
@@ -262,7 +262,7 @@
                           rgenop.constTYPE(RESULT))
     return VarRedBox(genvar)
 
-class ContainerTypeDesc(object):
+class StructTypeDesc(object):
     _type_cache = weakref.WeakKeyDictionary()
 
     def __init__(self, TYPE):
@@ -270,26 +270,23 @@
         self.PTRTYPE = lltype.Ptr(TYPE)
         self.gv_type = rgenop.constTYPE(self.TYPE)
         self.gv_ptrtype = rgenop.constTYPE(self.PTRTYPE)
-        # XXX only for Struct so far
         self.fielddescs = [StructFieldDesc.make(self.PTRTYPE, name)
                            for name in TYPE._names]
         defls = []
-        for name in TYPE._names:
-            FIELDTYPE = TYPE._flds[name]
-            if isinstance(FIELDTYPE, lltype.ContainerType):
-                subtypedesc = ContainerTypeDesc.make(FIELDTYPE)
-                defaultbox = VirtualRedBox(subtypedesc)
+        for desc in self.fielddescs:
+            if desc.inlined_typedesc is not None:
+                defaultbox = VirtualRedBox(desc.inlined_typedesc)
             else:
-                defaultvalue = FIELDTYPE._defl()
+                defaultvalue = desc.RESTYPE._defl()
                 defaultbox = ConstRedBox.ll_fromvalue(defaultvalue)
             defls.append(defaultbox)
         self.content_boxes = defls
 
     def make(T):
         try:
-            return ContainerTypeDesc._type_cache[T]
+            return StructTypeDesc._type_cache[T]
         except KeyError:
-            desc = ContainerTypeDesc._type_cache[T] = ContainerTypeDesc(T)
+            desc = StructTypeDesc._type_cache[T] = StructTypeDesc(T)
             return desc
     make = staticmethod(make)
 
@@ -334,9 +331,12 @@
         self.fieldname = fieldname
         self.gv_fieldname = rgenop.constFieldName(fieldname)
         self.fieldindex = operator.indexOf(PTRTYPE.TO._names, fieldname)
-        if isinstance(RES1, lltype.ContainerType):
+        if isinstance(RES1, lltype.Struct):
             # inlined substructure
-            self.inlined_typedesc = ContainerTypeDesc.make(RES1)
+            self.inlined_typedesc = StructTypeDesc.make(RES1)
+##        elif isinstance(RES1, lltype.Array):
+##            # inlined array XXX in-progress
+##            self.inlined_typedesc = ArrayTypeDesc.make(RES1)
         else:
             self.inlined_typedesc = None
 



More information about the Pypy-commit mailing list