[pypy-svn] r52949 - in pypy/branch/jit-hotpath/pypy/jit: rainbow timeshifter

antocuni at codespeak.net antocuni at codespeak.net
Tue Mar 25 23:17:04 CET 2008


Author: antocuni
Date: Tue Mar 25 23:17:03 2008
New Revision: 52949

Modified:
   pypy/branch/jit-hotpath/pypy/jit/rainbow/typesystem.py
   pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py
Log:
some changes to make rcontainer more ootype.Record friendly



Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/typesystem.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/typesystem.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/typesystem.py	Tue Mar 25 23:17:03 2008
@@ -10,7 +10,7 @@
 def fieldType(T, name):
     if isinstance(T, lltype.Struct):
         return getattr(T, name)
-    elif isinstance(T, ootype.Instance):
+    elif isinstance(T, (ootype.Instance, ootype.Record)):
         _, FIELD = T._lookup_field(name)
         return FIELD
     else:

Modified: pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py	Tue Mar 25 23:17:03 2008
@@ -83,7 +83,7 @@
     def __init__(self, RGenOp, TYPE):
         self.TYPE = TYPE
         self.PTRTYPE = self.Ptr(TYPE)
-        self.name = TYPE._name
+        self.name = self._get_type_name(TYPE)
         self.ptrkind = RGenOp.kindToken(self.PTRTYPE)
 
         self.immutable = TYPE._hints.get('immutable', False)
@@ -111,7 +111,10 @@
         for name in TYPE._names:
             FIELDTYPE = getattr(TYPE, name)
             yield name, FIELDTYPE
-    
+
+    def _get_type_name(self, TYPE):
+        return TYPE._name
+
     def _compute_fielddescs(self, RGenOp):
         TYPE = self.TYPE
         innermostdesc = self
@@ -258,6 +261,11 @@
         for name, (FIELDTYPE, defl) in TYPE._fields.iteritems():
             yield name, FIELDTYPE
 
+    def _get_type_name(self, TYPE):
+        if isinstance(TYPE, ootype.Record):
+            return TYPE._short_name()
+        else:
+            return TYPE._name
 
 def create_varsize(jitstate, contdesc, sizebox):
     gv_size = sizebox.getgenvar(jitstate)


More information about the pypy-svn mailing list