harpoon.Backend.Runtime1
Class ObjectBuilder

java.lang.Object
  |
  +--harpoon.Backend.Generic.Runtime.ObjectBuilder
        |
        +--harpoon.Backend.Runtime1.ObjectBuilder

public class ObjectBuilder
extends Runtime.ObjectBuilder

ObjectBuilder is an implementation of harpoon.Backend.Generic.Runtime.ObjectBuilder for the Runtime1 runtime.

To accomodate transformations which add fields to java.lang.Object, this Runtime.ObjectBuilder initializes all fields of Object with null, rather than attempting to consult the given Info for them. If other behavior is eventually needed, it is a custom RootOracle be defined and provided to the constructor which will be consulted on the value of every field *before* any Info. This provides for extensibility without direct code modifications to the various parts of Runtime1 which use this ObjectBuilder.

Version:
$Id: ObjectBuilder.java,v 1.3 2002/02/26 22:44:31 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Nested Class Summary
static class ObjectBuilder.RootOracle
          A RootOracle allows a transformation to add fields to java.lang.Object (or any other class, really) and provide the initial values for that field in the various runtime constant objects without having to directly extend every ObjectInfo used in this Generic.Runtime implementation.
 
Nested classes inherited from class harpoon.Backend.Generic.Runtime.ObjectBuilder
Runtime.ObjectBuilder.ArrayInfo, Runtime.ObjectBuilder.Info, Runtime.ObjectBuilder.ObjectInfo
 
Constructor Summary
ObjectBuilder(Runtime runtime)
          Creates a ObjectBuilder with a RootOracle which supplies null values to any field of java.lang.Object (which there usually aren't any of).
ObjectBuilder(Runtime runtime, ObjectBuilder.RootOracle ro)
          Creates a ObjectBuilder.
 
Method Summary
 Stm buildArray(TreeFactory tf, Runtime.ObjectBuilder.ArrayInfo info, boolean exported)
          Build an array.
 Stm buildObject(TreeFactory tf, Runtime.ObjectBuilder.ObjectInfo info, boolean exported)
          Build an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectBuilder

public ObjectBuilder(Runtime runtime)
Creates a ObjectBuilder with a RootOracle which supplies null values to any field of java.lang.Object (which there usually aren't any of).


ObjectBuilder

public ObjectBuilder(Runtime runtime,
                     ObjectBuilder.RootOracle ro)
Creates a ObjectBuilder.

Method Detail

buildObject

public Stm buildObject(TreeFactory tf,
                       Runtime.ObjectBuilder.ObjectInfo info,
                       boolean exported)
Description copied from class: Runtime.ObjectBuilder
Build an object.

Specified by:
buildObject in class Runtime.ObjectBuilder
Parameters:
info - Information about the type and contents of the object to build.
exported - true if this object's label is to be exported outside its module.

buildArray

public Stm buildArray(TreeFactory tf,
                      Runtime.ObjectBuilder.ArrayInfo info,
                      boolean exported)
Description copied from class: Runtime.ObjectBuilder
Build an array.

Specified by:
buildArray in class Runtime.ObjectBuilder
Parameters:
info - Information about the type, length and contents of the array to build.
exported - true if this object's label is to be exported outside its module.