Examples of Jump


Examples of IRTree2.JUMP

    return new ExpList(exp, null);
  }

  public Stm build(ExpList kids)
  {
    return new JUMP(kids.head, targets);
  }
View Full Code Here

Examples of com.dragome.compiler.ast.Jump

      }

      case Const.GOTO:
      {

        instruction= new Jump(currentIndex + bytes.readShort());
        break;
      }

      case Const.GOTO_W:
      {

        instruction= new Jump(currentIndex + bytes.readInt());
        break;
      }

      case Const.NEW:
      {
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.ast.Jump

                        sb.append(" ");
                    }
                    sb.append("]");
                }
            } else if (this instanceof Jump) {
                Jump jump = (Jump)this;
                if (type == Token.BREAK || type == Token.CONTINUE) {
                    sb.append(" [label: ");
                    appendPrintId(jump.getJumpStatement(), printIds, sb);
                    sb.append(']');
                } else if (type == Token.TRY) {
                    Node catchNode = jump.target;
                    Node finallyTarget = jump.getFinally();
                    if (catchNode != null) {
                        sb.append(" [catch: ");
                        appendPrintId(catchNode, printIds, sb);
                        sb.append(']');
                    }
                    if (finallyTarget != null) {
                        sb.append(" [finally: ");
                        appendPrintId(finallyTarget, printIds, sb);
                        sb.append(']');
                    }
                } else if (type == Token.LABEL || type == Token.LOOP
                           || type == Token.SWITCH)
                {
                    sb.append(" [break: ");
                    appendPrintId(jump.target, printIds, sb);
                    sb.append(']');
                    if (type == Token.LOOP) {
                        sb.append(" [continue: ");
                        appendPrintId(jump.getContinue(), printIds, sb);
                        sb.append(']');
                    }
                } else {
                    sb.append(" [target: ");
                    appendPrintId(jump.target, printIds, sb);
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.ast.Jump

                break;
              }

              case Token.TRY:
              {
                Jump jump = (Jump)node;
                Node finallytarget = jump.getFinally();
                if (finallytarget != null) {
                    hasFinally = true;
                    loops.push(node);
                    loopEnds.push(finallytarget);
                }
                break;
              }

              case Token.TARGET:
              case Token.LEAVEWITH:
                if (!loopEnds.isEmpty() && loopEnds.peek() == node) {
                    loopEnds.pop();
                    loops.pop();
                }
                break;

              case Token.YIELD:
                ((FunctionNode)tree).addResumptionPoint(node);
                break;

              case Token.RETURN:
              {
                boolean isGenerator = tree.getType() == Token.FUNCTION
                    && ((FunctionNode)tree).isGenerator();
                if (isGenerator) {
                    node.putIntProp(Node.GENERATOR_END_PROP, 1);
                }
                /* If we didn't support try/finally, it wouldn't be
                 * necessary to put LEAVEWITH nodes here... but as
                 * we do need a series of JSR FINALLY nodes before
                 * each RETURN, we need to ensure that each finally
                 * block gets the correct scope... which could mean
                 * that some LEAVEWITH nodes are necessary.
                 */
                if (!hasFinally)
                    break;     // skip the whole mess.
                Node unwindBlock = null;
                for (int i=loops.size()-1; i >= 0; i--) {
                    Node n = (Node) loops.get(i);
                    int elemtype = n.getType();
                    if (elemtype == Token.TRY || elemtype == Token.WITH) {
                        Node unwind;
                        if (elemtype == Token.TRY) {
                            Jump jsrnode = new Jump(Token.JSR);
                            Node jsrtarget = ((Jump)n).getFinally();
                            jsrnode.target = jsrtarget;
                            unwind = jsrnode;
                        } else {
                            unwind = new Node(Token.LEAVEWITH);
                        }
                        if (unwindBlock == null) {
                            unwindBlock = new Node(Token.BLOCK,
                                                   node.getLineno());
                        }
                        unwindBlock.addChildToBack(unwind);
                    }
                }
                if (unwindBlock != null) {
                    Node returnNode = node;
                    Node returnExpr = returnNode.getFirstChild();
                    node = replaceCurrent(parent, previous, node, unwindBlock);
                    if (returnExpr == null || isGenerator) {
                        unwindBlock.addChildToBack(returnNode);
                    } else {
                        Node store = new Node(Token.EXPR_RESULT, returnExpr);
                        unwindBlock.addChildToFront(store);
                        returnNode = new Node(Token.RETURN_RESULT);
                        unwindBlock.addChildToBack(returnNode);
                        // transform return expression
                        transformCompilationUnit_r(tree, store, scope,
                                                   createScopeObjects,
                                                   inStrictMode);
                    }
                    // skip transformCompilationUnit_r to avoid infinite loop
                    continue siblingLoop;
                }
                break;
              }

              case Token.BREAK:
              case Token.CONTINUE:
              {
                Jump jump = (Jump)node;
                Jump jumpStatement = jump.getJumpStatement();
                if (jumpStatement == null) Kit.codeBug();

                for (int i = loops.size(); ;) {
                    if (i == 0) {
                        // Parser/IRFactory ensure that break/continue
                        // always has a jump statement associated with it
                        // which should be found
                        throw Kit.codeBug();
                    }
                    --i;
                    Node n = (Node) loops.get(i);
                    if (n == jumpStatement) {
                        break;
                    }

                    int elemtype = n.getType();
                    if (elemtype == Token.WITH) {
                        Node leave = new Node(Token.LEAVEWITH);
                        previous = addBeforeCurrent(parent, previous, node,
                                                    leave);
                    } else if (elemtype == Token.TRY) {
                        Jump tryNode = (Jump)n;
                        Jump jsrFinally = new Jump(Token.JSR);
                        jsrFinally.target = tryNode.getFinally();
                        previous = addBeforeCurrent(parent, previous, node,
                                                    jsrFinally);
                    }
                }
View Full Code Here

Examples of net.sourceforge.htmlunit.corejs.javascript.ast.Jump

            stackChange(-1);
            break;

          case Token.TRY:
            {
                Jump tryNode = (Jump)node;
                int exceptionObjectLocal = getLocalBlockRef(tryNode);
                int scopeLocal = allocLocal();

                addIndexOp(Icode_SCOPE_SAVE, scopeLocal);

                int tryStart = iCodeTop;
                boolean savedFlag = itsInTryFlag;
                itsInTryFlag = true;
                while (child != null) {
                    visitStatement(child, initialStackDepth);
                    child = child.getNext();
                }
                itsInTryFlag = savedFlag;

                Node catchTarget = tryNode.target;
                if (catchTarget != null) {
                    int catchStartPC
                        = labelTable[getTargetLabel(catchTarget)];
                    addExceptionHandler(
                        tryStart, catchStartPC, catchStartPC,
                        false, exceptionObjectLocal, scopeLocal);
                }
                Node finallyTarget = tryNode.getFinally();
                if (finallyTarget != null) {
                    int finallyStartPC
                        = labelTable[getTargetLabel(finallyTarget)];
                    addExceptionHandler(
                        tryStart, finallyStartPC, finallyStartPC,
View Full Code Here

Examples of nexj.core.meta.integration.service.Jump

                  }
               });
            }
            else if (sElement.equals("Goto"))
            {
               step = new Jump();
               step.setActivity(activity);
            }
            else
            {
               step = loadFlowMacroScript(element, sStepName, activity);

               if (step == null)
               {
                  throw new MetadataException("err.meta.service.invalidElement",
                     new Object[]{sElement, activity.getFlow().getFullName()});
               }
            }

            final String sNextStepName = XMLUtil.getStringAttr(element, "next");

            if (sNextStepName != null)
            {
               if (step == null)
               {
                  step = new Jump();
               }

               final Step fstep = step;

               m_flowFixupList.add(new ContextFixup(getHelper())
View Full Code Here

Examples of org.eclipse.jdt.internal.debug.eval.ast.instructions.Jump

    ConditionalJump conditionalJump = new ConditionalJump(false);
    fInstructions.insert(conditionalJump, conditionalAddress + 1);

    // Insert the jump
    int jumpAddress = ifTrueAddress + 2;
    Jump jump = new Jump();
    fInstructions.insert(jump, jumpAddress);

    // Set the jump offsets
    conditionalJump.setOffset(ifTrue.getSize() + 1);
    jump.setOffset(ifFalse.getSize() + 1);

    fCounter += 2;
    storeInstruction();

  }
View Full Code Here

Examples of org.eclipse.jdt.internal.debug.eval.ast.instructions.Jump

    // for each pending break or continue instruction which are related to
    // this loop, set the offset of the corresponding jump.
    for (Iterator<CompleteInstruction> iter = fCompleteInstructions.iterator(); iter.hasNext();) {
      CompleteInstruction instruction = iter.next();
      Jump jumpInstruction = instruction.fInstruction;
      int instructionAddress = fInstructions.indexOf(jumpInstruction);
      if (instructionAddress > bodyStartAddress
          && (instruction.fLabel == null || instruction.fLabel
              .equals(label))) {
        iter.remove();
        if (instruction.fIsBreak) {
          // jump to the instruction after the last jump
          jumpInstruction
              .setOffset((conditionAddress - instructionAddress) + 1);
        } else {
          // jump to the first instruction of the condition
          jumpInstruction.setOffset(bodyAddress - instructionAddress);
        }
      }
    }

    storeInstruction();
View Full Code Here

Examples of org.eclipse.jdt.internal.debug.eval.ast.instructions.Jump

    bodyAddress++;
    fCounter++;
    condJump.setOffset(body.getSize() + 1);

    // add jump
    Jump jump = new Jump();
    fInstructions.add(jump);
    fCounter++;
    jump.setOffset(initAddress - (bodyAddress + 1));

    // for each pending break or continue instruction which are related to
    // this loop, set the offset of the corresponding jump.
    String label = getLabel(node);
    for (Iterator<CompleteInstruction> iter = fCompleteInstructions.iterator(); iter.hasNext();) {
      CompleteInstruction instruction = iter.next();
      Jump jumpInstruction = instruction.fInstruction;
      int instructionAddress = fInstructions.indexOf(jumpInstruction);
      if (instructionAddress > conditionAddress
          && (instruction.fLabel == null || instruction.fLabel
              .equals(label))) {
        iter.remove();
        if (instruction.fIsBreak) {
          // jump to the instruction after the last jump
          jumpInstruction
              .setOffset((bodyAddress - instructionAddress) + 1);
        } else {
          // jump to the first instruction of the condition
          jumpInstruction.setOffset(initAddress - instructionAddress);
        }
      }
    }

    storeInstruction();
View Full Code Here

Examples of org.eclipse.jdt.internal.debug.eval.ast.instructions.Jump

      conditionAddress = 0;
      condition = null;
    }

    // add jump
    Jump jump = new Jump();
    fInstructions.add(jump);
    fCounter++;

    if (hasCondition) {
      // add conditional jump
      ConditionalJump condJump = new ConditionalJump(false);
      fInstructions.insert(condJump, conditionAddress + 1);
      bodyAddress++;
      bodyStartAddress++;
      updatersAddress++;
      fCounter++;
      // set conditional jump offset
      condJump.setOffset(body.getSize() + updaters.getSize() + 1);
    }

    // set jump offset
    jump.setOffset(-((hasCondition && (condition != null) ? condition
        .getSize() : 0) + body.getSize() + updaters.getSize() + 2));

    // for each pending break or continue instruction which are related to
    // this loop, set the offset of the corresponding jump.
    for (Iterator<CompleteInstruction> iter = fCompleteInstructions.iterator(); iter.hasNext();) {
      CompleteInstruction instruction = iter.next();
      Jump jumpInstruction = instruction.fInstruction;
      int instructionAddress = fInstructions.indexOf(jumpInstruction);
      if (instructionAddress > bodyStartAddress
          && (instruction.fLabel == null || instruction.fLabel
              .equals(label))) {
        iter.remove();
        if (instruction.fIsBreak) {
          // jump to the instruction after the last jump
          jumpInstruction
              .setOffset((updatersAddress - instructionAddress) + 1);
        } else {
          // jump to the first instruction of the condition
          jumpInstruction.setOffset(bodyAddress - instructionAddress);
        }
      }
    }

    storeInstruction();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.