[pypy-svn] r47206 - pypy/branch/kill-keepalives-again/pypy/rpython/rctypes

arigo at codespeak.net arigo at codespeak.net
Fri Oct 5 22:21:23 CEST 2007


Author: arigo
Date: Fri Oct  5 22:21:23 2007
New Revision: 47206

Modified:
   pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rmodel.py
   pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rvoid_p.py
Log:
More tweaks in rctypes.  I think that tests pass now.


Modified: pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rmodel.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rmodel.py	(original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rmodel.py	Fri Oct  5 22:21:23 2007
@@ -374,11 +374,10 @@
         llops.genop('setarrayitem', [v_destarray, v_destindex, v_source])
 
 def genreccopy_structfield(llops, v_source, v_deststruct, fieldname):
-    c_name = inputconst(lltype.Void, fieldname)
     FIELDTYPE = getattr(v_deststruct.concretetype.TO, fieldname)
     if isinstance(FIELDTYPE, lltype.ContainerType):
-        v_dest = llops.genop('getsubstruct', [v_deststruct, c_name],
-                             resulttype = lltype.Ptr(FIELDTYPE))
+        v_dest = gen_unsafe_getfield(llops, v_deststruct, fieldname)
         genreccopy(llops, v_source, v_dest)
     else:
+        c_name = inputconst(lltype.Void, fieldname)
         llops.genop('setfield', [v_deststruct, c_name, v_source])

Modified: pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rvoid_p.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rvoid_p.py	(original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/rctypes/rvoid_p.py	Fri Oct  5 22:21:23 2007
@@ -1,4 +1,5 @@
 from pypy.rpython.rctypes.rmodel import CTypesValueRepr, C_ZERO
+from pypy.rpython.rctypes.rmodel import unsafe_getfield
 from pypy.rpython.rctypes.rstringbuf import StringBufRepr
 from pypy.annotation.pairtype import pairtype
 from pypy.rpython.rstr import AbstractStringRepr
@@ -54,7 +55,7 @@
 
 def ll_string2addr(s):
     if s:
-        ptr = lltype.direct_arrayitems(s.chars)
+        ptr = lltype.direct_arrayitems(unsafe_getfield(s, 'chars'))
         return llmemory.cast_ptr_to_adr(ptr)
     else:
         return llmemory.NULL



More information about the Pypy-commit mailing list