Interpreter Class Reference

#include <Interpreter.hpp>

Public Types

enum  InterpreterStartupMode { SAVE_IMAGE_MODE = 0 , RUN_MODE = 1 }
 

Static Public Member Functions

static void init ()
 
static void live (size_t)
 
static void liveGeneral (int reason)
 
static void processStartup ()
 
static void processShutdown ()
 
static void getResourceLock (const char *ds, int di)
 
static void releaseResourceLock (const char *ds, int di)
 
static void createLocks ()
 
static void closeLocks ()
 
static int createInstance (RexxInstance *&instance, RexxThreadContext *&threadContext, RexxOption *options)
 
static bool terminateInterpreter ()
 
static void startInterpreter (InterpreterStartupMode mode, const char *imageTarget)
 
static bool isTerminated ()
 
static bool isActive ()
 
static bool lastInstance ()
 
static InterpreterInstancecreateInterpreterInstance (RexxOption *options)
 
static InterpreterInstancecreateInterpreterInstance ()
 
static bool terminateInterpreterInstance (InterpreterInstance *instance)
 
static RexxStringgetVersionNumber ()
 
static void initLocal ()
 
static size_t getInterpreterVersion ()
 
static size_t getLanguageLevel ()
 
static bool hasTimeSliceElapsed ()
 
static int getWordSize ()
 
static bool isBigEndian ()
 
static void logicError (const char *desc, const char *info1=NULL, size_t info2=0)
 
static wholenumber_t messageNumber (RexxString *)
 
static void setTimeSliceElapsed ()
 
static void clearTimeSliceElapsed ()
 
static bool haltAllActivities (RexxString *)
 
static void decodeConditionData (RexxDirectory *conditionObj, RexxCondition *condData)
 
static RexxClassfindClass (RexxString *className)
 
static RexxStringgetCurrentQueue ()
 

Static Public Attributes

static RexxObjectlocalServer = OREF_NULL
 

Static Protected Attributes

static SysMutex resourceLock
 
static int initializations
 
static bool timeSliceElapsed = false
 
static RexxListinterpreterInstances = OREF_NULL
 
static bool active = false
 
static RexxStringversionNumber = OREF_NULL
 

Detailed Description

Definition at line 59 of file Interpreter.hpp.

Member Enumeration Documentation

◆ InterpreterStartupMode

Enumerator
SAVE_IMAGE_MODE 
RUN_MODE 

Definition at line 62 of file Interpreter.hpp.

Member Function Documentation

◆ clearTimeSliceElapsed()

static void Interpreter::clearTimeSliceElapsed ( )
inlinestatic

Definition at line 132 of file Interpreter.hpp.

References timeSliceElapsed.

Referenced by SystemInterpreter::startTimeSlice().

◆ closeLocks()

static void Interpreter::closeLocks ( )
inlinestatic

Definition at line 83 of file Interpreter.hpp.

References SysMutex::close(), and resourceLock.

Referenced by processShutdown().

◆ createInstance()

int Interpreter::createInstance ( RexxInstance *&  instance,
RexxThreadContext *&  threadContext,
RexxOption options 
)
static

Create a new instance and return the instance context pointers and thread context pointer for the instance.

Parameters
instanceThe returned instance pointer.
threadContextThe returned thread context pointer.
optionsOptions to apply to this interpreter instance.
Returns
0 if the instance was created ok.

Definition at line 258 of file Interpreter.cpp.

References createInterpreterInstance(), RexxActivity::deactivate(), InterpreterInstance::getInstanceContext(), InterpreterInstance::getRootActivity(), InterpreterInstance::getRootThreadContext(), RexxActivity::releaseAccess(), and RXAPI_MEMFAIL.

Referenced by RexxCreateInterpreter().

◆ createInterpreterInstance() [1/2]

static InterpreterInstance* Interpreter::createInterpreterInstance ( )
inlinestatic

◆ createInterpreterInstance() [2/2]

InterpreterInstance * Interpreter::createInterpreterInstance ( RexxOption options)
static

Create a new interpreter instance. An interpreter instance is an accessible set of threads that constitutes an interpreter environment for the purposes API access.

Parameters
exitsThe set of exits to use for this invocation.
defaultEnvironmentThe default addressible environment.
Returns
The new interpreter instance.

Definition at line 293 of file Interpreter.cpp.

References RexxList::append(), ActivityManager::getRootActivity(), InterpreterInstance::initialize(), interpreterInstances, OREF_NULL, RUN_MODE, and startInterpreter().

◆ createLocks()

static void Interpreter::createLocks ( )
inlinestatic

Definition at line 78 of file Interpreter.hpp.

References SysMutex::create(), and resourceLock.

Referenced by processStartup().

◆ decodeConditionData()

void Interpreter::decodeConditionData ( RexxDirectory conditionObj,
RexxCondition condData 
)
static

Decode a condition directory into a easier to use structure form for a native code user. This breaks the directory into its component pieces, including converting values into primitive form using just a single API call.

Parameters
conditionObjA directory object containing the condition information.
pRexxCondDataThe condition data structure that is populated with the condition information.

Definition at line 462 of file Interpreter.cpp.

References RexxCondition::additional, RexxDirectory::at(), RexxCondition::code, RexxCondition::conditionName, RexxCondition::description, RexxCondition::errortext, RexxCondition::message, messageNumber(), OREF_NULL, RexxCondition::position, RexxCondition::program, and RexxCondition::rc.

Referenced by DecodeConditionInfo().

◆ findClass()

RexxClass * Interpreter::findClass ( RexxString className)
static

Default class resolution processing done without benefit of a program context.

Parameters
classNameThe class name.
Returns
A resolved class object (if any).

Definition at line 522 of file Interpreter.cpp.

References ActivityManager::getLocalEnvironment(), OREF_NULL, TheEnvironment, and RexxString::upper().

Referenced by RexxNativeActivation::findCallerClass(), BaseCode::findClass(), and RexxNativeActivation::findClass().

◆ getCurrentQueue()

RexxString * Interpreter::getCurrentQueue ( )
static

Return the current queue name.

Returns
The name of the current queue.

Definition at line 543 of file Interpreter.cpp.

References ActivityManager::getLocalEnvironment(), OREF_NULL, and RexxObject::sendMessage().

Referenced by RexxActivity::callFunctionExit(), RexxNativeActivation::callRegisteredRoutine(), and RexxNativeActivation::variablePoolFetchPrivate().

◆ getInterpreterVersion()

size_t Interpreter::getInterpreterVersion ( )
static

Get the interpreter version level as a binary number to be returned in the APIs.

Returns
The binary interpreter version level.

Definition at line 92 of file Version.cpp.

References REXX_CURRENT_INTERPRETER_VERSION.

Referenced by InterpreterVersion().

◆ getLanguageLevel()

size_t Interpreter::getLanguageLevel ( )
static

Return the current language level implemented by this interpreter version.

Returns
The current defined language level.

Definition at line 103 of file Version.cpp.

References REXX_CURRENT_LANGUAGE_LEVEL.

Referenced by LanguageLevel().

◆ getResourceLock()

static void Interpreter::getResourceLock ( const char *  ds,
int  di 
)
inlinestatic

◆ getVersionNumber()

◆ getWordSize()

static int Interpreter::getWordSize ( )
inlinestatic

Definition at line 114 of file Interpreter.hpp.

Referenced by ProgramMetaData::ProgramMetaData(), and ProgramMetaData::validate().

◆ haltAllActivities()

bool Interpreter::haltAllActivities ( RexxString name)
static

Tell the interpreter to have all of the instances halt its activities.

Definition at line 351 of file Interpreter.cpp.

References RexxList::firstIndex(), RexxList::getValue(), InterpreterInstance::haltAllActivities(), interpreterInstances, LIST_END, and RexxList::nextIndex().

Referenced by SystemInterpreter::processSignal(), and signalHandler().

◆ hasTimeSliceElapsed()

static bool Interpreter::hasTimeSliceElapsed ( )
inlinestatic

Definition at line 102 of file Interpreter.hpp.

References timeSliceElapsed.

Referenced by RexxActivation::run().

◆ init()

void Interpreter::init ( void  )
static

Initialize the interpreter subsystem.

Definition at line 77 of file Interpreter.cpp.

References interpreterInstances, and new_list().

Referenced by RexxMemory::createImage(), and RexxMemory::restore().

◆ initLocal()

void Interpreter::initLocal ( )
static

Initialize an instance .local object.

Definition at line 167 of file Interpreter.cpp.

References localServer, RexxObject::messageSend(), and OREF_NULL.

Referenced by InterpreterInstance::initialize().

◆ isActive()

static bool Interpreter::isActive ( )
inlinestatic

◆ isBigEndian()

static bool Interpreter::isBigEndian ( )
inlinestatic

Definition at line 119 of file Interpreter.hpp.

