RV: "thisContext selector" (the revenge)
DanI at wdi.disney.com
Mon Aug 31 21:36:16 UTC 1998
Ale (and those who are following this adventure) -
I must apologize that my previous reply did not answer your real need. Also, I must apologize that I don't have a means right now to unzip the file you sent. However, I do think I understand enough of what you are trying to do to help with the next step.
The situation is that you have a single "stub" method installed in nearly every method slot in the system, whose sole function is to restore the proper method by some means, and then continue execution. You have managed to make this work normally, but the perform primitive slides its arguments down in the stack, obliterating the original selector, thus making it impossible to identify the proper method to be restored.
So, try this:
1. Define parallel methods to all the primitive perform methods with names such as primitivePerform:, primitivePerform:with:, and so on. All these methods may be identified by executing...
Smalltalk browseAllSelect: [:m | m primitive between: 83 and: 84]
2. Redefine the current perform methods so that they simply make an indirect call on the new primitivePerform methods. For instance...
<Object>perform: aSymbol with: anObject
"Access to the perform primitive passes indirectly through this method so
that trapped calls on swapped out methods may have access to the selector."
^ self primitivePerform: aSymbol with: anObject
3. In your stub method, if the selector sent is found to be one of the perform selectors, then you can find the real selector in the (now accessible) intermediate activation of the non-primitive perform method.
More information about the Squeak-dev