|
SandMark version 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sandmark.watermark.util.BasicBlockMarker | +--sandmark.watermark.util.StaticWriteParityMarker
This class encodes one-bit values in basic blocks. It does so
using parity which can be toggled by inserting one of the following
instruction sequences into the basic block:
getstatic dummyfield ineg putstatic dummyfieldor
getstatic dummyfield iconst_1 iadd putstatic dummyfieldwhere dummyfield is a field added to the program during marking, and is hence not used anywhere by the program. For blocks from instance methods, an instance field is used, so the first and last instructions would be getfield and putfield, respectively.
MethodCFG
where the possibility of a thrown exception does not end
a basic block.
MethodCFG.MethodCFG(de.fub.bytecode.generic.MethodGen,
boolean)
,
MethodCFG.MethodCFG(de.fub.bytecode.generic.MethodGen,
de.fub.bytecode.generic.ConstantPoolGen,
boolean)
Constructor Summary | |
protected |
StaticWriteParityMarker(de.fub.bytecode.generic.ClassGen cg,
boolean _increment)
Constructs a new marker which will create a new static field in the given class if necessary. |
Method Summary | |
(package private) boolean |
capacityIsConstant()
Returns true if this class returns the same capacity for any basic block, including null. |
void |
embed(BasicBlock b,
de.fub.bytecode.generic.ClassGen cg,
java.math.BigInteger value)
Attempts to encode the given value in the given basic block. |
int |
getCapacity(BasicBlock b)
Returns the number of bits that can be encoded into the given basic block. |
protected abstract int |
getParity(BasicBlock b)
Returns either 0 or 1, based on what the parity of the given basic block currently is. |
(package private) static de.fub.bytecode.generic.MethodGen |
methodGen(BasicBlock b)
|
java.util.Iterator |
recognize(BasicBlock b)
Returns an Iterator over all values
found to be embedded in the
given basic block. |
Methods inherited from class sandmark.watermark.util.BasicBlockMarker |
embed |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected StaticWriteParityMarker(de.fub.bytecode.generic.ClassGen cg, boolean _increment)
cg
- class to create a new dummy static field in_increment
- If this argument is true, each added piece of
code will increment a new field by 1. If it is
false, each piece will negate the new field. Note that
the negating instruction sequence consists of 3 instructions,
while the incrementing instruction sequence consists of 4.Method Detail |
protected abstract int getParity(BasicBlock b)
public final void embed(BasicBlock b, de.fub.bytecode.generic.ClassGen cg, java.math.BigInteger value)
IllegalArgumentException
will be thrown.
embed
in class BasicBlockMarker
b
- basic block to encode data incg
- class the basic block comes fromvalue
- data to encode
java.lang.IllegalArgumentException
- if value is neither 0 nor 1getCapacity(sandmark.util.controlflowgraph.BasicBlock)
public final java.util.Iterator recognize(BasicBlock b)
Iterator
over all values
found to be embedded in the
given basic block. Only values embedded using the marking scheme
used by this marker will be reported.Iterator
will iterate over
exactly one value, and that value will be either 0 or 1.
recognize
in class BasicBlockMarker
b
- basic block to search for a mark inpublic final int getCapacity(BasicBlock b)
getCapacity
in class BasicBlockMarker
b
- basic block to report the bit capacity ofembed(sandmark.util.controlflowgraph.BasicBlock,
de.fub.bytecode.generic.ClassGen, java.math.BigInteger)
,
BasicBlockMarker.embed(sandmark.util.controlflowgraph.BasicBlock,
de.fub.bytecode.generic.ClassGen, long)
final boolean capacityIsConstant()
capacityIsConstant
in class BasicBlockMarker
getCapacity(sandmark.util.controlflowgraph.BasicBlock)
static de.fub.bytecode.generic.MethodGen methodGen(BasicBlock b)
|
SandMark version 3.0 Wed Jan 29 10:30:05 MST 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |