harpoon.Analysis.Transactions
Class SyncTransformer

java.lang.Object
  extended by harpoon.Analysis.Transformation.MethodSplitter
      extended by harpoon.Analysis.Transactions.SyncTransformer
All Implemented Interfaces:
Serializable

public class SyncTransformer
extends MethodSplitter

SyncTransformer transforms synchronized code to atomic transactions. Works on QuadSSI form (via an internal conversion to SSA). Outputs QuadRSSx. Use the SyncTransformer.treeCodeFactory() to clean up the transformed code by doing low-level tree form optimizations.

Version:
$Id: SyncTransformer.java,v 1.20 2007/04/05 20:47:34 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class harpoon.Analysis.Transformation.MethodSplitter
MethodSplitter.Token
 
Field Summary
 
Fields inherited from class harpoon.Analysis.Transformation.MethodSplitter
ORIGINAL
 
Constructor Summary
SyncTransformer(HCodeFactory hcf, ClassHierarchy ch, Linker l, boolean pointersAreLong, HMethod mainM, Set roots)
          Creates a SyncTransformer with no transaction root methods.
SyncTransformer(HCodeFactory hcf, ClassHierarchy ch, Linker l, boolean pointersAreLong, HMethod mainM, Set roots, Set<HMethod> transRoots)
          Creates a SyncTransformer with the specified transaction root method set.
SyncTransformer(HCodeFactory hcf, ClassHierarchy ch, Linker l, boolean pointersAreLong, HMethod mainM, Set roots, String resourceName)
          Creates a SyncTransformer with a transaction root method set loaded from the specified resource name.
 
Method Summary
protected  harpoon.Analysis.Transactions.SyncTransformer.MyHCodeAndMaps cloneHCode(HCode hc, HMethod newmethod)
          Override this method if you do not want the mutatable HCode to be a straight clone of the original HCode: for example, if the input HCodes were QuadSSI and you wanted to clone them into QuadRSSIs before mutating.
 HCodeFactory codeFactory()
          Returns a HCodeFactory containing representations for the methods split by the MethodSplitter.
 Iterator<HData> filterData(Frame f, Iterator<HData> it)
          Munge HDatas to insert bit-field numbering information.
protected  boolean isValidToken(MethodSplitter.Token which)
          Check the validity of a given MethodSplitter.Token.
protected  String mutateCodeName(String codeName)
          Override this method to change the codename which this MethodMutator's codefactory reports.
protected  String mutateDescriptor(HMethod hm, MethodSplitter.Token which)
          Override this method if you want to create mutated methods with descriptors differing from that of the original method.
protected  HCode mutateHCode(HCodeAndMaps input, MethodSplitter.Token which)
          Override this method to effect transformations on split methods.
 Set<HMethod> transRoots()
          Export additional method roots after transactions transformation.
 HCodeFactory treeCodeFactory(Frame f, HCodeFactory hcf)
          Return an HCodeFactory that will clean up the tree form of the transformed code by performing some optimizations which can't be represented in quad form.
 
Methods inherited from class harpoon.Analysis.Transformation.MethodSplitter
isVirtual, select
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncTransformer

public SyncTransformer(HCodeFactory hcf,
                       ClassHierarchy ch,
                       Linker l,
                       boolean pointersAreLong,
                       HMethod mainM,
                       Set roots)
Creates a SyncTransformer with no transaction root methods.


SyncTransformer

public SyncTransformer(HCodeFactory hcf,
                       ClassHierarchy ch,
                       Linker l,
                       boolean pointersAreLong,
                       HMethod mainM,
                       Set roots,
                       String resourceName)
Creates a SyncTransformer with a transaction root method set loaded from the specified resource name.


SyncTransformer

public SyncTransformer(HCodeFactory hcf,
                       ClassHierarchy ch,
                       Linker l,
                       boolean pointersAreLong,
                       HMethod mainM,
                       Set roots,
                       Set<HMethod> transRoots)
Creates a SyncTransformer with the specified transaction root method set.

Method Detail

isValidToken

protected boolean isValidToken(MethodSplitter.Token which)
Description copied from class: MethodSplitter
Check the validity of a given MethodSplitter.Token. Override if (when) your subclass defines new tokens.

Overrides:
isValidToken in class MethodSplitter

codeFactory

public HCodeFactory codeFactory()
Description copied from class: MethodSplitter
Returns a HCodeFactory containing representations for the methods split by the MethodSplitter.

Overrides:
codeFactory in class MethodSplitter

transRoots

public Set<HMethod> transRoots()
Export additional method roots after transactions transformation.


mutateDescriptor

protected String mutateDescriptor(HMethod hm,
                                  MethodSplitter.Token which)
Description copied from class: MethodSplitter
Override this method if you want to create mutated methods with descriptors differing from that of the original method.

Overrides:
mutateDescriptor in class MethodSplitter

cloneHCode

protected harpoon.Analysis.Transactions.SyncTransformer.MyHCodeAndMaps cloneHCode(HCode hc,
                                                                                  HMethod newmethod)
Description copied from class: MethodSplitter
Override this method if you do not want the mutatable HCode to be a straight clone of the original HCode: for example, if the input HCodes were QuadSSI and you wanted to clone them into QuadRSSIs before mutating. By default, this method returns hc.clone(newmethod).

Overrides:
cloneHCode in class MethodSplitter

mutateCodeName

protected String mutateCodeName(String codeName)
Description copied from class: MethodSplitter
Override this method to change the codename which this MethodMutator's codefactory reports.

Overrides:
mutateCodeName in class MethodSplitter

mutateHCode

protected HCode mutateHCode(HCodeAndMaps input,
                            MethodSplitter.Token which)
Description copied from class: MethodSplitter
Override this method to effect transformations on split methods.

Overrides:
mutateHCode in class MethodSplitter

treeCodeFactory

public HCodeFactory treeCodeFactory(Frame f,
                                    HCodeFactory hcf)
Return an HCodeFactory that will clean up the tree form of the transformed code by performing some optimizations which can't be represented in quad form.


filterData

public Iterator<HData> filterData(Frame f,
                                  Iterator<HData> it)
Munge HDatas to insert bit-field numbering information.