Hi pypy !<br><br>I'm still exploring rpython and I face a problem when adding a jit to an interpreter.<br>In Assembler class (pypy.jit.codewriter.assembler), in emit_const method, it seems to be assumed that there is no more than 256 constants. (constant seems to be accessed in a array with a 1 byte index).<br>
<br>If I try to translate an interpreter with more than 256 constant objects (like string ?), I get this error :<br><br>[translation:ERROR] Error:<br>[translation:ERROR] Traceback (most recent call last):<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/translator/goal/translate.py", line 308, in main<br>
[translation:ERROR] drv.proceed(goals)<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/translator/driver.py", line 810, in proceed<br>[translation:ERROR] return self._execute(goals, task_skip = self._maybe_skip())<br>
[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/translator/tool/taskengine.py", line 116, in _execute<br>[translation:ERROR] res = self._do(goal, taskcallable, *args, **kwds)<br>
[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/translator/driver.py", line 286, in _do<br>[translation:ERROR] res = func()<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/translator/driver.py", line 397, in task_pyjitpl_lltype<br>
[translation:ERROR] backend_name=self.config.translation.jit_backend, inline=True)<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/metainterp/warmspot.py", line 42, in apply_jit<br>
[translation:ERROR] **kwds)<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/metainterp/warmspot.py", line 199, in __init__<br>[translation:ERROR] self.codewriter.make_jitcodes(verbose=verbose)<br>
[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/codewriter/codewriter.py", line 72, in make_jitcodes<br>[translation:ERROR] self.transform_graph_to_jitcode(graph, jitcode, verbose)<br>
[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/codewriter/codewriter.py", line 61, in transform_graph_to_jitcode<br>[translation:ERROR] self.assembler.assemble(ssarepr, jitcode)<br>
[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/codewriter/assembler.py", line 35, in assemble<br>[translation:ERROR] self.write_insn(insn)<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/codewriter/assembler.py", line 135, in write_insn<br>
[translation:ERROR] is_short = self.emit_const(x, kind, allow_short=True)<br>[translation:ERROR] File "/home/olivier/workspace/talstai_ext/pypy-1.6-src/pypy/jit/codewriter/assembler.py", line 108, in emit_const<br>
[translation:ERROR] self.code.append(chr(self.constants_dict[key]))<br>[translation:ERROR] ValueError: character code not in range(256)<br><br>With this snippet of code :<br><br>self.constants_dict[key] = 256 - len(constants)<br>
<br>If len(constants) is 257,<br>then self.constants_dict[key] is -1<br>and chr(-1) raise the ValueError.<br><br>I attached a (really) stupid example to reproduce.<br>When I browse pypy sources in rpython, I can't believe there is less than 256 constants of type 'ref'.<br>
<br>What do you think ? Did I miss something ?<br><br>Thanks !<br><br>Zariko.<br>