eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ExecutableFunction':

Home

everywhere
www.exept.de
for:
[back]

Class: ExecutableFunction


Inheritance:

   Object
   |
   +--ExecutableFunction
      |
      +--CompiledCode
      |
      +--ExternalFunction

Package:
stx:libbasic
Category:
Kernel-Methods
Version:
rev: 1.56 date: 2010/04/27 10:26:12
user: cg
file: ExecutableFunction.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


This is an abstract class, to merge common attributes of all kinds of
executable code objects; i.e. non-ST functions, Blocks and Methods
and whatever there might be in the future.

Instances of ExecutableCode are not meant to be created by user code -
the compilers create instances of Method & Block, while compiling.
(the VM would not even know what to do with such an instance, and triggered
 and exception, if ever encountered during block/method execution).


NOTICE: layout known by runtime system and compiler - do not change


[Instance variables:]
  code        <not_an_object>   the function pointer to the machine code.
                                Not accessable from smalltalk code.
                                (notice the '*' in the instVarNames definition)


[Class variables:]
  ExecutionErrorSignal          parent of all execution errors
                                (not raised itself)

  InvalidCodeSignal             codeObject is not executable


Class protocol:

queries
o  isBuiltInClass
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.


Instance protocol:

accessing
o  code
return the code field. This is not an object but the address of the machine instructions.
Therefore an integer representing the code-address is returned

o  instVarAt: index
have to catch instVar access to code - since its no object

o  instVarAt: index put: value
have to catch instVar access to code - since its no object

binary storage
o  readBinaryContentsFrom: stream manager: manager
make certain, that no invalid function addresses are created.

error handling
o  invalidCode
this error is triggered by the interpreter when something is wrong
with the code object (any error not handled by Method-signals).
In this case, the VM sends this to the bad method/block (the receiver).
Can only happen when the Compiler/runtime system is broken or
someone played around.

printing & storing
o  printOn: aStream
append a printed representation of the receiver to aStream

o  printStringForBrowserWithSelector: selector
return a printString to represent myself to the user in a browser.

o  printStringForBrowserWithSelector: selector inClass: aClass
return a printString to represent myself to the user in a browser.

private-accessing
o  code: anAddress
set the code field - DANGER ALERT.
This is not an object but the address of the machine instructions.
Therefore the argument must be an integer representing this address.
You can crash Smalltalk very badly when playing around here ...
This method is for compiler support and very special cases (debugging) only
- do not use

o  invalidate

queries
o  category
return the category of this codeObject.
Return nil here, to alow alien codeObjects to be handled by the
browsers.

o  hasCode
return true, if this codeObject has machinecode to execute.

o  hasResource
return true, if this codeObject has a resource (false here - only real methods have).

o  isBreakpointed
return true, if this is a wrapper method for a breakpoint.
False is returned here - this method is redefined in WrappedMethod

o  isExecutable
return true, if this codeObject is executable.

o  isInstrumented
return true, if this is an instrumented method.
False is returned here - this method is redefined in InstrumentedMethod

o  isInvalid
return true, if this codeObject is invalidated.
Return false here, to alow alien codeObjects to be handled by the
browsers.

o  isJavaMethod

o  isLazyMethod
return true, if this is a lazy method.
False is returned here - this method is redefined in LazyMethod

o  isObsolete

o  isTimed
return true, if this is a wrapper method for a time measurement.
False is returned here - this method is redefined in WrappedMethod

o  isTraced
return true, if this is a wrapper method for a trace point.
False is returned here - this method is redefined in WrappedMethod

o  isUnloaded
return true, if the objects machine code has been unloaded
from the system (i.e. it is not executable).

o  isWrapped
return true, if this is a wrapper method.
False is returned here - this method is redefined in WrappedMethod

o  messagesSent

o  messagesSentToSelf

o  privacy
return a symbol describing the methods access rights (privacy);
Currently, this is one of #private, #protected, #public or #ignored.

Here we unconditionally return #public, to allow alien code objects
to be handled by the browsers.

o  referencesGlobal: aGlobalSymbol
return true, if this method references the global
bound to aGlobalSymbol.
Return false (we dont know) here, to allow alien code objects to be
handled by the browsers.

o  referencesGlobalMatching: aMatchPattern
return true, if this method references a global
whose name matches aMatchPattern.
Return false (we dont know) here, to allow alien code objects to be
handled by the browsers.

o  referencesLiteral: aLiteral
return true, if this executable references the literal directly (i.e. a flat search).
Return false (we dont know) here, to allow alien code objects to be
handled by the browsers.

o  refersToLiteral: aLiteral
return true, if this executable references the literal directly or indirectly (i.e. a deep search).
Return false (we dont know) here, to allow alien code objects to be
handled by the browsers.

o  resources

o  sends: aSelectorSymbol
return true, if this code object contains a message-send with aSelectorSymbol as selector.
- due to the simple check in the literal array, also simple uses
of aSelectorSymbol as symbol will return true.
Should ask compiler, if there is really a send.

o  usedGlobals
return a collection with the global names referred to by the receiver.
Uses Parser to parse methods source and extract them.



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 09:02:26 GMT