[Vm-dev] headerTypeBytes oddity

David T. Lewis lewis at mail.msen.com
Thu Feb 19 01:03:35 UTC 2009


On Wed, Feb 18, 2009 at 03:09:22PM +0200, Igor Stasenko wrote:
>  
> A headerTypeBytes ivar used in Interpreter, but initialized only once
> during its lifetime - in readImageFromFile: f HeapSize:
> desiredHeapSize StartingAt: imageOffset),
> and with same constants:
> 
> 	headerTypeBytes at: 0 put: BytesPerWord * 2.		"3-word header (type 0)"	
> 	headerTypeBytes at: 1 put: BytesPerWord.		"2-word header (type 1)"
> 	headerTypeBytes at: 2 put: 0.					"free chunk (type 2)"	
> 	headerTypeBytes at: 3 put: 0.					"1-word header (type 3)"
> 
> I think this initialization could be put into static var declaration,
> in #declareCVarsIn:
> 	aCCodeGenerator
> 		var: #headerTypeBytes
> 		declareC: 'static sqInt headerTypeBytes[4] = { blablabla}'.
> 	
> then we don't have to pollute already complex #readImageFromFile:...
> method with odd stuff like this.

Igor,

Can you make a Mantis entry for this? It looks like an easy and harmless
change, but it would be good to have a record of it on Mantis so the
various VM projects can keep in sync.

Dave



More information about the Vm-dev mailing list