[pypy-issue] [issue925] RPython arrays sometimes getting the wrong type?
Laurence Tratt
tracker at bugs.pypy.org
Thu Oct 27 22:19:36 CEST 2011
New submission from Laurence Tratt <laurie at tratt.net>:
This patch to the RPython Converge VM was meant to be a simple code tidy-up:
https://github.com/ltratt/converge/commit/65cc1dc822c19df0f3478b0ac01a169d51350d93
Under --opt=3 and below it works fine. With --opt=jit, the translation throws
up this error:
[translation:ERROR] Error:
[translation:ERROR] Traceback (most recent call last):
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/translator/goal/translate.py", line 308, in main
[translation:ERROR] drv.proceed(goals)
[translation:ERROR] File "/home/ltratt/tmp/pypy/pypy/translator/driver.py",
line 809, in proceed
[translation:ERROR] return self._execute(goals, task_skip =
self._maybe_skip())
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/translator/tool/taskengine.py", line 116, in _execute
[translation:ERROR] res = self._do(goal, taskcallable, *args, **kwds)
[translation:ERROR] File "/home/ltratt/tmp/pypy/pypy/translator/driver.py",
line 286, in _do
[translation:ERROR] res = func()
[translation:ERROR] File "/home/ltratt/tmp/pypy/pypy/translator/driver.py",
line 397, in task_pyjitpl_lltype
[translation:ERROR] backend_name=self.config.translation.jit_backend,
inline=True)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/metainterp/warmspot.py", line 43, in apply_jit
[translation:ERROR] **kwds)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/metainterp/warmspot.py", line 210, in __init__
[translation:ERROR] self.codewriter.make_jitcodes(verbose=verbose)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/codewriter.py", line 72, in make_jitcodes
[translation:ERROR] self.transform_graph_to_jitcode(graph, jitcode, verbose)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/codewriter.py", line 41, in
transform_graph_to_jitcode
[translation:ERROR] transform_graph(graph, self.cpu, self.callcontrol,
portal_jd)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/jtransform.py", line 24, in
transform_graph
[translation:ERROR] t.transform(graph)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/jtransform.py", line 43, in transform
[translation:ERROR] self.optimize_block(block)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/jtransform.py", line 67, in
optimize_block
[translation:ERROR] oplist = self.rewrite_operation(op)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/jtransform.py", line 202, in
rewrite_operation
[translation:ERROR] return rewrite(self, op)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/codewriter/jtransform.py", line 520, in
rewrite_op_getarrayitem
[translation:ERROR] arraydescr = self.cpu.arraydescrof(ARRAY)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/backend/llsupport/llmodel.py", line 236, in
arraydescrof
[translation:ERROR] return get_array_descr(self.gc_ll_descr, A)
[translation:ERROR] File
"/home/ltratt/tmp/pypy/pypy/jit/backend/llsupport/descr.py", line 254, in
get_array_descr
[translation:ERROR] assert isinstance(ARRAY, lltype.GcArray)
[translation:ERROR] AssertionError
Sticking a print in to see what type ARRAY is gives this:
Array of * Func ( * GcStruct VM.VM { super, inst_pypy_config, inst_builtins,
inst_cf_stack, inst_mods, inst_spare_ff, inst_st } ) -> Void
It turns out that only one tiny little part of the patch causes problems.
This patch reverts two lines:
https://github.com/ltratt/converge/commit/75498f726fda2056722bac69c1388f42c229935c
but then ARRAY has what I assume is the correct type:
GcArray of dictentry { key: * GcStruct rpy_string { hash, chars }, value: *
GcStruct object { typeptr } }
At the very least, everything executes as I would expect with this type!
What's weird is that executing one of:
Builtins.new_c_con_func_for_mod(vm, "exit", exit, mod)
Builtins.new_c_con_func_for_mod(vm, "println", println, mod)
on their own is fine (i.e. comment out either one, and things translate
fine). It's only in conjunction with each other that they throw a problem.
This is all running against PyPy HEAD. I have to be honest, this one has
got me completely stumped.
----------
messages: 3388
nosy: ltratt, pypy-issue
priority: bug
status: unread
title: RPython arrays sometimes getting the wrong type?
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue925>
________________________________________
More information about the pypy-issue
mailing list