[Vm-dev] byteSizeOf: is that correct for 64bit images? Also what about the (sqInt)(long)

David T. Lewis lewis at mail.msen.com
Sun Dec 20 23:44:43 UTC 2009


On Sun, Dec 20, 2009 at 02:45:59PM -0800, John M McIntosh wrote:
> 
> Ok, I have to ask, is this correct?    Er 4 or 8 or does it matter, do we have other '4' values embedded in the interpreter? 
> byteSizeOf: oop
> 	| slots |
> self flag: #Dan.
> 	(self isIntegerObject: oop) ifTrue:[^0].
> 	slots := self slotSizeOf: oop.
> 	(self isBytesNonInt: oop)
> 		ifTrue:[^slots]
> 		ifFalse:[^slots * 4]
> 

No, this is not correct, good catch. It should be:

  byteSizeOf: oop
  	| slots |
  self flag: #Dan.
  	(self isIntegerObject: oop) ifTrue:[^0].
  	slots := self slotSizeOf: oop.
  	(self isBytesNonInt: oop)
  		ifTrue:[^slots]
  		ifFalse:[^slots * ObjectMemory bytesPerWord]

I've clean a lot of this crud out of the interpreter, but there are bound
to be a few more that we have not spotted yet.

Dave



More information about the Vm-dev mailing list