References LITEND.

Referenced by ProgramMetaData::ProgramMetaData(), and ProgramMetaData::validate().

◆ isTerminated()

static bool Interpreter::isTerminated ( )
inlinestatic

Definition at line 91 of file Interpreter.hpp.

References active.

Referenced by TimeSliceControl().

◆ lastInstance()

bool Interpreter::lastInstance ( )
static

Quick test if we're down to just a single interpreter instance.

Returns
true if we're down to a single interpreter instance.

Definition at line 241 of file Interpreter.cpp.

References interpreterInstances, and RexxList::items().

Referenced by InterpreterInstance::terminate().

◆ live()

void Interpreter::live ( size_t  liveMark)
static

Definition at line 83 of file Interpreter.cpp.

References interpreterInstances, localServer, memory_mark, and versionNumber.

Referenced by RexxMemory::live().

◆ liveGeneral()

void Interpreter::liveGeneral ( int  reason)
static

◆ logicError()

◆ messageNumber()

◆ processShutdown()

void Interpreter::processShutdown ( )
static

◆ processStartup()

void Interpreter::processStartup ( )
static

◆ releaseResourceLock()

static void Interpreter::releaseResourceLock ( const char *  ds,
int  di 
)
inlinestatic

◆ setTimeSliceElapsed()

static void Interpreter::setTimeSliceElapsed ( )
inlinestatic

Definition at line 131 of file Interpreter.hpp.

References timeSliceElapsed.

Referenced by TimeSliceControl().

◆ startInterpreter()

void Interpreter::startInterpreter ( InterpreterStartupMode  mode,
const char *  imageTarget 
)
static

Perform interpreter startup processing.

Parameters
modeThe startup mode. This indicates whether we're saving the image or in shutdown mode.

Definition at line 124 of file Interpreter.cpp.

References active, env_find, RexxMemory::initialize(), interpreterInstances, isActive(), localServer, memoryObject, RexxObject::messageSend(), new_list(), new_string(), OREF_NULL, RexxCreateSessionQueue(), RUN_MODE, and SystemInterpreter::startInterpreter().

Referenced by createInterpreterInstance(), RexxCreateInterpreterImage(), and RexxInitialize().

◆ terminateInterpreter()

bool Interpreter::terminateInterpreter ( )
static

Terminate the global interpreter environment, shutting down all of the interpreter instances that we can and releasing the object heap memory.

Returns
true if everything was shutdown, false if there are reasons why this can't be shutdown.

Definition at line 187 of file Interpreter.cpp.

References interpreterInstances, isActive(), RexxList::items(), RexxMemory::lastChanceUninit(), memoryObject, RexxDeleteSessionQueue(), SystemInterpreter::terminateInterpreter(), PackageManager::unload(), and RexxMemory::verboseMessage().

Referenced by RexxStart(), RexxTerminate(), RexxTranslateProgram(), and Terminate().

◆ terminateInterpreterInstance()

bool Interpreter::terminateInterpreterInstance ( InterpreterInstance instance)
static

Shutdown an interpreter instance and remove it from the list of accessible items.

Parameters
instanceThe instance we're shutting down.
Returns
true if this instance was in a state that could be terminated.

Definition at line 337 of file Interpreter.cpp.

References interpreterInstances, and RexxList::removeItem().

Referenced by InterpreterInstance::terminate().

Member Data Documentation

◆ active

bool Interpreter::active = false
staticprotected

Definition at line 146 of file Interpreter.hpp.

Referenced by isActive(), isTerminated(), and startInterpreter().

◆ initializations

int Interpreter::initializations
staticprotected

Definition at line 143 of file Interpreter.hpp.

◆ interpreterInstances

◆ localServer

RexxObject * Interpreter::localServer = OREF_NULL
static

Definition at line 138 of file Interpreter.hpp.

Referenced by initLocal(), live(), liveGeneral(), and startInterpreter().

◆ resourceLock

SysMutex Interpreter::resourceLock
staticprotected

Definition at line 142 of file Interpreter.hpp.

Referenced by closeLocks(), createLocks(), getResourceLock(), and releaseResourceLock().

◆ timeSliceElapsed

bool Interpreter::timeSliceElapsed = false
staticprotected

◆ versionNumber

RexxString * Interpreter::versionNumber = OREF_NULL
staticprotected

Definition at line 147 of file Interpreter.hpp.

Referenced by getVersionNumber(), live(), and liveGeneral().


The documentation for this class was generated from the following files: