eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ExecutableFunction':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ExecutableFunction


Inheritance:

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

Package:
stx:libbasic
Category:
Kernel-Methods
Version:
rev: 1.71 date: 2022/12/08 15:56:48
user: stefan
file: ExecutableFunction.st directory: libbasic
module: stx stc-classLibrary: libbasic

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 subclasses, such as Method & Block
(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 accessible 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

copyright

COPYRIGHT (c) 1994 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

queries
o  isAbstract
(comment from inherited method)
Return if this class is an abstract class.
True is returned for Object here; false for subclasses.
Abstract subclasses must redefine this again.

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 externalAddress representing the code-address is returned

o  getCode
return the code field. This is not an object but the address of the machine instructions.
Therefore an externalAddress 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

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
( an extension from the stx:libtool package )
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 allow alien codeObjects to be handled by the browsers.

o  hasCanvasResource
Return true, if this method is an canvas-resource method, false otherwise.
This is done by looking for a #canvas key in the method's resources.

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

o  hasImageResource
return true, if this method is an image-resource method.
This is done by looking for a #image key in the method's resources.

o  hasMenuResource
return true, if this method is a menu-resource method.
This is done by looking for a #image key in the method's resources.

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

o  hasResource: aSymbol
return true if the method has a <resource> definition for aSymbol.

Usage example(s):

     Method allInstancesDo:[:m |
	(m hasResource:#image) ifTrue:[self halt]
     ].

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 allow alien codeObjects to be handled by the browsers.

o  isJavaMethod
(comment from inherited method)
return true if this is a JavaMethod.
false is returned here - the method is only redefined in JavaMethod.

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

o  isMocked
( an extension from the stx:libbasic3 package )
Return true, if the method has been mocked (by means of MessageTracer>>mockMethod:do:

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
actually: unknown here in this abstract class

o  messagesSentToSelf
actually: unknown here in this abstract class

o  privacy
return a symbol describing the method's 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 don't 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 don't 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 don't 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 don't know) here, to allow alien code objects to be
handled by the browsers.

o  refersToLiteralMatching: aMatchPattern
return true if the receiver or recursively any array element in the
receiver is symbolic and matches aMatchPattern (i.e. a deep search).
Return false (we don't 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.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  sendsAny: aCollectionOfSelectorSymbols
return true, if this method contains a message-send
to any of aCollectionOfSelectorSymbols.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  sendsAnySelector: aCollectionOfSelectorSymbols
return true, if this method contains a message-send
to any of aCollectionOfSelectorSymbols.

o  sendsSelector: 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 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:37:02 GMT