Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] assertions or exceptions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques GARRIGUE <garrigue@k...>
Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions?
From: John Prevost <j.prevost@gmail.com>

> Apologies for keeping the conversation going, but since I just thought of this:
> 
> Caml's internal pointers are at minimum 4-byte aligned.  What about
> using the other "safe" set of trailing bits, "10", to mark options? 
> i.e.:
> 
> None = ...0010 (2)
> Some None =  ...0110 (6)
> Some Some None = ...1010 (10)
> Some Some Some None = ...1110 (14)
> 
> and so on?  This would remove the need to use a special memory area
> (or check that area) for wrapping and unwrapping.  There'd still be a
> cost, but I would think it should be smaller than the cost you
> describe?
> 
> That said, I also don't think this is a critical issue.

Now that you tell it, Xavier's idea (and implementation) was actually
along this line.
The trouble is that it doesn't change the cost: you just do an and on
the lower bits rather than on the higher ones.
Might be worth retrying some day, as hardware is changing, but I don't
expect any real change.

Jacques Garrigue

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners