Class VariableInstructionForm
java.lang.Object
org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteCodeForm
org.apache.commons.compress.harmony.unpack200.bytecode.forms.VariableInstructionForm
- Direct Known Subclasses:
SwitchForm
,WideForm
This abstract class implements the common code for instructions which have variable lengths. This is currently the *switch instructions and some wide (_w)
instructions.
-
Field Summary
Fields inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteCodeForm
byteCodeArray, byteCodesByName, WIDENED
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setRewrite2Bytes
(int operand, int absPosition, int[] rewrite) This method writes operand directly into the rewrite array at index position specified.void
setRewrite4Bytes
(int operand, int[] rewrite) Given an int operand, set the rewrite bytes for the next available operand position and the three immediately following it to a highest-byte, mid-high, mid-low, low-byte encoding of the operand.void
setRewrite4Bytes
(int operand, int absPosition, int[] rewrite) This method writes operand directly into the rewrite array at index position specified.Methods inherited from class org.apache.commons.compress.harmony.unpack200.bytecode.forms.ByteCodeForm
calculateOperandPosition, firstOperandIndex, fixUpByteCodeTargets, get, getName, getOpcode, getRewrite, getRewriteCopy, hasMultipleByteCodes, hasNoOperand, nestedMustStartClassPool, operandLength, setByteCodeOperands, toString
-
Constructor Details
-
VariableInstructionForm
-
-
Method Details
-
setRewrite2Bytes
This method writes operand directly into the rewrite array at index position specified.- Parameters:
operand
- value to writeabsPosition
- position in array to write. Note that this is absolute position in the array, so one can overwrite the bytecode if one isn't careful.rewrite
- array to write into
-
setRewrite4Bytes
This method writes operand directly into the rewrite array at index position specified.- Parameters:
operand
- value to writeabsPosition
- position in array to write. Note that this is absolute position in the array, so one can overwrite the bytecode if one isn't careful.rewrite
- array to write into
-
setRewrite4Bytes
Given an int operand, set the rewrite bytes for the next available operand position and the three immediately following it to a highest-byte, mid-high, mid-low, low-byte encoding of the operand. Note that unlike the ByteCode setOperand* operations, this starts with an actual bytecode rewrite array (rather than a ByteCodeForm prototype rewrite array). Also, this method overwrites -1 values in the rewrite array - so if you start with an array that looks like: {100, -1, -1, -1, -1, 200, -1, -1, -1, -1} then calling setRewrite4Bytes(0, rewrite) the first time will convert it to: {100, 0, 0, 0, 0, 200, -1, -1, -1, -1} Calling setRewrite4Bytes(0, rewrite) a second time will convert it to: {100, 0, 0, 0, 0, 200, 0, 0, 0, 0}- Parameters:
operand
- int to set the rewrite bytes torewrite
- int[] bytes to rewrite
-