|
||||||||||
| 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 citcpIdx - -
index for the array field in the cPool
NotFoundExceptionpublic void visitGETFIELD(BytecodeInstruction instr)
visitGETFIELD in interface BytecodeVisitorvisitGETFIELD in class VisitorSupport
private void delegateArrayPutfield(int cpIdx,
CodeIterator cit,
int idx)
cit - -
iterator through method's body codeidx - -
current position in the citcpIdx - -
index for the array field in the cPool
NotFoundExceptionpublic void visitPUTFIELD(BytecodeInstruction instr)
visitPUTFIELD in interface BytecodeVisitorvisitPUTFIELD 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
BadBytecodepublic void visitNEWARRAY(BytecodeInstruction instr)
visitNEWARRAY in interface BytecodeVisitorvisitNEWARRAY in class VisitorSupport
private void delegateANewArray(int cpIdx,
CodeIterator cit,
int idx)
public void visitANEWARRAY(BytecodeInstruction instr)
visitANEWARRAY in interface BytecodeVisitorvisitANEWARRAY in class VisitorSupport
private void delegateArrayAccess(String methodName,
CtClass retType,
CtClass[] args,
CodeIterator cit,
int idx)
cit - -
code iteratoridx - -
current position in the citmethodName - -
name of the method to be calledretType - -
return type of the method to be calledargs - -
actual arguments for the method to be called
BadBytecodeprivate CtClass getKoratArrayType(CtClass opType)
public void visitAALOAD(BytecodeInstruction instr)
visitAALOAD in interface BytecodeVisitorvisitAALOAD in class VisitorSupportpublic void visitAASTORE(BytecodeInstruction instr)
visitAASTORE in interface BytecodeVisitorvisitAASTORE in class VisitorSupportpublic void visitARRAYLENGTH(BytecodeInstruction instr)
visitARRAYLENGTH in interface BytecodeVisitorvisitARRAYLENGTH in class VisitorSupportpublic void visitBALOAD(BytecodeInstruction instr)
visitBALOAD in interface BytecodeVisitorvisitBALOAD in class VisitorSupportpublic void visitBASTORE(BytecodeInstruction instr)
visitBASTORE in interface BytecodeVisitorvisitBASTORE in class VisitorSupportpublic void visitCALOAD(BytecodeInstruction instr)
visitCALOAD in interface BytecodeVisitorvisitCALOAD in class VisitorSupportpublic void visitCASTORE(BytecodeInstruction instr)
visitCASTORE in interface BytecodeVisitorvisitCASTORE in class VisitorSupportpublic void visitDALOAD(BytecodeInstruction instr)
visitDALOAD in interface BytecodeVisitorvisitDALOAD in class VisitorSupportpublic void visitDASTORE(BytecodeInstruction instr)
visitDASTORE in interface BytecodeVisitorvisitDASTORE in class VisitorSupportpublic void visitFALOAD(BytecodeInstruction instr)
visitFALOAD in interface BytecodeVisitorvisitFALOAD in class VisitorSupportpublic void visitFASTORE(BytecodeInstruction instr)
visitFASTORE in interface BytecodeVisitorvisitFASTORE in class VisitorSupportpublic void visitIALOAD(BytecodeInstruction instr)
visitIALOAD in interface BytecodeVisitorvisitIALOAD in class VisitorSupportpublic void visitIASTORE(BytecodeInstruction instr)
visitIASTORE in interface BytecodeVisitorvisitIASTORE in class VisitorSupportpublic void visitLALOAD(BytecodeInstruction instr)
visitLALOAD in interface BytecodeVisitorvisitLALOAD in class VisitorSupportpublic void visitLASTORE(BytecodeInstruction instr)
visitLASTORE in interface BytecodeVisitorvisitLASTORE in class VisitorSupportpublic void visitSALOAD(BytecodeInstruction instr)
visitSALOAD in interface BytecodeVisitorvisitSALOAD in class VisitorSupportpublic void visitSASTORE(BytecodeInstruction instr)
visitSASTORE in interface BytecodeVisitorvisitSASTORE in class VisitorSupport
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||