Class SynchronizedBlockDuplicator
java.lang.Object
com.ibm.wala.cast.tree.rewrite.CAstRewriter<CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>
com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator
public class SynchronizedBlockDuplicator
extends CAstRewriter<CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>
transforms each synchronized block to execute under a conditional test calling some method m(),
where the block is duplicated in both the if and else branches. The transformation enables a
static analysis to separately analyze the synchronized block for true and false return values
from m().
See "Finding Concurrency-Related Bugs using Random Isolation," Kidd et al., VMCAI'09, Section 3
-
Nested Class Summary
Nested classes/interfaces inherited from class CAstRewriter
CAstRewriter.CopyKey<Self>, CAstRewriter.Rewrite, CAstRewriter.RewriteContext<K>Modifier and TypeClassDescriptionstatic interfaceCAstRewriter.CopyKey<Self extends CAstRewriter.CopyKey<Self>>interface to be implemented by keys used for cloning sub-trees during the rewritestatic interfacerepresents a rewritten CAststatic interfaceCAstRewriter.RewriteContext<K extends CAstRewriter.CopyKey<K>>interface to be implemented by contexts used while traversing the AST -
Field Summary
Fields inherited from class CAstRewriter
Ast, DEBUG, recursive, rootContextModifier and TypeFieldDescriptionprotected final CAstprotected static final booleanprotected final booleanfor CAstEntity nodes r s.t.protected final CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> -
Constructor Summary
ConstructorsConstructorDescriptionSynchronizedBlockDuplicator(CAst Ast, boolean recursive, CallSiteReference f) -
Method Summary
Modifier and TypeMethodDescriptionprotected CAstNodecopyNodes(CAstNode n, CAstControlFlowMap cfg, CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> c, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap) rewrite the CAst rooted at root under some context, returning the node at the root of the rewritten tree.protected CAstNodeflowOutTo(Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, CAstControlFlowMap orig, CAstSourcePositionMap src) inCAstRewriter.copyFlow(Map, CAstControlFlowMap, CAstSourcePositionMap), if the source of some original CFG edge is replicated, but we find no replica for the target, what node should be the target of the CFG edge in the rewritten AST? By default, just uses the original target.translate(CAstEntity original) Methods inherited from class CAstRewriter
copyChildren, copyChildrenArray, copyChildrenArrayAndTargets, copyFlow, copySource, copySubtreesIntoNewNode, copySubtreesIntoNewNode, copyTypes, rewrite, rewriteModifier and TypeMethodDescriptionprotected Map<CAstNode, Collection<CAstEntity>> copyChildren(CAstNode root, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap, Map<CAstNode, @NonNull Collection<CAstEntity>> children) copyChildrenArray(CAstNode n, CAstControlFlowMap cfg, CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> context, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap) copyChildrenArrayAndTargets(CAstNode n, CAstControlFlowMap cfg, CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> context, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap) protected CAstControlFlowMapcopyFlow(Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, @NonNull CAstNode> nodeMap, CAstControlFlowMap orig, CAstSourcePositionMap newSrc) create a control-flow map for the rewritten tree, given the mapping from (original node, copy key) pairs ot new nodes and the original control-flow map.protected CAstSourcePositionMapcopySource(Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap, CAstSourcePositionMap orig) protected CAstNodecopySubtreesIntoNewNode(CAstNode n, CAstControlFlowMap cfg, CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> c, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap) protected CAstNodecopySubtreesIntoNewNode(CAstNode n, CAstControlFlowMap cfg, CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> c, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap, Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> pairKey) protected CAstNodeTypeMapcopyTypes(Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap, CAstNodeTypeMap orig) rewrite(CAstEntity root) perform the rewrite on aCAstEntity, returning the newCAstEntityas the resultrewrite(CAstNode root, CAstControlFlowMap cfg, CAstSourcePositionMap pos, CAstNodeTypeMap types, Map<CAstNode, Collection<CAstEntity>> children, CAstNode[] defaults) rewrite the CAst sub-tree rooted at root
-
Constructor Details
-
SynchronizedBlockDuplicator
-
-
Method Details
-
translate
-
flowOutTo
protected CAstNode flowOutTo(Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap, CAstNode oldSource, Object label, CAstNode oldTarget, CAstControlFlowMap orig, CAstSourcePositionMap src) Description copied from class:CAstRewriterinCAstRewriter.copyFlow(Map, CAstControlFlowMap, CAstSourcePositionMap), if the source of some original CFG edge is replicated, but we find no replica for the target, what node should be the target of the CFG edge in the rewritten AST? By default, just uses the original target.- Overrides:
flowOutToin classCAstRewriter<CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>
-
copyNodes
protected CAstNode copyNodes(CAstNode n, CAstControlFlowMap cfg, CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey> c, Map<Pair<CAstNode, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, CAstNode> nodeMap) Description copied from class:CAstRewriterrewrite the CAst rooted at root under some context, returning the node at the root of the rewritten tree. mutate nodeMap in the process, indicating how (original node, copy key) pairs are mapped to nodes in the rewritten tree.- Specified by:
copyNodesin classCAstRewriter<CAstRewriter.RewriteContext<com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>, com.ibm.wala.cast.java.examples.ast.SynchronizedBlockDuplicator.UnwindKey>
-