public void addNewInstance(ArrayList<Instruction> instructions, short reg, String type) {
   short register = getRegister(instructions, reg, false, true);
   instructions.add(
       new Instruction21c(Opcode.NEW_INSTANCE, register, ic.addTypeIdItem(type))
           .setInject()); // 256
   restoreRegister(instructions, reg, false, true);
 }
  public void addInvoke(
      ArrayList<Instruction> instructions, DebugMethod method, short startReg, CodeItem codeItem) {
    short registerCount = 0;

    if (method.params.length != 0) {
      registerCount = (short) method.params.length;
      for (String param : method.params) {
        if (param.equals("J") || param.equals("D")) {
          registerCount++;
        }
      }
    }

    if (!(method.opcode.name.equals(Opcode.INVOKE_STATIC.name)
        || method.opcode.name.equals(Opcode.INVOKE_STATIC_RANGE.name))) {
      registerCount++;
    }

    instructions.add(
        new Instruction3rc(
                method.opcode, // 65536
                registerCount,
                startReg,
                ic.prepareMethodIdItem(method))
            .setInject());
    if (codeItem.outWords < registerCount) {
      codeItem.outWords = registerCount;
    }
  }
 public void addConstString(ArrayList<Instruction> instructions, short reg, String string) {
   short register = getRegister(instructions, reg, false, true);
   StringIdItem stringIdItem = ic.prepareStringIdItem(string);
   if (stringIdItem.getIndex() > 0xFFFF) {
     instructions.add(
         new Instruction31c(Opcode.CONST_STRING_JUMBO, register, stringIdItem).setInject()); // 256
   } else {
     instructions.add(
         new Instruction21c(Opcode.CONST_STRING, register, stringIdItem).setInject()); // 256
   }
   restoreRegister(instructions, reg, false, true);
 }
示例#4
0
 @Override
 public void execute() {
   IDialogModelTemplate template = templateFactory.createTemplate();
   if (template == ItemTemplateFactory.NO_TEMPLATE) {
     return;
   }
   try {
     itemCreator.operate(template);
   } catch (PersistenceException e) {
     Message message =
         new Message(resources.getString("AnathemaPersistence.NewMenu.Message.Error"), e);
     MessageUtilities.indicateMessage(
         NewItemCommand.class, SwingApplicationFrame.getParentComponent(), message);
   }
 }