Thanks for your responses :) sobota, 5 lutego 2022 o 18:38:11 UTC+1 Gil Tene napisał(a):
> You might want to give it a spin on Prime (Zing) 11 and see what you get, > the Falcon JIT in Prime will do polymorphic guarded in-line caching for up > to 6 implementers by default, I believe (as is configurable to higher if > needed). This is exactly the sort of thing that capability is meant for. > > On Saturday, February 5, 2022 at 1:35:31 AM UTC-10 [email protected] > wrote: > >> JVM 11+ (OpenJDK / Zulu) >> >> sobota, 5 lutego 2022 o 12:30:38 UTC+1 [email protected] napisał(a): >> >>> which jvm? >>> >>> On Sat, Feb 5, 2022 at 6:26 AM r r <[email protected]> wrote: >>> >>>> Hello, >>>> we know that there are some techniques that make virtual calls not so >>>> expensive in JVM like Inline Cache or Polymorphic Inline Cache. >>>> >>>> Let's consider the following situation: >>>> >>>> Base is an interface. >>>> >>>> public void f(Base[] b) { >>>> for(int i = 0; i < b.length; i++) { >>>> b[i].m(); >>>> } >>>> } >>>> >>>> I see from my profiler that calling virtual (interface) method m is >>>> relatively expensive. >>>> f is on the hot path and it was compiled to machine code (C2) but I >>>> see that call to m is a real virtual call. It means that it was not >>>> optimised by JVM. >>>> >>>> The question is, how to deal with a such situation? Obviously, I cannot >>>> make the method m not virtual here because it requires a serious >>>> redesign. >>>> >>>> Can I do anything or I have to accept it? I was thinking how to "force" >>>> or "convince" a JVM to >>>> >>>> 1. use polymorphic inline cache here - the number of different types in >>>> b is quite low - between 4-5 types. >>>> 2. to unroll this loop - length of b is also relatively small. After >>>> an unroll it is possible that Inline Cache will be helpful here. >>>> >>>> Thanks in advance for any advices. >>>> Regards, >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "mechanical-sympathy" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web, visit >>>> https://groups.google.com/d/msgid/mechanical-sympathy/9b52b34e-6388-4cba-b89e-ce7521109cban%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/mechanical-sympathy/9b52b34e-6388-4cba-b89e-ce7521109cban%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> >>> >>> -- >>> Studying for the Turing test >>> >> -- You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/fc7141da-8b5a-4afc-8439-bd1a1fe0ca75n%40googlegroups.com.
