Esempio n. 1
0
  protected short op_call() {
    int nlocals;
    int i;
    short thislocal;

    if (operands[0] == 0) {
      /* calls to zero return false */
      /*
       * Can't just return false because call is not treated as a store in
       * execute_instruction
       */
      zm.set_variable(storevar, ZFALSE);
    } else {
      zm.zstack.push(new ZFrameBound(isstore()));
      zm.zstack.push(new Integer(storevar));
      zm.zstack.push(new Integer(zm.pc));
      zm.zstack.push(zm.locals);
      // System.err.print("From ");
      // System.err.print(Integer.toString(zm.pc, 16));
      zm.pc = zm.routine_address(operands[0]);
      // System.err.print(" calling routine at ");
      // System.err.println(Integer.toString(zm.pc, 16));
      nlocals = zm.get_code_byte();
      zm.locals = new short[nlocals];
      for (i = 0; i < nlocals; i++) {
        thislocal = (short) (((zm.get_code_byte() << 8) & 0xFF00) | (zm.get_code_byte() & 0xFF));
        if (i < (count - 1)) {
          zm.locals[i] = operands[i + 1];
        } else {
          zm.locals[i] = thislocal;
        }
      }
    }
    return ZFALSE;
  }
Esempio n. 2
0
  protected void z_ret() {
    Object tos;

    do tos = zm.zstack.pop();
    while (!(tos instanceof short[]));
    zm.locals = (short[]) tos;
    // System.err.print("From ");
    // System.err.print(Integer.toString(zm.pc, 16));
    zm.pc = ((Integer) zm.zstack.pop()).intValue();
    // System.err.print(" returning to ");
    // System.err.println(Integer.toString(zm.pc, 16));
    storevar = (short) (((Integer) zm.zstack.pop()).intValue());
    zm.zstack.pop(); /* stack frame boundary */
  }