#include <InterpreterInstance.hpp>
Protected Member Functions | |
bool | processOptions (RexxOption *options) |
Protected Member Functions inherited from RexxVirtualBase | |
virtual | ~RexxVirtualBase () |
virtual void | baseVirtual () |
Static Protected Attributes | |
static RexxInstanceInterface | interfaceVector |
Friends | |
class | SysInterpreterInstance |
Additional Inherited Members | |
Static Public Member Functions inherited from RexxInternalObject | |
static size_t | getObjectHeaderSize () |
Public Attributes inherited from RexxInternalObject | |
ObjectHeader | header |
RexxBehaviour * | behaviour |
Definition at line 55 of file InterpreterInstance.hpp.
|
inline |
Definition at line 63 of file InterpreterInstance.hpp.
InterpreterInstance::InterpreterInstance | ( | ) |
Definition at line 66 of file InterpreterInstance.cpp.
References context, SysSemaphore::create(), RexxInstance_::functions, InstanceContext::instance, InstanceContext::instanceContext, interfaceVector, SysSemaphore::reset(), and terminationSem.
InterpreterInstance::InterpreterInstance | ( | ExitHandler * | handlers | ) |
void InterpreterInstance::activityDeactivated | ( | RexxActivity * | activity | ) |
void InterpreterInstance::addActivity | ( | RexxActivity * | ) |
void InterpreterInstance::addCommandHandler | ( | const char * | name, |
const char * | registeredName | ||
) |
Add a handler for a registered subcom handler to the address handler list.
name | The environment name of the handler. |
registeredName | The name of the registered subcom handler. |
Definition at line 779 of file InterpreterInstance.cpp.
References commandHandlers, CommandHandler::isResolved(), new_upper_string(), and RexxDirectory::put().
Referenced by processOptions(), and SysInterpreterInstance::registerCommandHandlers().
void InterpreterInstance::addCommandHandler | ( | const char * | name, |
REXXPFN | entryPoint | ||
) |
Add a handler to the environment list.
name | The name of the address environment this services. |
entryPoint | The entry point address of the handler. |
Definition at line 765 of file InterpreterInstance.cpp.
References commandHandlers, new_upper_string(), and RexxDirectory::put().
void InterpreterInstance::addGlobalReference | ( | RexxObject * | o | ) |
Add an object to the global references table.
o | The added object. |
Definition at line 516 of file InterpreterInstance.cpp.
References globalReferences, OREF_NULL, and RexxIdentityTable::put().
Referenced by RequestGlobalReference().
void InterpreterInstance::addRequiresFile | ( | RexxString * | shortName, |
RexxString * | fullName, | ||
PackageClass * | package | ||
) |
Add a package to our cache, using weak references.
shortName | The shortName (always provided). |
fullName | A second, fully resolved alias name. |
package | The package to add |
Definition at line 853 of file InterpreterInstance.cpp.
References OREF_NULL, RexxDirectory::put(), and requiresFiles.
Referenced by loadRequires().
RexxActivity * InterpreterInstance::attachThread | ( | ) |
Attach a thread to an interpreter instance.
Definition at line 195 of file InterpreterInstance.cpp.
References allActivities, RexxList::append(), ActivityManager::attachThread(), findActivity(), RexxActivity::nestAttach(), OREF_NULL, and RexxActivity::setupAttachedActivity().
Referenced by AttachThread(), attachThread(), and enterOnCurrentThread().
int InterpreterInstance::attachThread | ( | RexxThreadContext *& | attachedContext | ) |
Attach a thread to an interpreter instance, returning the activity thread context.
attachedContext | The pointer for returning the thread context. |
Definition at line 179 of file InterpreterInstance.cpp.
References attachThread(), RexxActivity::getThreadContext(), and RexxActivity::releaseAccess().
void InterpreterInstance::attachToProcess | ( | ) |
void InterpreterInstance::copyExits | ( | ExitHandler * | target | ) |
bool InterpreterInstance::detachThread | ( | ) |
Detach a thread from this interpreter instance.
Definition at line 273 of file InterpreterInstance.cpp.
References findActivity().
Referenced by RexxActivity::detachThread().
bool InterpreterInstance::detachThread | ( | RexxActivity * | activity | ) |
Detach a thread from this interpreter instance.
activity | The activity to detach |
Definition at line 230 of file InterpreterInstance.cpp.
References allActivities, RexxActivity::isActive(), RexxActivity::isAttached(), RexxActivity::isNestedAttach(), RexxList::items(), OREF_NULL, SysSemaphore::post(), RexxActivity::releaseAccess(), RexxList::removeItem(), ActivityManager::returnActivity(), RexxActivity::returnAttach(), terminating, and terminationSem.
RexxActivity * InterpreterInstance::enterOnCurrentThread | ( | ) |
Enter on the current thread context, making sure the interpreter lock is obtained.
Definition at line 386 of file InterpreterInstance.cpp.
References RexxActivity::activate(), attachThread(), and RexxActivity::requestAccess().
Referenced by terminate().
void InterpreterInstance::exitCurrentThread | ( | ) |
We're leaving the current thread. So we need to deactivate this.
Definition at line 408 of file InterpreterInstance.cpp.
References RexxActivity::exitCurrentThread(), and findActivity().
Referenced by terminate().
RexxActivity * InterpreterInstance::findActivity | ( | ) |
Find an activity for the current thread that's associated with this activity.
Definition at line 373 of file InterpreterInstance.cpp.
References SysActivity::queryThreadID().
Referenced by attachThread(), detachThread(), exitCurrentThread(), and terminate().
RexxActivity * InterpreterInstance::findActivity | ( | thread_id_t | threadId | ) |
Locate an activity for a specific thread ID that's attached to this instance.
threadId | The target thread id. |
Definition at line 345 of file InterpreterInstance.cpp.
References allActivities, RexxList::getValue(), RexxActivity::isSuspended(), RexxActivity::isThread(), RexxList::lastIndex(), LIST_END, OREF_NULL, and RexxList::previousIndex().
|
inline |
Definition at line 73 of file InterpreterInstance.hpp.
References defaultEnvironment.
Referenced by RexxActivation::RexxActivation(), RexxStartDispatcher::run(), and RoutineClass::runProgram().
|
inline |
Definition at line 97 of file InterpreterInstance.hpp.
References exits.
Referenced by setExitHandler(), and RexxActivity::setupExits().
|
inline |
Definition at line 108 of file InterpreterInstance.hpp.
References context, and InstanceContext::instanceContext.
Referenced by RexxActivity::addToInstance(), and Interpreter::createInstance().
|
inline |
Definition at line 111 of file InterpreterInstance.hpp.
References localEnvironment.
Referenced by RexxActivity::getLocal().
RexxObject * InterpreterInstance::getLocalEnvironment | ( | RexxString * | name | ) |
Retrieve a value from the instance local environment.
name | The name of the .local object. |
Definition at line 750 of file InterpreterInstance.cpp.
References RexxDirectory::at(), localEnvironment, OREF_NULL, and TheNilObject.
Referenced by RexxActivity::getLocalEnvironment().
PackageClass * InterpreterInstance::getRequiresFile | ( | RexxActivity * | activity, |
RexxString * | name | ||
) |
Retrieve a requires file that might be loaded for this instance.
name | The name used for the requires file. |
Definition at line 826 of file InterpreterInstance.cpp.
References WeakReference::get(), RexxHashTableCollection::get(), OREF_NULL, RexxDirectory::remove(), requiresFiles, and ThePackageClass.
|
inline |
Definition at line 74 of file InterpreterInstance.hpp.
References rootActivity.
Referenced by Interpreter::createInstance(), InstanceBlock::InstanceBlock(), and NativeContextBlock::NativeContextBlock().
RexxThreadContext * InterpreterInstance::getRootThreadContext | ( | ) |
Get the thread context vector for the root activity of the instance.
Definition at line 737 of file InterpreterInstance.cpp.
References RexxActivity::getThreadContext(), and rootActivity.
Referenced by Interpreter::createInstance().
|
inline |
Definition at line 106 of file InterpreterInstance.hpp.
References securityManager.
Referenced by RexxActivity::getEffectiveSecurityManager(), and RexxActivity::getInstanceSecurityManager().
bool InterpreterInstance::haltAllActivities | ( | RexxString * | name | ) |
Raise a halt condition on all running activities.
Definition at line 541 of file InterpreterInstance.cpp.
References allActivities, RexxList::firstIndex(), RexxList::getValue(), RexxActivity::halt(), RexxActivity::isActive(), LIST_END, RexxList::nextIndex(), and OREF_NULL.
Referenced by Halt(), and Interpreter::haltAllActivities().
void InterpreterInstance::initialize | ( | RexxActivity * | activity, |
RexxOption * | options | ||
) |
Initialize an interpreter instance.
activity | The root activity for the interpreter instance. |
handlers | The exit handlers used by all threads running under this instance. |
defaultEnvironment | The default address environment for this interpreter instance. Each active interpreter instance can define its own default environment. |
Definition at line 126 of file InterpreterInstance.cpp.
References allActivities, RexxList::append(), commandHandlers, defaultEnvironment, SystemInterpreter::getDefaultAddressName(), globalReferences, SysInterpreterInstance::initialize(), Interpreter::initLocal(), localEnvironment, new_directory(), new_identity_table(), new_list(), OREF_NULL, processOptions(), SysInterpreterInstance::registerCommandHandlers(), requiresFiles, rootActivity, searchExtensions, securityManager, RexxActivity::setupAttachedActivity(), RexxActivity::setupExits(), and sysInstance.
Referenced by Interpreter::createInterpreterInstance().
|
virtual |
Reimplemented from RexxVirtualBase.
Definition at line 81 of file InterpreterInstance.cpp.
References allActivities, commandHandlers, defaultEnvironment, globalReferences, localEnvironment, memory_mark, requiresFiles, rootActivity, searchExtensions, searchPath, and securityManager.
|
virtual |
Reimplemented from RexxVirtualBase.
Definition at line 99 of file InterpreterInstance.cpp.
References allActivities, commandHandlers, defaultEnvironment, globalReferences, localEnvironment, memory_mark_general, requiresFiles, rootActivity, searchExtensions, searchPath, and securityManager.
PackageClass * InterpreterInstance::loadRequires | ( | RexxActivity * | activity, |
RexxString * | shortName, | ||
const char * | data, | ||
size_t | length | ||
) |
Load a ::requires file into this interpreter instance.
activity | The current activity we're loading on., |
shortName | The original short name of this package. |
data | The source file data. |
length | The length of the source data. |
Definition at line 995 of file InterpreterInstance.cpp.
References addRequiresFile(), Error_Routine_not_found_requires, PackageManager::loadRequires(), OREF_NULL, reportException(), runRequires(), and ThePackageClass.
Referenced by LoadPackage(), LoadPackageFromData(), and RexxSource::loadRequires().
PackageClass * InterpreterInstance::loadRequires | ( | RexxActivity * | activity, |
RexxString * | shortName, | ||
RexxArray * | source | ||
) |
Load a ::requires file into this interpreter instance.
activity | The current activity we're loading on., |
shortName | The original short name of this package. |
fullName | An expanded fully resolved file name. |
Definition at line 952 of file InterpreterInstance.cpp.
References addRequiresFile(), Error_Routine_not_found_requires, PackageManager::loadRequires(), OREF_NULL, reportException(), runRequires(), and ThePackageClass.
PackageClass * InterpreterInstance::loadRequires | ( | RexxActivity * | activity, |
RexxString * | shortName, | ||
RexxString * | fullName | ||
) |
Load a ::requires file into this interpreter instance.
activity | The current activity we're loading on., |
shortName | The original short name of this package. |
fullName | An expanded fully resolved file name. |
Definition at line 892 of file InterpreterInstance.cpp.
References addRequiresFile(), Error_Routine_not_found_requires, PackageManager::loadRequires(), new_string(), OREF_NULL, reportException(), runRequires(), BaseExecutable::setName(), and ThePackageClass.
|
inline |
Definition at line 69 of file InterpreterInstance.hpp.
|
inline |
Definition at line 67 of file InterpreterInstance.hpp.
void * InterpreterInstance::operator new | ( | size_t | size | ) |
Create a new Package object instance.
size | Size of the object. |
Definition at line 61 of file InterpreterInstance.cpp.
References new_object(), and T_InterpreterInstance.
|
inline |
Definition at line 66 of file InterpreterInstance.hpp.
bool InterpreterInstance::poolActivity | ( | RexxActivity * | activity | ) |
Return a spawned activity back to the activity pool. This will disassociate the activity from the interpreter instance and place the thread back into the global thread pool.
activity | The activity to return. |
Definition at line 312 of file InterpreterInstance.cpp.
References allActivities, RexxActivity::detachInstance(), RexxList::items(), ActivityManager::poolActivity(), SysSemaphore::post(), RexxList::removeItem(), terminating, and terminationSem.
Referenced by RexxActivity::runThread().
|
protected |
Process interpreter instance options.
options | The list of defined options. |
Definition at line 595 of file InterpreterInstance.cpp.
References addCommandHandler(), RexxList::append(), APPLICATION_DATA, RexxInstance_::applicationData, context, defaultEnvironment, DIRECT_ENVIRONMENTS, DIRECT_EXITS, EXTERNAL_CALL_EXTENSIONS, EXTERNAL_CALL_PATH, PackageManager::getLibrary(), RexxContextEnvironment::handler, if(), INITIAL_ADDRESS_ENVIRONMENT, InstanceContext::instanceContext, LOAD_REQUIRED_LIBRARY, new_string(), RexxOption::option, RexxOption::optionName, REGISTER_LIBRARY, REGISTERED_ENVIRONMENTS, REGISTERED_EXITS, RexxRegisteredEnvironment::registeredName, PackageManager::registerPackage(), RXENDLST, searchExtensions, searchPath, setExitHandler(), _RexxContextExit::sysexit_code, _RXSYSEXIT::sysexit_code, _ValueDescriptor::value, _ValueDescriptor::value_CSTRING, and _ValueDescriptor::value_POINTER.
Referenced by initialize().
void InterpreterInstance::removeActivity | ( | RexxActivity * | ) |
void InterpreterInstance::removeGlobalReference | ( | RexxObject * | o | ) |
Remove the global reference protection from an object.
o | The protected object. |
Definition at line 529 of file InterpreterInstance.cpp.
References globalReferences, OREF_NULL, and RexxIdentityTable::remove().
Referenced by ReleaseGlobalReference().
void InterpreterInstance::removeInactiveActivities | ( | ) |
Definition at line 417 of file InterpreterInstance.cpp.
References allActivities, RexxList::append(), RexxActivity::isActive(), RexxList::items(), RexxList::removeFirstItem(), and RexxActivity::terminatePoolActivity().
Referenced by terminate().
CommandHandler * InterpreterInstance::resolveCommandHandler | ( | RexxString * | name | ) |
Resolve a command handler for invoking a command.
name | The name of the target address environment. |
Definition at line 798 of file InterpreterInstance.cpp.
References RexxDirectory::at(), commandHandlers, RexxString::getStringData(), CommandHandler::isResolved(), OREF_NULL, RexxDirectory::put(), and RexxString::upper().
Referenced by RexxActivity::resolveCommandHandler().
|
inline |
Definition at line 105 of file InterpreterInstance.hpp.
References SysInterpreterInstance::resolveProgramName(), and sysInstance.
Referenced by LoadPackage(), PackageClass::newRexx(), RexxSource::resolveProgramName(), and RexxActivity::resolveProgramName().
void InterpreterInstance::runRequires | ( | RexxActivity * | activity, |
RexxString * | name, | ||
RoutineClass * | code | ||
) |
Do the initial run of a ::REQUIRES file.
activity | The current activity. |
name | The name of the requires file. |
code | The routine instance to run. |
Definition at line 871 of file InterpreterInstance.cpp.
References RexxActivity::addRunningRequires(), RoutineClass::call(), and RexxActivity::removeRunningRequires().
Referenced by loadRequires().
|
inline |
Definition at line 99 of file InterpreterInstance.hpp.
References getExitHandler(), and ExitHandler::resolve().
|
inline |
Definition at line 98 of file InterpreterInstance.hpp.
References getExitHandler(), and ExitHandler::setEntryPoint().
Referenced by processOptions().
|
inline |
Definition at line 101 of file InterpreterInstance.hpp.
References getExitHandler(), _RexxContextExit::handler, ExitHandler::resolve(), and _RexxContextExit::sysexit_code.
|
inline |
Definition at line 100 of file InterpreterInstance.hpp.
References getExitHandler(), ExitHandler::resolve(), _RXSYSEXIT::sysexit_code, and _RXSYSEXIT::sysexit_name.
void InterpreterInstance::setSecurityManager | ( | RexxObject * | m | ) |
Set a new security manager object for this instance.
m | The security manager to set. |
Definition at line 164 of file InterpreterInstance.cpp.
References securityManager.
|
inline |
Definition at line 121 of file InterpreterInstance.hpp.
References SysInterpreterInstance::setupProgram(), and sysInstance.
Referenced by RexxActivation::run().
RexxActivity * InterpreterInstance::spawnActivity | ( | RexxActivity * | parent | ) |
Spawn off a new thread from an existing thread.
parent | The parent thread. |
Definition at line 288 of file InterpreterInstance.cpp.
References RexxActivity::addToInstance(), allActivities, RexxList::append(), and ActivityManager::createNewActivity().
Referenced by RexxActivity::spawnReply().
bool InterpreterInstance::terminate | ( | ) |
Attempt to shutdown the interpreter instance. This can only be done from the root activity.
Definition at line 448 of file InterpreterInstance.cpp.
References allActivities, RexxList::append(), SysSemaphore::close(), RexxMemory::collectAndUninit(), RexxHashTableCollection::empty(), enterOnCurrentThread(), exitCurrentThread(), findActivity(), globalReferences, RexxActivity::isActive(), RexxList::items(), Interpreter::lastInstance(), memoryObject, removeInactiveActivities(), RexxList::removeItem(), ActivityManager::returnRootActivity(), rootActivity, sysInstance, SysInterpreterInstance::terminate(), terminated, Interpreter::terminateInterpreterInstance(), terminating, terminationSem, RexxMemory::verboseMessage(), and SysSemaphore::wait().
Referenced by Terminate(), InstanceBlock::~InstanceBlock(), and NativeContextBlock::~NativeContextBlock().
void InterpreterInstance::traceAllActivities | ( | bool | on | ) |
Raise a trace condition on all running activities.
Definition at line 567 of file InterpreterInstance.cpp.
References allActivities, RexxList::firstIndex(), RexxList::getValue(), RexxActivity::isActive(), LIST_END, RexxList::nextIndex(), and RexxActivity::setTrace().
Referenced by SetTrace().
void InterpreterInstance::waitForCompletion | ( | ) |
|
friend |
Definition at line 59 of file InterpreterInstance.hpp.
|
protected |
Definition at line 136 of file InterpreterInstance.hpp.
Referenced by attachThread(), detachThread(), findActivity(), haltAllActivities(), initialize(), live(), liveGeneral(), poolActivity(), removeInactiveActivities(), spawnActivity(), terminate(), and traceAllActivities().
|
protected |
Definition at line 141 of file InterpreterInstance.hpp.
|
protected |
Definition at line 143 of file InterpreterInstance.hpp.
Referenced by addCommandHandler(), initialize(), live(), liveGeneral(), and resolveCommandHandler().
|
protected |
Definition at line 131 of file InterpreterInstance.hpp.
Referenced by getInstanceContext(), InterpreterInstance(), and processOptions().
|
protected |
Definition at line 138 of file InterpreterInstance.hpp.
Referenced by getDefaultEnvironment(), initialize(), live(), liveGeneral(), and processOptions().
|
protected |
Definition at line 151 of file InterpreterInstance.hpp.
Referenced by getExitHandler().
|
protected |
Definition at line 137 of file InterpreterInstance.hpp.
Referenced by addGlobalReference(), initialize(), live(), liveGeneral(), removeGlobalReference(), and terminate().
|
staticprotected |
Definition at line 153 of file InterpreterInstance.hpp.
Referenced by InterpreterInstance().
|
protected |
Definition at line 142 of file InterpreterInstance.hpp.
Referenced by getLocal(), getLocalEnvironment(), initialize(), live(), and liveGeneral().
|
protected |
Definition at line 144 of file InterpreterInstance.hpp.
Referenced by addRequiresFile(), getRequiresFile(), initialize(), live(), and liveGeneral().
|
protected |
Definition at line 134 of file InterpreterInstance.hpp.
Referenced by getRootActivity(), getRootThreadContext(), initialize(), live(), liveGeneral(), and terminate().
|
protected |
Definition at line 140 of file InterpreterInstance.hpp.
Referenced by SysInterpreterInstance::addSearchExtension(), initialize(), live(), liveGeneral(), processOptions(), and SysInterpreterInstance::resolveProgramName().
|
protected |
Definition at line 139 of file InterpreterInstance.hpp.
Referenced by live(), liveGeneral(), processOptions(), and SysInterpreterInstance::resolveProgramName().
|
protected |
Definition at line 135 of file InterpreterInstance.hpp.
Referenced by getSecurityManager(), initialize(), live(), liveGeneral(), and setSecurityManager().
|
protected |
Definition at line 132 of file InterpreterInstance.hpp.
Referenced by initialize(), resolveProgramName(), setupProgram(), and terminate().
|
protected |
Definition at line 147 of file InterpreterInstance.hpp.
Referenced by terminate().
|
protected |
Definition at line 146 of file InterpreterInstance.hpp.
Referenced by detachThread(), poolActivity(), and terminate().
|
protected |
Definition at line 148 of file InterpreterInstance.hpp.
Referenced by detachThread(), InterpreterInstance(), poolActivity(), and terminate().