Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.stack
Class Analyzer.ContextSensitivePolicy

    java.lang.Object
      avrora.stack.Analyzer.ContextSensitivePolicy

All Implemented Interfaces:
  AnalyzerPolicy

Enclosing class:
  Analyzer

public class Analyzer.ContextSensitivePolicy
extends java.lang.Object
implements AnalyzerPolicy

The `ContextSensitive` class implements the context-sensitive analysis similar to 1-CFA. It is an implementation of the `Analyzer.Policy` interface that determines what should be done in the case of a call, return, push, pop, indirect call, etc. The context-sensitive analysis does not model the contents of the stack, so pushes and pops essentially only modify the height of the stack.

Field Summary
`protected int` | `edgeType`
`StateCache.State` | `frontierState`

Constructor Summary
`Analyzer.ContextSensitivePolicy()`

Method Summary
`MutableState` | `call(MutableState s, int target_address)` The `call()` method is called by the abstract interpreter when it encounters a call instruction within the program.
`MutableState` | `indirectCall(MutableState s, char addr_low, char addr_hi)` The `indirectCall()` method is called by the abstract interpreter when it encounters an indirect call within the program.
`MutableState` | `indirectCall(MutableState s, char addr_low, char addr_hi, char ext)` The `indirectCall()` method is called by the abstract interpreter when it encounters an indirect call within the program.
`MutableState` | `indirectJump(MutableState s, char addr_low, char addr_hi)` The `indirectJump()` method is called by the abstract interpreter when it encounters an indirect jump within the program.
`MutableState` | `indirectJump(MutableState s, char addr_low, char addr_hi, char ext)` The `indirectJump()` method is called by the abstract interpreter when it encounters an indirect jump within the program.
`MutableState` | `interrupt(MutableState s, int num)` The `interrupt()` is called by the abstract interrupt when it encounters a place in the program when an interrupt might occur.
`char` | `pop(MutableState s)` The `pop()` method is called by the abstract interpreter when a pop from the stack is ecountered in the program.
`void` | `push(MutableState s, char val)` The `push()` method is called by the abstract interpreter when a push to the stack is encountered in the program.
`void` | `pushState(MutableState newState)` The `pushState` method is called by the abstract interpreter when a state is forked by the abstract interpreter (for example when a branch condition is not known and both branches must be taken.
`MutableState` | `ret(MutableState s)` The `ret()` method is called by the abstract interpreter when it encounters a return within the program.
`MutableState` | `reti(MutableState s)` The `reti()` method is called by the abstract interpreter when it encounters a return from an interrupt within the program.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### frontierState

    public StateCache.State frontierState

### edgeType

    protected int edgeType

Constructor Detail

### Analyzer.ContextSensitivePolicy

    public Analyzer.ContextSensitivePolicy()

Method Detail

### call

    public MutableState call(MutableState s,
                             int target_address)

  The `call()` method is called by the abstract interpreter when it encounters a call instruction within the program. Different policies may handle calls differently. This context-sensitive analysis keeps track of the call site every time a new method is entered. Thus the states coming into a method call are merged according to the call site, instead of all merged together.

  Specified by:
    `call` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
    `target_address` - the concrete target address of the call
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### interrupt

    public MutableState interrupt(MutableState s,
                                  int num)

  The `interrupt()` is called by the abstract interrupt when it encounters a place in the program when an interrupt might occur.

  Specified by:
    `interrupt` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the abstract state just before interrupt
    `num` - the interrupt number that might occur
  Returns:
    the state of the program after the interrupt, null if there is no next state

### ret

    public MutableState ret(MutableState s)

  The `ret()` method is called by the abstract interpreter when it encounters a return within the program. In the context-sensitive analysis, the return state must be connected with the call site. This is done by accessing the call site list which is stored in this frontier state and inserting edges for each call site.

  Specified by:
    `ret` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### reti

    public MutableState reti(MutableState s)

  The `reti()` method is called by the abstract interpreter when it encounters a return from an interrupt within the program.

  Specified by:
    `reti` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### indirectCall

    public MutableState indirectCall(MutableState s,
                                     char addr_low,
                                     char addr_hi)

  The `indirectCall()` method is called by the abstract interpreter when it encounters an indirect call within the program. The abstract values of the address are given as parameters, so that a policy can choose to compute possible targets or be conservative or whatever it so chooses.

  Specified by:
    `indirectCall` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
    `addr_low` - the (abstract) low byte of the address
    `addr_hi` - the (abstract) high byte of the address
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### indirectJump

    public MutableState indirectJump(MutableState s,
                                     char addr_low,
                                     char addr_hi)

  The `indirectJump()` method is called by the abstract interpreter when it encounters an indirect jump within the program. The abstract values of the address are given as parameters, so that a policy can choose to compute possible targets or be conservative or whatever it so chooses.

  Specified by:
    `indirectJump` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
    `addr_low` - the (abstract) low byte of the address
    `addr_hi` - the (abstract) high byte of the address
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### indirectCall

    public MutableState indirectCall(MutableState s,
                                     char addr_low,
                                     char addr_hi,
                                     char ext)

  The `indirectCall()` method is called by the abstract interpreter when it encounters an indirect call within the program. The abstract values of the address are given as parameters, so that a policy can choose to compute possible targets or be conservative or whatever it so chooses.

  Specified by:
    `indirectCall` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
    `addr_low` - the (abstract) low byte of the address
    `addr_hi` - the (abstract) high byte of the address
    `ext` - the (abstract) extended part of the address
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### indirectJump

    public MutableState indirectJump(MutableState s,
                                     char addr_low,
                                     char addr_hi,
                                     char ext)

  The `indirectJump()` method is called by the abstract interpreter when it encounters an indirect jump within the program. The abstract values of the address are given as parameters, so that a policy can choose to compute possible targets or be conservative or whatever it so chooses.

  Specified by:
    `indirectJump` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
    `addr_low` - the (abstract) low byte of the address
    `addr_hi` - the (abstract) high byte of the address
    `ext` - the (abstract) extended part of the address
  Returns:
    null because the correct state transitions are inserted by the policy, and the abstract interpreter should not be concerned.

### push

    public void push(MutableState s,
                     char val)

  The `push()` method is called by the abstract interpreter when a push to the stack is encountered in the program. The policy can then choose what outgoing and/or modelling of the stack needs to be done.

  Specified by:
    `push` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
    `val` - the abstract value to push onto the stack

### pop

    public char pop(MutableState s)

  The `pop()` method is called by the abstract interpreter when a pop from the stack is ecountered in the program. The policy can then choose to either return whatever information it has about the stack contents, or return an UNKNOWN value.

  Specified by:
    `pop` in interface `AnalyzerPolicy`
  Parameters:
    `s` - the current abstract state
  Returns:
    the abstract value popped from the stack

### pushState

    public void pushState(MutableState newState)

  The `pushState` method is called by the abstract interpreter when a state is forked by the abstract interpreter (for example when a branch condition is not known and both branches must be taken.

  Specified by:
    `pushState` in interface `AnalyzerPolicy`
  Parameters:
    `newState` - the new state created

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD