Examples of JSR


Examples of com.google.test.metric.method.op.stack.JSR

  public void testJSRSingleBlock() throws Exception {
    Block main = new Block("main");
    Block sub = new Block("sub");

    main.addOp(new Load(0, new Variable("this", JavaType.OBJECT, false, false)));
    main.addOp(new JSR(0, sub));
    main.addOp(new PutField(0, new FieldInfo(null, "a", JavaType.INT, false, false,
        false)));

    sub.addOp(new Load(0, new Constant(1, JavaType.INT)));
    sub.addOp(new Return(0, JavaType.VOID));
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

    Block sub1 = new Block("sub1");
    Block sub2 = new Block("sub2");
    sub.addNextBlock(sub1);
    sub1.addNextBlock(sub2);

    main.addOp(new JSR(0, sub));

    Stack2Turing converter = new Stack2Turing(main);
    converter.translate(); // Assert no exceptions
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

  }

  public void testMakeSureThatJsrWhichCallsItselfDoesNotRecurseForever() throws Exception {
    Block main = new Block("main");
    Block sub = new Block("sub");
    main.addOp(new JSR(0, sub));
    main.addOp(new JSR(0, sub));
    sub.addOp(new RetSub(1));
    sub.addNextBlock(main);
    Stack2Turing converter = new Stack2Turing(main);
    converter.translate(); // Assert no exceptions and that we don't get into infinite recursion
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

    Block mainBlock = decomposer.getMainBlock();
    assertEquals(0, mainBlock.getNextBlocks().size());
    List<StackOperation> operations = mainBlock.getOperations();
    assertEquals("[load 1{int}, JSR sub_0, load 2{int}, return void]",
        operations.toString());
    JSR jsr = (JSR) operations.get(1);
    Block subBlock = jsr.getBlock();
    assertEquals("[load 3{int}, RETSUB]", subBlock.getOperations().toString());
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

  public void jumpSubroutine(Label label, int lineNumber) {
    Block subBlock = subrutineBlocks.get(label);
    if (subBlock == null) {
      subBlock = new Block("sub_" + (counter++));
    }
    addOp(new JSR(lineNumber, subBlock));
    subrutineBlocks.put(label, subBlock);
    applyLastLabel();
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

      block = blocks.remove(0);
      processed.add(block);
      for (StackOperation operation : block.getOperations()) {
        translateStackOperation(block, operation);
        if (operation instanceof JSR) {
          JSR jsr = (JSR) operation;
          Block jsrBlock = jsr.getBlock();
          stack.split(block, asList(jsrBlock));
          Block terminalBlock = translate(jsrBlock, processed);
          stack.join(asList(terminalBlock), block);
          processed.add(jsrBlock);
        }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

  public void jumpSubroutine(Label label, int lineNumber) {
    Block subBlock = blocks.get(label);
    if (subBlock == null) {
      subBlock = new Block("sub_" + (counter++));
    }
    addOp(new JSR(lineNumber, subBlock));
    blocks.put(label, subBlock);
    applyLastLabel();
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

      block = blocks.remove(0);
      processed.add(block);
      for (StackOperation operation : block.getOperations()) {
        translateStackOperation(block, operation);
        if (operation instanceof JSR) {
          JSR jsr = (JSR) operation;
          Block jsrBlock = jsr.getBlock();
          stack.split(block, asList(jsrBlock));
          Block terminalBlock = translate(jsrBlock);
          stack.join(asList(terminalBlock), block);
          processed.add(jsrBlock);
        }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

    Block mainBlock = decomposer.getMainBlock();
    assertEquals(0, mainBlock.getNextBlocks().size());
    List<StackOperation> operations = mainBlock.getOperations();
    assertEquals("[load 1{int}, JSR sub_0, load 2{int}, return void]",
        operations.toString());
    JSR jsr = (JSR) operations.get(1);
    Block subBlock = jsr.getBlock();
    assertEquals("[load 3{int}, RETSUB]", subBlock.getOperations().toString());
  }
View Full Code Here

Examples of com.google.test.metric.method.op.stack.JSR

  public void testJSRSingleBlock() throws Exception {
    Block main = new Block("main");
    Block sub = new Block("sub");

    main.addOp(new Load(0, new Variable("this", Type.OBJECT, false, false)));
    main.addOp(new JSR(0, sub));
    main.addOp(new PutField(0, new FieldInfo(null, "a", Type.INT, false, false,
        false)));

    sub.addOp(new Load(0, new Constant(1, Type.INT)));
    sub.addOp(new Return(0, Type.VOID));
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.