Class Vset

  • All Implemented Interfaces:
    Constants, RuntimeConstants

    public final class Vset
    extends java.lang.Object
    implements Constants
    WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Field Detail

      • vset

        long vset
      • uset

        long uset
      • x

        long[] x
      • emptyX

        static final long[] emptyX
      • fullX

        static final long[] fullX
      • DEAD_END

        static final Vset DEAD_END
        This is the Vset which reports all vars assigned and unassigned. This impossibility is degenerately true exactly when control flow cannot reach this point.
    • Constructor Detail

      • Vset

        public Vset()
        Create an empty Vset.
      • Vset

        private Vset​(long vset,
                     long uset,
                     long[] x)
    • Method Detail

      • copy

        public Vset copy()
        Create an copy of the given Vset. (However, DEAD_END simply returns itself.)
      • growX

        private void growX​(int length)
      • isDeadEnd

        public boolean isDeadEnd()
        Ask if this is a vset for a dead end. Answer true only for the canonical dead-end, DEAD_END. A canonical dead-end is produced only as a result of a statement that cannot complete normally, as specified by the JLS. Due to the special-case rules for if-then and if-then-else, this may fail to detect actual unreachable code that could easily be identified.
      • isReallyDeadEnd

        public boolean isReallyDeadEnd()
        Ask if this is a vset for a dead end. Answer true for any dead-end. Since 'clearDeadEnd' has no effect on this predicate, if-then and if-then-else are handled in the more 'obvious' and precise way. This predicate is to be preferred for dead code elimination purposes. (Presently used in workaround for bug 4173473 in MethodExpression.java)
      • clearDeadEnd

        public Vset clearDeadEnd()
        Replace canonical DEAD_END with a distinct but equivalent Vset. The bits are unaltered, but the result does not answer true to 'isDeadEnd'.

        Used mostly for error recovery, but see 'IfStatement.check', where it is used to implement the special-case treatment of statement reachability for such statements.

      • testVar

        public boolean testVar​(int varNumber)
        Ask if a var is definitely assigned.
      • testVarUnassigned

        public boolean testVarUnassigned​(int varNumber)
        Ask if a var is definitely un-assigned. (This is not just the negation of testVar: It's possible for neither to be true.)
      • addVar

        public Vset addVar​(int varNumber)
        Note that a var is definitely assigned. (Side-effecting.)
      • addVarUnassigned

        public Vset addVarUnassigned​(int varNumber)
        Note that a var is definitely un-assigned. (Side-effecting.)
      • clearVar

        public Vset clearVar​(int varNumber)
        Retract any assertion about the var. This operation is ineffective on a dead-end. (Side-effecting.)
      • join

        public Vset join​(Vset other)
        Join with another vset. This is set intersection. (Side-effecting.)
      • addDAandJoinDU

        public Vset addDAandJoinDU​(Vset other)
        Add in the definite assignment bits of another vset, but join the definite unassignment bits. This unusual operation is used only for 'finally' blocks. The original vset 'this' is destroyed by this operation. (Part of fix for 4068688.)
      • firstDAandSecondDU

        public static Vset firstDAandSecondDU​(Vset sourceDA,
                                              Vset sourceDU)
        Construct a vset consisting of the DA bits of the first argument and the DU bits of the second argument. This is a higly unusual operation, as it implies a case where the flowgraph for DA analysis differs from that for DU analysis. It is only needed for analysing 'try' blocks. The result is a dead-end iff the first argument is dead-end. (Part of fix for 4068688.)
      • removeAdditionalVars

        public Vset removeAdditionalVars​(int varNumber)
        Remove variables from the vset that are no longer part of a context. Zeroes are stored past varNumber. (Side-effecting.)

        However, if this is a dead end, keep it so. That is, leave an infinite tail of bits set.

      • varLimit

        public int varLimit()
        Return one larger than the highest bit set.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object