public class Monitoring extends java.lang.Object implements IAnalysisMonitoring
Modifier and Type | Method and Description |
---|---|
void |
addMessage(AbstractNode n,
Message.Severity severity,
java.lang.String msg)
Adds a message for the given node.
|
void |
addMessage(AbstractNode n,
Message.Severity severity,
java.lang.String key,
java.lang.String msg)
Adds a message for the given node.
|
void |
addMessageInfo(AbstractNode n,
Message.Severity severity,
java.lang.String msg)
Adds a message for the given node.
|
boolean |
allowNextIteration()
Returns true if the fixpoint solver should continue with its next iteration or abort early and unsoundly.
|
java.util.Set<Message> |
getMessages()
Returns the collected messages.
|
java.util.List<Message> |
getSortedMessages()
Returns the sorted list of messages produced during scanning.
|
java.util.Map<TypeCollector.VariableSummary,Value> |
getTypeInformation()
Returns the collected type information.
|
static IAnalysisMonitoring |
make() |
static IAnalysisMonitoring |
make(boolean allow_progress_monitor)
Constructs a new monitoring object.
|
void |
setSolverInterface(GenericSolver.SolverInterface c)
Sets the solver interface which will be used by the analysis.
|
void |
visitBlockTransferPost(BasicBlock b,
State state)
Ignored.
|
void |
visitBlockTransferPre(BasicBlock block,
State state)
Counts block transfers.
|
void |
visitCall(AbstractNode n,
Value funval)
Checks for call/construct to a non-function value causing a TypeError.
|
void |
visitEvalCall(AbstractNode n,
Value v)
Registers a call to eval.
|
void |
visitEventHandlerRegistration(AbstractNode node,
Context context,
Value handler)
Ignored.
|
void |
visitFunction(Function f,
java.util.Collection<State> entry_states)
Registers reachability information.
|
void |
visitIf(IfNode n,
Value v)
Checks whether the branch condition is always true or always false.
|
void |
visitIn(AbstractNode n,
boolean maybe_v2_object,
boolean maybe_v2_nonobject)
Checks whether the 'in' operation may fail with a TypeError.
|
void |
visitInnerHTMLWrite(Node n,
Value v)
Registers a write to innerHTML.
|
void |
visitInstanceof(AbstractNode n,
boolean maybe_v2_non_function,
boolean maybe_v2_function,
boolean maybe_v2_prototype_primitive,
boolean maybe_v2_prototype_nonprimitive)
Checks whether the 'instanceof' operation may fail with a TypeError.
|
void |
visitIterationDone(java.lang.String terminatedEarlyMsg)
Ignored.
|
void |
visitJoin(long ms)
Counts state join operations and their time.
|
void |
visitNativeFunctionCall(AbstractNode n,
HostObject hostobject,
boolean num_actuals_unknown,
int num_actuals,
int min,
int max)
Checks the number of parameters for a call to a native function.
|
void |
visitNativeFunctionReturn(AbstractNode node,
HostObject hostObject,
Value result)
Ignored.
|
void |
visitNewFlow(BasicBlock b,
Context c,
State s,
java.lang.String diff,
java.lang.String info)
Collects new dataflow (if enabled).
|
void |
visitNewObject(AbstractNode node,
ObjectLabel label,
State s)
Ignored.
|
void |
visitNodeTransferPost(AbstractNode n,
State s)
Ignored.
|
void |
visitNodeTransferPre(AbstractNode n,
State s)
Counts node transfers and registers reachability information.
|
void |
visitPhasePost(AnalysisPhase phase)
Invoked at the end of a phase.
|
void |
visitPhasePre(AnalysisPhase phase)
Invoked at the beginning of a phase.
|
void |
visitPropagationPost(BlockAndContext<Context> from,
BlockAndContext<Context> to,
boolean changed)
Ignored.
|
void |
visitPropagationPre(BlockAndContext<Context> from,
BlockAndContext<Context> to)
Ignored.
|
void |
visitPropertyAccess(Node n,
Value baseval)
Checks whether the property access operation may dereference null or undefined causing a TypeError.
|
void |
visitPropertyRead(AbstractNode n,
java.util.Set<ObjectLabel> objs,
PKeys propertyname,
State state,
boolean check_unknown)
Checks for reads from unknown properties;
also registers a read operation on abstract objects.
|
void |
visitPropertyWrite(Node n,
java.util.Set<ObjectLabel> objs,
PKeys propertyname)
Checks for writes to unknown properties;
also registers a write operation on abstract objects.
|
void |
visitRead(Node n,
Value v,
State state)
Registers type information about a var/prop read.
|
void |
visitReadNonThisVariable(ReadVariableNode n,
Value v)
Checks whether an absent variable is read.
|
void |
visitReadProperty(ReadPropertyNode n,
java.util.Set<ObjectLabel> objlabels,
PKeys propertyname,
boolean maybe,
State state,
Value v,
ObjectLabel global_obj)
Checks whether the property read operation accesses an absent property and whether the operation returns null/undefined.
|
void |
visitReadThis(ReadVariableNode n,
Value v,
State state,
ObjectLabel global_obj)
Checks whether the read of 'this' yields the global object or an imprecise value.
|
void |
visitReadVariable(ReadVariableNode n,
Value v,
State state)
Checks whether the variable read yields null/undefined.
|
void |
visitRecoveryGraph(AbstractNode node,
int size)
Registers the recovery graph size.
|
void |
visitRenameObject(AbstractNode node,
ObjectLabel from,
ObjectLabel to,
State s)
Ignored.
|
void |
visitUnknownValueResolve(AbstractNode node,
boolean partial,
boolean scanning)
Counts unknown-value-resolve operations.
|
void |
visitUserFunctionCall(Function f,
AbstractNode call,
boolean constructor)
Checks whether the function is invoked both as a constructor (with 'new') and as a function/method (without 'new').
|
void |
visitVariableAsRead(AbstractNode n,
java.lang.String varname,
Value v,
State state)
Registers that the given variable is read; also checks for suspicious type mixings.
|
void |
visitVariableOrProperty(AbstractNode node,
java.lang.String var,
SourceLocation loc,
Value value,
Context context,
State state)
Registers the name, location, and value of a variable or property being read or written.
|
public void addMessage(AbstractNode n, Message.Severity severity, java.lang.String msg)
addMessage
in interface IAnalysisMonitoring
public void addMessage(AbstractNode n, Message.Severity severity, java.lang.String key, java.lang.String msg)
addMessage
in interface IAnalysisMonitoring
public void addMessageInfo(AbstractNode n, Message.Severity severity, java.lang.String msg)
addMessageInfo
in interface IAnalysisMonitoring
public boolean allowNextIteration()
ISolverMonitoring
allowNextIteration
in interface ISolverMonitoring<State,Context>
public java.util.Set<Message> getMessages()
getMessages
in interface IAnalysisMonitoring
public java.util.List<Message> getSortedMessages()
public java.util.Map<TypeCollector.VariableSummary,Value> getTypeInformation()
IAnalysisMonitoring
getTypeInformation
in interface IAnalysisMonitoring
public static IAnalysisMonitoring make()
public static IAnalysisMonitoring make(boolean allow_progress_monitor)
public void setSolverInterface(GenericSolver.SolverInterface c)
IAnalysisMonitoring
setSolverInterface
in interface IAnalysisMonitoring
public void visitBlockTransferPost(BasicBlock b, State state)
visitBlockTransferPost
in interface ISolverMonitoring<State,Context>
public void visitBlockTransferPre(BasicBlock block, State state)
visitBlockTransferPre
in interface ISolverMonitoring<State,Context>
public void visitCall(AbstractNode n, Value funval)
visitCall
in interface IAnalysisMonitoring
n
- node responsible for the callfunval
- the function valuepublic void visitEvalCall(AbstractNode n, Value v)
visitEvalCall
in interface IAnalysisMonitoring
n
- node that may call evalv
- value being eval'edpublic void visitEventHandlerRegistration(AbstractNode node, Context context, Value handler)
visitEventHandlerRegistration
in interface IAnalysisMonitoring
public void visitFunction(Function f, java.util.Collection<State> entry_states)
visitFunction
in interface ISolverMonitoring<State,Context>
public void visitIf(IfNode n, Value v)
visitIf
in interface IAnalysisMonitoring
n
- if nodev
- the boolean valuepublic void visitIn(AbstractNode n, boolean maybe_v2_object, boolean maybe_v2_nonobject)
visitIn
in interface IAnalysisMonitoring
n
- node performing the operationmaybe_v2_object
- if the second parameter may be an object valuemaybe_v2_nonobject
- if the second parameter may be a non-object valuepublic void visitInnerHTMLWrite(Node n, Value v)
visitInnerHTMLWrite
in interface IAnalysisMonitoring
n
- node where the write occursv
- value being writtenpublic void visitInstanceof(AbstractNode n, boolean maybe_v2_non_function, boolean maybe_v2_function, boolean maybe_v2_prototype_primitive, boolean maybe_v2_prototype_nonprimitive)
visitInstanceof
in interface IAnalysisMonitoring
n
- node performing the operationmaybe_v2_non_function
- set if the second parameter may be a non-function valuemaybe_v2_function
- set if the second parameter may be a function valuemaybe_v2_prototype_primitive
- set if the prototype property of the second parameter may be a primitive valuemaybe_v2_prototype_nonprimitive
- set if the prototype property of the second parameter may be an object valuepublic void visitIterationDone(java.lang.String terminatedEarlyMsg)
visitIterationDone
in interface ISolverMonitoring<State,Context>
terminatedEarlyMsg
- message about premature termination, if non-nullpublic void visitJoin(long ms)
visitJoin
in interface ILatticeMonitoring
ms
- time used by the join operationpublic void visitNativeFunctionCall(AbstractNode n, HostObject hostobject, boolean num_actuals_unknown, int num_actuals, int min, int max)
visitNativeFunctionCall
in interface IAnalysisMonitoring
n
- node responsible for the callhostobject
- the native function being callednum_actuals_unknown
- if set, the number of actuals is unknownnum_actuals
- number of actuals (if num_actuals_unknown is not set)min
- minimum number of parameters expectedmax
- maximum number of paramaters expected (-1 for any number)public void visitNativeFunctionReturn(AbstractNode node, HostObject hostObject, Value result)
visitNativeFunctionReturn
in interface IAnalysisMonitoring
public void visitNewFlow(BasicBlock b, Context c, State s, java.lang.String diff, java.lang.String info)
visitNewFlow
in interface ISolverMonitoring<State,Context>
public void visitNewObject(AbstractNode node, ObjectLabel label, State s)
visitNewObject
in interface ILatticeMonitoring
public void visitNodeTransferPost(AbstractNode n, State s)
visitNodeTransferPost
in interface ISolverMonitoring<State,Context>
public void visitNodeTransferPre(AbstractNode n, State s)
visitNodeTransferPre
in interface ISolverMonitoring<State,Context>
public void visitPhasePost(AnalysisPhase phase)
IAnalysisMonitoring
visitPhasePost
in interface IAnalysisMonitoring
public void visitPhasePre(AnalysisPhase phase)
IAnalysisMonitoring
visitPhasePre
in interface IAnalysisMonitoring
public void visitPropagationPost(BlockAndContext<Context> from, BlockAndContext<Context> to, boolean changed)
visitPropagationPost
in interface ISolverMonitoring<State,Context>
changed
- true if the destination state was changedISolverMonitoring.visitPropagationPre(BlockAndContext, BlockAndContext)
public void visitPropagationPre(BlockAndContext<Context> from, BlockAndContext<Context> to)
visitPropagationPre
in interface ISolverMonitoring<State,Context>
public void visitPropertyAccess(Node n, Value baseval)
visitPropertyAccess
in interface IAnalysisMonitoring
n
- operation that accesses a propertybaseval
- base value for the accesspublic void visitPropertyRead(AbstractNode n, java.util.Set<ObjectLabel> objs, PKeys propertyname, State state, boolean check_unknown)
visitPropertyRead
in interface IAnalysisMonitoring
n
- the node responsible for the readobjs
- the objects being read frompropertyname
- description of the property namecheck_unknown
- if set, warn about reads from unknown propertiespublic void visitPropertyWrite(Node n, java.util.Set<ObjectLabel> objs, PKeys propertyname)
visitPropertyWrite
in interface IAnalysisMonitoring
n
- the node responsible for the writeobjs
- the objects being written topropertyname
- description of the property namepublic void visitRead(Node n, Value v, State state)
visitRead
in interface IAnalysisMonitoring
public void visitReadNonThisVariable(ReadVariableNode n, Value v)
visitReadNonThisVariable
in interface IAnalysisMonitoring
n
- (non-this) read variable operationv
- the value being readpublic void visitReadProperty(ReadPropertyNode n, java.util.Set<ObjectLabel> objlabels, PKeys propertyname, boolean maybe, State state, Value v, ObjectLabel global_obj)
visitReadProperty
in interface IAnalysisMonitoring
n
- read property operationobjlabels
- objects being read frompropertyname
- description of the property namemaybe
- if there may be more than one valuestate
- current abstract statev
- property value with attributesglobal_obj
- the global objectpublic void visitReadThis(ReadVariableNode n, Value v, State state, ObjectLabel global_obj)
visitReadThis
in interface IAnalysisMonitoring
n
- (this) read variable operationv
- the value being readstate
- current abstract statepublic void visitReadVariable(ReadVariableNode n, Value v, State state)
visitReadVariable
in interface IAnalysisMonitoring
n
- read variable operationv
- the value being readpublic void visitRecoveryGraph(AbstractNode node, int size)
visitRecoveryGraph
in interface ILatticeMonitoring
public void visitRenameObject(AbstractNode node, ObjectLabel from, ObjectLabel to, State s)
visitRenameObject
in interface ILatticeMonitoring
public void visitUnknownValueResolve(AbstractNode node, boolean partial, boolean scanning)
visitUnknownValueResolve
in interface ILatticeMonitoring
public void visitUserFunctionCall(Function f, AbstractNode call, boolean constructor)
visitUserFunctionCall
in interface IAnalysisMonitoring
f
- function being calledcall
- node responsible for the callconstructor
- if set, the call uses 'new'public void visitVariableAsRead(AbstractNode n, java.lang.String varname, Value v, State state)
visitVariableAsRead
in interface IAnalysisMonitoring
n
- (non-this) read variable operationvarname
- the name of the variablev
- value being readpublic void visitVariableOrProperty(AbstractNode node, java.lang.String var, SourceLocation loc, Value value, Context context, State state)
visitVariableOrProperty
in interface IAnalysisMonitoring
Copyright © 2009-2019 Aarhus University