"thisContext selector" (the revenge)

Alejandro F. Reimondo aleReimondo at sugarweb.com
Fri Aug 21 23:06:08 UTC 1998

"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
.... [snip]
>You can determine the selector for these by building a
>bytecode->selector dictionary.
Dan Ingalls <<DanI at wdi.disney.com>> replied...
>...[snip]...you can get all of the special selectors, ..[snip]...
>Smalltalk specialObjectsArray at: 24

It is working ok as suggested by Tim and using the expression
      Smalltalk specialSelectorAt: index
to find the special selectors.
It works the first time!
what happens when you send a #perform: message?
It is solved in a primitive method that sends the message inside the VM;
 activating a new method context to solve the performed message.
Then, when I look for the sent message in the context, the message found
 is #perform:... and the activated method is NOT the #perform implementation
The #perform: implementation does not create a MethodContext because
 it is a primitive method!
When I search in the contexts (actual and the sender's context)
I can find the #perform: selector, but the arguments are missing
( has been absorbed by primitive)
Provably the problem will be difficult to solve with the contexts information only...

Is there any known (easy) way to solve the #perform: problem?


More information about the Squeak-dev mailing list