int getLength() { return super.getLength() + 2; }
int getLength() { return super.getLength() + 2; }
/** * Returns the byteIndex of the given instruction. */ int getByteIndex(Instruction ins) { if (_byteIndexesValid && ins.byteIndex != -1) return ins.byteIndex; int byteIndex = 0; for (CodeEntry entry = _head.next; entry != _tail; entry = entry.next) { if (entry == ins) return byteIndex; byteIndex += ((Instruction) entry).getLength(); } throw new IllegalArgumentException("ins.owner != this"); }
/** * Returns the byteIndex of the given instruction. */ int getByteIndex(Instruction ins) { if (_byteIndexesValid && ins.byteIndex != -1) return ins.byteIndex; int byteIndex = 0; for (CodeEntry entry = _head.next; entry != _tail; entry = entry.next) { if (entry == ins) return byteIndex; byteIndex += ((Instruction) entry).getLength(); } throw new IllegalArgumentException("ins.owner != this"); }
/** * Returns the instruction in this code block found at the given byte index. */ Instruction getInstruction(int byteIndex) { if (byteIndex < 0) return null; int curIndex = 0; for (CodeEntry entry = _head.next; entry != _tail; entry = entry.next) { if (byteIndex == curIndex) return (Instruction) entry; curIndex += ((Instruction) entry).getLength(); } // some instruction ptrs are actually to a "next" instruction, so // allow one past the end if (byteIndex == curIndex) return null; throw new IllegalArgumentException(String.valueOf(byteIndex)); }
/** * Returns the instruction in this code block found at the given byte index. */ Instruction getInstruction(int byteIndex) { if (byteIndex < 0) return null; int curIndex = 0; for (CodeEntry entry = _head.next; entry != _tail; entry = entry.next) { if (byteIndex == curIndex) return (Instruction) entry; curIndex += ((Instruction) entry).getLength(); } // some instruction ptrs are actually to a "next" instruction, so // allow one past the end if (byteIndex == curIndex) return null; throw new IllegalArgumentException(String.valueOf(byteIndex)); }
/** * Get the number of bytes for which this local has a value in * the code byte array. */ public int getLength() { if (_end != null) return _end.getByteIndex() + _end.getLength() - _target.getByteIndex(); return _length; }
/** * Return the program counter end position for this exception handler. * This represents an index into the code byte array. */ public int getTryEndPc() { return _tryEnd.getByteIndex() + getTryEnd().getLength(); }
/** * Return the program counter end position for this exception handler. * This represents an index into the code byte array. */ public int getTryEndPc() { return _tryEnd.getByteIndex() + getTryEnd().getLength(); }
/** * Get the number of bytes for which this local has a value in * the code byte array. */ public int getLength() { if (_end != null) return _end.getByteIndex() + _end.getLength() - _target.getByteIndex(); return _length; }
int getLength() { // covers maxStack, maxLocals, codeLength, exceptionTableLength, // attributeCount int length = 12; // add code Instruction last = getLastInstruction(); if (last != null) length += last.getByteIndex() + last.getLength(); // add exception reps; each is 8 bytes length += (8 * _handlers.size()); // add all attribute lengths Attribute[] attrs = getAttributes(); for (int i = 0; i < attrs.length; i++) length += (attrs[i].getLength() + 6); return length; }
int getLength() { // covers maxStack, maxLocals, codeLength, exceptionTableLength, // attributeCount int length = 12; // add code Instruction last = getLastInstruction(); if (last != null) length += last.getByteIndex() + last.getLength(); // add exception reps; each is 8 bytes length += (8 * _handlers.size()); // add all attribute lengths Attribute[] attrs = getAttributes(); for (int i = 0; i < attrs.length; i++) length += (attrs[i].getLength() + 6); return length; }
private void readCode(DataInput in, int len) throws IOException { _head.next = _tail; _tail.prev = _head; _size = 0; _byteIndexesValid = true; beforeFirst(); Instruction ins; for (int byteIndex = 0; byteIndex < len;) { ins = createInstruction(in.readUnsignedByte()); _ci.addInternal(ins); ins.byteIndex = byteIndex; ins.read(in); byteIndex += ins.getLength(); } updateInstructionPointers(); beforeFirst(); // sanity check if (!_byteIndexesValid) throw new IllegalStateException(); }
private void readCode(DataInput in, int len) throws IOException { _head.next = _tail; _tail.prev = _head; _size = 0; _byteIndexesValid = true; beforeFirst(); Instruction ins; for (int byteIndex = 0; byteIndex < len;) { ins = createInstruction(in.readUnsignedByte()); _ci.addInternal(ins); ins.byteIndex = byteIndex; ins.read(in); byteIndex += ins.getLength(); } updateInstructionPointers(); beforeFirst(); // sanity check if (!_byteIndexesValid) throw new IllegalStateException(); }