Hi,
at the sprint we talked about how to better handle boxes that become
virtual in a bridge. In the jit-virtual_state branch there is now a
first step towards that. Try:

  py.test test/test_virtual.py -k test_dual_counter --viewloops

in pypy/jit/metainterp. The idea is compare the state of all the
OptValues of the jump_args at the end of the bridge white all the
OptValues of the jump_args at the end of  the preamble. We will need
this check anyway to be sure that it is safe to call the loop (just
being able to inline the short preamble turned out not to be enough).
When the states differ we have 3 options:

  - Force some of the virtuals to make the states match
  - Emitt guards to make the states match
  - Retrace the loop to form a new specialized version

We will need some heuristic to choose between these. Currently I emit
GUARD_CLASS if the boxes was of correct class during the current trace
(box.value). In all other cases I retrace (which is probably too
often).

For the test above there are 2 virtuals, node1 and node2. There will
be 3 specialized version of the loop generated:

  - node1 virtual, node2 allocated
  - node2 virtual, node1 allocated
  - both node1 and node2 virtuals

The first 2 of these are currently generated. The last is not. For the
last to be generated the retraced loop will need to inherit the
virtuals from the bridge that causes it to be retraced (in the same
manner as the bridges inherit the virtuals of their parent loops).

-- 
Håkan Ardö
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to