Class BranchManager.BranchNode

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, BranchManager.BranchNode node)
      boolean add​(BranchManager.BranchNode node)
      (package private) void calculateBlockType​(java.util.List<WasmInstruction> instructions)
      Calculate the block type (return type).
      private int findEndInstruction​(java.util.List<WasmInstruction> instructions, int idx)
      Find the END instruction of the block.
      (package private) int handle​(int codePosition, java.util.List<WasmInstruction> instructions, int idx, int lineNumber)
      Handle branches on the current codePosition
      • Methods inherited from class java.util.ArrayList

        addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Field Detail

      • startPos

        private final int startPos
      • endPos

        private int endPos
      • data

        private java.lang.Object data
        Extra data depending of the operator. For example the return type of a block.
      • startBlock

        private WasmBlockInstruction startBlock
        A instruction for which the return type must be calculated.
      • startIdx

        private int startIdx
        The position of the startBlock in the instructions
      • elseEndPos

        private int elseEndPos
      • continuePos

        private int continuePos
        jump position for a CONTINUE in a loop
    • Constructor Detail

      • BranchNode

        BranchNode​(int startPos,
                   int endPos,
                   WasmBlockOperator startOp,
                   WasmBlockOperator endOp)
        Create a new description.
        Parameters:
        startPos - the start position in the Java code. Limit also the children.
        endPos - the end position in the Java code. Limit also the children.
        startOp - The WASM operation on the start position. Can be null if there is nothing in WASM.
        endOp - the WASM operation on the end position. Can be null if there is nothing in WASM.
      • BranchNode

        BranchNode​(int startPos,
                   int endPos,
                   WasmBlockOperator startOp,
                   WasmBlockOperator endOp,
                   java.lang.Object data)
        Create a new description.
        Parameters:
        startPos - the start position in the Java code. Limit also the children.
        endPos - the end position in the Java code. Limit also the children.
        startOp - The WASM operation on the start position. Can be null if there is nothing in WASM.
        endOp - the WASM operation on the end position. Can be null if there is nothing in WASM.
        data - extra data depending of the start operator
    • Method Detail

      • handle

        int handle​(int codePosition,
                   java.util.List<WasmInstruction> instructions,
                   int idx,
                   int lineNumber)
        Handle branches on the current codePosition
        Parameters:
        codePosition - current code position
        instructions - the target for instructions
        idx - index in the current instruction
        lineNumber - the line number in the Java source code
        Returns:
        the new index in the instructions
      • calculateBlockType

        void calculateBlockType​(java.util.List<WasmInstruction> instructions)
        Calculate the block type (return type). The value type that is on the stack after the block.
        Parameters:
        instructions - the instructions of the function
      • findEndInstruction

        private int findEndInstruction​(java.util.List<WasmInstruction> instructions,
                                       int idx)
        Find the END instruction of the block.
        Parameters:
        instructions - the list of instructions
        idx - the index of the block start
        Returns:
        the END index