Remove the assert in Integer.valueOf()
Alan Bateman
Alan.Bateman at oracle.com
Tue Apr 24 15:01:50 UTC 2012
On 24/04/2012 14:56, Rémi Forax wrote:
>
> Here, I don't really ask for tweaking something but more to remove an
> assert
> which do something which is unrelated to the current algorithm.
> In my opinion, it's a debug assert used during the development
> that slip into the production code. The fact that the range [-128,
> 127] should be
> covered by the cache is mandated by the JLS, but if you really want an
> assert
> you should move it when high and low are initialized (they are final)
> and not where they are used.
>
> I also agree that the inlining heuristic should be changed and
> I'm sure that everybody that have looked to the inlining heuristic
> code of Hotspot will agree with that
> but this is somehow unrelated to the problem.
> This is how I've found this assert,
> it doesn't change the fact that this assert should not be there.
I added that assert as part of the work of 6807702. You can't use
asserts in code that is executed before system initialization is
complete and I think this is why we put the assert is valueOf rather
than in the initializer. I don't have any objection to removing it,
assuming Joe is okay with it too.
-Alan
[1] http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4c3f752993a5
More information about the core-libs-dev
mailing list