Class RTStack

java.lang.Object
svm.RTStack

public abstract class RTStack extends Object

Runtime Stack.

	STACK -----------.  OUTMOST STACK
	...              |
	STACK -----------'
FRAME:
	EXPORT ?  -------.  FRAME HEAD
	IMPORT           |
	...              |
	IMPORT           |
	RETURN ADDRESS   |
	LOCAL            |
	...              |
	LOCAL -----------'
	STACK -----------.  LOCAL STACK
	...              |
	STACK -----------'
MORE FRAMES ?

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The CALL Stack
    The PRECALL Stack
    private static Stack<Value>
    The Runtime Stack
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addExport(int nSlotStacked, int nExportSlots)
    Add EXPORT slots to the Current Stack Frame.
    Returns the CALL Stack TOP
    static void
    Check RTStack empty
    static int
    Returns Stack size within the current Frame
    static void
    Dump the RTStack
    static void
    dup(int n)
    Duplicate the 'n' top values on the stack
    static int
    Returns the current Frame index
    static Value
    load(int index)
    Returns the value at the given index
    static Value
    Returns the value at the top of this stack
    static int
    Returns the value at the top of this stack as n int
    static Value
    pop()
    Pop the top off this stack and returns that value.
    Pop the top two values off this stack and return it as a GeneralAddress.
    Pop the top two values off this stack and return it as an ObjectAddress.
    static int
    Pop the top off this stack and returns that value as an int
    static double
    Pop the top off this stack and returns that value as a double
    Pop the top off this stack and returns that value as an ObjectAddress value.
    static float
    Pop the top off this stack and returns that value as a float
    static String
    Pop the top three items off this stack as an infix(string).
    static Vector<Value>
    popx(int n)
    Pop the top 'n' values off this stack.
    static void
    Print the entire Call Stack
    static void
    push(Value value)
    Push a value onto the stack
    static void
    pushx(Vector<Value> values)
    Push a set of values onto the stack
    static int
    Returns The total Stack size
    static void
    store(int index, Value value)
    Store a value at the given index
    static String
    Listing utility: Edit the RTStack as a single line

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • RTStack

      public RTStack()
      Default Constructor
  • Method Details

    • checkStackEmpty

      public static void checkStackEmpty()
      Check RTStack empty
    • callStack_TOP

      public static CallStackFrame callStack_TOP()
      Returns the CALL Stack TOP
      Returns:
      the CALL Stack TOP
    • printCallTrace

      public static void printCallTrace(String title)
      Print the entire Call Stack
      Parameters:
      title - the title of the printout
    • curSize

      public static int curSize()
      Returns Stack size within the current Frame
      Returns:
      Stack size within the current Frame
    • size

      public static int size()
      Returns The total Stack size
      Returns:
      The total Stack size
    • load

      public static Value load(int index)
      Returns the value at the given index
      Parameters:
      index - the index
      Returns:
      the value at the given index
    • store

      public static void store(int index, Value value)
      Store a value at the given index
      Parameters:
      index - the index
      value - the value
    • dup

      public static void dup(int n)
      Duplicate the 'n' top values on the stack
      Parameters:
      n - number of values to be duplicated
    • push

      public static void push(Value value)
      Push a value onto the stack
      Parameters:
      value - the value
    • addExport

      public static void addExport(int nSlotStacked, int nExportSlots)

      Add EXPORT slots to the Current Stack Frame.

      Current Stack;
      
           IMPORT	idx = last - (nSlotStacked - 1)
           ...    nSlotStacked
      TOP: IMPORT	idx = last
      

      ===>

           EXPORT
           ...    nExportSlots
           EXPORT
           IMPORT
           ...    nSlotStacked
      TOP: IMPORT
      
      Parameters:
      nSlotStacked - number of slots stacked
      nExportSlots - number of Exports slots
    • pop

      public static Value pop()
      Pop the top off this stack and returns that value.
      Returns:
      the value popped off the stack
    • peek

      public static Value peek()
      Returns the value at the top of this stack
      Returns:
      the value at the top of this stack
    • pushx

      public static void pushx(Vector<Value> values)
      Push a set of values onto the stack
      Parameters:
      values - the values
    • popx

      public static Vector<Value> popx(int n)
      Pop the top 'n' values off this stack.
      Parameters:
      n - number of pop
      Returns:
      the set of values popped off the stack
    • peekInt

      public static int peekInt()
      Returns the value at the top of this stack as n int
      Returns:
      the value at the top of this stack as an int
    • popInt

      public static int popInt()
      Pop the top off this stack and returns that value as an int
      Returns:
      the int value popped off the stack
    • popReal

      public static float popReal()
      Pop the top off this stack and returns that value as a float
      Returns:
      the floar value popped off the stack
    • popLongReal

      public static double popLongReal()
      Pop the top off this stack and returns that value as a double
      Returns:
      the double value popped off the stack
    • popGADDR

      public static GeneralAddress popGADDR()
      Pop the top two values off this stack and return it as a GeneralAddress.
      Returns:
      the GeneralAddress value popped off the stack
    • popGADDRasOADDR

      public static ObjectAddress popGADDRasOADDR()
      Pop the top two values off this stack and return it as an ObjectAddress.
      Returns:
      the ObjectAddress value popped off the stack
    • frameIndex

      public static int frameIndex()
      Returns the current Frame index
      Returns:
      the current Frame index
    • popOADDR

      public static ObjectAddress popOADDR()
      Pop the top off this stack and returns that value as an ObjectAddress value.
      Returns:
      the ObjectAddress value popped off the stack
    • popString

      public static String popString()
      Pop the top three items off this stack as an infix(string). Then, use it to form a Java String value.
      Returns:
      the Java String formed
    • toLine

      public static String toLine()
      Listing utility: Edit the RTStack as a single line
      Returns:
      the RTStack as a single line
    • dumpRTStack

      public static void dumpRTStack(String title)
      Dump the RTStack
      Parameters:
      title - the title of the dump printout