SandMark version 3.0


sandmark.util.controlflowgraph
Class PositiveIntSynthesizer

java.lang.Object
  |
  +--sandmark.util.controlflowgraph.ControlFlowSynthesizer
        |
        +--sandmark.util.controlflowgraph.IntFuncSynthesizer
              |
              +--sandmark.util.controlflowgraph.PositiveIntSynthesizer

public class PositiveIntSynthesizer
extends IntFuncSynthesizer

A PositiveIntSyntheizer generates an integer function that works by maintaining the "hidden" invariant: its one variable always has a nonnegative value. The function argument is made non-negative using a randomly chosen code fragment. Basic block code fragments (also randomly chosen) preserve the invariant. Code can be generated to force a positive, negative, zero, or nonzero result, allowing use with an opaque predicate.


Field Summary
 
Fields inherited from class sandmark.util.controlflowgraph.ControlFlowSynthesizer
rng
 
Constructor Summary
PositiveIntSynthesizer()
           
 
Method Summary
 MethodCFG generate(Graph graph, de.fub.bytecode.generic.ConstantPoolGen cpg)
          Generates an integer function corresponding to the given graph.
 MethodCFG generate(Graph graph, de.fub.bytecode.generic.ConstantPoolGen cpg, short opcode)
          Generates an integer function with a constraint on the returned result.
static void main(java.lang.String[] args)
          Test driver; see ControlFlowSynthesizer.test.
 
Methods inherited from class sandmark.util.controlflowgraph.IntFuncSynthesizer
genLoad, genPush, genStore, makeFunc
 
Methods inherited from class sandmark.util.controlflowgraph.ControlFlowSynthesizer
makeNOPs, randomIn, setSeed, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositiveIntSynthesizer

public PositiveIntSynthesizer()
Method Detail

generate

public MethodCFG generate(Graph graph,
                          de.fub.bytecode.generic.ConstantPoolGen cpg)
Generates an integer function corresponding to the given graph. All graphs are acceptable. The generated code is guaranteed to return safely, without throwing an exception, provided that the graph contains at least one leaf node. (A leaf node produces a return. With no return, the code loops forever.)

Specified by:
generate in class ControlFlowSynthesizer

generate

public MethodCFG generate(Graph graph,
                          de.fub.bytecode.generic.ConstantPoolGen cpg,
                          short opcode)
Generates an integer function with a constraint on the returned result. The opcode argument is one of the de.fub.bytecode.Constants values IFLT, IFLE, IFEQ, IFNE, IFGE, IFGT, or NOP. The generated code will ensure, for any passed argument, that the result value passes the test (takes the jump) indicated by the opcode. A NOP argument indicates a don't-care situation where the result is unconstrained.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test driver; see ControlFlowSynthesizer.test.

java.lang.Exception

SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003