Hi Eliot. I am fighting since several hours with something in Cog and I cannot realize it. I am blind. <br><br>I need to intercept all messages sent to an object. I have already done this for Interpreter VM and for StackVM. Now, I am trying latest CogMTVM, and there is something I am not sying...I have this test:<br>
<br>testBlah<br><br> ClassWith1Var new fooLong.<br> ClassWith1Var new fooLong.<br> ClassWith1Var new fooLong.<br> <br><br>ClassWith1Var >> fooLong<br> | aaa |<br> Object new.<br> self foo.<br><br>
<br>Now, I modified <br><br>CoInterpreter >> commonSend<br> "Send a message, starting lookup with the receiver's class."<br> "Assume: messageSelector and argumentCount have been set, and that <br>
the receiver and arguments have been pushed onto the stack,"<br> "Note: This method is inlined into the interpreter dispatch loop."<br> <sharedCodeNamed: 'commonSend' inCase: 131><br>
self sendBreak: messageSelector + BaseHeaderSize<br> point: (objectMemory lengthOf: messageSelector)<br> receiver: (self internalStackValue: argumentCount).<br> cogit recordSendTrace ifTrue:<br> [self recordTrace: lkupClass thing: messageSelector source: TraceIsFromInterpreter].<br>
self internalFindNewMethod.<br> <span style="background-color:rgb(255, 255, 51)"> self print: 'called: '; printStringOf: messageSelector; cr.</span><br> self internalExecuteNewMethod.<br> self fetchNextBytecode<br>
<br><br>And when running the VM from gdb, 'called: fooLong' doesn't appear at all!!! why ? <br>In addition, it appears 'called: foo' which is correct because #fooLong sends #foo<br>but it appears only ONCE. <br>
<br>#fooLong as I can see is not a quick return method but instead it goes by #sendLiteralSelector0ArgsBytecode. But the same happens if I put the print in that method... (which makes sense).<br>I tried with a StackVM and the same....so it seems that #fooLong is going by another place than #commonSend. <br>
<br>As far as I understand, there is nothing related with PIC or Jitt. In any of those cases, as what I can see, the #commonSend is called anyways. <br><br>So...I am completly lost. <br><br>Thanks in advance for any help.<br>
<br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>