sa-jdi

 new JumpClosure()
        {
          public void process(GenerateOopMap c, int bcpDelta, int[] data)
          {
            c.mergeState(bcpDelta, data);
          }
        }, itr.getIndex(), null);
      }
      else if (fall_through)
      {
        if (Assert.ASSERTS_ENABLED) {
          Assert.that(lim_bci == _basic_blocks[(bbIndex(bb) + 1)]._bci, "there must be another bb");
        }
        mergeStateIntoBB(_basic_blocks[(bbIndex(bb) + 1)]);
      }
    }
  }
  
  void restoreState(BasicBlock bb)
  {
    for (int i = 0; i < _state_len; i++) {
      _state.get(i).set(_state.get(i));
    }
    _stack_top = _stack_top;
    _monitor_top = _monitor_top;
  }
  
  int nextBBStartPC(BasicBlock bb)
  {
    int bbNum = bbIndex(bb) + 1;
    if (bbNum == _bb_count) {
      return (int)method().getCodeSize();
    }
    return _basic_blocks[bbNum]._bci;
  }
  
  void updateBasicBlocks(int bci, int delta)
  {
    BitMap bbBits = new BitMap((int)(_method.getCodeSize() + delta));
    for (int k = 0; k < _bb_count; k++)
    {
      if (_basic_blocks[k]._bci > bci)
      {
        _basic_blocks[k]._bci += delta;
        _basic_blocks[k]._end_bci += delta;
      }
      bbBits.atPut(_basic_blocks[k]._bci, true);
    }
    _bb_hdr_bits = bbBits;
  }
  
  void markBB(int bci, int[] data)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((bci >= 0) && (bci < method().getCodeSize()), "index out of bounds");
    }
    if (isBBHeader(bci)) {
      return;
    }
    setBBMarkBit(bci);
    _bb_count += 1;
  }
  
  void markReachableCode()
  {
    int[] change = new int[1];
    change[0] = 1;
    
    _basic_blocks[0].markAsAlive();
    TypeArray excps = method().getExceptionTable();
    for (int i = 0; i < excps.getLength(); i += 4)
    {
      int handler_pc_idx = i + 2;
      BasicBlock bb = getBasicBlockAt(excps.getIntAt(handler_pc_idx));
      if (bb.isDead()) {
        bb.markAsAlive();
      }
    }
    BytecodeStream bcs = new BytecodeStream(_method);
    while (change[0] != 0)
    {
      change[0] = 0;
      for (int i = 0; i < _bb_count; i++)
      {
        BasicBlock bb = _basic_blocks[i];
        if (bb.isAlive())
        {
          bcs.setStart(_end_bci);
          bcs.next();
          int bytecode = bcs.code();
          int bci = bcs.bci();
          if (Assert.ASSERTS_ENABLED) {
            Assert.that(bci == _end_bci, "wrong bci");
          }
          boolean fell_through = jumpTargetsDo(bcs, new JumpClosure()
          {
            public void process(GenerateOopMap c, int bciDelta, int[] change)
            {
              c.reachableBasicblock(bciDelta, change);
            }
          }, change);
          switch (bytecode)
          {
          case 168: 
          case 201: 
            if (Assert.ASSERTS_ENABLED) {
              Assert.that(!fell_through, "should not happen");
            }
            reachableBasicblock(bci + Bytecodes.lengthFor(bytecode), change);
          }
          if (fell_through) {
            if (_basic_blocks[(i + 1)].isDead())
            {
              _basic_blocks[(i + 1)].markAsAlive();
              change[0] = 1;
            }
          }
        }
      }
    }
  }
  
  void reachableBasicblock(int bci, int[] data)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((bci >= 0) && (bci < method().getCodeSize()), "index out of bounds");
    }
    BasicBlock bb = getBasicBlockAt(bci);
    if (bb.isDead())
    {
      bb.markAsAlive();
      data[0] = 1;
    }
  }
  
  void doInterpretation()
  {
    int i = 0;
    do
    {
      _conflict = false;
      _monitor_safe = true;
      if (!_got_error) {
        initBasicBlocks();
      }
      if (!_got_error) {
        setupMethodEntryState();
      }
      if (!_got_error) {
        interpAll();
      }
      if (!_got_error) {
        rewriteRefvalConflicts();
      }
      i++;
    } while ((_conflict) && (!_got_error));
  }
  
  void initBasicBlocks()
  {
    _basic_blocks = new BasicBlock[_bb_count];
    for (int i = 0; i < _bb_count; i++) {
      _basic_blocks[i] = new BasicBlock();
    }
    BytecodeStream j = new BytecodeStream(_method);
    
    int bbNo = 0;
    int monitor_count = 0;
    int prev_bci = -1;
    int bytecode;
    while ((bytecode = j.next()) >= 0)
    {
      if (j.code() == 194) {
        monitor_count++;
      }
      int bci = j.bci();
      if (isBBHeader(bci))
      {
        BasicBlock bb = _basic_blocks[bbNo];
        _bci = bci;
        _max_locals = _max_locals;
        _max_stack = _max_stack;
        bb.setChanged(false);
        _stack_top = -2;
        _monitor_top = -1;
        if (bbNo > 0) {
          _basic_blocks[(bbNo - 1)]._end_bci = prev_bci;
        }
        bbNo++;
      }
      prev_bci = bci;
    }
    _basic_blocks[(bbNo - 1)]._end_bci = prev_bci;
    
    _max_monitors = monitor_count;
    
    initState();
    
    CellTypeStateList basicBlockState = new CellTypeStateList(bbNo * _state_len);
    for (int blockNum = 0; blockNum < bbNo; blockNum++)
    {
      BasicBlock bb = _basic_blocks[blockNum];
      _state = basicBlockState.subList(blockNum * _state_len, (blockNum + 1) * _state_len);
      if ((Assert.ASSERTS_ENABLED) && 
        (blockNum + 1 < bbNo))
      {
        int bc_len = Bytecodes.javaLengthAt(_method, _end_bci);
        Assert.that(_end_bci + bc_len == _basic_blocks[(blockNum + 1)]._bci, "unmatched bci info in basicblock");
      }
    }
    if (Assert.ASSERTS_ENABLED)
    {
      BasicBlock bb = _basic_blocks[(bbNo - 1)];
      int bc_len = Bytecodes.javaLengthAt(_method, _end_bci);
      Assert.that(_end_bci + bc_len == _method.getCodeSize(), "wrong end bci");
    }
    if (bbNo != _bb_count)
    {
      if (bbNo < _bb_count) {
        throw new RuntimeException("jump into the middle of instruction?");
      }
      throw new RuntimeException("extra basic blocks - should not happen?");
    }
    markReachableCode();
  }
  
  void setupMethodEntryState()
  {
    makeContextUninitialized();
    
    methodsigToEffect(method().getSignature(), method().isStatic(), vars());
    
    initializeVars();
    
    mergeStateIntoBB(_basic_blocks[0]);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(_basic_blocks[0].changed(), "we are not getting off the ground");
    }
  }
  
  void interpAll()
  {
    boolean change = true;
    for (; (change) && (!_got_error); goto 17)
    {
      change = false;
      int i = 0;
      if ((i < _bb_count) && (!_got_error))
      {
        BasicBlock bb = _basic_blocks[i];
        if (bb.changed())
        {
          if (_got_error) {
            return;
          }
          change = true;
          bb.setChanged(false);
          interpBB(bb);
        }
        i++;
      }
    }
  }
  
  void interp1(BytecodeStream itr)
  {
    if (_report_result == true) {
      switch (itr.code())
      {
      case 182: 
      case 183: 
      case 184: 
      case 185: 
      case 186: 
        _itr_send = itr;
        _report_result_for_send = true;
        break;
      default: 
        fillStackmapForOpcodes(itr, vars(), stack(), _stack_top);
      }
    }
    switch (itr.code())
    {
    case 0: 
      break;
    case 167: 
      break;
    case 200: 
      break;
    case 132: 
      break;
    case 177: 
      doReturnMonitorCheck();
      break;
    case 1: 
    case 187: 
      ppush1(CellTypeState.makeLineRef(itr.bci()));
      break;
    case 2: 
    case 3: 
    case 4: 
    case 5: 
    case 6: 
    case 7: 
    case 8: 
    case 11: 
    case 12: 
    case 13: 
    case 16: 
    case 17: 
      ppush1(valCTS); break;
    case 9: 
    case 10: 
    case 14: 
    case 15: 
      ppush(vvCTS); break;
    case 20: 
      ppush(vvCTS); break;
    case 18: 
      doLdc(itr.getIndex(), itr.bci()); break;
    case 19: 
      doLdc(itr.getIndexBig(), itr.bci()); break;
    case 21: 
    case 23: 
      ppload(vCTS, itr.getIndex()); break;
    case 22: 
    case 24: 
      ppload(vvCTS, itr.getIndex()); break;
    case 25: 
      ppload(rCTS, itr.getIndex()); break;
    case 26: 
    case 34: 
      ppload(vCTS, 0); break;
    case 27: 
    case 35: 
      ppload(vCTS, 1); break;
    case 28: 
    case 36: 
      ppload(vCTS, 2); break;
    case 29: 
    case 37: 
      ppload(vCTS, 3); break;
    case 30: 
    case 38: 
      ppload(vvCTS, 0); break;
    case 31: 
    case 39: 
      ppload(vvCTS, 1); break;
    case 32: 
    case 40: 
      ppload(vvCTS, 2); break;
    case 33: 
    case 41: 
      ppload(vvCTS, 3); break;
    case 42: 
      ppload(rCTS, 0); break;
    case 43: 
      ppload(rCTS, 1); break;
    case 44: 
      ppload(rCTS, 2); break;
    case 45: 
      ppload(rCTS, 3); break;
    case 46: 
    case 48: 
    case 51: 
    case 52: 
    case 53: 
      pp(vrCTS, vCTS); break;
    case 47: 
      pp(vrCTS, vvCTS); break;
    case 49: 
      pp(vrCTS, vvCTS); break;
    case 50: 
      ppNewRef(vrCTS, itr.bci()); break;
    case 54: 
    case 56: 
      ppstore(vCTS, itr.getIndex()); break;
    case 55: 
    case 57: 
      ppstore(vvCTS, itr.getIndex()); break;
    case 58: 
      doAstore(itr.getIndex()); break;
    case 59: 
    case 67: 
      ppstore(vCTS, 0); break;
    case 60: 
    case 68: 
      ppstore(vCTS, 1); break;
    case 61: 
    case 69: 
      ppstore(vCTS, 2); break;
    case 62: 
    case 70: 
      ppstore(vCTS, 3); break;
    case 63: 
    case 71: 
      ppstore(vvCTS, 0); break;
    case 64: 
    case 72: 
      ppstore(vvCTS, 1); break;
    case 65: 
    case 73: 
      ppstore(vvCTS, 2); break;
    case 66: 
    case 74: 
      ppstore(vvCTS, 3); break;
    case 75: 
      doAstore(0); break;
    case 76: 
      doAstore(1); break;
    case 77: 
      doAstore(2); break;
    case 78: 
      doAstore(3); break;
    case 79: 
    case 81: 
    case 84: 
    case 85: 
    case 86: 
      ppop(vvrCTS); break;
    case 80: 
    case 82: 
      ppop(vvvrCTS); break;
    case 83: 
      ppop(rvrCTS); break;
    case 87: 
      ppopAny(1); break;
    case 88: 
      ppopAny(2); break;
    case 89: 
      ppdupswap(1, "11"); break;
    case 90: 
      ppdupswap(2, "121"); break;
    case 91: 
      ppdupswap(3, "1321"); break;
    case 92: 
      ppdupswap(2, "2121"); break;
    case 93: 
      ppdupswap(3, "21321"); break;
    case 94: 
      ppdupswap(4, "214321"); break;
    case 95: 
      ppdupswap(2, "12"); break;
    case 96: 
    case 98: 
    case 100: 
    case 102: 
    case 104: 
    case 106: 
    case 108: 
    case 110: 
    case 112: 
    case 114: 
    case 120: 
    case 122: 
    case 124: 
    case 126: 
    case 128: 
    case 130: 
    case 136: 
    case 137: 
    case 142: 
    case 144: 
    case 149: 
    case 150: 
      pp(vvCTS, vCTS); break;
    case 97: 
    case 99: 
    case 101: 
    case 103: 
    case 105: 
    case 107: 
    case 109: 
    case 111: 
    case 113: 
    case 115: 
    case 127: 
    case 129: 
    case 131: 
      pp(vvvvCTS, vvCTS); break;
    case 116: 
    case 118: 
    case 134: 
    case 139: 
    case 145: 
    case 146: 
    case 147: 
      pp(vCTS, vCTS); break;
    case 117: 
    case 119: 
    case 138: 
    case 143: 
      pp(vvCTS, vvCTS); break;
    case 121: 
    case 123: 
    case 125: 
      pp(vvvCTS, vvCTS); break;
    case 133: 
    case 135: 
    case 140: 
    case 141: 
      pp(vCTS, vvCTS); break;
    case 148: 
      pp(vvvvCTS, vCTS); break;
    case 151: 
    case 152: 
      pp(vvvvCTS, vCTS); break;
    case 153: 
    case 154: 
    case 155: 
    case 156: 
    case 157: 
    case 158: 
    case 170: 
      ppop1(valCTS);
      break;
    case 172: 
    case 174: 
      doReturnMonitorCheck();
      ppop1(valCTS);
      break;
    case 159: 
    case 160: 
    case 161: 
    case 162: 
    case 163: 
    case 164: 
      ppop(vvCTS);
      break;
    case 173: 
      doReturnMonitorCheck();
      ppop(vvCTS);
      break;
    case 175: 
      doReturnMonitorCheck();
      ppop(vvCTS);
      break;
    case 165: 
    case 166: 
      ppop(rrCTS); break;
    case 168: 
      doJsr(itr.dest()); break;
    case 201: 
      doJsr(itr.dest_w()); break;
    case 178: 
      doField(true, true, itr.getIndexBig(), itr.bci());
      
      break;
    case 179: 
      doField(false, true, itr.getIndexBig(), itr.bci()); break;
    case 180: 
      doField(true, false, itr.getIndexBig(), itr.bci()); break;
    case 181: 
      doField(false, false, itr.getIndexBig(), itr.bci()); break;
    case 182: 
    case 183: 
      doMethod(false, false, itr.getIndexBig(), itr.bci()); break;
    case 184: 
      doMethod(true, false, itr.getIndexBig(), itr.bci()); break;
    case 186: 
      doMethod(false, true, itr.getIndexBig(), itr.bci()); break;
    case 185: 
      doMethod(false, true, itr.getIndexBig(), itr.bci()); break;
    case 188: 
    case 189: 
      ppNewRef(vCTS, itr.bci()); break;
    case 192: 
      doCheckcast(); break;
    case 190: 
    case 193: 
      pp(rCTS, vCTS); break;
    case 194: 
      doMonitorenter(itr.bci()); break;
    case 195: 
      doMonitorexit(itr.bci()); break;
    case 191: 
      if ((!_has_exceptions) && (_monitor_top > 0)) {
        _monitor_safe = false;
      }
      break;
    case 176: 
      doReturnMonitorCheck();
      ppop1(refCTS);
      break;
    case 198: 
    case 199: 
      ppop1(refCTS); break;
    case 197: 
      doMultianewarray(itr.codeAt(itr.bci() + 3), itr.bci()); break;
    case 196: 
      throw new RuntimeException("Iterator should skip this bytecode");
    case 169: 
      break;
    case 221: 
      ppNewRef(rCTS, itr.bci()); break;
    case 220: 
      ppush1(valCTS); break;
    case 208: 
      pp(rCTS, vCTS); break;
    case 203: 
      ppNewRef(rCTS, itr.bci()); break;
    case 219: 
      ppload(rCTS, 0); break;
    case 171: 
    case 227: 
    case 228: 
      ppop1(valCTS); break;
    case 202: 
    case 204: 
    case 205: 
    case 206: 
    case 207: 
    case 209: 
    case 210: 
    case 211: 
    case 212: 
    case 213: 
    case 214: 
    case 215: 
    case 216: 
    case 217: 
    case 218: 
    case 222: 
    case 223: 
    case 224: 
    case 225: 
    case 226: 
    default: 
      throw new RuntimeException("unexpected opcode: " + itr.code());
    }
  }
  
  void doExceptionEdge(BytecodeStream itr)
  {
    if (!Bytecodes.canTrap(itr.code())) {
      return;
    }
    switch (itr.code())
    {
    case 42: 
    case 219: 
      return;
    case 172: 
    case 173: 
    case 174: 
    case 175: 
    case 176: 
    case 177: 
      if (_monitor_top == 0) {
        return;
      }
      break;
    case 195: 
      if ((_monitor_top != -1) && (_monitor_top != 0)) {
        return;
      }
      break;
    }
    if (_has_exceptions)
    {
      int bci = itr.bci();
      TypeArray exct = method().getExceptionTable();
      for (int i = 0; i < exct.getLength(); i += 4)
      {
        int start_pc = exct.getIntAt(i);
        int end_pc = exct.getIntAt(i + 1);
        int handler_pc = exct.getIntAt(i + 2);
        int catch_type = exct.getIntAt(i + 3);
        if ((start_pc <= bci) && (bci < end_pc))
        {
          BasicBlock excBB = getBasicBlockAt(handler_pc);
          CellTypeStateList excStk = excBB.stack();
          CellTypeStateList cOpStck = stack();
          CellTypeState cOpStck_0 = cOpStck.get(0).copy();
          int cOpStackTop = _stack_top;
          if (Assert.ASSERTS_ENABLED) {
            Assert.that(method().getMaxStack() > 0L, "sanity check");
          }
          cOpStck.get(0).set(CellTypeState.makeSlotRef(_max_locals));
          _stack_top = 1;
          
          mergeStateIntoBB(excBB);
          
          cOpStck.get(0).set(cOpStck_0);
          _stack_top = cOpStackTop;
          if (catch_type == 0) {
            return;
          }
        }
      }
    }
    if (_monitor_top == 0) {
      return;
    }
    if (_monitor_safe) {
      reportMonitorMismatch("non-empty monitor stack at exceptional exit");
    }
    _monitor_safe = false;
  }
  
  void checkType(CellTypeState expected, CellTypeState actual)
  {
    if (!expected.equalKind(actual)) {
      throw new RuntimeException("wrong type on stack (found: " + actual.toChar() + " expected: " + expected.toChar() + ")");
    }
  }
  
  void ppstore(CellTypeState[] in, int loc_no)
  {
    for (int i = 0; (i < in.length) && (!in[i].equal(CellTypeState.bottom)); i++)
    {
      CellTypeState expected = in[i];
      CellTypeState actual = pop();
      checkType(expected, actual);
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(loc_no >= 0, "sanity check");
      }
      setVar(loc_no++, actual);
    }
  }
  
  void ppload(CellTypeState[] out, int loc_no)
  {
    for (int i = 0; (i < out.length) && (!out[i].equal(CellTypeState.bottom)); i++)
    {
      CellTypeState out1 = out[i];
      CellTypeState vcts = getVar(loc_no);
      if (Assert.ASSERTS_ENABLED) {
        Assert.that((out1.canBeReference()) || (out1.canBeValue()), "can only load refs. and values.");
      }
      if (out1.isReference())
      {
        if (Assert.ASSERTS_ENABLED) {
          Assert.that(loc_no >= 0, "sanity check");
        }
        if (!vcts.isReference())
        {
          _conflict = true;
          if (vcts.canBeUninit())
          {
            addToRefInitSet(loc_no);
            vcts = out1;
          }
          else
          {
            recordRefvalConflict(loc_no);
            vcts = out1;
          }
          push(out1);
        }
        else
        {
          push(vcts);
        }
      }
      else
      {
        push(out1);
      }
      loc_no++;
    }
  }
  
  void ppush1(CellTypeState in)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(in.isReference() | in.isValue(), "sanity check");
    }
    push(in);
  }
  
  void ppush(CellTypeState[] in)
  {
    for (int i = 0; (i < in.length) && (!in[i].equal(CellTypeState.bottom)); i++) {
      ppush1(in[i]);
    }
  }
  
  void ppush(CellTypeStateList in)
  {
    for (int i = 0; (i < in.size()) && (!in.get(i).equal(CellTypeState.bottom)); i++) {
      ppush1(in.get(i));
    }
  }
  
  void ppop1(CellTypeState out)
  {
    CellTypeState actual = pop();
    
    checkType(out, actual);
  }
  
  void ppop(CellTypeState[] out)
  {
    for (int i = 0; (i < out.length) && (!out[i].equal(CellTypeState.bottom)); i++) {
      ppop1(out[i]);
    }
  }
  
  void ppopAny(int poplen)
  {
    if (_stack_top >= poplen) {
      _stack_top -= poplen;
    } else {
      throw new RuntimeException("stack underflow");
    }
  }
  
  void pp(CellTypeState[] in, CellTypeState[] out)
  {
    ppop(in);
    ppush(out);
  }
  
  void ppNewRef(CellTypeState[] in, int bci)
  {
    ppop(in);
    ppush1(CellTypeState.makeLineRef(bci));
  }
  
  void ppdupswap(int poplen, String out)
  {
    CellTypeState[] actual = new CellTypeState[5];
    Assert.that(poplen < 5, "this must be less than length of actual vector");
    for (int i = 0; i < poplen; i++) {
      actual[i] = pop();
    }
    for (int i = 0; i < out.length(); i++)
    {
      char push_ch = out.charAt(i);
      int idx = push_ch - '1';
      if (Assert.ASSERTS_ENABLED) {
        Assert.that((idx >= 0) && (idx < poplen), "wrong arguments");
      }
      push(actual[idx]);
    }
  }
  
  void doLdc(int idx, int bci)
  {
    ConstantPool cp = method().getConstants();
    ConstantTag tag = cp.getTagAt(idx);
    CellTypeState cts = (tag.isString()) || (tag.isUnresolvedString()) || (tag.isKlass()) || (tag.isUnresolvedKlass()) ? CellTypeState.makeLineRef(bci) : valCTS;
    
    ppush1(cts);
  }
  
  void doAstore(int idx)
  {
    CellTypeState r_or_p = pop();
    if ((!r_or_p.isAddress()) && (!r_or_p.isReference())) {
      throw new RuntimeException("wrong type on stack (found: " + r_or_p.toChar() + ", expected: {pr})");
    }
    setVar(idx, r_or_p);
  }
  
  void doJsr(int targBCI)
  {
    push(CellTypeState.makeAddr(targBCI));
  }
  
  void doField(boolean is_get, boolean is_static, int idx, int bci)
  {
    ConstantPool cp = method().getConstants();
    int nameAndTypeIdx = cp.getNameAndTypeRefIndexAt(idx);
    int signatureIdx = cp.getSignatureRefIndexAt(nameAndTypeIdx);
    Symbol signature = cp.getSymbolAt(signatureIdx);
    
    char sigch = (char)signature.getByteAt(0L);
    CellTypeState[] temp = new CellTypeState[4];
    CellTypeState[] eff = sigcharToEffect(sigch, bci, temp);
    
    CellTypeState[] in = new CellTypeState[4];
    
    int i = 0;
    CellTypeState[] out;
    CellTypeState[] out;
    if (is_get)
    {
      out = eff;
    }
    else
    {
      out = epsilonCTS;
      i = copyCTS(in, eff);
    }
    if (!is_static) {
      in[(i++)] = CellTypeState.ref;
    }
    in[i] = CellTypeState.bottom;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(i <= 3, "sanity check");
    }
    pp(in, out);
  }
  
  void doMethod(boolean is_static, boolean is_interface, int idx, int bci)
  {
    ConstantPool cp = _method.getConstants();
    int nameAndTypeIdx = cp.getTagAt(idx).isNameAndType() ? idx : cp.getNameAndTypeRefIndexAt(idx);
    int signatureIdx = cp.getSignatureRefIndexAt(nameAndTypeIdx);
    Symbol signature = cp.getSymbolAt(signatureIdx);
    
    CellTypeStateList out = new CellTypeStateList(4);
    CellTypeStateList in = new CellTypeStateList(257);
    ComputeCallStack cse = new ComputeCallStack(signature);
    
    int res_length = cse.computeForReturntype(out);
    if ((out.get(0).equal(CellTypeState.ref)) && (out.get(1).equal(CellTypeState.bottom))) {
      out.get(0).set(CellTypeState.makeLineRef(bci));
    }
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(res_length <= 4, "max value should be vv");
    }
    int arg_length = cse.computeForParameters(is_static, in);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(arg_length <= 256, "too many locals");
    }
    for (int i = arg_length - 1; i >= 0; i--) {
      ppop1(in.get(i));
    }
    if (_report_result_for_send == true)
    {
      fillStackmapForOpcodes(_itr_send, vars(), stack(), _stack_top);
      _report_result_for_send = false;
    }
    ppush(out);
  }
  
  void doMultianewarray(int dims, int bci)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(dims >= 1, "sanity check");
    }
    for (int i = dims - 1; i >= 0; i--) {
      ppop1(valCTS);
    }
    ppush1(CellTypeState.makeLineRef(bci));
  }
  
  void doMonitorenter(int bci)
  {
    CellTypeState actual = pop();
    if (_monitor_top == -1) {
      return;
    }
    if (actual.isLockReference())
    {
      _monitor_top = -1;
      _monitor_safe = false;
      
      reportMonitorMismatch("nested redundant lock -- bailout...");
      
      return;
    }
    CellTypeState lock = CellTypeState.makeLockRef(bci);
    checkType(refCTS, actual);
    if (!actual.isInfoTop())
    {
      replaceAllCTSMatches(actual, lock);
      monitorPush(lock);
    }
  }
  
  void doMonitorexit(int bci)
  {
    CellTypeState actual = pop();
    if (_monitor_top == -1) {
      return;
    }
    checkType(refCTS, actual);
    CellTypeState expected = monitorPop();
    if ((!actual.isLockReference()) || (!expected.equal(actual)))
    {
      _monitor_top = -1;
      _monitor_safe = false;
      
      BasicBlock bb = getBasicBlockContaining(bci);
      bb.setChanged(true);
      _monitor_top = -1;
      
      reportMonitorMismatch("improper monitor pair");
    }
    else
    {
      replaceAllCTSMatches(actual, CellTypeState.makeLineRef(bci));
    }
    if (_report_for_exit_bci == bci) {
      _matching_enter_bci = expected.getMonitorSource();
    }
  }
  
  void doReturnMonitorCheck()
  {
    if (_monitor_top > 0)
    {
      _monitor_safe = false;
      
      reportMonitorMismatch("non-empty monitor stack at return");
    }
  }
  
  void doCheckcast()
  {
    CellTypeState actual = pop();
    checkType(refCTS, actual);
    push(actual);
  }
  
  CellTypeState[] sigcharToEffect(char sigch, int bci, CellTypeState[] out)
  {
    if ((sigch == 'L') || (sigch == '['))
    {
      out[0] = CellTypeState.makeLineRef(bci);
      out[1] = CellTypeState.bottom;
      return out;
    }
    if ((sigch == 'J') || (sigch == 'D')) {
      return vvCTS;
    }
    if (sigch == 'V') {
      return epsilonCTS;
    }
    return vCTS;
  }
  
  int copyCTS(CellTypeState[] dst, CellTypeState[] src)
  {
    for (int idx = 0; (idx < src.length) && (!src[idx].isBottom()); idx++) {
      dst[idx] = src[idx];
    }
    return idx;
  }
  
  void reportResult()
  {
    _report_result = true;
    
    fillStackmapProlog(_gc_points);
    for (int i = 0; i < _bb_count; i++) {
      if (_basic_blocks[i].isReachable())
      {
        _basic_blocks[i].setChanged(true);
        interpBB(_basic_blocks[i]);
      }
    }
    fillStackmapEpilog();
    
    fillInitVars(_init_vars);
    
    _report_result = false;
  }
  
  void initializeVars()
  {
    for (int k = 0; k < _init_vars.size(); k++) {
      _state.get(((Integer)_init_vars.get(k)).intValue()).set(CellTypeState.makeSlotRef(k));
    }
  }
  
  void addToRefInitSet(int localNo)
  {
    Integer local = new Integer(localNo);
    if (_init_vars.contains(local)) {
      return;
    }
    _init_vars.add(local);
  }
  
  void recordRefvalConflict(int varNo)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that((varNo >= 0) && (varNo < _max_locals), "index out of range");
    }
    System.err.println("### Conflict detected (local no: " + varNo + ")");
    if (_new_var_map == null)
    {
      _new_var_map = new int[_max_locals];
      for (int k = 0; k < _max_locals; k++) {
        _new_var_map[k] = k;
      }
    }
    if (_new_var_map[varNo] == varNo)
    {
      if (_max_locals + _nof_refval_conflicts >= 65536) {
        throw new RuntimeException("Rewriting exceeded local variable limit");
      }
      _new_var_map[varNo] = (_max_locals + _nof_refval_conflicts);
      _nof_refval_conflicts += 1;
    }
  }
  
  void rewriteRefvalConflicts()
  {
    if (_nof_refval_conflicts > 0)
    {
      if (VM.getVM().isDebugging()) {
        throw new RuntimeException("Should not reach here (method rewriting should have been done by the VM already)");
      }
      throw new RuntimeException("Method rewriting not yet implemented in Java");
    }
  }
  
  String stateVecToString(CellTypeStateList vec, int len)
  {
    for (int i = 0; i < len; i++) {
      _state_vec_buf[i] = vec.get(i).toChar();
    }
    return new String(_state_vec_buf, 0, len);
  }
  
  void retJumpTargetsDo(BytecodeStream bcs, JumpClosure closure, int varNo, int[] data)
  {
    CellTypeState ra = vars().get(varNo);
    if (!ra.isGoodAddress()) {
      throw new RuntimeException("ret returns from two jsr subroutines?");
    }
    int target = ra.getInfo();
    
    RetTableEntry rtEnt = _rt.findJsrsForTarget(target);
    int bci = bcs.bci();
    for (int i = 0; i < rtEnt.nofJsrs(); i++)
    {
      int target_bci = rtEnt.jsrs(i);
      
      BasicBlock jsr_bb = getBasicBlockContaining(target_bci - 1);
      if (Assert.ASSERTS_ENABLED)
      {
        BasicBlock target_bb = _basic_blocks[(1 + bbIndex(jsr_bb))];
        Assert.that(target_bb == getBasicBlockAt(target_bci), "wrong calc. of successor basicblock");
      }
      boolean alive = jsr_bb.isAlive();
      if (alive) {
        closure.process(this, target_bci, data);
      }
    }
  }
  
  boolean jumpTargetsDo(BytecodeStream bcs, JumpClosure closure, int[] data)
  {
    int bci = bcs.bci();
    switch (bcs.code())
    {
    case 153: 
    case 154: 
    case 155: 
    case 156: 
    case 157: 
    case 158: 
    case 159: 
    case 160: 
    case 161: 
    case 162: 
    case 163: 
    case 164: 
    case 165: 
    case 166: 
    case 198: 
    case 199: 
      closure.process(this, bcs.dest(), data);
      closure.process(this, bci + 3, data);
      break;
    case 167: 
      closure.process(this, bcs.dest(), data);
      break;
    case 200: 
      closure.process(this, bcs.dest_w(), data);
      break;
    case 170: 
      BytecodeTableswitch tableswitch = BytecodeTableswitch.at(bcs);
      int len = tableswitch.length();
      
      closure.process(this, bci + tableswitch.defaultOffset(), data);
      for (;;)
      {
        len--;
        if (len < 0) {
          break;
        }
        closure.process(this, bci + tableswitch.destOffsetAt(len), data);
      }
    case 171: 
    case 227: 
    case 228: 
      BytecodeLookupswitch lookupswitch = BytecodeLookupswitch.at(bcs);
      int npairs = lookupswitch.numberOfPairs();
      closure.process(this, bci + lookupswitch.defaultOffset(), data);
      for (;;)
      {
        npairs--;
        if (npairs < 0) {
          break;
        }
        LookupswitchPair pair = lookupswitch.pairAt(npairs);
        closure.process(this, bci + pair.offset(), data);
      }
    case 168: 
      Assert.that(!bcs.isWide(), "sanity check");
      closure.process(this, bcs.dest(), data);
      break;
    case 201: 
      closure.process(this, bcs.dest_w(), data);
      break;
    case 196: 
      throw new RuntimeException("Should not reach here");
    case 169: 
    case 172: 
    case 173: 
    case 174: 
    case 175: 
    case 176: 
    case 177: 
    case 191: 
      break;
    case 178: 
    case 179: 
    case 180: 
    case 181: 
    case 182: 
    case 183: 
    case 184: 
    case 185: 
    case 186: 
    case 187: 
    case 188: 
    case 189: 
    case 190: 
    case 192: 
    case 193: 
    case 194: 
    case 195: 
    case 197: 
    case 202: 
    case 203: 
    case 204: 
    case 205: 
    case 206: 
    case 207: 
    case 208: 
    case 209: 
    case 210: 
    case 211: 
    case 212: 
    case 213: 
    case 214: 
    case 215: 
    case 216: 
    case 217: 
    case 218: 
    case 219: 
    case 220: 
    case 221: 
    case 222: 
    case 223: 
    case 224: 
    case 225: 
    case 226: 
    default: 
      return true;
    }
    return false;
  }
  
  public GenerateOopMap(Method method)
  {
    _method = method;
    _max_locals = 0;
    _init_vars = null;
    _rt = new RetTable();
  }
  
  public void computeMap()
  {
    _got_error = false;
    _conflict = false;
    _max_locals = ((int)method().getMaxLocals());
    _max_stack = ((int)method().getMaxStack());
    _has_exceptions = (method().getExceptionTable().getLength() > 0L);
    _nof_refval_conflicts = 0;
    _init_vars = new ArrayList(5);
    _report_result = false;
    _report_result_for_send = false;
    _report_for_exit_bci = -1;
    _new_var_map = null;
    if ((method().getCodeSize() == 0L) || (_max_locals + method().getMaxStack() == 0L))
    {
      fillStackmapProlog(0);
      fillStackmapEpilog();
      return;
    }
    if (!_got_error) {
      _rt.computeRetTable(_method);
    }
    if (!_got_error) {
      markBBHeadersAndCountGCPoints();
    }
    if (!_got_error) {
      doInterpretation();
    }
    if ((!_got_error) && (reportResults())) {
      reportResult();
    }
    if (_got_error) {
      throw new RuntimeException("Illegal bytecode sequence encountered while generating interpreter pointer maps - method should be rejected by verifier.");
    }
  }
  
  public void resultForBasicblock(int bci)
  {
    _report_result = true;
    
    BasicBlock bb = getBasicBlockContaining(bci);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(bb.isReachable(), "getting result from unreachable basicblock");
    }
    bb.setChanged(true);
    interpBB(bb);
  }
  
  public int maxLocals()
  {
    return _max_locals;
  }
  
  public Method method()
  {
    return _method;
  }
  
  public boolean monitorSafe()
  {
    return _monitor_safe;
  }
  
  public int getMonitorMatch(int bci)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(_monitor_safe, "Attempt to match monitor in broken code.");
    }
    _report_for_exit_bci = bci;
    _matching_enter_bci = -1;
    
    BasicBlock bb = getBasicBlockContaining(bci);
    if (bb.isReachable())
    {
      bb.setChanged(true);
      interpBB(bb);
      _report_for_exit_bci = -1;
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(_matching_enter_bci != -1, "monitor matching invariant");
      }
    }
    return _matching_enter_bci;
  }
  
  private int bbIndex(BasicBlock bb)
  {
    for (int i = 0; i < _basic_blocks.length; i++) {
      if (_basic_blocks[i] == bb) {
        return i;
      }
    }
    throw new RuntimeException("Should have found block");
  }
  
  public boolean allowRewrites()
  {
    return false;
  }
  
  public boolean reportResults()
  {
    return true;
  }
  
  public boolean reportInitVars()
  {
    return true;
  }
  
  public boolean possibleGCPoint(BytecodeStream bcs)
  {
    throw new RuntimeException("ShouldNotReachHere");
  }
  
  public void fillStackmapProlog(int nofGCPoints)
  {
    throw new RuntimeException("ShouldNotReachHere");
  }
  
  public void fillStackmapEpilog()
  {
    throw new RuntimeException("ShouldNotReachHere");
  }
  
  public void fillStackmapForOpcodes(BytecodeStream bcs, CellTypeStateList vars, CellTypeStateList stack, int stackTop)
  {
    throw new RuntimeException("ShouldNotReachHere");
  }
  
  public void fillInitVars(List init_vars)
  {
    throw new RuntimeException("ShouldNotReachHere");
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.GenerateOopMap
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

import java.io.PrintStream;

public class HeapPrinter
  implements HeapVisitor
{
  private OopPrinter oopPrinter;
  
  public HeapPrinter(PrintStream tty)
  {
    oopPrinter = new OopPrinter(tty);
  }
  
  public void prologue(long size) {}
  
  public boolean doObj(Oop obj)
  {
    obj.iterate(oopPrinter, true);
    return false;
  }
  
  public void epilogue() {}
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.HeapPrinter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

public abstract interface HeapVisitor
{
  public abstract void prologue(long paramLong);
  
  public abstract boolean doObj(Oop paramOop);
  
  public abstract void epilogue();
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.HeapVisitor
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

import java.io.PrintStream;

public class IndexableFieldIdentifier
  extends FieldIdentifier
{
  private int index;
  
  public IndexableFieldIdentifier(int index)
  {
    this.index = index;
  }
  
  public int getIndex()
  {
    return index;
  }
  
  public String getName()
  {
    return Integer.toString(getIndex());
  }
  
  public void printOn(PrintStream tty)
  {
    tty.print(" - " + getIndex() + ":\t");
  }
  
  public boolean equals(Object obj)
  {
    if (obj == null) {
      return false;
    }
    if (!(obj instanceof IndexableFieldIdentifier)) {
      return false;
    }
    return ((IndexableFieldIdentifier)obj).getIndex() == index;
  }
  
  public int hashCode()
  {
    return index;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.IndexableFieldIdentifier
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class Instance$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    Instance.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.Instance.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;

public class Instance
  extends Oop
{
  private static long typeSize;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Instance.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
    throws WrongTypeException
  {
    Type type = db.lookupType("instanceOopDesc");
    typeSize = type.getSize();
  }
  
  Instance(OopHandle handle, ObjectHeap heap)
  {
    super(handle, heap);
  }
  
  public static long getHeaderSize()
  {
    if (VM.getVM().isCompressedOopsEnabled()) {
      return typeSize - VM.getVM().getIntSize();
    }
    return typeSize;
  }
  
  public boolean isInstance()
  {
    return true;
  }
  
  public void iterateFields(OopVisitor visitor, boolean doVMFields)
  {
    super.iterateFields(visitor, doVMFields);
    ((InstanceKlass)getKlass()).iterateNonStaticFields(visitor);
  }
  
  public void printValueOn(PrintStream tty)
  {
    if (getKlass().getName().asString().equals("java/lang/String")) {
      tty.print("\"" + OopUtilities.stringOopToString(this) + "\"");
    } else {
      super.printValueOn(tty);
    }
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.Instance
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class InstanceKlass$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    InstanceKlass.access$000(VM.getVM().getTypeDataBase());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.InstanceKlass.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

public class InstanceKlass$ClassState
{
  public static final ClassState UNPARSABLE_BY_GC = new ClassState("unparsable_by_gc");
  public static final ClassState ALLOCATED = new ClassState("allocated");
  public static final ClassState LOADED = new ClassState("loaded");
  public static final ClassState LINKED = new ClassState("linked");
  public static final ClassState BEING_INITIALIZED = new ClassState("beingInitialized");
  public static final ClassState FULLY_INITIALIZED = new ClassState("fullyInitialized");
  public static final ClassState INITIALIZATION_ERROR = new ClassState("initializationError");
  private String value;
  
  private InstanceKlass$ClassState(String value)
  {
    this.value = value;
  }
  
  public String toString()
  {
    return value;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.InstanceKlass.ClassState
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

public abstract interface InstanceKlass$InnerClassAttributeOffset
{
  public static final int innerClassInnerClassInfoOffset = 0;
  public static final int innerClassOuterClassInfoOffset = 1;
  public static final int innerClassInnerNameOffset = 2;
  public static final int innerClassAccessFlagsOffset = 3;
  public static final int innerClassNextOffset = 4;
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.oops.InstanceKlass.InnerClassAttributeOffset
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.oops;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.memory.SymbolTable;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.types.WrongTypeException;
import sun.jvm.hotspot.utilities.Assert;

public class InstanceKlass
  extends Klass
{
  public static int ACCESS_FLAGS_OFFSET;
  public static int NAME_INDEX_OFFSET;
  public static int SIGNATURE_INDEX_OFFSET;
  public static int INITVAL_INDEX_OFFSET;
  public static int LOW_OFFSET;
  public static int H
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd