VM Profiling in Linux

Tim Rowledge tim at sumeru.stanford.edu
Mon Mar 11 22:14:16 UTC 2002


In message <0GST00803WSFCU at mta10.srv.hcvlny.cv.net>
          Anthony Hannan <ajh18 at cornell.edu> wrote:

>  In particular, I want to avoid initializing all
> temps to nil at the start of every method.  Most methods have no temps so
> it is a waste for the VM to go through this loop even if it is empty.  Also,
> since the nils will likely be overriden it is a waste to put nils in the stack
> in the first place.
Eek. Danger Will Robinson!

Those nils are there for a good reason. Well, several actually.
First, leaving anything random in there may (depending upon many details
of the precise manner in which contexts are handled) blow the poor GCs
little brains out.
Second, any reflection upon the context _must_ find things as they are
supposed to be. LPD expressed this many years ago as "you can cheat but
you mustn't get caught". This is not C land where people _expect_ to
find junk everywhere.

This is not to say that you cannot do what you are suggesting, but
that you must take care to properly hide it. Context GC code may need
altering to be able to jump over uninitialised context temps (though to
be honest setting them to nil is a good easy way to do it) and if there
aren't any it doesn't take much time to do. Making things work for
reflection could probably be done in a similar manner to the way that
stack access is guarded in Contexts (See ObjectMemory>lastPointerOf: and
ContextPart>stackp: - but it will need to be done.

You absolutely cannot leave 'old' oops in context temps and expect
things to work properly.  And besides, if there are no temps it isn't
exaclty going to take long time to do that loop 0 times, is it?


tim
-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
An algorithm must be seen to be believed.  - D. E. Knuth




More information about the Squeak-dev mailing list