[Vm-dev] Simulator Question

Gabriel Hernán Barbuto gbarbuto at gmail.com
Thu Jan 6 17:23:26 UTC 2011


Andreas

Thanks for your reply. I think I should've given more information. I
am running the simulator, and while debugging I found that following
oops is too hard. Maybe there is another way that I am not aware of.

I am trying to implement a wrapper around the oops. I can get at the
structure of an object and see its class and if it has any instance
variables.

The problem is when I want to see the object in an inspector. For
example, for oop = 4. I can see its class is as expected
UndefinedObject. But I want to get nil to display. Maybe for nil is
not that important but for example, for true and false I think it's
important. I have tried with InterpreterSimulator>>#stringOf: but it
does not work.

I have no idea about the Android VM. But I will take a look at it. I
don't want to change the Interpreter. This object is meant to work
with the simulator. I thought it would be possible to make the
interpreter to interpret a method call that does not really exist in
the byte code stream.

Thanks again, and I hope this clarifies what I am trying to achieve
and how I thought it would be possible.

Cheers
Gabriel

On Thu, Jan 6, 2011 at 5:27 PM, Andreas Raab <andreas.raab at gmx.de> wrote:
>
> All you need to support this is in the Android VM. The Android VM calls
> interpret() in response to every input event and interpret() returns when
> the event is handled[*]. If you add an event that gets a selector (or some
> source code to be evaluated) you have just what you were looking for.
>
> [*] For a certain definition of "handled", involving aspects such as whether
> delays are involved, or other processes are being scheduled. In effect, the
> VM runs as long as there are active processes, and returns when there is no
> more work to do. Whether or not that corresponds with the result of the
> input expression is a different question.
>
> Cheers,
>  - Andreas
>
> On 1/6/2011 5:00 PM, Igor Stasenko wrote:
>>
>> On 6 January 2011 16:41, Gabriel Hernán Barbuto<gbarbuto at gmail.com>
>>  wrote:
>>>
>>> Hi
>>>
>>> I am working with the InterpreterSimulator and I would like to send a
>>> message to an object inside the simulated environment. For example, I
>>> have the oop for true and I want to send it the message printString.
>>>
>>> My question is if this is possible. I don't know if there is a way to
>>> send a message to an object inside the simulation. I have thought
>>> about tinkering with the stack and calling an interpreter method. But
>>> I am not sure if this will work.
>>>
>>
>> Hi, Gabriel.
>> The problem is, that even if you prepare a context and all arguments
>> for message send,
>> you should start interpreting the code and then leave the interpret
>> loop once you received the answer.
>> But if you look at #interpret method, there is an infinite loop,
>> and no way how to escape it.
>>
>> I don't know if there is a way to tell simulator to leave the loop at
>> certain point.
>>
>>
>> P.S. In general, it would be cool to have something like:
>>
>> sqInt interpreter_call( sqInt receiver , sqInt selector , sqInt *
>> arguments )
>>
>> means: send message to receiver and return the answer.
>>
>> Unfortunately, Squeak VM does not provides such things, in contrast to
>> languages like Lua,
>> which providing C interoperability layer by default from very
>> beginning of it existence.
>>
>>> Any hint will be much appreciated. Thanks in advance.
>>>
>>> Gabriel
>>>
>>
>>
>


More information about the Vm-dev mailing list