cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | the secret reason for us trying to get PyPy users: to test the JIT well enough that we're somewhat confident about it
<user24>
I'm currently trying to build an interpreter with RPython. Right now, the translator thinks the elements of a list i use are not non-negative. How can I make it think they are?
<simpson>
user24: You can `assert i >= 0` and then the annotator will be convinced that `i` is non-negative.
<user24>
simpson: I tried, but it does not have the desired effect
<user24>
(nothing changes)
<user24>
maybe my code is too convoluted and confuses it
<simpson>
user24: So, first, in terms of reading the exception, the problem is at l85, not l454.
<user24>
Is it possible to annotate the type in advance?
<simpson>
Note how, on l79 of the traceback, the operations leading up to the problem: v8 = add((9), lencode_0)
<simpson>
So it looks like `lencode` could be negative. Indeed, we see that `state` is a list of ints which could be negative.
<user24>
yep, that's the list
<simpson>
So you probably want to check and handle the case where lencode is negative as an implementation error.
<simpson>
assert lencode >= 0, 'Implementation error: lencode was negative!?'
<user24>
the elements in the list (the runtime state) should never be negative. is there a way of ensuring the types of its elements without having to assert() on every modification?
<simpson>
You should only have to assert at places where the modification could cause stuff to go negative, but manually finding all of those locations could be a real pain.
<user24>
yeah
JamJam_kid has joined #pypy
<user24>
simpson: I just noticed that I have to rewrite the thing anyway, since it uses lists of lists/sometimes ints
marself has quit [Quit: WeeChat 1.9.1]
marself has joined #pypy
marself has quit [Client Quit]
ceridwen has quit [Ping timeout: 265 seconds]
<user24>
Ok, RPython seems to support lists of lists of integers
<julius>
i ran into problems when using the portable pypy version on ubuntu 18.04: https://bpaste.net/show/bc678b99f2bc will a pypy build from source solve those?
<user24>
At first I didn't like the Mandelbrot thing but now it is such a good reward
raynold has joined #pypy
antocuni has joined #pypy
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 248 seconds]
tbodt has joined #pypy
energizer has joined #pypy
antocuni has quit [Ping timeout: 264 seconds]
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 240 seconds]
<user24>
I downloaded a prebuilt pypy binary and use it to invoke translate.py on my interpreter.py. Now I want to use from pypy.rlib.jit import JitDriver, but get: ImportError: No module named pypy Do I have to build pypy from source?
<cfbolz>
user24: the tutorial is out of date. It's now rpython.rlib.jit
dddddd has quit [Remote host closed the connection]
<cfbolz>
If it's just the last one, the RPython jit will probably nicely recognize that you're not doing anything with the serialized state and remove it in many cases
<user24>
for now, I just keep the outermost process in a deserialized state as long as it is running.
dmarasca has joined #pypy
<user24>
since inner processes do not have any effects but on themselves, and the system is single threaded and deterministic I can also optimize the tree traversal
<dmarasca>
Hi! I am working on a Smalltalk VM using RPython and i am having a few issues with long traces. Is there a tool besides jitviewer to view/debug traces? Thanks!