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

Bert Freudenberg bert at freudenbergs.de
Mon Dec 21 00:32:52 UTC 2009


On 21.12.2009, at 01:17, David T. Lewis wrote:
> 
> 
> On Mon, Dec 21, 2009 at 12:56:01AM +0100, Bert Freudenberg wrote:
>> 
>> On 21.12.2009, at 00:44, David T. Lewis wrote:
>>> 
>>> 
>>> 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
>>> 
>> 
>> Does "ObjectMemory bytesPerWord" compile to a constant?
> 
> Bert,
> 
> Obviously you are not using SlangBrowser ;-)
> 
> Yes, it answers a constant. 

Thanks :)

I'd find it more readable and more revealing to use BytesPerWord directly, as is done in almost all other places:

	... ifFalse:[^slots * BytesPerWord]

- Bert -




More information about the Vm-dev mailing list