process_prims.hpp

Go to the documentation of this file.
00001 /* Copyright 1994, 1995 LongView Technologies L.L.C. $Revision: 1.24 $ */
00002 /* Copyright (c) 2006, Sun Microsystems, Inc.
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 
00006 following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 
00010           disclaimer in the documentation and/or other materials provided with the distribution.
00011     * Neither the name of Sun Microsystems nor the names of its contributors may be used to endorse or promote products derived 
00012           from this software without specific prior written permission.
00013 
00014 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 
00015 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 
00016 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00017 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00018 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
00019 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
00020 
00021 
00022 */
00023 
00024 // Primitives for processes
00025 
00026 class processOopPrimitives : AllStatic {
00027  private: 
00028   static void inc_calls() { number_of_calls++; }
00029  public:
00030   static int number_of_calls;
00031 
00032   //%prim
00033   // <Process class> primitiveProcessCreate: block <BlockWithoutArguments>
00034   //                                 ifFail: failBlock <PrimFailBlock> ^<Process> =
00035   //   Internal { doc   = 'Creates a new process'
00036   //              error = #(ProcessAllocationFailed)
00037   //              name  = 'processOopPrimitives::create' }
00038   //%
00039   static PRIM_DECL_2(create, oop receiver, oop block);
00040 
00041   //%prim
00042   // <NoReceiver> primitiveProcessYield ^<Process> =
00043   //   Internal { doc   = 'Yields the control to the scheduler.'
00044   //              doc   = 'Does nothing if executed by the scheduler.'
00045   //              doc   = 'Returns current process when regaining control.' 
00046   //              name  = 'processOopPrimitives::yield' }
00047   //%
00048   static PRIM_DECL_0(yield);
00049 
00050   //%prim
00051   // <NoReceiver> primitiveProcessStop ^<Process> =
00052   //   Internal { doc   = 'Yields the control to the scheduler.'
00053   //              doc   = 'Does nothing if executed by the scheduler.'
00054   //              doc   = 'Returns current process when regaining control.' 
00055   //              name  = 'processOopPrimitives::stop' }
00056   //%
00057   static PRIM_DECL_0(stop);
00058 
00059   //%prim
00060   // <NoReceiver> primitiveProcessActiveProcess ^<Object> =
00061   //   Internal { doc   = 'Returns the active process'
00062   //              name  = 'processOopPrimitives::activeProcess' }
00063   //%
00064   static PRIM_DECL_0(activeProcess);
00065 
00066   //%prim
00067   // <NoReceiver> primitiveProcessTransferTo: process   <Process> 
00068   //                                  ifFail: failBlock <PrimFailBlock> ^<Object> =
00069   //   Internal { doc   = 'Transfers the control from the scheduler to a process.'
00070   //              doc   = 'Returns the status of process (see primitiveProcessStatus).'
00071   //              error = #(NotInScheduler ProcessCannotContinue Dead)
00072   //              name  = 'processOopPrimitives::transferTo' }
00073   //%
00074   static PRIM_DECL_1(transferTo, oop process);
00075 
00076   //%prim
00077   // <Process> primitiveProcessSetMode: mode       <Symbol>
00078   //                        activation: activation <Activation>
00079   //                       returnValue: value      <Object>
00080   //                            ifFail: failBlock  <PrimFailBlock> ^<Symbol> =
00081   //   Internal { doc   = 'Change the mode of the process. mode: #Normal #Step #StepNext #StepEnd #Revert #Return'
00082   //              doc   = 'Returns the old mode of the process.'
00083   //              error = #(InScheduler Dead)
00084   //              name  = 'processOopPrimitives::set_mode' }
00085   //%
00086   static PRIM_DECL_3(set_mode, oop process, oop mode, oop value);
00087 
00088   //%prim
00089   // <NoReceiver> primitiveProcessStartEvaluator: process   <Process> 
00090   //                                      ifFail: failBlock <PrimFailBlock> ^<Object> =
00091   //   Internal { doc   = 'Transfers the control from the scheduler to a process,'
00092   //              doc   = 'and enters the evaluator.'
00093   //              doc   = 'Returns the status of process (see primitiveProcessStatus).'
00094   //              error = #(NotInScheduler ProcessCannotContinue Dead)
00095   //              name  = 'processOopPrimitives::start_evaluator' }
00096   //%
00097   static PRIM_DECL_1(start_evaluator, oop process);
00098 
00099   //%prim
00100   // <Process> primitiveProcessTerminateIfFail: failBlock <PrimFailBlock> ^<Self> =
00101   //   Internal { doc   = 'Terminates the process'
00102   //              error = #(Dead)
00103   //              flags = #(NLR)
00104   //              name  = 'processOopPrimitives::terminate' }
00105   //%
00106   static PRIM_DECL_1(terminate, oop receiver);
00107 
00108   //%prim
00109   // <Process> primitiveProcessStatus ^<Symbol> =
00110   //   Internal { doc  = 'Returns the process status:'
00111   //              doc  = '  #Initialized            - State right after creation.'
00112   //              doc  = '  #Yielded                - Gave up control by calling yield.'
00113   //              doc  = '  #Running                - Is running.'
00114   //              doc  = '  #InAsyncDLL             - Gave up control but continues to execute asynchronous DLL.'
00115   //              doc  = '  #Stopped                - Gave up control by calling stop.'
00116   //              doc  = '  #Preempted              - Was preempted by system.'
00117   //              doc  = '  #Completed              - Ran to completion.'
00118   //              doc  = '  #Dead                   - The process is dead.'
00119   //              doc  = '  #BooleanError           - A boolean was expected at hardcoded control structure.'
00120   //              doc  = '  #FloatError             - A float was expected at hardcoded float operation.'
00121   //              doc  = '  #LookupError            - The receiver does not understand doesNotUnderstand:.'
00122   //              doc  = '  #PrimitiveLookupError   - Binding a primitive failed.'
00123   //              doc  = '  #DLLLookupError         - Binding a DLL function failed.'
00124   //              doc  = '  #NLRError               - Context for NLR did not exist.'
00125   //              doc  = '  #StackOverflow          - Stack exhausted.'
00126   //              name = 'processOopPrimitives::status' }
00127   //%
00128   static PRIM_DECL_1(status, oop process);
00129   
00130   //%prim
00131   // <Process> primitiveProcessSchedulerWait: milliseconds <SmallInteger>
00132   //                                  ifFail: failBlock <PrimFailBlock> ^<Boolean> =
00133   //   Internal { doc   = 'Waits until timer has expired or a asynchronous dll call has returned.'
00134   //              doc   = 'Returns whether the timer expired.'
00135   //              name  = 'processOopPrimitives::scheduler_wait' }
00136   //%
00137   static PRIM_DECL_1(scheduler_wait, oop milliseconds);
00138 
00139   //%prim
00140   // <Process> primitiveProcessTraceStack: size <SmallInteger>
00141   //                               ifFail: failBlock <PrimFailBlock> ^<Self> =
00142   //   Internal { doc    = 'Prints the stack trace'
00143   //              errors = #(Dead)
00144   //              name   = 'processOopPrimitives::trace_stack' }
00145   //%
00146   static PRIM_DECL_2(trace_stack, oop receiver, oop size);
00147 
00148   //%prim
00149   // <NoReceiver> primitiveProcessEnterCritical ^<Process> =
00150   //   Internal { doc    = 'Disables preemption in active process.'
00151   //              name   = 'processOopPrimitives::enter_critical' }
00152   //%
00153   static PRIM_DECL_0(enter_critical);
00154 
00155   //%prim
00156   // <NoReceiver> primitiveProcessLeaveCritical ^<Process> =
00157   //   Internal { doc    = 'Enables preemption in active process'
00158   //              name   = 'processOopPrimitives::leave_critical' }
00159   //%
00160   static PRIM_DECL_0(leave_critical);
00161 
00162   //%prim
00163   // <NoReceiver> primitiveProcessYieldInCritical ^<Process> =
00164   //   Internal { doc   = 'Yields the control to the scheduler.'
00165   //              doc   = 'Does nothing if executed by the scheduler.'
00166   //              doc   = 'Returns current process when regaining control.' 
00167   //              name  = 'processOopPrimitives::yield_in_critical' }
00168   //%
00169   static PRIM_DECL_0(yield_in_critical);
00170 
00171   //%prim
00172   // <Process> primitiveProcessUserTime ^<Float> =
00173   //   Internal { doc   = 'Returns time, in seconds, the process has spent in user code' 
00174   //              name  = 'processOopPrimitives::user_time' }
00175   //%
00176   static PRIM_DECL_1(user_time, oop receiver);
00177 
00178   //%prim
00179   // <Process> primitiveProcessSystemTime ^<Float> =
00180   //   Internal { doc   = 'Returns time, in seconds, the process has spent in system code' 
00181   //              name  = 'processOopPrimitives::user_time' }
00182   //%
00183   static PRIM_DECL_1(system_time, oop receiver);
00184 
00185   //%prim
00186   // <Process> primitiveProcessStackLimit: limit <SmallInteger>
00187   //                               ifFail: failBlock <PrimFailBlock> ^<IndexedInstanceVariables> =
00188   //   Internal { errors = #(Dead Running)
00189   //              doc    = 'Returns an array of the process activation.'
00190   //              doc    = 'The primitive fails if either the receiver is a dead process or'
00191   //              doc    = 'if it is the active process'
00192   //              name   = 'processOopPrimitives::stack' }
00193   //%
00194   static PRIM_DECL_2(stack, oop receiver, oop limit);
00195 
00196 };

Generated on Mon Oct 9 13:37:25 2006 for Strongtalk VM by  doxygen 1.4.7