|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkorat.instrumentation.bytecode.VisitorSupport
korat.instrumentation.bytecode.JavassistInstructionVisitor
korat.instrumentation.bytecode.ArrayBytecodesVisitor
public class ArrayBytecodesVisitor
Visitor that handles each bytecode instruction in order to instrument all accesses to array fields.
Field Summary | |
---|---|
private static String[] |
koratArrayClassNames
This is used when replacing NEWARRAY bytecode instructions. |
Fields inherited from class korat.instrumentation.bytecode.JavassistInstructionVisitor |
---|
booleanType, byteType, charType, classPool, classType, constPool, doubleType, floatType, intType, longType, objectType, operandStack, shortType, stringType, voidType |
Constructor Summary | |
---|---|
ArrayBytecodesVisitor(ClassPool classPool,
ConstPool constPool,
OperandStack operandStack)
|
Method Summary | |
---|---|
private void |
delegateANewArray(int cpIdx,
CodeIterator cit,
int idx)
|
private void |
delegateArrayAccess(String methodName,
CtClass retType,
CtClass[] args,
CodeIterator cit,
int idx)
Replaces all kinds of array accesses (ARRAYLENGTH, IALOAD, IASTORE, LALOAD, LASTORE, ...) with the specified method call. |
private void |
delegateArrayGetfield(int cpIdx,
CodeIterator cit,
int idx)
Replaces retrieval of the array field with the retrieval of its corresponding KoratArray field. |
private void |
delegateArrayPutfield(int cpIdx,
CodeIterator cit,
int idx)
Replaces setting array field with the setting its corresponding KoratArray field. |
private void |
delegateNewArray(int arrayType,
CodeIterator cit,
int idx)
Replaces creation of the array with the creation of the KoratArray field. |
private CtClass |
getKoratArrayType(CtClass opType)
|
void |
visitAALOAD(BytecodeInstruction instr)
|
void |
visitAASTORE(BytecodeInstruction instr)
|
void |
visitANEWARRAY(BytecodeInstruction instr)
|
void |
visitARRAYLENGTH(BytecodeInstruction instr)
array.length -> __korat_KoratArray_array.getLength() |
void |
visitBALOAD(BytecodeInstruction instr)
byteArray[i] -> __korat_KoratArray_byteArray.get(i) |
void |
visitBASTORE(BytecodeInstruction instr)
byteArray[i] = x -> __korat_KoratArray_byteArray.set(i, x) |
void |
visitCALOAD(BytecodeInstruction instr)
charArray[i] -> __korat_KoratArray_charArray.get(i) |
void |
visitCASTORE(BytecodeInstruction instr)
charArray[i] = x -> __korat_KoratArray_charArray.set(i, x) |
void |
visitDALOAD(BytecodeInstruction instr)
doubleArray[i] -> __korat_KoratArray_doubleArray.get(i) |
void |
visitDASTORE(BytecodeInstruction instr)
doubleArray[i] = x -> __korat_KoratArray_doubleArray.set(i, x) |
void |
visitFALOAD(BytecodeInstruction instr)
floatArray[i] -> __korat_KoratArray_floatArray.get(i) |
void |
visitFASTORE(BytecodeInstruction instr)
floatArray[i] = x -> __korat_KoratArray_floatArray.set(i, x) |
void |
visitGETFIELD(BytecodeInstruction instr)
|
void |
visitIALOAD(BytecodeInstruction instr)
intArray[i] -> __korat_KoratArray_intArray.get(i) |
void |
visitIASTORE(BytecodeInstruction instr)
intArray[i] = x -> __korat_KoratArray_intArray.set(i, x) |
void |
visitLALOAD(BytecodeInstruction instr)
longArray[i] -> __korat_KoratArray_longArray.get(i) |
void |
visitLASTORE(BytecodeInstruction instr)
longArray[i] = x -> __korat_KoratArray_longArray.set(i, x) |
void |
visitNEWARRAY(BytecodeInstruction instr)
|
void |
visitPUTFIELD(BytecodeInstruction instr)
|
void |
visitSALOAD(BytecodeInstruction instr)
shortArray[i] -> __korat_KoratArray_shortArray.get(i) |
void |
visitSASTORE(BytecodeInstruction instr)
shortArray[i] = x -> __korat_KoratArray_shortArray.set(i, x) |
Methods inherited from class korat.instrumentation.bytecode.JavassistInstructionVisitor |
---|
checkArrayType, checkArrayType, checkArrayType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static String[] koratArrayClassNames
This is used when replacing NEWARRAY bytecode instructions. NEWARRAY is
used for arrays of primitive types creation. NEWARRAY instruction is 2
byte long. The second byte represents the primitive type of the array: 4 -
boolean, 5 - char, and so on. koratClassNames
maps those
byte numbers to KoratArray class names.
Constructor Detail |
---|
public ArrayBytecodesVisitor(ClassPool classPool, ConstPool constPool, OperandStack operandStack)
Method Detail |
---|
private void delegateArrayGetfield(int cpIdx, CodeIterator cit, int idx)
cit
- -
CodeIteratoridx
- -
current position in the cit
cpIdx
- -
index for the array field in the cPool
NotFoundException
public void visitGETFIELD(BytecodeInstruction instr)
visitGETFIELD
in interface BytecodeVisitor
visitGETFIELD
in class VisitorSupport
private void delegateArrayPutfield(int cpIdx, CodeIterator cit, int idx)
cit
- -
iterator through method's body codeidx
- -
current position in the cit
cpIdx
- -
index for the array field in the cPool
NotFoundException
public void visitPUTFIELD(BytecodeInstruction instr)
visitPUTFIELD
in interface BytecodeVisitor
visitPUTFIELD
in class VisitorSupport
private void delegateNewArray(int arrayType, CodeIterator cit, int idx)
int
parameter
that represents the length of the array.
arrayType
- -
type of array in terms of JVMcit
- -
iterator through method's body codeidx
- -
current position in the cit
BadBytecode
public void visitNEWARRAY(BytecodeInstruction instr)
visitNEWARRAY
in interface BytecodeVisitor
visitNEWARRAY
in class VisitorSupport
private void delegateANewArray(int cpIdx, CodeIterator cit, int idx)
public void visitANEWARRAY(BytecodeInstruction instr)
visitANEWARRAY
in interface BytecodeVisitor
visitANEWARRAY
in class VisitorSupport
private void delegateArrayAccess(String methodName, CtClass retType, CtClass[] args, CodeIterator cit, int idx)
cit
- -
code iteratoridx
- -
current position in the cit
methodName
- -
name of the method to be calledretType
- -
return type of the method to be calledargs
- -
actual arguments for the method to be called
BadBytecode
private CtClass getKoratArrayType(CtClass opType)
public void visitAALOAD(BytecodeInstruction instr)
visitAALOAD
in interface BytecodeVisitor
visitAALOAD
in class VisitorSupport
public void visitAASTORE(BytecodeInstruction instr)
visitAASTORE
in interface BytecodeVisitor
visitAASTORE
in class VisitorSupport
public void visitARRAYLENGTH(BytecodeInstruction instr)
visitARRAYLENGTH
in interface BytecodeVisitor
visitARRAYLENGTH
in class VisitorSupport
public void visitBALOAD(BytecodeInstruction instr)
visitBALOAD
in interface BytecodeVisitor
visitBALOAD
in class VisitorSupport
public void visitBASTORE(BytecodeInstruction instr)
visitBASTORE
in interface BytecodeVisitor
visitBASTORE
in class VisitorSupport
public void visitCALOAD(BytecodeInstruction instr)
visitCALOAD
in interface BytecodeVisitor
visitCALOAD
in class VisitorSupport
public void visitCASTORE(BytecodeInstruction instr)
visitCASTORE
in interface BytecodeVisitor
visitCASTORE
in class VisitorSupport
public void visitDALOAD(BytecodeInstruction instr)
visitDALOAD
in interface BytecodeVisitor
visitDALOAD
in class VisitorSupport
public void visitDASTORE(BytecodeInstruction instr)
visitDASTORE
in interface BytecodeVisitor
visitDASTORE
in class VisitorSupport
public void visitFALOAD(BytecodeInstruction instr)
visitFALOAD
in interface BytecodeVisitor
visitFALOAD
in class VisitorSupport
public void visitFASTORE(BytecodeInstruction instr)
visitFASTORE
in interface BytecodeVisitor
visitFASTORE
in class VisitorSupport
public void visitIALOAD(BytecodeInstruction instr)
visitIALOAD
in interface BytecodeVisitor
visitIALOAD
in class VisitorSupport
public void visitIASTORE(BytecodeInstruction instr)
visitIASTORE
in interface BytecodeVisitor
visitIASTORE
in class VisitorSupport
public void visitLALOAD(BytecodeInstruction instr)
visitLALOAD
in interface BytecodeVisitor
visitLALOAD
in class VisitorSupport
public void visitLASTORE(BytecodeInstruction instr)
visitLASTORE
in interface BytecodeVisitor
visitLASTORE
in class VisitorSupport
public void visitSALOAD(BytecodeInstruction instr)
visitSALOAD
in interface BytecodeVisitor
visitSALOAD
in class VisitorSupport
public void visitSASTORE(BytecodeInstruction instr)
visitSASTORE
in interface BytecodeVisitor
visitSASTORE
in class VisitorSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |