RFR: 8224162: assert(profile.count() == 0) failed: sanity in InlineTree::is_not_reached

Jie Fu fujie at loongson.cn
Thu May 30 06:16:12 UTC 2019


Hi Vladimir Ivanov,

Thank you for your kind review and nice suggestions.
Updated: http://cr.openjdk.java.net/~jiefu/8224162/webrev.06/

Please see comments inlined below.

Thanks a lot.
Best regards,
Jie

On 2019/5/29 下午8:02, Vladimir Ivanov wrote:
> There are other places where overflow can occur:
>
>           int rcount = call->receiver_count(i) + epsilon;
>
>           receivers_count_total += rcount;
>
> Maybe introduce a helper routine for saturating addition?
>
Good catch. Fixed.
>
> src/hotspot/share/oops/methodData.hpp:
>
>    uint count() const {
> -    return uint_at(count_off);
> +    intptr_t raw_data = intptr_at(count_off);
> +    if (raw_data > max_jint) {
> +      raw_data = max_jint;
> +    } else if (raw_data < min_jint) {
> +      raw_data = min_jint;
> +    }
> +    return uint(raw_data);
>    }
>
> Should uintptr_t be used here instead? It looks like this version 
> won't work as expected on 32-bit platforms (since uint => intrptr_t 
> conversion becomes lossy).
uintptr_t shouldn't be used here since the counter may contain a 
negative value[1][2].
If uintx was used, max_jint would be returned by CounterData::count() in 
cases of negative values, which is unexpected.
And I don't think the type conversion is problematic due to the 
inaccuracy of profile[3].
What we care about is just whether the counter is greater or less than a 
specific threshold, not its absolute value.
>
> Also, I don't understand why you added comparison against min_jint. 
> Since counts are unsigned, the following should be enough:
I did it because the counter may contain a negative value.
It might be better to also detect and handle the underflow condition.
The interpreter also does this here[4].

[1] 
http://hg.openjdk.java.net/jdk/jdk/file/c41783eb76eb/src/hotspot/share/ci/ciMethod.cpp#l515
[2] 
http://hg.openjdk.java.net/jdk/jdk/file/c41783eb76eb/src/hotspot/share/ci/ciMethod.cpp#l533
[3] 
http://hg.openjdk.java.net/jdk/jdk/file/c41783eb76eb/src/hotspot/share/oops/methodData.hpp#l49
[4] 
http://hg.openjdk.java.net/jdk/jdk/file/c41783eb76eb/src/hotspot/cpu/x86/interp_masm_x86.cpp#l1407


>
>   uint count() const {
>     uintx raw_data = (uintx)intptr_at(count_off);
>     if (raw_data > max_jint) {
>       raw_data = max_jint;
>     }
>     return uint(raw_data);
>   }



More information about the hotspot-compiler-dev mailing list