Class TokenTracer

  extended by orc.trace.TokenTracer
All Implemented Interfaces:
Locatable, Located
Direct Known Subclasses:

public abstract class TokenTracer
extends java.lang.Object
implements Locatable

Interface for writing traces from a single Orc thread. Methods correspond to events which may be traced; in essence this is like a visitor of execution events. Some guidelines used to organize events:

"Trace" objects (TokenTracer.StoreTrace et al) serve as abstract handles for events and are used to record relationships between events in different threads. Since Java doesn't have existential types, implementors have to cast these objects to the appropriate concrete types internally. This is safe as long as all the TokenTracers produced by a single Tracer use use compatible concrete trace types.


Nested Class Summary
static interface TokenTracer.PullTrace
          Abstract handle for a pull event
static interface TokenTracer.StoreTrace
          Abstract handle for a store event
Constructor Summary
Method Summary
abstract  void block(TokenTracer.PullTrace pull)
          Block a thread waiting for a future.
abstract  void choke(TokenTracer.StoreTrace store)
          Killed through the setting of a future.
abstract  void die()
          Terminate a thread.
abstract  void enter(Closure closure)
          Enter a closure.
abstract  void error(TokenException error)
          Report an error.
abstract  TokenTracer fork()
          Create a new thread.
abstract  void leave(int depth)
          Leave "depth" closures EXPERIMENTAL
abstract  void print(java.lang.String value, boolean newline)
          Print to stdout.
abstract  void publish(java.lang.Object value)
          Publish a value from the program.
abstract  TokenTracer.PullTrace pull()
          Create a new future for a pull.
abstract  void receive(java.lang.Object value)
          Return from a site call.
abstract  void send(java.lang.Object site, java.lang.Object[] arguments)
          Call a site.
abstract  TokenTracer.StoreTrace store(TokenTracer.PullTrace event, java.lang.Object value)
          Store a value for a future.
abstract  void unblock(TokenTracer.StoreTrace store)
          Receive a future we were waiting for.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface orc.error.Locatable
Methods inherited from interface orc.error.Located

Constructor Detail


public TokenTracer()
Method Detail


public abstract TokenTracer fork()
Create a new thread. By convention the new thread should evaluate the right side of the combinator.


public abstract void die()
Terminate a thread.


public abstract void send(java.lang.Object site,
                          java.lang.Object[] arguments)
Call a site.


public abstract TokenTracer.StoreTrace store(TokenTracer.PullTrace event,
                                             java.lang.Object value)
Store a value for a future. The return value should be used when tracing the results of this store. If this returns null, clients are free to not call choke(StoreTrace).

The engine guarantees that all choke(orc.trace.TokenTracer.StoreTrace) and unblock(orc.trace.TokenTracer.StoreTrace) events will occur before the die() event for this tracer.

See Also:
choke(orc.trace.TokenTracer.StoreTrace), unblock(orc.trace.TokenTracer.StoreTrace)


public abstract void choke(TokenTracer.StoreTrace store)
Killed through the setting of a future. Should be followed by die().


public abstract void receive(java.lang.Object value)
Return from a site call. Should be called after send(Object, Object[]).


public abstract void block(TokenTracer.PullTrace pull)
Block a thread waiting for a future.


public abstract void unblock(TokenTracer.StoreTrace store)
Receive a future we were waiting for.


public abstract void print(java.lang.String value,
                           boolean newline)
Print to stdout.


public abstract void publish(java.lang.Object value)
Publish a value from the program. Should be followed by die().


public abstract void error(TokenException error)
Report an error. Should be followed by die().


public abstract TokenTracer.PullTrace pull()
Create a new future for a pull. Should be followed by fork().


public abstract void enter(Closure closure)
Enter a closure. EXPERIMENTAL


public abstract void leave(int depth)
Leave "depth" closures EXPERIMENTAL