Searching for "thisContext selector"
Dan Ingalls
DanI at wdi.disney.com
Tue Aug 18 01:38:29 UTC 1998
<x-rich>"Alejandro F. Reimondo" <<aleReimondo at sugarweb.com> wrote...
>>What can I do to get the sent selector of thisContext
>> from the VM stack (or current method) ?
Tim Olson <<tim at jumpnet.com> replied...
>You will have to look at the bytecode prior to the sender's PC to
>determine its type. If it is a literal send (> 208), then you can get
>the selector using something like:
> | method pc |
> method := thisContext sender method.
> pc := thisContext sender pc.
> ^ method literals at: ((method at: pc-1) - 207)
>
>Common selectors such as the arithmetic primitives and things like
"at:"
>use special bytecodes in the following ranges:
> 176-191 sendArithmeticSelectorBytecode
> 192-207 sendCommonSelectorBytecode
>
>You can determine the selector for these by building a
bytecode->selector
>dictionary.
....or an Array for speed.
And, by the way, you can get all of the special selectors, interspersed
with their arity, by printing (or executing)...
Smalltalk specialObjectsArray at: 24
Good luck on this cool project, Ale!
- Dan
</x-rich>
More information about the Squeak-dev
mailing list
|