[9] RFR(S): 8174164: SafePointNode::_replaced_nodes breaks with irreducible loops

Roland Westrelin rwestrel at redhat.com
Tue Feb 14 10:13:52 UTC 2017

> I assume test_helper() is inlined into test() in all these
> cases. Right?


> Why we do replacement on exit of method inlined() which not have any
> code? Should we do it in Call node map before we inline and parse it?

replaced nodes were introduced for this code pattern:

    static void inlined1(Object o) {
        A a = (A)o;

    static void inlined2(Object o) {

    static void inlined3(Object o) {

    static void test(Object o) {
        // use o that benefit from knowing it's of type A

This works if we propagate the replaced nodes at the end of parsing.

> Is not this bad (not inlining)?

Sure it's a bad thing. But then again it works by accident because there
happens to be a call to inlined(). What would be nice is that the
virtual call be inlined with or without the call to inlined() (apply
replaced nodes after the load?).

> But I think it is smaller number of cases vs current fix. Also most
> OSR methods are recompiled as normal nmethods so affect will be only
> temporary.

My test case is pretty simple and it results in irreducible
loops. Replaced nodes were added for nashorn and I remember they had
simple scripts with a loop that would only get OSR compiled. Anyway,
here is the fix with a check for irreducible loops:



More information about the hotspot-compiler-dev mailing list