harpoon.Backend.Generic
Class Runtime

java.lang.Object
  extended by harpoon.Backend.Generic.Runtime
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Runtime

public abstract class Runtime
extends Object
implements Serializable

A Generic.Runtime provides runtime-specific information to the backend. It should be largely-to-totally independent of the particular architecture targetted; all interfaces in Runtime interact with IR.Tree form, not the architecture-specific IR.Assem form.

Among other things, a Generic.Runtime provides class data constructors to provide class information to the runtime system.

Version:
$Id: Runtime.java,v 1.5 2003/04/19 01:03:44 salcianu Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
Serialized Form

Nested Class Summary
static class Runtime.ObjectBuilder
          The ObjectBuilder constructs data tables in the IR.Tree form to represent static objects which may be needed by the runtime---primarily string constant objects.
static class Runtime.TreeBuilder
          The TreeBuilder constructs bits of code in the IR.Tree form to handle various runtime-dependent tasks---primarily method and field access.
 
Field Summary
 Set<String> configurationSet
          Return a Set of labels which specify configuration dependencies.
 
Constructor Summary
protected Runtime()
           
 
Method Summary
abstract  List<HData> classData(HClass hc)
          Returns a list of HDatas which are needed for the given class.
abstract  NameMap getNameMap()
          Returns a NameMap valid for this Generic.Runtime.
abstract  Runtime.TreeBuilder getTreeBuilder()
          Returns a TreeBuilder object for this Generic.Runtime.
 HCodeFactory nativeTreeCodeFactory(HCodeFactory hcf)
          This code factory hook allows the runtime to return runtime-specific stubs for native methods --- or any other method which the runtime wishes to reimplement.
abstract  String resourcePath(String basename)
          Prefixes a runtime-specific path onto the specific resource name, so that transformations can refer to runtime-specific properties files in a uniform manner.
abstract  Collection runtimeCallableMethods()
          Return a Set of HMethods and HClasses which are referenced / callable by code in the runtime implementation (and should therefore be included in every class hierarchy).
 void setCallGraph(CallGraph cg)
          Sets the CallGraph to use for this Generic.Runtime.
 void setClassHierarchy(ClassHierarchy ch)
          Sets the ClassHierarchy to use for this Generic.Runtime.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configurationSet

public final Set<String> configurationSet
Return a Set of labels which specify configuration dependencies. A reference will be emitted by the FLEX component of this Generic.Runtime for each string in this set, which should match correspondingly-named labels in a properly configured C runtime. This allows us to check at link time that the C runtime's configuration matches the FLEX configuration.

Constructor Detail

Runtime

protected Runtime()
Method Detail

getTreeBuilder

public abstract Runtime.TreeBuilder getTreeBuilder()
Returns a TreeBuilder object for this Generic.Runtime.


getNameMap

public abstract NameMap getNameMap()
Returns a NameMap valid for this Generic.Runtime.


resourcePath

public abstract String resourcePath(String basename)
Prefixes a runtime-specific path onto the specific resource name, so that transformations can refer to runtime-specific properties files in a uniform manner.


setClassHierarchy

public void setClassHierarchy(ClassHierarchy ch)
Sets the ClassHierarchy to use for this Generic.Runtime. This method must be called at least once before the TreeBuilder or classData are used to generate tree form. It may be called multiple times if transformations cause the class hierarchy to change.


setCallGraph

public void setCallGraph(CallGraph cg)
Sets the CallGraph to use for this Generic.Runtime. Some runtime options do not require a call graph, and thus do not require that this method ever be called. However, for those that do, this method must be called at least once before the TreeBuilder or classData are used to generate tree form. It may be called multiple times if transformations cause the call graph to change.


classData

public abstract List<HData> classData(HClass hc)
Returns a list of HDatas which are needed for the given class.


nativeTreeCodeFactory

public HCodeFactory nativeTreeCodeFactory(HCodeFactory hcf)
This code factory hook allows the runtime to return runtime-specific stubs for native methods --- or any other method which the runtime wishes to reimplement. The default implementation just passes the given code factory through without modification.

The code factory returned by this method should return a null for methods which the output routine should skip. For example, if stubs are not needed for native methods, then the code factory should return null when convert() is called on a native method (just as the standard code factories do).

The code factory given should produce tree form. The returned code factory should also produce tree form; the tree form need not be canonicalized or optimized.


runtimeCallableMethods

public abstract Collection runtimeCallableMethods()
Return a Set of HMethods and HClasses which are referenced / callable by code in the runtime implementation (and should therefore be included in every class hierarchy).