Пример #1
0
  public void visit(MethodCall p) throws ParseTreeException {
    if (isSameObject(p, original_methodcall)) {
      Expression expr = p.getReferenceExpr();
      TypeName reftype = p.getReferenceType();

      if (expr != null) {
        if (expr instanceof Leaf
            || expr instanceof ArrayAccess
            || expr instanceof FieldAccess
            || expr instanceof MethodCall
            || expr instanceof Variable) {
          expr.accept(this);
        } else {
          writeParenthesis(expr);
        }
      } else if (reftype != null) {
        reftype.accept(this);
      }

      // -------------------------------------------------------------
      mutated_line = line_num;
      out.print(mutant);
      writeLog(
          removeNewline(
              p.toString()
                  + " =>  "
                  + p.toString().substring(0, p.toString().length() - ".clone()".length())));
      // -------------------------------------------------------------

    } else {
      super.visit(p);
    }
  }
 @Test
 public void testToContext() throws Exception {
   final MethodCall<ParametersPassesExpressionUnitTest> methodCall =
       toMethodCall(ParametersPassesExpressionUnitTest.class, this, "test", "a", 1, "b", 2);
   final StandardEvaluationContext context = new Evaluator().toContext(methodCall);
   assertThat(context.getRootObject().getValue(), is((Object) methodCall));
   assertThat(context.lookupVariable("methodName"), is((Object) "test"));
   assertThat(context.lookupVariable("parameters"), is((Object) methodCall.getParameters()));
   assertThat(context.getPropertyAccessors(), is(Evaluator.DEFAULT_PROPERTY_ACCESSORS));
 }
Пример #3
0
 @Override
 public MethodCall callMethod(MethodCall methodCall) {
   if (methodCall == null || methodCall.getMethodDefinition() == null) {
     return null;
   }
   visitMethod = true;
   visitMethod = true;
   methodCall.getMethodDefinition().accept(this);
   visitMethod = false;
   return null;
 }
Пример #4
0
  /**
   * Invokes a method in all members and expects responses from members contained in dests (or all
   * members if dests is null).
   *
   * @param dests A list of addresses. If null, we'll wait for responses from all cluster members
   * @param method_call The method (plus args) to be invoked
   * @param options A collection of call options, e.g. sync versus async, timeout etc
   * @param listener A FutureListener which will be registered (if non null) with the future
   *     <em>before</em> the call is invoked
   * @return NotifyingFuture A future from which the results can be fetched
   * @throws Exception If the sending of the message threw an exception. Note that <em>no</em>
   *     exception will be thrown if any of the target members threw an exception; such an exception
   *     will be in the Rsp element for the particular member in the RspList
   */
  public <T> NotifyingFuture<RspList<T>> callRemoteMethodsWithFuture(
      Collection<Address> dests,
      MethodCall method_call,
      RequestOptions options,
      FutureListener<RspList<T>> listener)
      throws Exception {
    if (dests != null && dests.isEmpty()) { // don't send if dest list is empty
      if (log.isTraceEnabled())
        log.trace(
            "destination list of %s() is empty: no need to send message", method_call.getName());
      return new NullFuture<>(new RspList());
    }

    if (log.isTraceEnabled())
      log.trace("dests=%s, method_call=%s, options=%s", dests, method_call, options);

    Buffer buf =
        req_marshaller != null
            ? req_marshaller.objectToBuffer(method_call)
            : Util.objectToBuffer(method_call);
    Message msg = new Message().setBuffer(buf);

    NotifyingFuture<RspList<T>> retval = super.castMessageWithFuture(dests, msg, options, listener);
    if (log.isTraceEnabled()) log.trace("responses: %s", retval);
    return retval;
  }
Пример #5
0
  public void writeMethod(MethodCall _methodCall, MethodEntry _methodEntry)
      throws CodeGenException {
    boolean noCL =
        _methodEntry
            .getOwnerClassModel()
            .getNoCLMethods()
            .contains(_methodEntry.getNameAndTypeEntry().getNameUTF8Entry().getUTF8());
    if (noCL) {
      return;
    }

    if (_methodCall instanceof VirtualMethodCall) {
      final Instruction instanceInstruction =
          ((VirtualMethodCall) _methodCall).getInstanceReference();
      if (!(instanceInstruction instanceof I_ALOAD_0)) {
        writeInstruction(instanceInstruction);
        write(".");
      } else {
        writeThisRef();
      }
    }
    final int argc = _methodEntry.getStackConsumeCount();
    write(_methodEntry.getNameAndTypeEntry().getNameUTF8Entry().getUTF8());
    write("(");

    for (int arg = 0; arg < argc; arg++) {
      if (arg != 0) {
        write(", ");
      }
      writeInstruction(_methodCall.getArg(arg));
    }
    write(")");
  }
