Methods Summary |
---|
public boolean | containsTarget(com.sun.org.apache.bcel.internal.generic.InstructionHandle ih)
if(target == ih)
return true;
for(int i=0; i < targets.length; i++)
if(targets[i] == ih)
return true;
return false;
|
void | dispose()Inform targets that they're not targeted anymore.
super.dispose();
for(int i=0; i < targets.length; i++)
targets[i].removeTargeter(this);
|
public void | dump(java.io.DataOutputStream out)Dump instruction as byte code to stream out.
out.writeByte(opcode);
for(int i=0; i < padding; i++) // Padding bytes
out.writeByte(0);
index = getTargetOffset(); // Write default target offset
out.writeInt(index);
|
public int[] | getIndices() return indices;
|
public int[] | getMatchs() return match;
|
public com.sun.org.apache.bcel.internal.generic.InstructionHandle[] | getTargets() return targets;
|
protected void | initFromFile(com.sun.org.apache.bcel.internal.util.ByteSequence bytes, boolean wide)Read needed data (e.g. index) from file.
padding = (4 - (bytes.getIndex() % 4)) % 4; // Compute number of pad bytes
for(int i=0; i < padding; i++) {
byte b;
if((b=bytes.readByte()) != 0)
throw new ClassGenException("Padding byte != 0: " + b);
}
// Default branch target common for both cases (TABLESWITCH, LOOKUPSWITCH)
index = bytes.readInt();
|
public void | setTarget(int i, com.sun.org.apache.bcel.internal.generic.InstructionHandle target)Set branch target for `i'th case
notifyTarget(targets[i], target, this);
targets[i] = target;
|
public java.lang.String | toString(boolean verbose)
StringBuffer buf = new StringBuffer(super.toString(verbose));
if(verbose) {
for(int i=0; i < match_length; i++) {
String s = "null";
if(targets[i] != null)
s = targets[i].getInstruction().toString();
buf.append("(" + match[i] + ", " + s + " = {" + indices[i] + "})");
}
}
else
buf.append(" ...");
return buf.toString();
|
protected int | updatePosition(int offset, int max_offset)Since this is a variable length instruction, it may shift the following
instructions which then need to update their position.
Called by InstructionList.setPositions when setting the position for every
instruction. In the presence of variable length instructions `setPositions'
performs multiple passes over the instruction list to calculate the
correct (byte) positions and offsets by calling this function.
position += offset; // Additional offset caused by preceding SWITCHs, GOTOs, etc.
short old_length = length;
/* Alignment on 4-byte-boundary, + 1, because of tag byte.
*/
padding = (4 - ((position + 1) % 4)) % 4;
length = (short)(fixed_length + padding); // Update length
return length - old_length;
|
public void | updateTarget(com.sun.org.apache.bcel.internal.generic.InstructionHandle old_ih, com.sun.org.apache.bcel.internal.generic.InstructionHandle new_ih)
boolean targeted = false;
if(target == old_ih) {
targeted = true;
setTarget(new_ih);
}
for(int i=0; i < targets.length; i++) {
if(targets[i] == old_ih) {
targeted = true;
setTarget(i, new_ih);
}
}
if(!targeted)
throw new ClassGenException("Not targeting " + old_ih);
|