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

Claes Redestad redestad at openjdk.java.net
Thu Oct 15 17:36:10 UTC 2020


On Thu, 15 Oct 2020 00:19:34 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> I got now why you need to scan reverse.
>
> 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);
  }
}

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

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


More information about the hotspot-compiler-dev mailing list