Пример #6
0
  /**
   * Message contains MethodCall. Execute it against *this* object and return result. Use
   * MethodCall.invoke() to do this. Return result.
   */
  public Object handle(Message req) throws Exception {
    if (server_obj == null) {
      log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest"));
      return null;
    }

    if (req == null || req.getLength() == 0) {
      log.error(Util.getMessage("MessageOrMessageBufferIsNull"));
      return null;
    }

    Object body =
        req_marshaller != null
            ? req_marshaller.objectFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength())
            : req.getObject();

    if (!(body instanceof MethodCall))
      throw new IllegalArgumentException("message does not contain a MethodCall object");

    MethodCall method_call = (MethodCall) body;

    if (log.isTraceEnabled()) log.trace("[sender=%s], method_call: %s", req.getSrc(), method_call);

    if (method_call.getMode() == MethodCall.ID) {
      if (method_lookup == null)
        throw new Exception(
            String.format(
                "MethodCall uses ID=%d, but method_lookup has not been set", method_call.getId()));
      Method m = method_lookup.findMethod(method_call.getId());
      if (m == null) throw new Exception("no method found for " + method_call.getId());
      method_call.setMethod(m);
    }

    return method_call.invoke(server_obj);
  }
Пример #7
0
 @SuppressWarnings("unchecked")
 private synchronized void checkReply()
 {
    if (mc.hasReply()) {
       Message m = mc.getReply();
       if (m instanceof Error)
          error = ((Error) m).getException();
       else if (m instanceof MethodReturn) {
          try {
             rval = (ReturnType) RemoteInvocationHandler.convertRV(m.getSig(), m.getParameters(), me, conn);
          } catch (DBusExecutionException DBEe) {
             error = DBEe;
          } catch (DBusException DBe) {
             if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe);
             error = new DBusExecutionException(DBe.getMessage());
          }
       }
    }
 }
Пример #8
0
 @Test
 public void testInvalidateSingleton() {
   CacheService cs = getCache();
   cs.longSingletonToCache_5("static");
   cs.__cacheData()
       .invalidateCache(MethodCall.get(cs.getClass(), "longSingletonToCache_5", "static"));
   int prev = cs.getCounter();
   cs.longSingletonToCache_5("static");
   assertTrue(prev + 1 == cs.getCounter());
 }
Пример #9
0
  public static MethodCall<Object> transformed(
      final MethodCall<Object> methodCall, final Object arg) {

    return new MethodCallBuilder()
        .setTimestamp(methodCall.timestamp())
        .setId(methodCall.id())
        .setName(methodCall.name())
        .setAddress(methodCall.address())
        .setParams(methodCall.params())
        .setHeaders(methodCall.headers())
        .setBody(arg)
        .setObjectName(methodCall.objectName())
        .setReturnAddress(methodCall.returnAddress())
        .setOriginatingRequest(methodCall.originatingRequest())
        .build();
  }
Пример #10
0
 public MethodCall toMethodCall(IMethod method) {
   MethodCall call = new MethodCall(this.position);
   call.instance = this.instance;
   call.name = this.name;
   call.method = method;
   call.dotless = this.dotless;
   call.arguments = EmptyArguments.INSTANCE;
   return call;
 }
