[Vm-dev] Cog and #commonSend are getting me crazy :(
Mariano Martinez Peck
marianopeck at gmail.com
Thu Apr 28 12:26:19 UTC 2011
Hi Eliot. I am fighting since several hours with something in Cog and I
cannot realize it. I am blind.
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:
testBlah
ClassWith1Var new fooLong.
ClassWith1Var new fooLong.
ClassWith1Var new fooLong.
ClassWith1Var >> fooLong
| aaa |
Object new.
self foo.
Now, I modified
CoInterpreter >> commonSend
"Send a message, starting lookup with the receiver's class."
"Assume: messageSelector and argumentCount have been set, and that
the receiver and arguments have been pushed onto the stack,"
"Note: This method is inlined into the interpreter dispatch loop."
<sharedCodeNamed: 'commonSend' inCase: 131>
self sendBreak: messageSelector + BaseHeaderSize
point: (objectMemory lengthOf: messageSelector)
receiver: (self internalStackValue: argumentCount).
cogit recordSendTrace ifTrue:
[self recordTrace: lkupClass thing: messageSelector source:
TraceIsFromInterpreter].
self internalFindNewMethod.
self print: 'called: '; printStringOf: messageSelector; cr.
self internalExecuteNewMethod.
self fetchNextBytecode
And when running the VM from gdb, 'called: fooLong' doesn't appear at
all!!! why ?
In addition, it appears 'called: foo' which is correct because #fooLong
sends #foo
but it appears only ONCE.
#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).
I tried with a StackVM and the same....so it seems that #fooLong is going by
another place than #commonSend.
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.
So...I am completly lost.
Thanks in advance for any help.
--
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110428/44aa73a2/attachment.htm
More information about the Vm-dev
mailing list