Thanks--Brian
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 mechanical-symp...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/CAFtUM9Zt%2BwJvkDix_ZEYA%2B5u6hA86VQW7d5ceEyvxetiLvq%2BfA%40mail.gmail.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/CAHjP37EiQQKRfJvm3AVv87DiUpimxckyTVTtHRxgZDYUhfMC4g%40mail.gmail.com.
De: "Brian Harris" <brianfr...@gmail.com>
À: "mechanical-sympathy" <mechanica...@googlegroups.com>
Envoyé: Lundi 30 Décembre 2019 17:13:38
Objet: Re: does call site polymorphism factor in method overrides?
Good to know Vitaly!So a poor example then. Better example is an abstract class with a method implementation that no subtypes override, yet multiple subtypes are found to be the receiver of a particular call site. Should we expect a monomorphic call site in that case.On Sun, Dec 29, 2019 at 12:42 PM Vitaly Davidovich <vit...@gmail.com> wrote:On Sun, Dec 29, 2019 at 10:22 AM Brian Harris <brianfr...@gmail.com> wrote:Hello!I was hoping to get one point of clarification about avoiding megamorphic call sites, after reading these excellent articles:When the runtime type of the call receiver is being observed, is it considered whether that type actually overrides the method in question? For example, when the method is an interface's default method that none of the runtime call receivers override, can we expect to get a monomorphic call site regardless of how many different receiver types are observed at runtime, given there is only one method body to invoke?In Hotspot, CHA is currently (AFAIK) disabled for default methods (https://bugs.openjdk.java.net/browse/JDK-8036580). So you have to be careful putting hot code into them. Overriding the method in the impl and just calling super will at least restore some performance if type profiling at the callsite helps.
ThanksBrian
ThanksBrianRémi
--
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 mechanical-symp...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/197490853.62864.1577729341131.JavaMail.zimbra%40u-pem.fr.
The big (potential) optimization loss here would be inlining; branch + call overhead itself is unlikely to matter modulo truly trivial code called in a tight loop. Missed optimizations due to inlining failure is the real problem.ThanksBrianRémi
--
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 mechanical-symp...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/197490853.62864.1577729341131.JavaMail.zimbra%40u-pem.fr.
Good to know Vitaly!So a poor example then. Better example is an abstract class with a method implementation that no subtypes override, yet multiple subtypes are found to be the receiver of a particular call site. Should we expect a monomorphic call site in that case.
On Sun, Dec 29, 2019 at 12:42 PM Vitaly Davidovich <vit...@gmail.com> wrote:
On Sun, Dec 29, 2019 at 10:22 AM Brian Harris <brianfr...@gmail.com> wrote:Hello!I was hoping to get one point of clarification about avoiding megamorphic call sites, after reading these excellent articles:When the runtime type of the call receiver is being observed, is it considered whether that type actually overrides the method in question? For example, when the method is an interface's default method that none of the runtime call receivers override, can we expect to get a monomorphic call site regardless of how many different receiver types are observed at runtime, given there is only one method body to invoke?In Hotspot, CHA is currently (AFAIK) disabled for default methods (https://bugs.openjdk.java.net/browse/JDK-8036580). So you have to be careful putting hot code into them. Overriding the method in the impl and just calling super will at least restore some performance if type profiling at the callsite helps.
Thanks--Brian
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 mechanical-sympathy+unsub...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/CAFtUM9Zt%2BwJvkDix_ZEYA%2B5u6hA86VQW7d5ceEyvxetiLvq%2BfA%40mail.gmail.com.
--Sent from my phone--
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 mechanical-sympathy+unsub...@googlegroups.com.