Пример #11
0
  /**
   * Message contains MethodCall. Execute it against *this* object and return result. Use
   * MethodCall.invoke() to do this. Return result.
   */
  public Object handle(Message req) {
    Object body;
    MethodCall method_call;

    if (server_obj == null) {
      if (log.isErrorEnabled()) log.error("no method handler is registered. Discarding request.");
      return null;
    }

    if (req == null || req.getLength() == 0) {
      if (log.isErrorEnabled()) log.error("message or message buffer is null");
      return null;
    }

    try {
      body =
          req_marshaller != null
              ? req_marshaller.objectFromByteBuffer(
                  req.getBuffer(), req.getOffset(), req.getLength())
              : req.getObject();
    } catch (Throwable e) {
      if (log.isErrorEnabled()) log.error("exception marshalling object", e);
      return e;
    }

    if (!(body instanceof MethodCall)) {
      if (log.isErrorEnabled()) log.error("message does not contain a MethodCall object");

      // create an exception to represent this and return it
      return new IllegalArgumentException("message does not contain a MethodCall object");
    }

    method_call = (MethodCall) body;

    try {
      if (log.isTraceEnabled())
        log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call);

      if (method_call.getMode() == MethodCall.ID) {
        if (method_lookup == null)
          throw new Exception(
              "MethodCall uses ID=" + method_call.getId() + ", but method_lookup has not been set");
        Method m = method_lookup.findMethod(method_call.getId());
        if (m == null) throw new Exception("no method found for " + method_call.getId());
        method_call.setMethod(m);
      }

      return method_call.invoke(server_obj);
    } catch (Throwable x) {
      return x;
    }
  }
Пример #12
0
 @Test
 public void testInvalidateAllValues() {
   CacheService cs = getCache();
   cs.longServiceToCache_5("static1");
   cs.longServiceToCache_5("static2");
   cs.longServiceToCache_5("static3");
   cs.longServiceToCache_5("static4");
   cs.__cacheData()
       .invalidateCache(
           MethodCall.get(cs.getClass(), "longServiceToCache_5", "static").getMethod());
   int prev = cs.getCounter();
   cs.longServiceToCache_5("static1");
   cs.longServiceToCache_5("static2");
   cs.longServiceToCache_5("static3");
   cs.longServiceToCache_5("static4");
   assertTrue(prev + 4 == cs.getCounter());
 }
Пример #13
0
  /**
   * Invokes a method in all members contained in dests (or all members if dests is null).
   *
   * @param dests A list of addresses. If null, the method will be invoked on all cluster members
   * @param method_call The method (plus args) to be invoked
   * @param options A collection of call options, e.g. sync versus async, timeout etc
   * @return RspList A list of return values and flags (suspected, not received) per member
   * @since 2.9
   */
  public RspList callRemoteMethods(
      Collection<Address> dests, MethodCall method_call, RequestOptions options) {
    if (dests != null && dests.isEmpty()) { // don't send if dest list is empty
      if (log.isTraceEnabled())
        log.trace(
            new StringBuilder("destination list of ")
                .append(method_call.getName())
                .append("() is empty: no need to send message"));
      return RspList.EMPTY_RSP_LIST;
    }

    if (log.isTraceEnabled())
      log.trace(
          new StringBuilder("dests=")
              .append(dests)
              .append(", method_call=")
              .append(method_call)
              .append(", options=")
              .append(options));

    Object buf;
    try {
      buf =
          req_marshaller != null
              ? req_marshaller.objectToBuffer(method_call)
              : Util.objectToByteBuffer(method_call);
    } catch (Exception e) {
      // if(log.isErrorEnabled()) log.error("exception", e);
      // we will change this in 3.0 to add the exception to the signature
      // (see http://jira.jboss.com/jira/browse/JGRP-193). The reason for a RTE is that we cannot
      // change the
      // signature in 2.3, otherwise 2.3 would be *not* API compatible to prev releases
      throw new RuntimeException("failure to marshal argument(s)", e);
    }

    Message msg = new Message();
    if (buf instanceof Buffer) msg.setBuffer((Buffer) buf);
    else msg.setBuffer((byte[]) buf);

    msg.setFlag(options.getFlags());
    if (options.getScope() > 0) msg.setScope(options.getScope());

    RspList retval = super.castMessage(dests, msg, options);
    if (log.isTraceEnabled()) log.trace("responses: " + retval);
    return retval;
  }
Пример #14
0
  @Test
  public void testSoftRef() {
    CacheService cs = getCache();
    try {
      for (int n = 0; n < 1000; n++) {
        cs.bigMemHard(n);
      }
      fail("should run out of ram");
    } catch (java.lang.OutOfMemoryError e) {
      // clear cache to free ram
      cs.__cacheData()
          .invalidateCache(MethodCall.get(cs.getClass(), "bigMemHard", (int) 0).getMethod());
    }

    for (int n = 0; n < 10; n++) {
      cs.bigMemSoft(n);
    }
  }
