[pypy-svn] r55148 - in pypy/dist/pypy/translator/c: . test
afa at codespeak.net
afa at codespeak.net
Fri May 23 15:45:26 CEST 2008
Author: afa
Date: Fri May 23 15:45:25 2008
New Revision: 55148
Modified:
pypy/dist/pypy/translator/c/node.py
pypy/dist/pypy/translator/c/test/test_lltyped.py
Log:
Avoid the creation of an empty structure when Arrays of Void are used.
This happens in _rawffi, and shows up when inlining is disabled.
(I disabled inlining because translation then only needs 410Mb of RAM...
and fits on my home PC when not too many modules are added)
Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py (original)
+++ pypy/dist/pypy/translator/c/node.py Fri May 23 15:45:25 2008
@@ -261,7 +261,9 @@
yield '\tlong length;'
line = '%s;' % cdecl(self.itemtypename, 'items[%d]'% self.varlength)
if self.ARRAY.OF is Void: # strange
- line = '/* %s */' % line
+ line = '/* array of void */'
+ if self.ARRAY._hints.get('nolength', False):
+ line = 'char _dummy; ' + line
yield '\t' + line
yield '};'
Modified: pypy/dist/pypy/translator/c/test/test_lltyped.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_lltyped.py (original)
+++ pypy/dist/pypy/translator/c/test/test_lltyped.py Fri May 23 15:45:25 2008
@@ -650,3 +650,10 @@
fn = self.getcompiled(llf)
fn()
+ def test_cast_to_void_array(self):
+ from pypy.rpython.lltypesystem import rffi
+ def llf():
+ TYPE = Ptr(rffi.CArray(Void))
+ y = rffi.cast(TYPE, 0)
+ fn = self.getcompiled(llf)
+ fn()
More information about the Pypy-commit
mailing list