Changeset 4275

Show
Ignore:
Timestamp:
05/24/08 08:23:23 (3 months ago)
Author:
pmoura
Message:

Small performance improvement to the caching of category predicates when using static binding.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4273 r4275  
    6565 
    6666:- dynamic('$lgt_current_protocol_'/3).         % '$lgt_current_protocol_'(Ptc, Prefix, Type) 
    67 :- dynamic('$lgt_current_category_'/5).         % '$lgt_current_category_'(Ctg, Prefix, Def, Type, Synchronized) 
     67:- dynamic('$lgt_current_category_'/6).         % '$lgt_current_category_'(Ctg, Prefix, Dcl, Def, Type, Synchronized) 
    6868:- dynamic('$lgt_current_object_'/8).           % '$lgt_current_object_'(Obj, Prefix, Dcl, Def, Super, Type, Synchronized, Threaded) 
    6969                                                 
     
    7676:- dynamic('$lgt_extends_protocol_'/3).         % '$lgt_extends_protocol_'(Ptc1, Ptc2, Scope) 
    7777                                                 
    78 :- dynamic('$lgt_complemented_object_'/4).      % '$lgt_complemented_object_'(Object, Category, Dcl, Def) 
     78:- dynamic('$lgt_complemented_object_'/4).      % '$lgt_complemented_object_'(Obj, Ctg, Dcl, Def) 
    7979 
    8080 
     
    314314    ;   '$lgt_extends_protocol_'(_, CtgOrPtc, _), \+ '$lgt_current_protocol_'(CtgOrPtc, _, _) -> 
    315315        throw(error(existence_error(protocol, CtgOrPtc), _, _)) 
    316     ;   '$lgt_imports_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _, _) -> 
     316    ;   '$lgt_imports_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _, _, _) -> 
    317317        throw(error(existence_error(category, CtgOrPtc), _, _)) 
    318     ;   '$lgt_extends_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _, _) -> 
     318    ;   '$lgt_extends_category_'(_, CtgOrPtc, _), \+ '$lgt_current_category_'(CtgOrPtc, _, _, _, _, _) -> 
    319319        throw(error(existence_error(category, CtgOrPtc), _, _)) 
    320320    ). 
     
    408408 
    409409current_category(Ctg) :- 
    410     '$lgt_current_category_'(Ctg, _, _, _, _). 
     410    '$lgt_current_category_'(Ctg, _, _, _, _, _). 
    411411 
    412412 
     
    452452 
    453453category_property(Ctg, Prop) :-             % static/dynamic property 
    454     '$lgt_current_category_'(Ctg, _, _, Prop, _). 
     454    '$lgt_current_category_'(Ctg, _, _, _, Prop, _). 
    455455 
    456456category_property(Ctg, synchronized) :- 
    457     '$lgt_current_category_'(Ctg, _, _, _, yes). 
     457    '$lgt_current_category_'(Ctg, _, _, _, _, yes). 
    458458 
    459459 
     
    491491 
    492492create_object(Obj, Rels, Dirs, Clauses) :- 
    493     '$lgt_current_category_'(Obj, _, _, _, _), 
     493    '$lgt_current_category_'(Obj, _, _, _, _, _), 
    494494    throw(error(permission_error(modify, category, Obj), create_object(Obj, Rels, Dirs, Clauses))). 
    495495 
     
    537537 
    538538create_category(Ctg, Rels, Dirs, Clauses) :- 
    539     '$lgt_current_category_'(Ctg, _, _, _, _), 
     539    '$lgt_current_category_'(Ctg, _, _, _, _, _), 
    540540    throw(error(permission_error(modify, category, Ctg), create_category(Ctg, Rels, Dirs, Clauses))). 
    541541 
     
    594594 
    595595create_protocol(Ptc, Rels, Dirs) :- 
    596     '$lgt_current_category_'(Ptc, _, _, _, _), 
     596    '$lgt_current_category_'(Ptc, _, _, _, _, _), 
    597597    throw(error(permission_error(modify, category, Ptc), create_protocol(Ptc, Rels, Dirs))). 
    598598 
     
    670670 
    671671abolish_category(Ctg) :- 
    672     (   '$lgt_current_category_'(Ctg, Prefix, _, Type, _) -> 
     672    (   '$lgt_current_category_'(Ctg, Prefix, _, _, Type, _) -> 
    673673        (   Type == (dynamic) -> 
    674674            call_with_args(Prefix, Dcl, Def, Rnm), 
     
    679679            abolish(Rnm/3), 
    680680            abolish(Prefix/3), 
    681             retractall('$lgt_current_category_'(Ctg, _, _, _, _)), 
     681            retractall('$lgt_current_category_'(Ctg, _, _, _, _, _)), 
    682682            retractall('$lgt_extends_category_'(Ctg, _, _)), 
    683683            retractall('$lgt_implements_protocol_'(Ctg, _, _)), 
     
    19631963'$lgt_alias_pred'(Ctg1, _, Alias, Pred, _) :- 
    19641964    '$lgt_extends_category_'(Ctg1, Ctg2, _), 
    1965     '$lgt_current_category_'(Ctg2, Prefix, _, _, _), 
     1965    '$lgt_current_category_'(Ctg2, Prefix, _, _, _, _), 
    19661966    '$lgt_alias_pred'(Ctg2, Prefix, Alias, Pred, _). 
    19671967 
    19681968'$lgt_alias_pred'(Obj, _, Alias, Pred, _) :- 
    19691969    '$lgt_imports_category_'(Obj, Ctg, _), 
    1970     '$lgt_current_category_'(Ctg, Prefix, _, _, _), 
     1970    '$lgt_current_category_'(Ctg, Prefix, _, _, _, _), 
    19711971    '$lgt_alias_pred'(Ctg, Prefix, Alias, Pred, _). 
    19721972 
     
    31613161    (   call_with_args(Dcl, Pred, _, _, _, _, _, _, _) -> 
    31623162        (   '$lgt_imports_category_'(This, Ctg, _), 
    3163             '$lgt_current_category_'(Ctg, _, Def, _, _), 
     3163            '$lgt_current_category_'(Ctg, _, _, Def, _, _), 
    31643164            call_with_args(Def, Pred, Sender, This, Self, Call, _) -> 
    31653165            call(Call) 
     
    33233323 
    33243324'$lgt_hidden_functor'(Functor) :- 
    3325     '$lgt_current_category_'(_, Prefix, _, _, _), 
     3325    '$lgt_current_category_'(_, Prefix, _, _, _, _), 
    33263326    atom_concat(Prefix, _, Functor), 
    33273327    !. 
     
    40654065 
    40664066'$lgt_redefined_entity'(Entity, category) :- 
    4067     '$lgt_current_category_'(Entity, _, _, _, _). 
     4067    '$lgt_current_category_'(Entity, _, _, _, _, _). 
    40684068 
    40694069 
     
    49214921    !. 
    49224922 
    4923 '$lgt_pp_rclause'('$lgt_current_category_'(Ctg, Prefix, Def, Mode, Synchronized)) :- 
    4924     '$lgt_pp_category_'(Ctg, Prefix, _, Def, _, Mode), 
     4923'$lgt_pp_rclause'('$lgt_current_category_'(Ctg, Prefix, Dcl, Def, Mode, Synchronized)) :- 
     4924    '$lgt_pp_category_'(Ctg, Prefix, Dcl, Def, _, Mode), 
    49254925    (   '$lgt_pp_synchronized_' -> 
    49264926        Synchronized = yes 
     
    87758775'$lgt_unknown_category'(Ctg) :- 
    87768776    '$lgt_pp_referenced_category_'(Ctg), 
    8777     \+ '$lgt_current_category_'(Ctg, _, _, _, _),   % not a currently loaded category 
    8778     \+ '$lgt_pp_category_'(Ctg, _, _, _, _, _),     % not the category being compiled (self references) 
    8779     \+ '$lgt_pp_entity_init_'(category, Ctg, _).    % not a category defined in the source file being compiled 
     8777    \+ '$lgt_current_category_'(Ctg, _, _, _, _, _),    % not a currently loaded category 
     8778    \+ '$lgt_pp_category_'(Ctg, _, _, _, _, _),         % not the category being compiled (self references) 
     8779    \+ '$lgt_pp_entity_init_'(category, Ctg, _).        % not a category defined in the source file being compiled 
    87808780 
    87818781 
     
    1060510605    retractall('$lgt_current_object_'(Entity, _, _, _, _, _, _, _)), 
    1060610606    retractall('$lgt_current_protocol_'(Entity, _, _)), 
    10607     retractall('$lgt_current_category_'(Entity, _, _, _, _)), 
     10607    retractall('$lgt_current_category_'(Entity, _, _, _, _, _)), 
    1060810608    retractall('$lgt_implements_protocol_'(Entity, _, _)), 
    1060910609    retractall('$lgt_imports_category_'(Entity, _, _)), 
     
    1067210672'$lgt_construct_category_functors'(Ctg, Prefix, Dcl, Def, Rnm) :- 
    1067310673    (   '$lgt_built_in_category'(Ctg) -> 
    10674         '$lgt_current_category_'(Ctg, Prefix, _, _, _), 
     10674        '$lgt_current_category_'(Ctg, Prefix, _, _, _, _), 
    1067510675        Call =.. [Prefix, Dcl, Def, Rnm], 
    1067610676        once(Call) 
     
    1072110721    (   '$lgt_current_object_'(Entity, Prefix, _, _, _, _, _, _), 
    1072210722        Type = object 
    10723     ;   '$lgt_current_category_'(Entity, Prefix, _, _, _), 
     10723    ;   '$lgt_current_category_'(Entity, Prefix, _, _, _, _), 
    1072410724        Type = category 
    1072510725    ), 
     
    1333213332        true 
    1333313333    ;   '$lgt_static_binding_entity_'(Ctg), 
    13334         '$lgt_current_category_'(Ctg, Prefix, _, _, _), 
    13335         Clause =.. [Prefix, Dcl, Def, _], 
    13336         call(Clause), 
     13334        '$lgt_current_category_'(Ctg, _, Dcl, Def, _, _), 
    1333713335        call_with_args(Dcl, Pred, _, static, _, _, _, DclCtn), !, 
    1333813336        functor(Pred, PredFunctor, PredArity), 
  • trunk/RELEASE_NOTES.txt

    r4274 r4275  
    2323    category that extends other categories.  Thanks to Victor Noel for  
    2424    the bug report. 
     25 
     26    Small performance improvement to the caching of category predicates  
     27    when using static binding. 
    2528 
    2629    Removed from the YAP config file the definition of the forall/2