SandMark version 3.0


sandmark.watermark.util
Class EveryBlockMarker

java.lang.Object
  |
  +--sandmark.watermark.util.MethodMarker
        |
        +--sandmark.watermark.util.EveryBlockMarker

public class EveryBlockMarker
extends MethodMarker

This implementation of MethodMarker takes a BasicBlockMarker and uses it to mark each basic block in a method. The BasicBlockMarker is also used to recognize embedded values from each basic block in the method.


Constructor Summary
EveryBlockMarker(BasicBlockMarker _marker)
          Constructs a marker that marks basic blocks using the given BasicBlockMarker.
 
Method Summary
 void embed(MethodCFG m, de.fub.bytecode.generic.ClassGen cg, java.math.BigInteger value)
          Attempts to encode the given value in the given method.
 int getCapacity(MethodCFG m)
          Returns the number of bits that can be encoded into the given method.
 java.util.Iterator recognize(MethodCFG m)
          Returns an Iterator over all values found to be embedded in the given method.
 
Methods inherited from class sandmark.watermark.util.MethodMarker
embed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EveryBlockMarker

public EveryBlockMarker(BasicBlockMarker _marker)
Constructs a marker that marks basic blocks using the given BasicBlockMarker.

Parameters:
_marker - used to embed and recognize values in each basic block of a method
Method Detail

embed

public final void embed(MethodCFG m,
                        de.fub.bytecode.generic.ClassGen cg,
                        java.math.BigInteger value)
Attempts to encode the given value in the given method. The method is modified in place. If the number of bits in the given value exceeds that of the value returned by getCapacity(), an IllegalArgumentException will be thrown.

Each basic block in the method will be marked with the given value.

Specified by:
embed in class MethodMarker
Parameters:
m - method to encode data in
cg - class the method comes from
value - data to encode
Throws:
java.lang.IllegalArgumentException - if value has too many bits
See Also:
getCapacity(sandmark.util.controlflowgraph.MethodCFG)

recognize

public final java.util.Iterator recognize(MethodCFG m)
Returns an Iterator over all values found to be embedded in the given method. The returned Iterator will iterate over all values found in at least one basic block of the method, sorted in descending order according to how many basic blocks each value was found in.

Specified by:
recognize in class MethodMarker
Parameters:
m - method to search for marks in

getCapacity

public final int getCapacity(MethodCFG m)
Returns the number of bits that can be encoded into the given method. This is calculated to be the smallest capacity among the basic blocks of the method, as returned by the underlying BasicBlockMarker.

Specified by:
getCapacity in class MethodMarker
Parameters:
m - method to report the bit capacity of
See Also:
embed(sandmark.util.controlflowgraph.MethodCFG, de.fub.bytecode.generic.ClassGen, java.math.BigInteger), MethodMarker.embed(sandmark.util.controlflowgraph.MethodCFG, de.fub.bytecode.generic.ClassGen, long), BasicBlockMarker.getCapacity(sandmark.util.controlflowgraph.BasicBlock)

SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003