RFR: 8254369: Node::disconnect_inputs may skip precedences [v2]

Vladimir Kozlov kvn at openjdk.java.net
Thu Oct 15 18:22:14 UTC 2020


On Thu, 15 Oct 2020 17:29:48 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> hi, @vnkozlov ,
>> Thank you to review it.
>> 
>> i<len() is there for protection.  Because `i` is unsigned int, len() - 1 or --i  underflows when len() is 0 or req() is
>> 0.
>
> I think you could write it like this to hoist the `i < len()` test from the loop while avoiding issues when `len()` or
> `req()` is 0:
> uint i = len();
> if (i > 0) {
>   while(i > req()) {
>     rm_prec(--i);
>   }
> }

Nice suggestion!

-------------

PR: https://git.openjdk.java.net/jdk/pull/664


More information about the hotspot-compiler-dev mailing list