[pypy-svn] r32191 - in pypy/branch/more-gckinds/pypy/rpython: . lltypesystem

mwh at codespeak.net mwh at codespeak.net
Tue Sep 12 10:28:04 CEST 2006


Author: mwh
Date: Tue Sep 12 10:27:59 2006
New Revision: 32191

Modified:
   pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py
   pypy/branch/more-gckinds/pypy/rpython/rptr.py
Log:
treat pointers to internal opaques as boring old pointers.
that this required fixing three places is not good at all...


Modified: pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py	(original)
+++ pypy/branch/more-gckinds/pypy/rpython/lltypesystem/lltype.py	Tue Sep 12 10:27:59 2006
@@ -1164,7 +1164,7 @@
         """XXX A nice docstring here"""
         T = typeOf(val)
         if isinstance(T, ContainerType):
-            if self._T._gckind == 'gc' and T._gckind == 'raw':
+            if self._T._gckind == 'gc' and T._gckind == 'raw' and not isinstance(T, OpaqueType):
                 val = _interior_ptr(T, self._obj, [offset])
             else:
                 val = _ptr(Ptr(T), val, solid=self._solid)
@@ -1211,10 +1211,8 @@
         """XXX A nice docstring here"""
         T = typeOf(val)
         if isinstance(T, ContainerType):
-            if T._gckind == 'raw':
-                val = _interior_ptr(T, self._parent, self._offsets + [offset])
-            else:
-                1/0
+            assert T._gckind == 'raw'
+            val = _interior_ptr(T, self._parent, self._offsets + [offset])
         return val
     
     

Modified: pypy/branch/more-gckinds/pypy/rpython/rptr.py
==============================================================================
--- pypy/branch/more-gckinds/pypy/rpython/rptr.py	(original)
+++ pypy/branch/more-gckinds/pypy/rpython/rptr.py	Tue Sep 12 10:27:59 2006
@@ -3,7 +3,7 @@
 from pypy.objspace.flow import model as flowmodel
 from pypy.rpython.lltypesystem.lltype import \
      Ptr, ContainerType, Void, Signed, Bool, FuncType, typeOf, FixedSizeArray, \
-     InteriorPtr
+     InteriorPtr, OpaqueType
 from pypy.rpython.error import TyperError
 from pypy.rpython.rmodel import Repr, IntegerRepr
 
@@ -36,7 +36,7 @@
             return hop.inputarg(hop.r_result, arg=0)
         FIELD_TYPE = getattr(self.lowleveltype.TO, attr)
         if isinstance(FIELD_TYPE, ContainerType):
-            if self.lowleveltype.TO._gckind == 'gc' and FIELD_TYPE._gckind == 'raw':
+            if self.lowleveltype.TO._gckind == 'gc' and FIELD_TYPE._gckind == 'raw' and not isinstance(FIELD_TYPE, OpaqueType):
                 return hop.genop('same_as', [hop.inputarg(self, 0)],
                                  resulttype=self.lowleveltype)
             else:
@@ -101,7 +101,7 @@
         ARRAY = r_ptr.lowleveltype.TO
         ITEM_TYPE = ARRAY.OF
         if isinstance(ITEM_TYPE, ContainerType):
-            if ARRAY._gckind == 'gc' and ITEM_TYPE._gckind == 'raw':
+            if ARRAY._gckind == 'gc' and ITEM_TYPE._gckind == 'raw' and not isinstance(ITEM_TYPE, OpaqueType):
                 v_array, v_index = hop.inputargs(r_ptr, Signed)
                 INTERIOR_PTR_TYPE = r_ptr.lowleveltype._interior_ptr_type_with_index(ITEM_TYPE)
                 v_interior_ptr = hop.genop('malloc', [flowmodel.Constant(INTERIOR_PTR_TYPE, Void)],



More information about the Pypy-commit mailing list