RFR: 8263227: C2: inconsistent spilling due to dead nodes in exception block

Vladimir Kozlov kvn at openjdk.java.net
Thu Apr 8 18:24:09 UTC 2021

On Thu, 8 Apr 2021 13:49:56 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> Thanks for reviewing, Vladimir! The intention of this loop is to remove all projections of a multi-node `n` before removing `n` itself (if it has been found to be dead). I indeed have to rethink this code as e.g. the loop can be executed if `n` is not a multi-node but `k` ends up pointing to a projection of another node. I will investigate and come back with a new revision.
> On second thought, at the loop entry, the only users of `n` are (unused) projections or else `n` wouldn't be dead. Assuming these projections are scheduled right after `n`, the code should be OK. In any case, I will submit a (hopefully) clearer revision.

You are right that users will follow `n` but I am not sure that no other nodes were inserted in between users.
I would prefer to see loop code like this:
  for (uint k = new_cnt; k > j; k-- ) {
    Node* user = sb->get_node(k);
    if (user->is_Proj() && user->in(0) == n) {
Or may be record user's indexes into a local array for users in previous loop at lines #1406-1412 and iterate of that loop.
I also noticed wrong code stile in `for()` statements near your change. Please, fix them too.


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

More information about the hotspot-compiler-dev mailing list