A general question about inlining. Take the following code:

void m() {
    ensureSomething();
    ...
}

void ensureSomething() {
    if (someTest()) return;
    doSomething();
}

boolean someTest() {
    return ... // a simple boolean expression;
}

void doSomething() {
    // heavy and long code
    ...
}

I would like the lightweight test in ensureSomething(), but not the
heavy doSomething(), to be inlined at each call site, like that in m().
Is a general jvm (HotSpot in primis) smart enough to do the inlining by
itself or is it better to code the pattern more explicitly by using
method handles to factor out the test, e.g., using guarded method handles?

Thanks
Raffaello
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to