Mercurial > hg > Members > kono > jpf-core
diff src/main/gov/nasa/jpf/jvm/bytecode/JVMArrayElementInstruction.java @ 25:3517702bd768
added class name to warning for ambiguous native methods (without MJI signatures)
fixed VarTracker, which was utterly unaware of new instruction type hierarchy.
added JVMArrayElementInstruction.get{Array/Index}Attr(ti) since listeners most
likely use attrs which otherwise would have to be retrieved/cached in
executeInstruction() notifications (e.g. variable name for array)
fixed ReadInstruction, which somehow extended StoreInstruction
author | Peter Mehlitz <pcmehlitz@gmail.com> |
---|---|
date | Wed, 22 Apr 2015 15:54:26 -0700 |
parents | 61d41facf527 |
children |
line wrap: on
line diff
--- a/src/main/gov/nasa/jpf/jvm/bytecode/JVMArrayElementInstruction.java Tue Apr 21 00:34:15 2015 -0700 +++ b/src/main/gov/nasa/jpf/jvm/bytecode/JVMArrayElementInstruction.java Wed Apr 22 15:54:26 2015 -0700 @@ -29,13 +29,20 @@ protected int arrayRef; protected int index; // the accessed element + + // we cache these to avoid the need for executeInstruction() listening + // if attrs are processed in instructionExecuted() + protected Object arrayOperandAttr; + protected Object indexOperandAttr; // we need this to be abstract because of the LongArrayStore insns @Override abstract public int peekIndex (ThreadInfo ti); - - abstract protected int peekArrayRef (ThreadInfo ti); - + abstract public int peekArrayRef (ThreadInfo ti); + + abstract public Object peekIndexAttr (ThreadInfo ti); + abstract public Object peekArrayAttr (ThreadInfo ti); + public boolean isReferenceArray() { return false; } @@ -62,6 +69,23 @@ } } + public Object getArrayOperandAttr (ThreadInfo ti){ + if (ti.isPreExec()) { + return peekArrayAttr(ti); + } else { + return arrayOperandAttr; + } + } + + public Object getIndexOperandAttr (ThreadInfo ti){ + if (ti.isPreExec()) { + return peekIndexAttr(ti); + } else { + return indexOperandAttr; + } + } + + @Override public ElementInfo peekArrayElementInfo (ThreadInfo ti){ int aref = getArrayRef(ti);