RFR: 8145096: Undefined behaviour in HotSpot, Take 2
vladimir.kozlov at oracle.com
Tue Dec 15 23:34:41 UTC 2015
Changes are good and implemented what was suggested during previous review.
I will wait what Kim will say.
On 12/15/15 8:44 AM, Andrew Haley wrote:
> To recap:
> I've been tracing through HotSpot with GCC's undefined behaviour
> sanitizer, which detects instances of undefined behaviour. There are
> many instances of UB we probably don't want to fix (e.g. unaliged
> accesses on x86) but some of them are serious.
> This patch fixes some signed integer overflow bugs in HotSpot which
> are certainly known to occur. These mostly occur in C2. There are
> surely many more such bugs but to begin with I want to concentrate on
> This patch introduces some functions which perform java-like
> arithmetic: java-add, etc. We think we've found a portable way to do
> I have tried my utmost to change things as little as possible. There
> are certainly places where we could make things more efficient, but my
> goal was to limit the scope of this diff to fixing bugs.
> Apart from the undefined behaviour being fixed, this patch should
> cause no behavioural changes, except in one case.
> AdvancedThresholdPolicy::weight() grossly overflows, so much so that
> its result is substantially noise. That's fixed here.
> It might be that the hashing functions for C2 types really should have
> unsigned type rather than using java_add; I can make that change but
> (as I said) I'm trying to change things as little as possible.
More information about the hotspot-dev