gnustep-dev
[Top][All Lists]
Advanced

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

Re: Tagged objects


From: Owen Shepherd
Subject: Re: Tagged objects
Date: Thu, 21 Jul 2011 19:11:24 +0100
User-agent: Microsoft-MacOutlook/14.12.0.110505

On 21/07/2011 15:44, "David Chisnall" <address@hidden> wrote:
>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 permissions...

In the general case, no, but many 64-bit architectures don't have 64-bit
virtual address spaces. For example, AMD64 has a 48-bit address space with
a giant chasm right down the middle, where the common case is that the top
half is used for the kernel and the bottom half for user space (Note
however that Solaris puts various bits of user stuff in both halves).

Also, within specific domains one can escape this problem by simply
constraining all objects to live within a certain region of the address
space (e.g. MMAP a large region for the GC heap and do all allocations
from that, using the offset instead of the pointer)

Or, in the x86 case, one can just truncate the upper 16 bits when encoding
the pointer into a double. Decoding then becomes a case of
        mov rax, [theDouble]
        shl rax, 16
        sar rax, 16
in order to regenerate the canonical address.

-- Owen Shepherd
http://www.owenshepherd.net
address@hidden (general) / address@hidden (academic)







reply via email to

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