harpoon.Analysis.Transactions
Class CloneImplementer

java.lang.Object
  extended by harpoon.Analysis.Transactions.CloneImplementer
All Implemented Interfaces:
HCodeFactory, Serializable

public class CloneImplementer
extends Object
implements HCodeFactory, Serializable

CloneImplementer adds synthetic specialized implementations for all clone methods. This works around the incomplete field type information available to the runtime, as well as making clone() methods a little more amenable to standard analysis. (OK, the field type information isn't really *incomplete* as much as it is *inefficient to access* in the way we'd like to.)

Arguably, this class should belong in the harpoon.Analysis.Quads package, but we'll leave it here until someone other than the Transactions transformation needs it.

Implementation details: a specialized method called $clone$() is created in all known classes. The existing native clone() methods are made non-native and given implementations which redirect to the virtual $clone$() method.

Version:
$Id: CloneImplementer.java,v 1.8 2004/02/08 03:20:25 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
CloneSynthesizer, Serialized Form

Constructor Summary
CloneImplementer(HCodeFactory parent, Linker l, Set knownClasses)
          Creates a CloneImplementer based on the given HCodeFactory, which must produce some QuadSSI form.
 
Method Summary
 void clear(HMethod m)
          Removes representation of method m from all caches in this factory and its parents.
 HCode convert(HMethod m)
          Make an HCode from an HMethod.
 String getCodeName()
          Returns a string naming the type of the HCode that this factory produces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloneImplementer

public CloneImplementer(HCodeFactory parent,
                        Linker l,
                        Set knownClasses)
Creates a CloneImplementer based on the given HCodeFactory, which must produce some QuadSSI form.

Method Detail

getCodeName

public String getCodeName()
Description copied from interface: HCodeFactory
Returns a string naming the type of the HCode that this factory produces.

this.getCodeName() should equal this.convert(m).getName() for every HMethod m.

Specified by:
getCodeName in interface HCodeFactory

clear

public void clear(HMethod m)
Description copied from interface: HCodeFactory
Removes representation of method m from all caches in this factory and its parents.

Specified by:
clear in interface HCodeFactory

convert

public HCode convert(HMethod m)
Description copied from interface: HCodeFactory
Make an HCode from an HMethod.

convert is allowed to return null if the requested conversion is impossible; typically this is because it's attempt to convert a source representation failed -- for example, because m is a native method.

Specified by:
convert in interface HCodeFactory