|
|
Class: ExecutableFunction
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
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
queries
-
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 integer 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
binary storage
-
readBinaryContentsFrom: stream manager: manager
-
make certain, that no invalid function addresses are created.
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
-
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 alow alien codeObjects to be handled by the
browsers.
-
hasCode
-
return true, if this codeObject has machinecode to execute.
-
hasResource
-
return true, if this codeObject has a resource (false here - only real methods have).
-
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 alow alien codeObjects to be handled by the
browsers.
-
isJavaMethod
-
-
isLazyMethod
-
return true, if this is a lazy method.
False is returned here - this method is redefined in LazyMethod
-
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
-
-
messagesSentToSelf
-
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
usedGlobals
-
return a collection with the global names referred to by the receiver.
Uses Parser to parse methods source and extract them.
|