Пример #15
0
  public void run() {
    InstField instField = new InstField();
    instField.run();

    StaticField.run();

    IntMath.run();
    FloatMath.run();
    Compare.run();

    Monitor.run();
    Switch.run();
    Array.run();
    Classes.run();
    Goto.run();
    MethodCall.run();
    Throw.run();

    try {
      UnresTest1.run();
    } catch (VerifyError ve) {
      System.out.println("Caught: " + ve);
    }
    try {
      UnresTest1.run();
    } catch (VerifyError ve) {
      System.out.println("Caught (retry): " + ve);
    }

    try {
      UnresTest2.run();
    } catch (VerifyError ve) {
      System.out.println("Caught: " + ve);
    } catch (Throwable th) {
      // We and the RI throw ClassNotFoundException, but that isn't declared so javac
      // won't let us try to catch it.
      th.printStackTrace();
    }
    InternedString.run();
  }
Пример #16
0
 /**
  * Looks up a previously created search result in the "global" cache.
  *
  * @return the List of previously found search results
  */
 private Map lookupMethod(MethodCall methodCall) {
   return (Map) getMethodCache().get(methodCall.getKey());
 }
Пример #17
0
 private void addCallToCache(MethodCall methodCall) {
   Map cachedCalls = lookupMethod(this.getMethodCall());
   cachedCalls.put(methodCall.getKey(), methodCall);
 }
Пример #18
0
 public Buffer objectToBuffer(Object obj) throws Exception {
   MethodCall call = (MethodCall) obj;
   ByteBuffer buf;
   switch (call.getId()) {
     case START:
     case GET_CONFIG:
       buf = ByteBuffer.allocate(Global.BYTE_SIZE);
       buf.put((byte) call.getId());
       return new Buffer(buf.array());
     case SET_OOB:
     case SET_SYNC:
       return new Buffer(booleanBuffer(call.getId(), (Boolean) call.getArgs()[0]));
     case SET_NUM_MSGS:
     case SET_NUM_THREADS:
     case SET_MSG_SIZE:
     case SET_ANYCAST_COUNT:
       return new Buffer(intBuffer(call.getId(), (Integer) call.getArgs()[0]));
     case GET:
       return new Buffer(longBuffer(call.getId(), (Long) call.getArgs()[0]));
     case PUT:
       Long long_arg = (Long) call.getArgs()[0];
       byte[] arg2 = (byte[]) call.getArgs()[1];
       buf =
           ByteBuffer.allocate(
               Global.BYTE_SIZE + Global.INT_SIZE + Global.LONG_SIZE + arg2.length);
       buf.put((byte) call.getId())
           .putLong(long_arg)
           .putInt(arg2.length)
           .put(arg2, 0, arg2.length);
       return new Buffer(buf.array());
     case SET_READ_PERCENTAGE:
       Double double_arg = (Double) call.getArgs()[0];
       buf = ByteBuffer.allocate(Global.BYTE_SIZE + Global.DOUBLE_SIZE);
       buf.put((byte) call.getId()).putDouble(double_arg);
       return new Buffer(buf.array());
     default:
       throw new IllegalStateException("method " + call.getMethod() + " not known");
   }
 }
