|
Class: ExecutableFunction
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
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
copyrightCOPYRIGHT (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.
queries
-
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.
-
isBuiltInClass
-
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.
accessing
-
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
-
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
-
instVarAt: index
-
have to catch instVar access to code - since its no object
-
instVarAt: index put: value
-
have to catch instVar access to code - since its no object
error handling
-
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
-
printOn: aStream
-
append a printed representation of the receiver to aStream
-
printStringForBrowserWithSelector: selector
( an extension from the stx:libtool package )
-
return a printString to represent myself to the user in a browser.
-
printStringForBrowserWithSelector: selector inClass: aClass
-
return a printString to represent myself to the user in a browser.
private-accessing
-
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
-
invalidate
-
queries
-
category
-
return the category of this codeObject.
Return nil here, to allow alien codeObjects to be handled by the browsers.
-
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.
-
hasCode
-
return true, if this codeObject has machinecode to execute.
-
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.
-
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.
-
hasResource
-
return true, if this codeObject has a resource (false here - only real methods have).
-
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]
].
|
-
isBreakpointed
-
return true, if this is a wrapper method for a breakpoint.
False is returned here - this method is redefined in WrappedMethod
-
isExecutable
-
return true, if this codeObject is executable.
-
isInstrumented
-
return true, if this is an instrumented method.
False is returned here - this method is redefined in InstrumentedMethod
-
isInvalid
-
return true, if this codeObject is invalidated.
Return false here, to allow alien codeObjects to be handled by the browsers.
-
isJavaMethod
-
(comment from inherited method)
return true if this is a JavaMethod.
false is returned here - the method is only redefined in JavaMethod.
-
isLazyMethod
-
return true, if this is a lazy method.
False is returned here - this method is redefined in LazyMethod
-
isMocked
( an extension from the stx:libbasic3 package )
-
Return true, if the method has been mocked (by means of MessageTracer>>mockMethod:do:
-
isObsolete
-
-
isTimed
-
return true, if this is a wrapper method for a time measurement.
False is returned here - this method is redefined in WrappedMethod
-
isTraced
-
return true, if this is a wrapper method for a trace point.
False is returned here - this method is redefined in WrappedMethod
-
isUnloaded
-
return true, if the objects machine code has been unloaded
from the system (i.e. it is not executable).
-
isWrapped
-
return true, if this is a wrapper method.
False is returned here - this method is redefined in WrappedMethod
-
messagesSent
-
actually: unknown here in this abstract class
-
messagesSentToSelf
-
actually: unknown here in this abstract class
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
resources
-
-
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) **
-
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) **
-
sendsAnySelector: aCollectionOfSelectorSymbols
-
return true, if this method contains a message-send
to any of aCollectionOfSelectorSymbols.
-
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.
-
usedGlobals
-
return a collection with the global names referred to by the receiver.
Uses Parser to parse methods source and extract them.
|