public VariableInstruction(byte opcode, int variableIndex, int constant) { this.opcode = opcode; this.variableIndex = variableIndex; this.constant = constant; this.wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; }
public VariableInstruction(byte opcode, int variableIndex, int constant) { this.opcode = opcode; this.variableIndex = variableIndex; this.constant = constant; this.wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; }
public VariableInstruction(byte opcode, int variableIndex, int constant) { this.opcode = opcode; this.variableIndex = variableIndex; this.constant = constant; this.wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; }
public VariableInstruction(byte opcode, int variableIndex, int constant) { this.opcode = opcode; this.variableIndex = variableIndex; this.constant = constant; this.wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; }
public Instruction shrink() { opcode = canonicalOpcode(); // Is this instruction pointing to a variable with index from 0 to 3? if (variableIndex <= 3) { switch (opcode) { case InstructionConstants.OP_ILOAD: opcode = (byte)(InstructionConstants.OP_ILOAD_0 + variableIndex); break; case InstructionConstants.OP_LLOAD: opcode = (byte)(InstructionConstants.OP_LLOAD_0 + variableIndex); break; case InstructionConstants.OP_FLOAD: opcode = (byte)(InstructionConstants.OP_FLOAD_0 + variableIndex); break; case InstructionConstants.OP_DLOAD: opcode = (byte)(InstructionConstants.OP_DLOAD_0 + variableIndex); break; case InstructionConstants.OP_ALOAD: opcode = (byte)(InstructionConstants.OP_ALOAD_0 + variableIndex); break; case InstructionConstants.OP_ISTORE: opcode = (byte)(InstructionConstants.OP_ISTORE_0 + variableIndex); break; case InstructionConstants.OP_LSTORE: opcode = (byte)(InstructionConstants.OP_LSTORE_0 + variableIndex); break; case InstructionConstants.OP_FSTORE: opcode = (byte)(InstructionConstants.OP_FSTORE_0 + variableIndex); break; case InstructionConstants.OP_DSTORE: opcode = (byte)(InstructionConstants.OP_DSTORE_0 + variableIndex); break; case InstructionConstants.OP_ASTORE: opcode = (byte)(InstructionConstants.OP_ASTORE_0 + variableIndex); break; } } // Only make the instruction wide if necessary. wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; return this; }
public Instruction shrink() { opcode = canonicalOpcode(); // Is this instruction pointing to a variable with index from 0 to 3? if (variableIndex <= 3) { switch (opcode) { case InstructionConstants.OP_ILOAD: opcode = (byte)(InstructionConstants.OP_ILOAD_0 + variableIndex); break; case InstructionConstants.OP_LLOAD: opcode = (byte)(InstructionConstants.OP_LLOAD_0 + variableIndex); break; case InstructionConstants.OP_FLOAD: opcode = (byte)(InstructionConstants.OP_FLOAD_0 + variableIndex); break; case InstructionConstants.OP_DLOAD: opcode = (byte)(InstructionConstants.OP_DLOAD_0 + variableIndex); break; case InstructionConstants.OP_ALOAD: opcode = (byte)(InstructionConstants.OP_ALOAD_0 + variableIndex); break; case InstructionConstants.OP_ISTORE: opcode = (byte)(InstructionConstants.OP_ISTORE_0 + variableIndex); break; case InstructionConstants.OP_LSTORE: opcode = (byte)(InstructionConstants.OP_LSTORE_0 + variableIndex); break; case InstructionConstants.OP_FSTORE: opcode = (byte)(InstructionConstants.OP_FSTORE_0 + variableIndex); break; case InstructionConstants.OP_DSTORE: opcode = (byte)(InstructionConstants.OP_DSTORE_0 + variableIndex); break; case InstructionConstants.OP_ASTORE: opcode = (byte)(InstructionConstants.OP_ASTORE_0 + variableIndex); break; } } // Only make the instruction wide if necessary. wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; return this; }
public Instruction shrink() { opcode = canonicalOpcode(); // Is this instruction pointing to a variable with index from 0 to 3? if (variableIndex <= 3) { switch (opcode) { case InstructionConstants.OP_ILOAD: opcode = (byte)(InstructionConstants.OP_ILOAD_0 + variableIndex); break; case InstructionConstants.OP_LLOAD: opcode = (byte)(InstructionConstants.OP_LLOAD_0 + variableIndex); break; case InstructionConstants.OP_FLOAD: opcode = (byte)(InstructionConstants.OP_FLOAD_0 + variableIndex); break; case InstructionConstants.OP_DLOAD: opcode = (byte)(InstructionConstants.OP_DLOAD_0 + variableIndex); break; case InstructionConstants.OP_ALOAD: opcode = (byte)(InstructionConstants.OP_ALOAD_0 + variableIndex); break; case InstructionConstants.OP_ISTORE: opcode = (byte)(InstructionConstants.OP_ISTORE_0 + variableIndex); break; case InstructionConstants.OP_LSTORE: opcode = (byte)(InstructionConstants.OP_LSTORE_0 + variableIndex); break; case InstructionConstants.OP_FSTORE: opcode = (byte)(InstructionConstants.OP_FSTORE_0 + variableIndex); break; case InstructionConstants.OP_DSTORE: opcode = (byte)(InstructionConstants.OP_DSTORE_0 + variableIndex); break; case InstructionConstants.OP_ASTORE: opcode = (byte)(InstructionConstants.OP_ASTORE_0 + variableIndex); break; } } // Only make the instruction wide if necessary. wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; return this; }
public Instruction shrink() { opcode = canonicalOpcode(); // Is this instruction pointing to a variable with index from 0 to 3? if (variableIndex <= 3) { switch (opcode) { case InstructionConstants.OP_ILOAD: opcode = (byte)(InstructionConstants.OP_ILOAD_0 + variableIndex); break; case InstructionConstants.OP_LLOAD: opcode = (byte)(InstructionConstants.OP_LLOAD_0 + variableIndex); break; case InstructionConstants.OP_FLOAD: opcode = (byte)(InstructionConstants.OP_FLOAD_0 + variableIndex); break; case InstructionConstants.OP_DLOAD: opcode = (byte)(InstructionConstants.OP_DLOAD_0 + variableIndex); break; case InstructionConstants.OP_ALOAD: opcode = (byte)(InstructionConstants.OP_ALOAD_0 + variableIndex); break; case InstructionConstants.OP_ISTORE: opcode = (byte)(InstructionConstants.OP_ISTORE_0 + variableIndex); break; case InstructionConstants.OP_LSTORE: opcode = (byte)(InstructionConstants.OP_LSTORE_0 + variableIndex); break; case InstructionConstants.OP_FSTORE: opcode = (byte)(InstructionConstants.OP_FSTORE_0 + variableIndex); break; case InstructionConstants.OP_DSTORE: opcode = (byte)(InstructionConstants.OP_DSTORE_0 + variableIndex); break; case InstructionConstants.OP_ASTORE: opcode = (byte)(InstructionConstants.OP_ASTORE_0 + variableIndex); break; } } // Only make the instruction wide if necessary. wide = requiredVariableIndexSize() > 1 || requiredConstantSize() > 1; return this; }
protected void writeInfo(byte[] code, int offset) { int variableIndexSize = variableIndexSize(); int constantSize = constantSize(); if (requiredVariableIndexSize() > variableIndexSize) { throw new IllegalArgumentException("Instruction has invalid variable index size ("+this.toString(offset)+")"); } if (requiredConstantSize() > constantSize) { throw new IllegalArgumentException("Instruction has invalid constant size ("+this.toString(offset)+")"); } writeValue(code, offset, variableIndex, variableIndexSize); offset += variableIndexSize; writeSignedValue(code, offset, constant, constantSize); }
protected void writeInfo(byte[] code, int offset) { int variableIndexSize = variableIndexSize(); int constantSize = constantSize(); if (requiredVariableIndexSize() > variableIndexSize) { throw new IllegalArgumentException("Instruction has invalid variable index size ("+this.toString(offset)+")"); } if (requiredConstantSize() > constantSize) { throw new IllegalArgumentException("Instruction has invalid constant size ("+this.toString(offset)+")"); } writeValue(code, offset, variableIndex, variableIndexSize); offset += variableIndexSize; writeSignedValue(code, offset, constant, constantSize); }
protected void writeInfo(byte[] code, int offset) { int variableIndexSize = variableIndexSize(); int constantSize = constantSize(); if (requiredVariableIndexSize() > variableIndexSize) { throw new IllegalArgumentException("Instruction has invalid variable index size ("+this.toString(offset)+")"); } if (requiredConstantSize() > constantSize) { throw new IllegalArgumentException("Instruction has invalid constant size ("+this.toString(offset)+")"); } writeValue(code, offset, variableIndex, variableIndexSize); offset += variableIndexSize; writeSignedValue(code, offset, constant, constantSize); }
protected void writeInfo(byte[] code, int offset) { int variableIndexSize = variableIndexSize(); int constantSize = constantSize(); if (requiredVariableIndexSize() > variableIndexSize) { throw new IllegalArgumentException("Instruction has invalid variable index size ("+this.toString(offset)+")"); } if (requiredConstantSize() > constantSize) { throw new IllegalArgumentException("Instruction has invalid constant size ("+this.toString(offset)+")"); } writeValue(code, offset, variableIndex, variableIndexSize); offset += variableIndexSize; writeSignedValue(code, offset, constant, constantSize); }