general inlining
Raffaello Giulietti
raffaello.giulietti at gmail.com
Tue Feb 16 06:07:46 PST 2010
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
More information about the mlvm-dev
mailing list