[pypy-svn] r46488 - in pypy/dist/pypy/translator/jvm: . test
antocuni at codespeak.net
antocuni at codespeak.net
Wed Sep 12 00:13:07 CEST 2007
Author: antocuni
Date: Wed Sep 12 00:13:05 2007
New Revision: 46488
Modified:
pypy/dist/pypy/translator/jvm/generator.py
pypy/dist/pypy/translator/jvm/test/test_list.py
Log:
we can't assume MALLOC_ZERO_FILLED for jvm!
Modified: pypy/dist/pypy/translator/jvm/generator.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/generator.py (original)
+++ pypy/dist/pypy/translator/jvm/generator.py Wed Sep 12 00:13:05 2007
@@ -1077,7 +1077,10 @@
def push_null(self, OOTYPE):
self.emit(ACONST_NULL)
- DEFINED_INT_SYMBOLICS = {'MALLOC_ZERO_FILLED':1,
+ # we can't assume MALLOC_ZERO_FILLED, because for scalar type the
+ # default item for ArrayList is null, not e.g. Integer(0) or
+ # Char(0).
+ DEFINED_INT_SYMBOLICS = {'MALLOC_ZERO_FILLED':0,
'0 /* we are not jitted here */': 0}
def push_primitive_constant(self, TYPE, value):
Modified: pypy/dist/pypy/translator/jvm/test/test_list.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/test/test_list.py (original)
+++ pypy/dist/pypy/translator/jvm/test/test_list.py Wed Sep 12 00:13:05 2007
@@ -8,3 +8,11 @@
def test_getitem_exc(self):
py.test.skip('fixme!')
+
+ def test_zeroed_list(self):
+ def fn():
+ lst = [0] * 16
+ return lst[0]
+ res = self.interpret(fn, [])
+ assert res == 0
+
More information about the pypy-svn
mailing list