Class StackHeights


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

      Fields 
      Modifier and Type Field Description
      int localCount
      number of local variable slots
      int stackCount
      number of stack slots
    • Constructor Summary

      Constructors 
      Constructor Description
      StackHeights()
      create withinitial counts 0
      StackHeights​(StackHeights toCopy)
      create a copy with the same counts as the original
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      StackHeights addLocalCount​(int increment)
      increment the local count and return this to allow chaining
      StackHeights addStackCount​(int increment)
      increment the stack count and return this to allow chaining
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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