sofya.apps.atomicity
Class AtomicityEvents

java.lang.Object
  extended by sofya.ed.semantic.AbstractEventSpecification
      extended by sofya.ed.semantic.AllModuleEvents
          extended by sofya.apps.atomicity.AtomicityEvents
All Implemented Interfaces:
EventSpecification

public class AtomicityEvents
extends AllModuleEvents

Specification which instructs an SemanticEventDispatcher to dispatch events for atomicity checking.

Version:
06/09/2006
Author:
Alex Kinneer

Nested Class Summary
 
Nested classes/interfaces inherited from interface sofya.ed.semantic.EventSpecification
EventSpecification.CallType, EventSpecification.FieldType, EventSpecification.MethodAction, EventSpecification.MonitorType
 
Field Summary
 
Fields inherited from interface sofya.ed.semantic.EventSpecification
FIELD_WITNESS_NONE, FIELD_WITNESS_READ, FIELD_WITNESS_WRITE
 
Constructor Summary
AtomicityEvents()
          Creates a new atomicity events specification.
AtomicityEvents(java.util.List systemUnitList, java.util.List moduleUnitList, boolean allSystemMonitors)
          Creates a new all atomicity events specification.
 
Method Summary
 boolean useCallInterceptor(org.apache.bcel.generic.InvokeInstruction call, org.apache.bcel.generic.ConstantPoolGen cpg)
          Checks whether a method call should be observed using an "interceptor" that can provide additional data about the call.
 boolean witnessCall(org.apache.bcel.generic.InvokeInstruction call, org.apache.bcel.generic.ConstantPoolGen cpg, org.apache.bcel.generic.MethodGen inMethod)
          Checks whether a method call in a given location is included in the specification.
 
Methods inherited from class sofya.ed.semantic.AllModuleEvents
deserialize, getModuleClasses, getSystemClasses, serialize, witnessAnyMonitor, witnessCatch, witnessCatch, witnessConstructorEntry, witnessConstructorExit, witnessField, witnessField, witnessField, witnessMethodEntry, witnessMethodExit, witnessMonitor, witnessNewObject, witnessStaticInitializerEntry, witnessThrow, witnessThrow
 
Methods inherited from class sofya.ed.semantic.AbstractEventSpecification
deserializeObjectIntMap, deserializeProgramUnit, deserializeStrings, serializeObjectIntMap, serializeProgramUnit, serializeStrings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomicityEvents

public AtomicityEvents()
Creates a new atomicity events specification.

The resulting specification will not define any classes comprising the system or module. This constructor is provided only to support deserialization.


AtomicityEvents

public AtomicityEvents(java.util.List systemUnitList,
                       java.util.List moduleUnitList,
                       boolean allSystemMonitors)
Creates a new all atomicity events specification.

Parameters:
systemUnitList - List of classes comprising the entire sytem.
moduleUnitList - List of classes comprising the module on which atomicity events are to be observed (this can be the same as the system class list).
allSystemMonitors - Flag that specifies whether all monitor events in the entire system should be included. This is provided since many analyses are interested in all lock related events despite only being interested in module related events otherwise.
Method Detail

witnessCall

public boolean witnessCall(org.apache.bcel.generic.InvokeInstruction call,
                           org.apache.bcel.generic.ConstantPoolGen cpg,
                           org.apache.bcel.generic.MethodGen inMethod)
Description copied from interface: EventSpecification
Checks whether a method call in a given location is included in the specification.

Specified by:
witnessCall in interface EventSpecification
Overrides:
witnessCall in class AllModuleEvents
Parameters:
call - Invoke instruction to be checked for exclusion in the specification.
cpg - Constant pool for the class containing the invoke instruction.
inMethod - Method in which the call is executed.
Returns:
true if the call is to a method included in the specification.

useCallInterceptor

public boolean useCallInterceptor(org.apache.bcel.generic.InvokeInstruction call,
                                  org.apache.bcel.generic.ConstantPoolGen cpg)
Description copied from interface: EventSpecification
Checks whether a method call should be observed using an "interceptor" that can provide additional data about the call.

The principle benefit of witnessing a call using an interceptor is that the values of the arguments to the method can be obtained. Important information can be obtained about calls for which subsequent EventListener.virtualMethodEnterEvent(sofya.ed.semantic.EventListener.ThreadData, sofya.ed.semantic.EventListener.ObjectData, sofya.ed.semantic.EventListener.MethodData)s cannot be raised, either because it is not possible (such as with native methods), or desirable (such as with Thread.start() or Thread.join() methods). However, there is considerable extra cost and potential interference associated with an interceptor, so they generally should not be used for other method calls.

Specified by:
useCallInterceptor in interface EventSpecification
Overrides:
useCallInterceptor in class AllModuleEvents
Parameters:
call - Invoke instruction to be checked for observation using an interceptor.
cpg - Constant pool for the class containing the invoke instruction.
Returns:
true if the call is to a method that should be witnessed using an interceptor.