<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 03.10.2010, at 12:45, Mariano Martinez Peck wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Sun, Oct 3, 2010 at 12:42 PM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; ">
&nbsp;<br><div style="word-wrap: break-word;"><div>What exactly are you trying to do?</div></div></blockquote><div><br>hehehe sorry. I am trying to "detect unused objects".<br></div></div></blockquote><div><br></div><div>What for?</div><br><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; ">
<div style="word-wrap: break-word;"><div>&nbsp;When do you consider an object to be "used"?&nbsp;</div><div><br></div></div></blockquote><div><br>When it receives a message. This is why I changed #normalSend<br><br>Thanks in advance,<br>
<br>Mariano<br></div></div></blockquote><div><br></div><div>Neither the class nor the compiled method "receive a message". Plus there are many ways an object "appears" to receive a message but isn't really. E.g. a Float won't receive #+ because that is short-circuited in the bytecodes. A super send does not use "normalSend". Etc.</div><div><br></div><div>Judging from your test cases, if an objects is just passed as an argument, you do not consider it to be used. What if you send it the #class message? What if you identity-compare it (==)? &nbsp;Should that count as "used"?</div><div><br></div><div>Maybe if you let us in on the bigger picture we could help you better.</div><div><br></div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">- Bert -</span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><br></span></div><div><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; position: static; z-index: auto; "><div style="word-wrap: break-word;"><div><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><font class="Apple-style-span" face="Helvetica"><br></font></span></div><div><div>On 03.10.2010, at 12:12, Mariano Martinez Peck wrote:</div><br><blockquote type="cite">Hi. I have a related question once again with this topic. I've changed Interpreter &gt;&gt; normalSend to something like this:<br>
<br><br>normalSend<br>&nbsp;&nbsp;&nbsp; "Send a message, starting lookup with the receiver's class."<br>
&nbsp;&nbsp;&nbsp; "Assume: messageSelector and argumentCount have been set, and that <br>&nbsp;&nbsp;&nbsp; the receiver and arguments have been pushed onto the stack,"<br>&nbsp;&nbsp;&nbsp; "Note: This method is inlined into the interpreter dispatch loop."<br>

&nbsp;&nbsp;&nbsp; | rcvr |<br>&nbsp;&nbsp;&nbsp; self inline: true.<br>&nbsp;&nbsp;&nbsp; self sharedCodeNamed: 'normalSend' inCase: 131.<br>&nbsp;&nbsp;&nbsp; rcvr := self internalStackValue: argumentCount.<br>&nbsp;<span style="background-color: rgb(255, 0, 0);">&nbsp;&nbsp; ((self isIntegerObject: rcvr) not and: [hasToTrace])</span><br style="background-color: rgb(255, 0, 0);">

<span style="background-color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ifTrue: [ </span><br style="background-color: rgb(255, 0, 0);"><span style="background-color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; self internalTurnOnUsedBit: rcvr.</span><br style="background-color: rgb(255, 0, 0);">

<span style="background-color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ].</span><br>&nbsp;&nbsp;&nbsp; lkupClass := self fetchClassOf: rcvr.<br>&nbsp;&nbsp;&nbsp; receiverClass := lkupClass.<br>&nbsp;&nbsp;&nbsp; self commonSend.<br><br><br>So...if it is not a SmallInetger and if the flag is on, I turn on a bit. <br>

<br>The question is, if I send a normal message to a normal object. Example:<br><br>| anObject |<br>anObject := MyClass new.<br>anObject foo<br><br>Now...I am sure that "anObject" was marked with the bit. But what about:<br>

a) the compiled method&nbsp; MyClass &gt;&gt; #foo<br>b) MyClass<br><br>should they be marked?<br><br>In other words:<br><br>self deny: (unUsed primitiveGetUsedBit: anObject).<br>&nbsp;&nbsp;&nbsp; self deny: (unUsed primitiveGetUsedBit: anObject class).<br>

&nbsp;&nbsp;&nbsp; self deny: (unUsed primitiveGetUsedBit: (anObject class &gt;&gt; #foo)).<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;anObject foo.<br><br>&nbsp;&nbsp;&nbsp; self assert: (unUsed primitiveGetUsedBit: anObject).<br>&nbsp;&nbsp;&nbsp; self assert: (unUsed primitiveGetUsedBit: anObject class).<br>

&nbsp;&nbsp;&nbsp; self assert: (unUsed primitiveGetUsedBit: (anObject class &gt;&gt; #foo)).<br>&nbsp;&nbsp;&nbsp; <br><br>should all the asserts pass?&nbsp; I ask because I don't know how CompiledMethods are executed (they receive a normalSend like any other object?) nor how class are accessed.<br>

<br>Thanks in advance,<br><br>Mariano<br><br><br><div class="gmail_quote">On Tue, May 11, 2010 at 5:43 PM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com" target="_blank">siguctua@gmail.com</a>&gt;</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;"><div><br>
On 11 May 2010 17:40, Mariano Martinez Peck &lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks Igor. I could see #class does not the normal way. It was logic as it already has the pointer there ;)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Now I wonder...to avoid those special cases, do you think it makes sense to intercept in commonSend rather than commonSend ?&nbsp; or it would be the same ?<br>
&gt;&gt; &gt;<br>
&gt;&gt; err... commonSend or commonSend? i think it would be the same :)<br>
&gt;&gt;<br>
&gt;<br>
&gt; hahahah sorry, I meant commonSend instead of normalSend.<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; the other point, where you can try intercept a send is cache lookup.<br>
&gt;&gt;<br>
&gt;<br>
&gt; internalFindNewMethod&nbsp; ?<br>
&gt;<br>
<br>
</div>I don't know, maybe :)<br>
<div><br>
&gt; Thanks<br>
&gt;<br>
&gt; Mariano<br>
&gt;<br></div></blockquote></div></blockquote></div><div>
<span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="font-family: Helvetica;">
<font face="'Lucida Grande'"><span style="font-size: medium;"><font face="Helvetica"><br></font></span></font></div></span></div></div><br></blockquote></div><br>
</blockquote></div><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="font-size: medium;"><br class="Apple-interchange-newline"></span></span>
</div>
<br></body></html>