Subject: Re: [boost] Interest request for pointer+bit compressionoptimization
From: troy d. straszheim (troy_at_[hidden])
Date: 2009-09-08 06:51:48
David Abrahams wrote:
> on Tue Sep 08 2009, Vicente Botet Escriba
> <vicente.botet-AT-wanadoo.fr> wrote:
>> Do you have a specific pointer for CLang related to this usage?
> Nope, this is hearsay. Doug?
If I remember Doug's explanation correctly, one of the
optimizations inside clang is: There is a global table of 'plain'
types, e.g. int, bool, float, std::string. Clang internally represents
CV qualified types by e.g. creating a pointer to the type 'int',
then using the small bits of the pointer to tag const and volatile. I
don't recall whether they used more than two bits (for, say reference,
static, pointer, etc.) Sebastian Redl gave a great intro to clang @
boostcon, I'd bet he knows the details as well.
Aside from that, another use case: Mark-and-sweep garbage collection.
This came up when as an exercise I implemented a lisp interpreter with
spirit, variants, visitors, and intrusive_ptr. Currently this thing
just leaks pointer loops, and a taggable_ptr combined with some kind of
memory pool would seem a nice way to start working on it...