[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tagged objects

From: David Chisnall
Subject: Re: Tagged objects
Date: Thu, 21 Jul 2011 15:44:30 +0100

On 21 Jul 2011, at 15:34, Dr. H. Nikolaus Schaller wrote:

>> That's a bit modern.  This technique was used by Lisp in 1958. 
> Ah, yes. I remember.

I was at a talk by Alan Kay a few years ago, where he talked about the 
development of Smalltalk.  He described this technique as being old when they 
used it.  It was the reason that Smalltalk didn't go the Java route of having 
primitive types as well as object types: there was an existing technique for 
efficiently boxing non-object types already.  

The B5000 architecture, on which the Smalltalk VM is based, did this in 
hardware back in 1961.  A few bits of each word were used for a tag.  For 
built-in tag types (e.g. integers), operations like ADD would just do the same 
as an add instruction on a modern system.  For tags marked as descriptors, 
they'd trap to the handler for the operation (i.e. call the relevant method).  

Floating point values complicated this slightly on modern machines.  Back in 
the '70s, no one had floating point hardware, so there was no problem 
implementing 30-bit floats in software - it was no slower than implementing 
32-bit floats in software.  Trying to support IEEE floating point is a lot 
harder, because you can't cram a floating point value in a pointer - there 
isn't space.

JavaScript VMs on 32-bit systems often use a technique where they use 64-bit 
values for pointers and with the exponent set to 0x7ff (indicating NaN), but on 
64-bit systems it's harder because you can't guarantee that there will be no 
valid pointers with the high bits set to that range.  Unless you do something 
really ugly, like mmap() that entire address range with no-access 


-- Sent from my IBM 1620

reply via email to

[Prev in Thread] Current Thread [Next in Thread]