RFR: 8333258: C2: high memory usage in PhaseCFG::insert_anti_dependences()

Roland Westrelin roland at openjdk.org
Thu Jun 20 08:45:12 UTC 2024


On Wed, 19 Jun 2024 16:28:15 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> We should use `VectorSet` for something like that. `worklist_visited` is definitely should be `VectorSet`. Instead of `already_enqueued` we should add `VectorSet` for `mem` to check if it was processed before. This assumes that this loop don't modify graph. Unfortunately we have one modification `store->add_prec(load);` which we should do something about. I may miss other ocde which modify graph.

I don't think `VectorSet` works here because It seems there are cases where we want to allow a Phi to be enqueued more than once. There's this comment:

// (Allow phis to be repeated; they can merge two relevant states.)

and in this loop when processing Phis:

      for (uint j = PhiNode::Input, jmax = store->req(); j < jmax; j++) {
        if (store->in(j) == mem) {   // Found matching input?

couldn't we reach the Phi from another mem input?
What the patch I propose does is that it prevents a Phi from being enqueued multiple times when it's reached from a particular mem input.

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

PR Comment: https://git.openjdk.org/jdk/pull/19791#issuecomment-2180140170


More information about the hotspot-compiler-dev mailing list