|
|
6.36 ContextPart
- Defined in namespace Smalltalk
- Category: Language-Implementation
- My instances represent executing Smalltalk code, which represent the local
environment of executable code. They contain a stack and also provide some
methods that can be used in inspection or debugging.
6.36.1 ContextPart class: exception handling
- backtrace
- Print a backtrace from the caller to the bottom of the stack on the Transcript
- backtraceOn: aStream
- Print a backtrace from the caller to the bottom of the stack on aStream
- lastUnwindPoint
- Private - Return the last context marked as an unwind point, or our environment if none is.
- removeLastUnwindPoint
- Private - Return and remove the last context marked as an unwind point, or our environment if the last unwind point belongs to another environment.
- unwind
- Return execution to the last context marked as an unwind point, returning nil on that stack.
- unwind: returnValue
- Return execution to the last context marked as an unwind point, returning returnValue on that stack.
6.36.2 ContextPart: accessing
- client
- Answer the client of this context, that is, the object that sent the message that created this context. Fail if the receiver has no parent
- environment
- To create a valid execution environment for the interpreter even before it starts, GST creates a fake context whose selector is nil and which can be used as a marker for the current execution environment. This method answers that context. For processes, it answers the process block itself
- home
- Answer the MethodContext to which the receiver refers
- initialIP
- Answer the value of the instruction pointer when execution starts in the current context
- ip
- Answer the current instruction pointer into the receiver
- ip: newIP
- Set the instruction pointer for the receiver
- isBlock
- Answer whether the receiver is a block context
- isEnvironment
- To create a valid execution environment for the interpreter even before it starts, GST creates a fake context whose selector is nil and which can be used as a marker for the current execution environment. Answer whether the receiver is that kind of context.
- isProcess
- Answer whether the receiver represents a process context, i.e. a context created by BlockClosure>>#newProcess. Such a context can be recognized because it has no parent but its flags are different from those of the contexts created by the VM's prepareExecutionEnvironment function.
- method
- Return the CompiledMethod being executed
- methodClass
- Return the class in which the CompiledMethod being executed is defined
- numArgs
- Answer the number of arguments passed to the receiver
- numTemps
- Answer the number of temporaries used by the receiver
- parentContext
- Answer the context that called the receiver
- receiver
- Return the receiver (self) for the method being executed
- selector
- Return the selector for the method being executed
- size
- Answer the number of valid fields for the receiver. Any read access from (self size + 1) to (self basicSize) has undefined results - even crashing
- sp
- Answer the current stack pointer into the receiver
- sp: newSP
- Set the stack pointer for the receiver.
- validSize
- Answer how many elements in the receiver should be inspected
6.36.3 ContextPart: copying
- deepCopy
- Answer a shallow copy of the receiver -- duplicating e.g. the method and the instance variables that have been pushed is almost surely not the right thing.
- shallowCopy
- Answer a copy of the receiver
6.36.4 ContextPart: enumerating
- scanBacktraceFor: selectors do: aBlock
- Scan the backtrace for contexts whose selector is among those listed in selectors; if one is found, invoke aBlock passing the selector.
6.36.5 ContextPart: exception handling
- mark
- Add the receiver as a possible unwind point
- returnTo: aContext
- Set the context to which the receiver will return
6.36.6 ContextPart: printing
- backtrace
- Print a backtrace from the receiver to the bottom of the stack on the Transcript.
- backtraceOn: aStream
- Print a backtrace from the caller to the bottom of the stack on aStream.
|