Hi folks. I need to intercept all messages. For such purpose, I modified Interpreter >> normalSend like this: normalSend "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." | rcvr | self inline: true. self sharedCodeNamed: 'normalSend' inCase: 131. rcvr := self internalStackValue: argumentCount. (self isIntegerObject: rcvr) ifFalse: [ self doSomething: rcvr. ]. lkupClass := self fetchClassOf: rcvr. receiverClass := lkupClass. self commonSend. But now, from the IMAGE side I would like to enable or disable such intercept. It would be great if from the Image side I can set a value to a boolean and read such value and ask, from the VM side. Do you know if I can do this? Should I use specialObjectArray ? If true, can you give me a hint of how to do it ? Thank you very much. Mariano |
just add some flag to interpreter state (ivar), like 'enableTrace' and a primitive which sets it to true or false. On 10 May 2010 17:33, Mariano Martinez Peck <[hidden email]> wrote: > > Hi folks. I need to intercept all messages. For such purpose, I modified Interpreter >> normalSend like this: > > > normalSend > "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." > | rcvr | > self inline: true. > self sharedCodeNamed: 'normalSend' inCase: 131. > rcvr := self internalStackValue: argumentCount. > (self isIntegerObject: rcvr) > ifFalse: [ > self doSomething: rcvr. > ]. > lkupClass := self fetchClassOf: rcvr. > receiverClass := lkupClass. > self commonSend. > > > > But now, from the IMAGE side I would like to enable or disable such intercept. It would be great if from the Image side I can set a value to a boolean and read such value and ask, from the VM side. > > Do you know if I can do this? Should I use specialObjectArray ? If true, can you give me a hint of how to do it ? > > Thank you very much. > > Mariano > > -- Best regards, Igor Stasenko AKA sig. |
On Mon, May 10, 2010 at 5:09 PM, Igor Stasenko <[hidden email]> wrote:
What an idiot I am...thanks Igor. Sorry for the newbie/stupid questions. I am still new in this VM world and sometimes I don't know where I am (in OO or C world) and how to communicate from one to the other one. That worked perfectly. Thanks again. Mariano
|
On 10 May 2010 23:10, Mariano Martinez Peck <[hidden email]> wrote: > > > > On Mon, May 10, 2010 at 5:09 PM, Igor Stasenko <[hidden email]> wrote: >> >> just add some flag to interpreter state (ivar), like 'enableTrace' >> and a primitive which sets it to true or false. >> > > What an idiot I am...thanks Igor. Sorry for the newbie/stupid questions. I am still new in this VM world and sometimes I don't know where I am (in OO or C world) and how to communicate from one to the other one. > > That worked perfectly. > > Thanks again. > I like VMMaker that it's based on a simple concepts, and actually is a meta-programming tool, i.e. a program which generates another program. Once i discovered Squeak and downloaded VM sources, i was stumbled: hey.. how do they manage to develop a VM with such weird looking sources, which consists mainly from a huge, bloated 800k C code in a single file, without any notion of organization and very hard to follow :) > Mariano > > >> >> On 10 May 2010 17:33, Mariano Martinez Peck <[hidden email]> wrote: >> > >> > Hi folks. I need to intercept all messages. For such purpose, I modified Interpreter >> normalSend like this: >> > >> > >> > normalSend >> > "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." >> > | rcvr | >> > self inline: true. >> > self sharedCodeNamed: 'normalSend' inCase: 131. >> > rcvr := self internalStackValue: argumentCount. >> > (self isIntegerObject: rcvr) >> > ifFalse: [ >> > self doSomething: rcvr. >> > ]. >> > lkupClass := self fetchClassOf: rcvr. >> > receiverClass := lkupClass. >> > self commonSend. >> > >> > >> > >> > But now, from the IMAGE side I would like to enable or disable such intercept. It would be great if from the Image side I can set a value to a boolean and read such value and ask, from the VM side. >> > >> > Do you know if I can do this? Should I use specialObjectArray ? If true, can you give me a hint of how to do it ? >> > >> > Thank you very much. >> > >> > Mariano >> > >> > >> >> >> >> -- >> Best regards, >> Igor Stasenko AKA sig. > > > -- Best regards, Igor Stasenko AKA sig. |
Free forum by Nabble | Edit this page |