Class StackHeights


  • public class StackHeights
    extends Object
    container to track either the current or the maximum local variable count and stack height while generating compiled code for a rule
    • Field Detail

      • stackCount

        public int stackCount
        number of stack slots
      • localCount

        public int localCount
        number of local variable slots
    • Constructor Detail

      • StackHeights

        public StackHeights()
        create withinitial counts 0
      • StackHeights

        public StackHeights​(StackHeights toCopy)
        create a copy with the same counts as the original
        Parameters:
        toCopy - the StackHeights instance to copy
    • Method Detail

      • addStackCount

        public StackHeights addStackCount​(int increment)
                                   throws CompileException
        increment the stack count and return this to allow chaining
        Parameters:
        increment - the amount ot add to stackCount (can be negative)
        Returns:
        this
        Throws:
        CompileException - if the stack count goes negative
      • addLocalCount

        public StackHeights addLocalCount​(int increment)
                                   throws CompileException
        increment the local count and return this to allow chaining
        Parameters:
        increment - the amount ot add to localCount (can be negative)
        Returns:
        this
        Throws:
        CompileException - if the local count goes negative