[Vm-dev] An event driven Squeak VM

Andreas Raab andreas.raab at gmx.de
Tue Nov 10 20:03:53 UTC 2009


John M McIntosh wrote:
> Well I'm not sure what exactly you are trying to fix or optimize

Sorry for not being clear. I'm trying to address several concrete problems:

1) Dragging a Squeak main window by its label currently blocks the VM. 
Sounds stops playing, animations stop animating etc.

2) Opening OS file dialogs or context menus block the VM. Same issues. 
You've had this problem in Sophie, we've added a specific solution for 
Teleplace and I'd like to generalize this into a generic solution.

3) Make it easy to embed a Squeak VM by making it possible to deliver an 
event and run the resulting code. Allowing for example to run the VM as 
a browser plugin by calling interpret() in response to the 
browser-delivered events.

Abstractly speaking, I am trying to turn around the way interpret() is 
being run. Instead of calling interpret() and it then calling 
ioProcessEvents() I want to call interpret in response to events 
generated elsewhere and have it return when it's done handling the 
events up to this point. This addresses all the issues mentioned above.

> Now as for the proposed changes, we would just call the 
> ioRelinquishProcessorForMicroseconds() logic after the interpreter() ends.
> On register rich machines (ancient powerpc machines this change would be 
> technically more expensive since it loads up 20 some registers
> on the entry to interpret() but give it's call rate of 50 times a second 
> no-one will notice.

For example. I am *not* proposing to implement the "trivial client loop" 
that I was talking about earlier. Rather, what I would do on Windows is 
call interpret() from the appropriate WNDPROC in response to a UI event. 
The main loop would be a "standard windows event loop" without any 
references to interpret(). I would expect that the other platforms do 
whatever is appropriate, the trivial client loop was intended purely as 
an example.

As a consequence of the changes, you would be able to have other main 
loops (via MFC, Cocoa, wxWidgets etc. you name it) and call interpret() 
in response to incoming events.

Cheers,
   - Andreas




More information about the Vm-dev mailing list