Polimorphic vs Megamorphic calls
Dawid Weiss
dawid.weiss at gmail.com
Wed Mar 30 17:19:51 UTC 2016
Aleksey has a very nice and relevant blog post about it:
http://shipilev.net/blog/2015/black-magic-method-dispatch/
Dawid
On Wed, Mar 30, 2016 at 5:12 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> ----- Mail original -----
>> De: "Ionut" <ionutb83 at yahoo.com>
>> À: "Hotspot-dev Developers" <hotspot-dev at openjdk.java.net>
>> Envoyé: Mardi 29 Mars 2016 10:32:40
>> Objet: Polimorphic vs Megamorphic calls
>>
>> Hello All,
>
> Hi,
>
>> Could you please explain what is the difference between a Polimorphic and a Megamorphic call?
>
> It's a dynamic property of a method call instruction (invokeinterface and invokevirtual in the Java bytecode).
> This is related to an optimization technique called inlining-cache [1],
> For Hotspot,
> - if the instruction has always been called the same method implementation, the callsite is monomorphic,
> and the inlining cache is just a comparison and a jump,
> - if the instruction has been called a small number of method implementations (for Hotspot, it's 2),
> the inlining cache do several comparison/jump checks.
> - if the instruction has been called with a lot of different implementations,
> there is no inlining cache, a virtual call [2] is generated instead.
>
>
>> If you have some documentation on this topic or how it is handled by HotSpot would be great.
>
> There is a wiki, (not updated as i should be)
>
> https://wiki.openjdk.java.net/display/HotSpot/PerformanceTechniques
> (see sections Profiling, Deoptimization, Methods)
>
>
>> Regards,
>> Ionut
>
> Rémi
>
> [1] https://en.wikipedia.org/wiki/Inline_caching
> [2] https://wiki.openjdk.java.net/display/HotSpot/VirtualCalls
More information about the hotspot-dev
mailing list