Another couple of questions that cropped up while doing the VM and
translation work:
1. Polling for events
Squeak seems to poll quite vigorously for events, undeterred by the
fact that nothing is happening. I also see it sucking significantly
more CPU in Morphic than in MVC when idle, which doesn't really seem
to be the desired behavior for an event-based system. The CPU usage
for idle Morphic is also somewhat bursty.
Should I simply put it too sleep in the event-getter code if there
are no events, or is this a bad idea? I should mention that the VM
is multi-threaded.
2. Surfaces
It looks like surfaces are a more general replacement for the
Display interface allowing multiple native windows. I've read the
comments but am not entirely clear what the status is. Could I
actually replace the current display output routines with
surface-oriented stuff and get a working image? Is there sample
code?
3. Misc VM
The code that saves the image directly accesses an char* imageName;
variable instead of using the provided getter routine for the
imageName. Is this intentional or something that should be removed?
Calls from the interpreter to the VM support code sometimes use
plain msg-sends that are translated to function calls (in the C VM),
and sometimes use inline C code. Wouldn't it be better to remove the
literal C-code and let the translator take care of it?
4. Stopping the interpreter
The interpret() loop as it is generated by default is not-stoppable
outside a setjmp()/longjmp(), meaning that the only way to terminate
it is to terminate the process, which makes the code after the loop
somewhat redundant (though harmless). I've added a flag that is
checked at the end of a message send and breaks out of the loop with
a goto for the VM I posted. Along with the recycling of the buffer
allocated with sqAllocateMemory this allows new images to be loaded
into an existing process (one at a time!) with only minor leakage.
Is this actually good enough? Could it be added as a standard
feature (I see something like it is there for Mac browseer plugins)?
After I have stopped the VM, is it possible to initiate a save-imge
sequence externally?
I am pretty sure I have some more questions, but this is probably
enough for now.
Marcel