Next: , Previous: , Up: ContextPart   [Index]


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


Next: , Previous: , Up: ContextPart   [Index]