Inlining primitive targets?
Chanwit Kaewkasi
chanwit at gmail.com
Fri Jul 17 03:10:57 PDT 2009
Hi all,
I just would like to see if the Hotspot is possible to inline this call site:
InvokeDynamic.<Object>"plus"(Object, Object)
with this target:
public static final int plus(int, int) {
return a + b;
}
I tested calling InvokeDynamic.<int>"plus"(Object, Object) with the above target
and it is running fine, although it's not inlined. C2 was trying to
inline it, but it failed.
See the log here [1].
Then, I tested calling InvokeDynamic.<Object>"plus"(Object, Object)
also with the above target.
This time I used the Fibonacci program, and JVM crashed. Although it
crashed, the inlining
information is really interesting to me. You cal see the full log from [2].
[Stub Code]
0xb3e78b00: jmp 0xb3e76e60 ; {no_reloc}
0xb3e78b05: push 0xb3e78b05 ; {section_word}
0xb3e78b0a: jmp 0xb3e4eb80 ; {runtime_call}
[Constants]
0xb3e78b0f: int3
@ 11 java.dyn.MethodHandle::invoke native method
@ 14 sun.dyn.FromGeneric$Adapter::convert_I inline (hot)
sun.dyn.FromGeneric$A2::invoke_I2 -> @ 14
sun.dyn.FromGeneric$Adapter::convert_I >>TypeProfile (32782/32782
counts) = sun/dyn/FromGeneric$A2 (9 bytes)
@ 5 java.dyn.MethodHandle::invoke native method
@ 33 java.dyn.MethodHandle::invoke native method
@ 33 g7.tests.classgen.Fib::fib inline (hot)
@ 2 java.lang.Integer::valueOf inline (hot)
@ 5 java.dyn.MethodHandle::invoke native method
@ 5 com.chanwit.g7.runtime.DefaultNumberMethods::__lt__
inline (hot)
@ 1 java.lang.Integer::intValue inline (hot)
@ 5 java.lang.Integer::intValue inline (hot)
@ 16 java.lang.Boolean::valueOf inline (hot)
@ 13 java.lang.Boolean::booleanValue inline (hot)
@ 25 java.lang.Integer::valueOf inline (hot)
@ 28 java.dyn.MethodHandle::invoke native method
@ 28 sun.dyn.FromGeneric$A2::invoke_I2 inline (hot)
@ 11 java.dyn.MethodHandle::invoke native method
@ 14 sun.dyn.FromGeneric$Adapter::convert_I inline (hot)
sun.dyn.FromGeneric$A2::invoke_I2 -> @ 14
sun.dyn.FromGeneric$Adapter::convert_I >>TypeProfile (32782/32782
counts) = sun/dyn/FromGeneric$A2 (9 bytes)
@ 5 java.dyn.MethodHandle::invoke native method
@ 33 java.dyn.MethodHandle::invoke native method
@ 33 g7.tests.classgen.Fib::fib recursively inlining too deep
@ 40 java.lang.Integer::valueOf inline (hot)
@ 43 java.dyn.MethodHandle::invoke native method
@ 43 sun.dyn.FromGeneric$A2::invoke_I2 inline (hot)
So my questions are (sorry if they look very newbie-ish):
I think in several cases, we need binary operators to be primitives.
So is it possible to by-pass this call sun.dyn.FromGeneric$A2::invoke_I2 ?
Or is it possible to have a call like
sun.dyn.FromGeneric$A2::invoke_I2, but with (II)I.
BTW, as the last time the target (Integer, Integer)Integer is
successfully inlined,
If I would like to do a simple boxing/unboxing pairs removal on
generated assembly codes,
which part of C2 can I start looking at?
Best regards,
Chanwit
[1] http://files.getdropbox.com/u/381580/mlvm/int_inlined.dump
[2] http://files.getdropbox.com/u/381580/mlvm/fib_inliing_00.dump
--
Chanwit Kaewkasi
PhD Candidate,
Centre for Novel Computing
School of Computer Science
The University of Manchester
Oxford Road
Manchester
M13 9PL, UK
More information about the mlvm-dev
mailing list