lua-users home
lua-l archive

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


Axel Kittenberger <axkibe@gmail.com> writes:
>> Though you then need to get slightly more creative about encoding the
>> type. A double has 52 bits of mantissa; with 48 taken for a
>> pointer-sized value, and 1 taken to ensure a quiet NaN, you only have
>> 3 bits left to encode the type. If you borrow the sign bit as well,
>> then you have 4 bits. For reference, the current implementation in 5.2
>> beta uses 6 bits for encoding type.
>
> Dont you need just 1 bit to encode if its a pointer or something else.
> Or 2 bits for the various different pointer types Lua has (light user
> data vs "heavy" user data, etc.).

There are a fair number of immediate types that contain pointers.

Many of them point to Lua internal objects (table, string, function,
etc), which can all share a header in the object that contains another
tag field to distinguish among them.  However pointer immediates which
point to external objects need to have unique tags in the immediate
value.

[See my previous post in this thread for a bit more detail.]

-Miles

-- 
"Yorton, Wressle, and Gospel Oak, the richness of your heritage is ended.
We shall not stop at you again; for Dr Beeching stops at nothing."