[ENH][VM] faster image startup

John M McIntosh johnmci at smalltalkconsulting.com
Wed Aug 6 20:12:05 UTC 2003


Make image startup slightly faster.

a) Don't rewrite all oops to clear the mark bit, only rewrite the ones  
that have the mark bit set.
b) Don't rewrite all oops to change oops address if the offset is zero  
which is the case on the mac when the same vm reads a recently saved  
image because of how the memory map is located. Unknown if this is the  
case on wintel.
c) Don't rescan the entire image a second time to null out compiled  
methods with an external primitive call, remember those oops on the  
first scan, then later null out the 320 or so contexts, versus  
rescaning 260 thousands oops


Now one of the 'ugly' things I did here to avoid altering the  
Interpreter class definition and having 16K of memory sucked up by a  
global one-time use table is to allocate a local 4096 element Array in  
ObjectMemory>>initializeObjectMemory: which gets passed to an altered  
adjustAllOopsBy: which remembers the methods oops that have refer to  
external primitives as it's looking for Oops with the Mark Bit set.

That array with the stored count is returned and at the end of  
initializeObjectMemory we decide to invoke the old  
flushExternalPrimitives if the count is >= 4095 or in my  testing with  
the base image since we only have 320 oops that match it means just  
invoking flushExternalPrimitiveOf: on the remembered oops.

At startup time we reduce the CPU time by 8% based on the changes to  
initializeObjectMemory:, and remove another 4% based on a no-longer  
required rescan by flushExternalPrimitives.

Although these changes reduce powerpc startup time by just a little it  
should make some noticeable changes for 100MB images, or on machines  
that are *much* slower.

Other changes go into the mac source code to reorganize how the menu  
bar is manipulated and not to start the 1/60 clock pthread until it's  
really required. That shaves a bunch of clock time off and now startup  
is much more snappy.

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FasterAppStartup-JMM.2.cs.gz
Type: application/x-gzip
Size: 2278 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030806/381e89b9/FasterAppStartup-JMM.2.cs.bin


More information about the Squeak-dev mailing list