mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Avoid creating the hash in an object when it isn't needed.
[SVN r83834]
This commit is contained in:
@@ -149,6 +149,17 @@ OBJECT * make_class_module( LIST * xname, LIST * bases, FRAME * frame )
|
||||
|
||||
class_module = bindmodule( name );
|
||||
|
||||
{
|
||||
/*
|
||||
Initialize variables that Boost.Build inserts in every object.
|
||||
We want to avoid creating the object's hash if it isn't needed.
|
||||
*/
|
||||
int num = class_module->num_fixed_variables;
|
||||
module_add_fixed_var( class_module, constant_name, &num );
|
||||
module_add_fixed_var( class_module, constant_class, &num );
|
||||
module_set_fixed_variables( class_module, num );
|
||||
}
|
||||
|
||||
var_set( class_module, constant_name, xname, VAR_SET );
|
||||
var_set( class_module, constant_bases, bases, VAR_SET );
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ void constants_init( void )
|
||||
constant_true = object_new( "true" );
|
||||
constant_name = object_new( "__name__" );
|
||||
constant_bases = object_new( "__bases__" );
|
||||
constant_class = object_new( "__class__" );
|
||||
constant_typecheck = object_new( ".typecheck" );
|
||||
constant_builtin = object_new( "(builtin)" );
|
||||
constant_HCACHEFILE = object_new( "HCACHEFILE" );
|
||||
@@ -84,6 +85,7 @@ void constants_done( void )
|
||||
object_free( constant_true );
|
||||
object_free( constant_name );
|
||||
object_free( constant_bases );
|
||||
object_free( constant_class );
|
||||
object_free( constant_typecheck );
|
||||
object_free( constant_builtin );
|
||||
object_free( constant_HCACHEFILE );
|
||||
@@ -138,6 +140,7 @@ OBJECT * constant_ok;
|
||||
OBJECT * constant_true;
|
||||
OBJECT * constant_name;
|
||||
OBJECT * constant_bases;
|
||||
OBJECT * constant_class;
|
||||
OBJECT * constant_typecheck;
|
||||
OBJECT * constant_builtin;
|
||||
OBJECT * constant_HCACHEFILE;
|
||||
|
||||
@@ -25,6 +25,7 @@ extern OBJECT * constant_ok; /* "ok" */
|
||||
extern OBJECT * constant_true; /* "true" */
|
||||
extern OBJECT * constant_name; /* "__name__" */
|
||||
extern OBJECT * constant_bases; /* "__bases__" */
|
||||
extern OBJECT * constant_class; /* "__class__" */
|
||||
extern OBJECT * constant_typecheck; /* ".typecheck" */
|
||||
extern OBJECT * constant_builtin; /* "(builtin)" */
|
||||
extern OBJECT * constant_HCACHEFILE; /* "HCACHEFILE" */
|
||||
|
||||
@@ -82,9 +82,8 @@ rule new ( class args * : * )
|
||||
.next-instance ?= 1 ;
|
||||
local id = object($(class))@$(.next-instance) ;
|
||||
|
||||
xinit $(id) : $(class) ;
|
||||
|
||||
INSTANCE $(id) : class@$(class) ;
|
||||
xinit $(id) : $(class) ;
|
||||
IMPORT_MODULE $(id) ;
|
||||
$(id).__init__ $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) :
|
||||
$(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) : $(17) :
|
||||
|
||||
Reference in New Issue
Block a user