harpoon.Analysis.Quads
Class InitializerTransform

java.lang.Object
  extended by harpoon.Analysis.Transformation.MethodSplitter
      extended by harpoon.Analysis.Quads.InitializerTransform
All Implemented Interfaces:
Serializable

public class InitializerTransform
extends MethodSplitter

InitializerTransform transforms class initializers so that they are idempotent and so that they perform all needed initializer ordering checks before accessing non-local data.

Version:
$Id: InitializerTransform.java,v 1.9 2006/01/07 15:11:57 salcianu 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
static MethodSplitter.Token CHECKED
          Token for the initializer-ordering-check version of a method.
 
Fields inherited from class harpoon.Analysis.Transformation.MethodSplitter
ORIGINAL
 
Constructor Summary
InitializerTransform(HCodeFactory parent, ClassHierarchy ch)
          Creates a InitializerTransform with no information about which native methods are 'safe'.
InitializerTransform(HCodeFactory parent, ClassHierarchy ch, Linker linker, String resourceName)
          Creates a InitializerTransform using the specified named resource to specify the safe and dependent native methods of this runtime.
InitializerTransform(HCodeFactory parent, ClassHierarchy ch, Map dependentMethods)
          Creates a InitializerTransform using the given information about safe and dependent methods.
 
Method Summary
 HCodeFactory codeFactory()
          Returns a HCodeFactory containing representations for the methods split by the MethodSplitter.
protected  boolean isValidToken(MethodSplitter.Token which)
          Checks the token types handled by this MethodSplitter subclass.
 HMethod methodWithInitCheck(HMethod hm)
          Return the handle for the verion of hm with "init-check" tests.
protected  HCode mutateHCode(HCodeAndMaps input, MethodSplitter.Token which)
          Mutate a given HCode to produce the version specified by which.
 
Methods inherited from class harpoon.Analysis.Transformation.MethodSplitter
cloneHCode, isVirtual, mutateCodeName, mutateDescriptor, select
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECKED

public static final MethodSplitter.Token CHECKED
Token for the initializer-ordering-check version of a method.

Constructor Detail

InitializerTransform

public InitializerTransform(HCodeFactory parent,
                            ClassHierarchy ch)
Creates a InitializerTransform with no information about which native methods are 'safe'.


InitializerTransform

public InitializerTransform(HCodeFactory parent,
                            ClassHierarchy ch,
                            Linker linker,
                            String resourceName)
Creates a InitializerTransform using the specified named resource to specify the safe and dependent native methods of this runtime.


InitializerTransform

public InitializerTransform(HCodeFactory parent,
                            ClassHierarchy ch,
                            Map dependentMethods)
Creates a InitializerTransform using the given information about safe and dependent methods.

Parameters:
parent - The input code factory. Will be converted to QuadWithTry.
ch - A class hierarchy for the application.
dependentMethods - a map from HMethods specifying native methods to a java.util.Set of the HInitializers of the classes whose static data this method may reference. HMethods which map to zero-size Sets are 'safe' to call within initializers (that is, they do not reference any static data).
Method Detail

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

isValidToken

protected boolean isValidToken(MethodSplitter.Token which)
Checks the token types handled by this MethodSplitter subclass.

Overrides:
isValidToken in class MethodSplitter

mutateHCode

protected HCode mutateHCode(HCodeAndMaps input,
                            MethodSplitter.Token which)
Mutate a given HCode to produce the version specified by which.

Overrides:
mutateHCode in class MethodSplitter

methodWithInitCheck

public HMethod methodWithInitCheck(HMethod hm)
Return the handle for the verion of hm with "init-check" tests.