The cost would be a combination of the deopt, cost of slow down, and cost of compilation all of which are variable based on the generated code which embeds the constant and the compiler used.
> On 22 Apr 2019, at 20:25, 'Carl Mastrangelo' via mechanical-sympathy > <mechanical-sympathy@googlegroups.com> wrote: > > These classes (especially MostlyConstant) are pretty cool. I have some > questions about them: > > 1. In MostlyConstant I noticed that modifying the constant doesn't call > MutableCallSite.syncAll(). Should it? > > 2. A followup to #1: MutableCallSite.syncAll() doesn't actually seem > implemented in OpenJDK. Is it correct to call it? > > 3. In my non-scientific JMH measurements, it seems like modifying the call > site takes about 1us. Does that sound about right? From what I can tell > modifying the constant is akin to deoptimizing the code and recompiling it, > which means that 1us seems really fast. > >> On Monday, February 26, 2018 at 11:29:19 AM UTC-8, Remi Forax wrote: >> Hi all, >> i'm preparing a talk at DevoxxFR on how to make a field value, a returned >> value, etc constant for any decent JITs (everything but c1), so i've bundled >> together several patterns i use for implementing dynamic language runtimes >> into an Java API >> >> https://github.com/forax/exotic >> >> I would like to have your comments about those exotic classes (it's already >> has been done, it's stupid, it's not thread safe, etc) >> >> regards, >> RĂ©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-sympathy+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.