Пример #19
0
  public void writeInstruction(Instruction _instruction) throws CodeGenException {
    if (_instruction instanceof CompositeIfElseInstruction) {
      write("(");
      final Instruction lhs =
          writeConditional(((CompositeInstruction) _instruction).getBranchSet());
      write(")?");
      writeInstruction(lhs);
      write(":");
      writeInstruction(lhs.getNextExpr().getNextExpr());
    } else if (_instruction instanceof CompositeInstruction) {
      writeComposite((CompositeInstruction) _instruction);

    } else if (_instruction instanceof AssignToLocalVariable) {
      final AssignToLocalVariable assignToLocalVariable = (AssignToLocalVariable) _instruction;

      final LocalVariableInfo localVariableInfo = assignToLocalVariable.getLocalVariableInfo();
      if (assignToLocalVariable.isDeclaration()) {
        final String descriptor = localVariableInfo.getVariableDescriptor();
        // Arrays always map to __global arrays
        if (descriptor.startsWith("[")) {
          write(" __global ");
        }
        write(convertType(descriptor, true));
      }
      if (localVariableInfo == null) {
        throw new CodeGenException("outOfScope" + _instruction.getThisPC() + " = ");
      } else {
        write(localVariableInfo.getVariableName() + " = ");
      }

      for (Instruction operand = _instruction.getFirstChild();
          operand != null;
          operand = operand.getNextExpr()) {
        writeInstruction(operand);
      }

    } else if (_instruction instanceof AssignToArrayElement) {
      final AssignToArrayElement arrayAssignmentInstruction = (AssignToArrayElement) _instruction;
      writeInstruction(arrayAssignmentInstruction.getArrayRef());
      write("[");
      writeInstruction(arrayAssignmentInstruction.getArrayIndex());
      write("]");
      write(" ");
      write(" = ");
      writeInstruction(arrayAssignmentInstruction.getValue());
    } else if (_instruction instanceof AccessArrayElement) {

      // we're getting an element from an array
      // if the array is a primitive then we just return the value
      // so the generated code looks like
      // arrayName[arrayIndex];
      // but if the array is an object, or multidimensional array, then we want to return
      // a pointer to our index our position in the array.  The code will look like
      // &(arrayName[arrayIndex * this->arrayNameLen_dimension]
      //
      final AccessArrayElement arrayLoadInstruction = (AccessArrayElement) _instruction;

      // object array, get address
      if (arrayLoadInstruction instanceof I_AALOAD) {
        write("(&");
      }
      writeInstruction(arrayLoadInstruction.getArrayRef());
      write("[");
      writeInstruction(arrayLoadInstruction.getArrayIndex());

      // object array, find the size of each object in the array
      // for 2D arrays, this size is the size of a row.
      if (arrayLoadInstruction instanceof I_AALOAD) {
        int dim = 0;
        Instruction load = arrayLoadInstruction.getArrayRef();
        while (load instanceof I_AALOAD) {
          load = load.getFirstChild();
          dim++;
        }

        String arrayName =
            ((AccessInstanceField) load)
                .getConstantPoolFieldEntry()
                .getNameAndTypeEntry()
                .getNameUTF8Entry()
                .getUTF8();
        write(" * this->" + arrayName + arrayDimMangleSuffix + dim);
      }

      write("]");

      // object array, close parentheses
      if (arrayLoadInstruction instanceof I_AALOAD) {
        write(")");
      }
    } else if (_instruction instanceof AccessField) {
      final AccessField accessField = (AccessField) _instruction;
      if (accessField instanceof AccessInstanceField) {
        Instruction accessInstanceField = ((AccessInstanceField) accessField).getInstance();
        if (accessInstanceField instanceof CloneInstruction) {
          accessInstanceField = ((CloneInstruction) accessInstanceField).getReal();
        }
        if (!(accessInstanceField instanceof I_ALOAD_0)) {
          writeInstruction(accessInstanceField);
          write(".");
        } else {
          writeThisRef();
        }
      }
      write(
          accessField
              .getConstantPoolFieldEntry()
              .getNameAndTypeEntry()
              .getNameUTF8Entry()
              .getUTF8());

    } else if (_instruction instanceof I_ARRAYLENGTH) {

      // getting the length of an array.
      // if this is a primitive array, then this is trivial
      // if we're getting an object array, then we need to find what dimension
      // we're looking at
      int dim = 0;
      Instruction load = _instruction.getFirstChild();
      while (load instanceof I_AALOAD) {
        load = load.getFirstChild();
        dim++;
      }
      final AccessInstanceField child = (AccessInstanceField) load;
      final String arrayName =
          child.getConstantPoolFieldEntry().getNameAndTypeEntry().getNameUTF8Entry().getUTF8();
      write("this->" + arrayName + arrayLengthMangleSuffix + dim);
    } else if (_instruction instanceof AssignToField) {
      final AssignToField assignedField = (AssignToField) _instruction;

      if (assignedField instanceof AssignToInstanceField) {
        final Instruction accessInstanceField =
            ((AssignToInstanceField) assignedField).getInstance().getReal();

        if (!(accessInstanceField instanceof I_ALOAD_0)) {
          writeInstruction(accessInstanceField);
          write(".");
        } else {
          writeThisRef();
        }
      }
      write(
          assignedField
              .getConstantPoolFieldEntry()
              .getNameAndTypeEntry()
              .getNameUTF8Entry()
              .getUTF8());
      write("=");
      writeInstruction(assignedField.getValueToAssign());
    } else if (_instruction instanceof Constant<?>) {
      final Constant<?> constantInstruction = (Constant<?>) _instruction;
      final Object value = constantInstruction.getValue();

      if (value instanceof Float) {

        final Float f = (Float) value;
        if (f.isNaN()) {
          write("NAN");
        } else if (f.isInfinite()) {
          if (f < 0) {
            write("-");
          }
          write("INFINITY");
        } else {
          write(value.toString());
          write("f");
        }
      } else if (value instanceof Double) {

        final Double d = (Double) value;
        if (d.isNaN()) {
          write("NAN");
        } else if (d.isInfinite()) {
          if (d < 0) {
            write("-");
          }
          write("INFINITY");
        } else {
          write(value.toString());
        }
      } else {
        write(value.toString());
        if (value instanceof Long) {
          write("L");
        }
      }

    } else if (_instruction instanceof AccessLocalVariable) {
      final AccessLocalVariable localVariableLoadInstruction = (AccessLocalVariable) _instruction;
      final LocalVariableInfo localVariable = localVariableLoadInstruction.getLocalVariableInfo();
      write(localVariable.getVariableName());
    } else if (_instruction instanceof I_IINC) {
      final I_IINC location = (I_IINC) _instruction;
      final LocalVariableInfo localVariable = location.getLocalVariableInfo();
      final int adjust = location.getAdjust();

      write(localVariable.getVariableName());
      if (adjust == 1) {
        write("++");
      } else if (adjust == -1) {
        write("--");
      } else if (adjust > 1) {
        write("+=" + adjust);
      } else if (adjust < -1) {
        write("-=" + (-adjust));
      }
    } else if (_instruction instanceof BinaryOperator) {
      final BinaryOperator binaryInstruction = (BinaryOperator) _instruction;
      final Instruction parent = binaryInstruction.getParentExpr();
      boolean needsParenthesis = true;

      if (parent instanceof AssignToLocalVariable) {
        needsParenthesis = false;
      } else if (parent instanceof AssignToField) {
        needsParenthesis = false;
      } else if (parent instanceof AssignToArrayElement) {
        needsParenthesis = false;
      } else {
        /**
         * if (parent instanceof BinaryOperator) { BinaryOperator parentBinaryOperator =
         * (BinaryOperator) parent; if (parentBinaryOperator.getOperator().ordinal() >
         * binaryInstruction.getOperator().ordinal()) { needsParenthesis = false; } }
         */
      }

      if (needsParenthesis) {
        write("(");
      }

      writeInstruction(binaryInstruction.getLhs());

      write(" " + binaryInstruction.getOperator().getText() + " ");
      writeInstruction(binaryInstruction.getRhs());

      if (needsParenthesis) {
        write(")");
      }

    } else if (_instruction instanceof CastOperator) {
      final CastOperator castInstruction = (CastOperator) _instruction;
      //  write("(");
      write(convertCast(castInstruction.getOperator().getText()));

      writeInstruction(castInstruction.getUnary());
      //    write(")");
    } else if (_instruction instanceof UnaryOperator) {
      final UnaryOperator unaryInstruction = (UnaryOperator) _instruction;
      //   write("(");
      write(unaryInstruction.getOperator().getText());

      writeInstruction(unaryInstruction.getUnary());
      //   write(")");
    } else if (_instruction instanceof Return) {

      final Return ret = (Return) _instruction;
      write("return");
      if (ret.getStackConsumeCount() > 0) {
        write("(");
        writeInstruction(ret.getFirstChild());
        write(")");
      }

    } else if (_instruction instanceof MethodCall) {
      final MethodCall methodCall = (MethodCall) _instruction;

      final MethodEntry methodEntry = methodCall.getConstantPoolMethodEntry();

      writeMethod(methodCall, methodEntry);
    } else if (_instruction.getByteCode().equals(ByteCode.CLONE)) {
      final CloneInstruction cloneInstruction = (CloneInstruction) _instruction;
      writeInstruction(cloneInstruction.getReal());
    } else if (_instruction.getByteCode().equals(ByteCode.INCREMENT)) {
      final IncrementInstruction incrementInstruction = (IncrementInstruction) _instruction;

      if (incrementInstruction.isPre()) {
        if (incrementInstruction.isInc()) {
          write("++");
        } else {
          write("--");
        }
      }

      writeInstruction(incrementInstruction.getFieldOrVariableReference());
      if (!incrementInstruction.isPre()) {
        if (incrementInstruction.isInc()) {
          write("++");
        } else {
          write("--");
        }
      }
    } else if (_instruction.getByteCode().equals(ByteCode.MULTI_ASSIGN)) {
      final MultiAssignInstruction multiAssignInstruction = (MultiAssignInstruction) _instruction;
      AssignToLocalVariable from = (AssignToLocalVariable) multiAssignInstruction.getFrom();
      final AssignToLocalVariable last = (AssignToLocalVariable) multiAssignInstruction.getTo();
      final Instruction common = multiAssignInstruction.getCommon();
      final Stack<AssignToLocalVariable> stack = new Stack<AssignToLocalVariable>();

      while (from != last) {
        stack.push(from);
        from = (AssignToLocalVariable) ((Instruction) from).getNextExpr();
      }

      for (AssignToLocalVariable alv = stack.pop();
          alv != null;
          alv = stack.size() > 0 ? stack.pop() : null) {

        final LocalVariableInfo localVariableInfo = alv.getLocalVariableInfo();
        if (alv.isDeclaration()) {
          write(convertType(localVariableInfo.getVariableDescriptor(), true));
        }
        if (localVariableInfo == null) {
          throw new CodeGenException("outOfScope" + _instruction.getThisPC() + " = ");
        } else {
          write(localVariableInfo.getVariableName() + " = ");
        }
      }
      writeInstruction(common);
    } else if (_instruction.getByteCode().equals(ByteCode.INLINE_ASSIGN)) {
      final InlineAssignInstruction inlineAssignInstruction =
          (InlineAssignInstruction) _instruction;
      final AssignToLocalVariable assignToLocalVariable =
          inlineAssignInstruction.getAssignToLocalVariable();

      final LocalVariableInfo localVariableInfo = assignToLocalVariable.getLocalVariableInfo();
      if (assignToLocalVariable.isDeclaration()) {
        // this is bad! we need a general way to hoist up a required declaration
        throw new CodeGenException(
            "/* we can't declare this "
                + convertType(localVariableInfo.getVariableDescriptor(), true)
                + " here */");
      }
      write(localVariableInfo.getVariableName());
      write("=");
      writeInstruction(inlineAssignInstruction.getRhs());
    } else if (_instruction.getByteCode().equals(ByteCode.FIELD_ARRAY_ELEMENT_ASSIGN)) {
      final FieldArrayElementAssign inlineAssignInstruction =
          (FieldArrayElementAssign) _instruction;
      final AssignToArrayElement arrayAssignmentInstruction =
          inlineAssignInstruction.getAssignToArrayElement();

      writeInstruction(arrayAssignmentInstruction.getArrayRef());
      write("[");
      writeInstruction(arrayAssignmentInstruction.getArrayIndex());
      write("]");
      write(" ");
      write(" = ");

      writeInstruction(inlineAssignInstruction.getRhs());
    } else if (_instruction.getByteCode().equals(ByteCode.FIELD_ARRAY_ELEMENT_INCREMENT)) {

      final FieldArrayElementIncrement fieldArrayElementIncrement =
          (FieldArrayElementIncrement) _instruction;
      final AssignToArrayElement arrayAssignmentInstruction =
          fieldArrayElementIncrement.getAssignToArrayElement();
      if (fieldArrayElementIncrement.isPre()) {
        if (fieldArrayElementIncrement.isInc()) {
          write("++");
        } else {
          write("--");
        }
      }
      writeInstruction(arrayAssignmentInstruction.getArrayRef());

      write("[");
      writeInstruction(arrayAssignmentInstruction.getArrayIndex());
      write("]");
      if (!fieldArrayElementIncrement.isPre()) {
        if (fieldArrayElementIncrement.isInc()) {
          write("++");
        } else {
          write("--");
        }
      }

    } else if (_instruction.getByteCode().equals(ByteCode.NONE)) {
      // we are done
    } else if (_instruction instanceof Branch) {
      throw new CodeGenException(
          String.format(
              "%s -> %04d",
              _instruction.getByteCode().toString().toLowerCase(),
              ((Branch) _instruction).getTarget().getThisPC()));
    } else if (_instruction instanceof I_POP) {
      // POP discarded void call return?
      writeInstruction(_instruction.getFirstChild());
    } else {
      throw new CodeGenException(
          String.format("%s", _instruction.getByteCode().toString().toLowerCase()));
    }
  }