[pypy-issue] Issue #2076: Pyrlang float datatype dead in virtualiazble array when switched out with bridge (pypy/pypy)
issues-reply at bitbucket.org
Mon Jul 6 04:21:25 CEST 2015
New issue 2076: Pyrlang float datatype dead in virtualiazble array when switched out with bridge
The float type in Pyrlang is simply a wrapper class of RPython float type.
My test Erlang script tried to do something like sum(list(3.1415926,3.1415926,3.1415926...)), so the JIT generated a trace that extract one element from the list, and add it into the sum result, and then the next element...
On the other hand, there is a yield counter in dispatch loop, around the bytecode IS_NONEMPLY_LIST (or any other if-statement-like bytecode instruction), when the counter reduced to 0, the process (dispatch loop) will be switched out.
I also annotated the X_Register as virtualiazble to improve the accessing performance.
My situation is that, when I execute the test Erlang script with large scale, the switched-out-path will be recorded as a bridge, which ended with a finish(Constr(ptr35) ...), and the computing result will be wrong. (say computing a 1000000 length list, the result should be 3141592.65359 but I only got 18.849556).
I also tried Erlang Integer for the same function, it worked well.
Tried executing without scheduler, worked well.
Tried less scale so the switched-out-path will not be recorded as bridge, worked well.
Tried removing the virtualiable in X Register, worked well.
You can reproduce the bug by:
1. clone or pull my repository from https://firstname.lastname@example.org/hrc706/pyrlang.git.
2. rpython -Ojit targettest.py
3. ./targettest-c test_beam/test_pi.beam test_s 1000000 (will output 18.849556)
./targettest-c test_beam/test_pi.beam test_s 100000 (will output 314159.265359, as expected)
./targettest-c test_beam/test_pi.beam test_si 100000 (executing the test function with integers, always output the correct result)
You can also check the Erlang script source at test_beam/test_pi.erl if you like :-).
More information about the pypy-issue