[pypy-commit] pypy default: Complain explicitly if we see a getarrayitem or setarrayitem on a
arigo
pypy.commits at gmail.com
Wed Mar 23 17:48:53 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r83307:85f1a32d4766
Date: 2016-03-23 22:48 +0100
http://bitbucket.org/pypy/pypy/changeset/85f1a32d4766/
Log: Complain explicitly if we see a getarrayitem or setarrayitem on a
FixedSizeArray in the codewriter
diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -688,6 +688,10 @@
ARRAY = op.args[0].concretetype.TO
if self._array_of_voids(ARRAY):
return []
+ if isinstance(ARRAY, lltype.FixedSizeArray):
+ raise NotImplementedError(
+ "%r uses %r, which is not supported by the JIT codewriter"
+ % (self.graph, ARRAY))
if op.args[0] in self.vable_array_vars: # for virtualizables
vars = self.vable_array_vars[op.args[0]]
(v_base, arrayfielddescr, arraydescr) = vars
@@ -718,6 +722,10 @@
ARRAY = op.args[0].concretetype.TO
if self._array_of_voids(ARRAY):
return []
+ if isinstance(ARRAY, lltype.FixedSizeArray):
+ raise NotImplementedError(
+ "%r uses %r, which is not supported by the JIT codewriter"
+ % (self.graph, ARRAY))
if op.args[0] in self.vable_array_vars: # for virtualizables
vars = self.vable_array_vars[op.args[0]]
(v_base, arrayfielddescr, arraydescr) = vars
diff --git a/rpython/jit/codewriter/test/test_jtransform.py b/rpython/jit/codewriter/test/test_jtransform.py
--- a/rpython/jit/codewriter/test/test_jtransform.py
+++ b/rpython/jit/codewriter/test/test_jtransform.py
@@ -1316,6 +1316,21 @@
tr = Transformer(None, None)
py.test.raises(NotImplementedError, tr.rewrite_operation, op)
+def test_no_fixedsizearray():
+ A = lltype.FixedSizeArray(lltype.Signed, 5)
+ v_x = varoftype(lltype.Ptr(A))
+ op = SpaceOperation('getarrayitem', [v_x, Constant(0, lltype.Signed)],
+ varoftype(lltype.Signed))
+ tr = Transformer(None, None)
+ tr.graph = 'demo'
+ py.test.raises(NotImplementedError, tr.rewrite_operation, op)
+ op = SpaceOperation('setarrayitem', [v_x, Constant(0, lltype.Signed),
+ Constant(42, lltype.Signed)],
+ varoftype(lltype.Void))
+ e = py.test.raises(NotImplementedError, tr.rewrite_operation, op)
+ assert str(e.value) == (
+ "'demo' uses %r, which is not supported by the JIT codewriter" % (A,))
+
def _test_threadlocalref_get(loop_inv):
from rpython.rlib.rthread import ThreadLocalField
tlfield = ThreadLocalField(lltype.Signed, 'foobar_test_',
More information about the pypy-commit
mailing list