Back: CompiledMethod-testing Up: Base classes Forward: ContextPart class-built ins   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.40 ContextPart

Defined in namespace Smalltalk
Superclass: Object
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.

1.40.1 ContextPart class: built ins  (class)
1.40.2 ContextPart class: exception handling  (class)
1.40.3 ContextPart: accessing  (instance)
1.40.4 ContextPart: built ins  (instance)
1.40.5 ContextPart: copying  (instance)
1.40.6 ContextPart: debugging  (instance)
1.40.7 ContextPart: enumerating  (instance)
1.40.8 ContextPart: printing  (instance)
1.40.9 ContextPart: security checks  (instance)


1.40.1 ContextPart class: built ins

thisContext
Return the value of the thisContext variable. Called internally when the variable is accessed.


1.40.2 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


1.40.3 ContextPart: accessing

at: index
Answer the index-th slot in the receiver. Any read access from (self size + 1) to (self basicSize) will give nil.

at: index put: anObject
Answer the index-th slot in the receiver. Any write access from (self size + 1) to (self basicSize) will give an error unless nil is being written. This is because doing such an access first, and then updating sp, is racy: the garbage collector may trigger in the middle and move anObject, but the slot in the context won't be adjusted.

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

currentFileName
Answer the name of the file where the method source code is

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

isDisabled
Answers whether the context is skipped when doing a return. Contexts are marked as disabled whenever a non-local return is done (either by returning from the enclosing method of a block, or with the #continue: method of ContextPart) and there are unwind contexts such as those created by #ensure:. All non-unwind contexts are then marked as disabled.

isEnvironment
To create a valid execution environment for the interpreter even before it starts, GST creates a fake context which invokes a special "termination" method. Such a context 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.

isUnwind
Answers whether the context must continue execution even after a non-local return (a return from the enclosing method of a block, or a call to the #continue: method of ContextPart). Such contexts are created by #ensure:.

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

parentContext: aContext
Set the context to which the receiver will return

push: anObject
Push an object on the receiver's stack.

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) will give nil.

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


1.40.4 ContextPart: built ins

continue: anObject
Resume execution from the receiver, faking that the context on top of it in the execution chain has returned anObject. The receiver must belong to the same process as the executing context, otherwise the results are not predictable. All #ensure: (and possibly #ifCurtailed:) blocks between the currently executing context and the receiver are evaluated (which is not what would happen if you directly bashed at the parent context of thisContext).


1.40.5 ContextPart: copying

copyStack
Answer a copy of the entire stack.

deepCopy
Answer a copy of the entire stack, but don't copy any of the other instance variables of the context.


1.40.6 ContextPart: debugging

currentLine
Answer the 1-based number of the line that is pointed to by the receiver's instruction pointer. The DebugTools package caches information, thus making the implementation faster.

currentLineInFile
Answer the 1-based number of the line that is pointed to by the receiver's instruction pointer, relative to the method's file. The implementation is slow unless the DebugTools package is loaded.

debugger
Answer the debugger that is attached to the given context. It is always nil unless the DebugTools package is loaded.

debuggerClass
Answer which debugger should be used to debug the current context chain. The class with the highest debugging priority is picked among those mentioned in the chain.

isInternalExceptionHandlingContext
Answer whether the receiver is a context that should be hidden to the user when presenting a backtrace.


1.40.7 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 context.

scanBacktraceForAttribute: selector do: aBlock
Scan the backtrace for contexts which have the attribute selector listed in selectors; if one is found, invoke aBlock passing the context and the attribute.


1.40.8 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.


1.40.9 ContextPart: security checks

checkSecurityFor: perm
Answer the receiver.

doSecurityCheckForName: name actions: actions target: target
Not commented.

securityCheckForName: name
Not commented.

securityCheckForName: name action: action
Not commented.

securityCheckForName: name actions: actions target: target
Not commented.

securityCheckForName: name target: target
Not commented.



Back: ContextPart-printing Up: ContextPart Forward: Continuation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on February, 22 2012 using texi2html