<br><br><div class="gmail_quote">On Tue, Oct 5, 2010 at 11:20 AM, Mariano Martinez Peck <span dir="ltr"><<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><br><div class="gmail_quote">On Tue, Oct 5, 2010 at 7:50 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br><br><br><div class="gmail_quote">On Tue, Oct 5, 2010 at 9:23 AM, Mariano Martinez Peck <span dir="ltr"><<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>Hi. So....if I want to intercept ALL message sends....going to #normalSend is not enough since I have #class, #==, Float>>#+ etc that are executed directly like bytecodes. So...my questions are now:<br><br>1) Those special selectors are those that are in "Smalltalk specialSelectors" ? are there more? all from there are special?<br>
<br>2) All those "Smalltalk specialSelectors" have their associated bytecode primitive in Interpreter?? If true, then I should modify all bytecodePrim* in Interpreter. I am right? If I do that, that's all ? I am intercepting everything?<br>
</blockquote><div><br></div><div>Right. Just modify all of them to eliminate the optimized code and to revert to normalSend. </div></div></blockquote><div><br>Thanks Eliot. I didn't understand. What is the optimized code? I checked all bytecodePrim* and the ones that DO NOT send "self normalSend" at the end, are very few. The problem is that some return before returning "self normalSend". So...I should modify all those who DO NOT call "self normalSend" at the end and those which return before. <br>
</div></div></blockquote><div><br></div><div>Change them all so they do a normalSend and nothing else, e.g.</div><div><br></div><div>bytecodePrimAdd</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>messageSelector := self specialSelector: 0.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>argumentCount := 1.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>self normalSend</div><div><br></div><div>Or change the part of the bytecode table that specifies the special selector primitives to read</div>
<div><div><span class="Apple-tab-span" style="white-space:pre">                </span>(176 207 sendSpecialSelectorBytecode)</div><div><br></div><div><div>sendSpecialSelectorBytecode</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| selectorIndex specialSelectors |</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>selectorIndex := (currentBytecode - 176) * 2.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>specialSelectors := self splObj: SpecialSelectors.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>messageSelector := self fetchPointer: selectorIndex</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>ofObject: specialSelectors.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>argumentCount := self fetchInteger: selectorIndex + 1</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>ofObject: specialSelectors.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>self normalSend</div></div><div><br></div><div>But most of all try and slow down and understand what is going on; then you will be able to answer your own questions. Reading the <a href="http://www.mirandabanda.org/bluebook/bluebook_imp_toc.html">blue book</a> will help.</div>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div>
<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div class="gmail_quote"><div>Providing you also look at the perform and method evaluation primitives I think you'll get all sends. </div>
<div><br></div></div></blockquote><div><br>#primitivePerform* and #primitiveExecuteMethod* ???<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div class="gmail_quote"><div></div><div>There is another way. Modify the Smalltalk compiler to to use the special selector sends.</div><div><br></div></div></blockquote><div><br>Thanks Eliot for the idea. Can you explain me a little more (sorry, newbie here!). You mean that with the Compiler I can do that all method sends use the normal send instead of special bytecodes or primitives?<br>
</div></div></blockquote><div><br></div><div>Yes. If you modify the compiler not to use the StdSelectors then the compiler will emit normal sends for all the special selectors. Again I think if you slowed down and started playing ore you would discover this for yourself and in the end be more productive. I know its hard and frustrating initially. But my own competence comes directly from having played around in this way.</div>
<div><br></div><div>best,</div><div>Eliot</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div>
<br>Thank you very much.<br><br>Mariano<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div class="gmail_quote"><div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<br>Thanks a lot in advance,<br><br>Mariano<br><br><br><br><div class="gmail_quote">On Sun, Oct 3, 2010 at 11:09 PM, Craig Latta <span dir="ltr"><<a href="mailto:craig@netjam.org" target="_blank">craig@netjam.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><br>
<br>
> Craig Latta has done all this work, talk to him.<br>
<br>
Sure, I'd be happy to discuss it.<br>
<br>
<br>
-C<br>
<font color="#888888"><br>
--<br>
Craig Latta<br>
<a href="http://www.netjam.org" target="_blank">www.netjam.org</a><br>
+ 31 020 894 6247<br>
+ 1 415 287 3547<br>
<br>
<br>
<br>
</font></blockquote></div><br>
<br></blockquote></div><br>
<br></blockquote></div><br>
<br></blockquote></div><br>