Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

Overview

This PR changes how we access the TypeState of TypeFlow nodes. The main changes are the folowing methods on the TypeFlow class:

  1. getState() now asserts that the flow is enabled. This is the main method that should be used in common cases.
  2. getOutputState() - whose result represents the state that is currently pushed out of the given flow along the use edges (which will be empty for disabled flows, Any/AllInstantiated for saturated flows, and the actual type state otherwise). It is a helper method that should be used sparingly, in situations when the input flow can be in arbitrary state. We need it for example for the new flows for filtering primitives, as they have multiple input flows, and just because one of the inputs is enabled does mean the others are as well.
  3. getRawState() - the real state of the flow, without checking any flags, meant mainly for debugging, logging and other special use cases, name intentionally chosen to sound dangerous, like something one typically should not use.
  4. getStateDescription() - helper to be used in toString() methods of all the flows, returns the string representation of the state including disabled/enabled/saturation information.

The rest of the PR is just updating all the usages of the old TypeFlow.getState() method, which makes this PR look big, but most of the changes should hopefully be quick to verify.

Motivation for the Change

Before this PR, the TypeState of every flow was queried using the getState() method. However, after WP-SCCP was merged, it is questionable whether it makes sense to query the TypeState of disabled flows, so we introduced accessor methods to distinguish between the main use cases, which allows us, e.g. to assert the state of the dependencies when we know from the context that they should be already enabled (if not, it suggests a bug is somewhere).

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 18, 2024
@graalvmbot graalvmbot closed this Oct 19, 2024
@graalvmbot graalvmbot deleted the d-kozak/GR-58690/dont-query-disabled-flow branch October 19, 2024 02:55
@graalvmbot graalvmbot merged commit e22b4da into master Oct 19, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants