Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-12-09 09:01:25


I think everybody knows already that my optimization strategy for V2 is to
rewrite all slow non-user-servicable parts in C. Previously, we've used to
add new builtins. I'd like to describe a slightly different approach I'm
planning to use.

The problem with builtins is that they are declared and executed in global
module. This means that if rule accesses module variables, or if rule is a
class method, we're in trouble, since those variables can't be accessed, at
least cleanly.

What I propose is new "NATIVE_RULE" builtin. For examples:

rule difference ( ) { }
    
NATIVE_RULE set : difference ;

The rule will check if there's native (i.e. implemented in C) rule
'set.difference'. If so, it will replace current definition with that native
one.

>From the bjam side, the rules will be declared like this:

LIST *difference( PARSE *parse, FRAME *frame )
{
....
}

void init_set()
{
{
char* args[] = { "B", "*", ":", "A", "*", 0 };
declare_native_rule("set", "difference", args,
difference);
}
}

Very much like builtins, but 'difference' will be executed in the 'set'
module. I've implemented native version of set.difference as proof of
concept, and plan to implelemnt native version of
toolset.set-target-variables (which needs optimization anyway). I might
implement some class method in C, too.

If there's something fundamentally flawed about this idea, I'd be greatefull
to know before I spend much more time on it ;-)

- Volodya

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk