All Packages  This Package  Class Hierarchy  Class Search  Index

Class utah.npm.core.Space
java.lang.Object
   |
   +----utah.npm.core.Lockable
           |
           +----utah.npm.core.NPMObject
                   |
                   +----utah.npm.core.Refable
                           |
                           +----utah.npm.core.Space

  Summary

public final class  Space
     extends utah.npm.core.Refable
{
          // Fields 4
     private MemPool currMemPool_;
     private Link keeperPort_;
     private Thread s_threadQ_;
     private int vmState;

          // Constructors 3
     private Space();
     public Space(Reference, MemPool);
     public Space(Reference, MemPool, int);

          // Methods 16
     private static native Space currSpace();
     public static void currentSpaceKeeperPort(Reference);
     public static void currentSpaceMemPool(Reference);
     static String typeName();

     private Class classNameException(String);
     public synchronized void destroy();
     private void lastThreadDied();
     int s_getVMState();
     private void s_init(Reference, MemPool, int);
     void s_setMemPool(MemPool);
     int s_type();
     public void startMain(String, String, String[]) throws Insanity;
     public String toString();
     private native void vmCreateSpace();
     private native void vmSpawnInitialThread(String, String, String[]);
     private int vm_MemPool();
}

Provide a virtual VM for Java applications to run in. The Space is the hook on which all of the resources for an application hang. Each thread in the system is associated with a Space. Each Space has a MemPool for its memory allocation. Each space has an (implied) namespace with fault handlers. TODO: Move the namespace stuff out of this class into a separate class Rename to Process

Version:
NPMJava 0.5.0 April, 1998
Author:
Patrick Tullmann tullmann@cs.utah.edu


  Cross Reference

Returned By:
Space.currSpace()





  Fields

· vmState

Summary  |  Top
   private int vmState


· currMemPool_

Summary  |  Top
   private MemPool currMemPool_

The current MemPool threads in this space should allocate out of.


· keeperPort_

Summary  |  Top
   private Link keeperPort_

A reference to a port the keeper thread for this space is waiting on.


· s_threadQ_

Summary  |  Top
   private Thread s_threadQ_

The head of the list of threads in this space.


  Constructors

· Space

Summary  |  Top

   public Space(Reference keeperPort, 
                MemPool memPool) 

Create a new Space object with the provided KeeperPort reference and the provided MemPool.

Parameter Description
keeperPort a reference to a port to send Space-related requests to.
memPool the MemPool object to link this Space to.



· Space

Summary  |  Top
   public Space(Reference keeperPort, 
                MemPool memPool, 
                int hashCode) 

Create a new Space object with the provided KeeperPort reference and the provided MemPool. Give the new space the provided hash code.

Parameter Description
keeperPort a reference to a port to send Space-related requests to.
memPool the MemPool object to link this Space to.
hashCode the hash code to give this Space.



· Space

Summary  |  Top
   private Space() 

A special null constructor used by the VM to bootstrap the special root Space object.



  Methods

· s_init

Summary  |  Top
   private void s_init(Reference keeperPortRef, 
                       MemPool memPool, 
                       int hashCode) 

Private Space initialization routine. Sets the various fields in the Space to the provided values.

Parameter Description
keeperPortRef a reference to a port to send Space-related requests to.
memPool the MemPool object to link this Space to.
hashCode the hash code to give this Space.



· vmCreateSpace

Summary  |  Top
   private native void vmCreateSpace() 

Create the VM-internal state associated with this space. This should only ever be called once for any given Space.



· currSpace

Summary  |  Top
   private static native Space currSpace() 

Return the current thread's space object. This function is private because the Space object itself should unavailable to the threads running in it.

Returns:
the current thread's space.


· currentSpaceKeeperPort

Summary  |  Top
   public static void currentSpaceKeeperPort(Reference out_ref) 

Return the Keeper Port reference for the current space object. TODO: rename to currentSpaceKeeperPort()

Parameter Description
out_ref The reference to fill in with the keeper port info.



· currentSpaceMemPool

Summary  |  Top
   public static void currentSpaceMemPool(Reference out_ref) 

Return the current Space's mem pool.

Parameter Description
out_ref The reference to point to the MemPool.



· vmSpawnInitialThread

Summary  |  Top
   private native void vmSpawnInitialThread(String threadName, 
                                            String initialObj, 
                                            String[] initialArgs) 

Ask the VM to actually fire off the initial thread. Both of the parameters must be non-null (this check is done by spawnInitialThread.) Only called by startMain.

Parameter Description
threadName the name of the thread to be created
initialObj the initial object to invoke the Main method of.
initialArgs the initial arguments to pass to the main method of the initialObj.

See Also: startMain



· startMain

Summary  |  Top
   public void startMain(String threadName, 
                         String initialObj, 
                         String[] initialArgs)  throws Insanity

Fire up the initial thread in this space. The thread is started up executing the Main method of the given initial object with the given vector of arguments (exactly like the object name on the command line of the VM.)

Parameter Description
threadName the name of the first thread to start in the space.
initialObj the name of the initial object to load and invoke the main method on.
initialArgs the initial arguments to the main method of initialObj.



· classNameException

Summary  |  Top
   private Class classNameException(String className) 

This method is invoked when a class isn't found in the Space. It generates a ClassNotFound fault on the Keeper port. The Keeper may respond with the name of a class to load, or just kill the Space off (as a real ClassNotFoundException would.)

This is only ever called directly by the VM.

Parameter Description
className the string name of the fully-qualified class to load.

Returns:
The class object to use in its place.


· lastThreadDied

Summary  |  Top
   private void lastThreadDied() 

This method is invoked when the last thread in the Space has died. It generates a "lastThreadDied" message to the Keeper.

This is only ever called directly by the VM.



· vm_MemPool

Summary  |  Top
   private int vm_MemPool() 

Return this Space's current memlimit's vmPrivate info.

This is only ever called directly by the VM.



· s_getVMState

Summary  |  Top
   int s_getVMState() 

This is method simply returns the VM's private Space state associated with the object. No locking is necessary, as the vmState is never changed after it is assigned at startup. XXX not used??

Returns:
the VM-private state associated with this Space


· s_setMemPool

Summary  |  Top
   void s_setMemPool(MemPool pool) 

Associate the given mempool with this space.



· destroy

Summary  |  Top
   public synchronized void destroy() 
Overrides:
destroy in class Refable


· toString

Summary  |  Top
   public String toString() 

Return a string representation of this space.

Returns:
the string "NPM Space"
Overrides:
toString in class NPMObject


· typeName

Summary  |  Top
   static String typeName() 

Return the string name of the Space type, "Space".

Returns:
the string "Space"
Overrides:
typeName in class NPMObject


· s_type

Summary  |  Top
   int s_type() 

Return the type of this object, NPMObject.SpaceType

Returns:
NPMObject.SpaceType
Overrides:
s_type in class NPMObject

See Also: NPMObject.SpaceType



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7