headless vm changes suggestions

Tim Rowledge rowledge at interval.com
Fri Mar 20 00:46:50 UTC 1998


I've made a simple set of changes that make doing headless squeak much simpler and which might interest you folks. John & I have discussed it a bit  previously and he seems to quite like it.

The most obvious glitch when trying to do a headless run of squeak is
that the window is created and opened by the vm before the image is
started up. Thus there is no easy way to have a headless image
without a vm that can understand not having a display. Ian has put a
bunch if #ifdefs in his window stuff to do this. Obviously there are
a load of other issues such as the communication to some other
image/machine for debugging etc, but that's for another day!

I spotted the posibility of a neater way to do this as a side effect
of having to change the beDisplay prim to support the Acorn display.
I have to call a function in the window.c file to fake out the
dispaly bitmap being outside object space, and noticed that it would
be a really good place to move the SetupWindow/SetWindowSize etc
work. That way, it is only when beDisplay is called that the window
need be created  and now the image can have complete control over
whether a window is used.

The VM changes are very small:-
- primitiveBeDisplay needs to call some outside function. For my
needs I use ioSetDisplayBitmap(int displayObj, int suggestedSize, int
w, int h, int d) where the arguments are the Display oop, the
suggested size of the bitmap in bytes, the width, height and depth.
This seems a reasonably comprehensive set of information that might
be useful, since we can actually specify the window size directly
rather than it always being a defaulted size. It also sets a flag
value to indicate that the window exists and avoids redoing it.  If
the window is already open to a different size, it ought to resize
the window programmatically.
- main() loses the Setupwindow etc calls and they move into the
ioSetDisplayBitmap function.
- ioScreenSize() checks the above mentioned flag and returns the open
window's size or the savedWindowSize as appropriate.

The image changes are simple as well:-
the startup sequence has to be fiddled a little, since we need to
check to see if the image wants to run headless very early on; I used
the existence of a file called 'beheadless' asa trivial test. I
suggest that using one of the vm attribute ids might be useful, since
that could be tied to the vm build. Obviously, image code could use a
variety of tests with no trouble.
Since a headless image won't want a display or cursor or source code
(probably) we can branch away from starting them up if running
headless and go to some other  branch that filesin some code or
simply hardcodes some work.

Clearly there would be more complicated work to do to handle
notifiers when running headless, but one thing at a time.

If you're interested, I can offer up the code; I'll happily do the C
code edits for you as well if you're interested but short on time. I
can test W95 (in fact I have indirectly got it running anyway) and
Mac but I have no unix machine available to test.
tim
-- 
Useful random insult:- Enjoys listening to telemarketers.
Tim Rowledge:  rowledge at interval.com (w)  +1 (650) 856-7230 (w)
 tim at sumeru.stanford.edu (h)  <http://sumeru.stanford.edu/tim>





More information about the Squeak-dev mailing list