Changeset 4125

Show
Ignore:
Timestamp:
03/04/08 16:19:45 (9 months ago)
Author:
pmoura
Message:

Corrected a Logtalk compiler bug that allowed a predicate to be declared both dynamic and synchronized. Improved error checking when compiling dynamic predicate directives. Improved documentation of some internal multi-threading support predicates.

Location:
trunk
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4122 r4125  
    55375537    '$lgt_valid_pred_ind'(Pred, Functor, Arity), 
    55385538    !, 
    5539     functor(Head, Functor, Arity), 
    5540     (   '$lgt_pp_calls_pred_'(Functor, Arity, _, _) -> 
     5539    (   '$lgt_pp_dynamic_'(Functor, Arity) -> 
    55415540        throw(permission_error(modify, predicate_interpretation, Pred)) 
    5542     ;   assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
     5541    ;   '$lgt_pp_calls_pred_'(Functor, Arity, _, _) -> 
     5542        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5543    ;   functor(Head, Functor, Arity), 
     5544        assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
    55435545        '$lgt_tr_synchronized_directive'(Preds, Mutex) 
    55445546    ). 
     
    55475549    '$lgt_valid_gr_ind'(Pred, Functor, Arity, Arity2), 
    55485550    !, 
    5549     functor(Head, Functor, Arity2), 
    5550     (   '$lgt_pp_calls_nt_'(Functor, Arity) -> 
     5551    (   '$lgt_pp_dynamic_'(Functor, Arity2) -> 
     5552        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5553    ;   '$lgt_pp_calls_nt_'(Functor, Arity) -> 
    55515554        throw(permission_error(modify, non_terminal_interpretation, Pred)) 
    5552     ;   assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
     5555    ;   functor(Head, Functor, Arity2), 
     5556        assertz('$lgt_pp_synchronized_'(Head, Mutex)), 
    55535557        '$lgt_tr_synchronized_directive'(Preds, Mutex) 
    55545558    ). 
     
    56675671    throw(instantiation_error). 
    56685672 
    5669 '$lgt_tr_dynamic_directive'([Pred| _]) :- 
    5670     functor(Pred, Functor, Arity), 
    5671     '$lgt_pp_calls_pred_'(Functor, Arity, _, _), 
    5672     throw(permission_error(modify, predicate_interpretation, Pred)). 
    5673  
    56745673'$lgt_tr_dynamic_directive'([Pred| Preds]) :- 
    56755674    '$lgt_valid_pred_ind'(Pred, Functor, Arity), 
    56765675    !, 
    5677     assertz('$lgt_pp_dynamic_'(Functor, Arity)), 
    5678     '$lgt_tr_dynamic_directive'(Preds). 
     5676    (   functor(Head, Functor, Arity), 
     5677        '$lgt_pp_synchronized_'(Head, _) -> 
     5678        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5679    ;   '$lgt_pp_calls_pred_'(Functor, Arity, _, _) -> 
     5680        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5681    ;   assertz('$lgt_pp_dynamic_'(Functor, Arity)), 
     5682        '$lgt_tr_dynamic_directive'(Preds) 
     5683    ). 
    56795684 
    56805685'$lgt_tr_dynamic_directive'([Pred| Preds]) :- 
    5681     '$lgt_valid_gr_ind'(Pred, Functor, _, Arity2), 
    5682     !, 
    5683     assertz('$lgt_pp_dynamic_'(Functor, Arity2)), 
    5684     '$lgt_tr_dynamic_directive'(Preds). 
     5686    '$lgt_valid_gr_ind'(Pred, Functor, Arity, Arity2), 
     5687    !, 
     5688    (   functor(Head, Functor, Arity2), 
     5689        '$lgt_pp_synchronized_'(Head, _) -> 
     5690        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5691    ;   '$lgt_pp_calls_nt_'(Functor, Arity) -> 
     5692        throw(permission_error(modify, predicate_interpretation, Pred)) 
     5693    ;   assertz('$lgt_pp_dynamic_'(Functor, Arity2)), 
     5694        '$lgt_tr_dynamic_directive'(Preds) 
     5695    ). 
    56855696 
    56865697'$lgt_tr_dynamic_directive'([Pred| _]) :- 
     
    1293412945 
    1293512946 
    12936 % '$lgt_mt_check_threads'(@list, @list) 
    12937 % 
    12938 % checks sucesseful creation of working "or" threads 
     12947% '$lgt_mt_check_threads'(@list, +message_queue_identifier) 
     12948% 
     12949% checks sucesseful creation of working threads; failure to create a thread 
     12950% usually results from exhaustion of virtual memory address space or exceeding  
     12951% the maximum number of threads allowed by the back-end Prolog compiler 
    1293912952 
    1294012953'$lgt_mt_check_threads'([], _). 
     
    1295112964% '$lgt_mt_threaded_and_exit'(+callable, +message_queue_identifier, +list) 
    1295212965% 
    12953 % retrieves the result of proving a conjunction of goals using a threaded/1 predicate call 
     12966% retrieves the result of proving a conjunction of goals using a threaded/1 predicate 
     12967% call by collecting the individual thread results posted to the call message queue 
    1295412968 
    1295512969'$lgt_mt_threaded_and_exit'(TGoals, Queue, Results) :- 
     
    1304613060% '$lgt_mt_threaded_or_exit'(+callable, +message_queue_identifier, +list) 
    1304713061% 
    13048 % retrieves the result of proving a disjunction of goals using a threaded/1 predicate call 
     13062% retrieves the result of proving a disjunction of goals using a threaded/1 predicate 
     13063% call by collecting the individual thread results posted to the call message queue 
    1304913064 
    1305013065'$lgt_mt_threaded_or_exit'(TGoals, Queue, Results) :- 
  • trunk/manuals/index.html

    r4102 r4125  
    3232    <div class="copyright"> 
    3333        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    34         <span>Last updated on: February 11, 2008</span> 
     34        <span>Last updated on: March 5, 2008</span> 
    3535    </div> 
    3636    <div class="navbottom"> 
  • trunk/manuals/refman/directives/dynamic1.html

    r3560 r4125  
    3232dynamic([Functor1//Arity1, Functor2//Arity2, ...])</pre> 
    3333<p> 
    34 Declares dynamic predicates and dynamic grammar rule non-terminals. Note that an object can be static and have both static and dynamic predicates/non-terminals. 
     34Declares dynamic predicates and dynamic grammar rule non-terminals. Note that an object can be static and have both static and dynamic predicates/non-terminals. Dynamic predicates cannot be declared as synchronized. 
    3535</p> 
    3636 
     
    5252    <div class="copyright"> 
    5353        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    54         <span>Last updated on: October 26, 2006</span> 
     54        <span>Last updated on: March 5, 2008</span> 
    5555    </div> 
    5656    <div class="navbottom"> 
  • trunk/manuals/refman/directives/synchronized1.html

    r3779 r4125  
    3535</p> 
    3636<p> 
    37 Synchronized predicates are silently compiled as normal predicates when using back-end Prolog compilers that don't support multi-threading programming. 
     37Synchronized predicates are silently compiled as normal predicates when using back-end Prolog compilers that don't support multi-threading programming. Note that synchronized predicates cannot be declared dynamic. 
    3838</p> 
    3939 
     
    5555    <div class="copyright"> 
    5656        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    57         <span>Last updated on: January 2, 2007</span> 
     57        <span>Last updated on: March 5, 2008</span> 
    5858    </div> 
    5959    <div class="navbottom"> 
  • trunk/manuals/refman/index.html

    r4038 r4125  
    319319    <div class="copyright"> 
    320320        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    321         <span>Last updated on: January 21, 2008</span> 
     321        <span>Last updated on: March 5, 2008</span> 
    322322    </div> 
    323323    <div class="navbottom"> 
  • trunk/manuals/refman/refman.header

    r4102 r4125  
    3636        <span>http://logtalk.org/</span> 
    3737    </p> 
    38     <p class="date">Last updated on January 21, 2008</p> 
     38    <p class="date">Last updated on March 5, 2008</p> 
    3939</div> 
    4040 
  • trunk/manuals/userman/index.html

    r4075 r4125  
    301301    <div class="copyright"> 
    302302        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/> 
    303         <span>Last updated on: February 11, 2008</span> 
     303        <span>Last updated on: March 5, 2008</span> 
    304304    </div> 
    305305    <div class="navbottom"> 
  • trunk/manuals/userman/threads.html

    r3852 r4125  
    211211 
    212212<p> 
    213 The <code>synchronized/1</code> directive must precede any local calls to the synchronized predicate (or synchronized non-terminal) in order to ensure proper compilation. In addition, as each Logtalk entity is independently compiled, this directive must be included in every object or category that contains a definition for the described predicate, even if the predicate declaration is inherited from another entity, in order to ensure proper compilation. 
     213The <code>synchronized/1</code> directive must precede any local calls to the synchronized predicate (or synchronized non-terminal) in order to ensure proper compilation. In addition, as each Logtalk entity is independently compiled, this directive must be included in every object or category that contains a definition for the described predicate, even if the predicate declaration is inherited from another entity, in order to ensure proper compilation. Note that a synchronized predicate cannot be declared dynamic. To ensure atomic updates of a dynamic predicate, declare as synchronized the predicate performing the update. 
    214214</p> 
    215215<p> 
     
    248248    <div class="copyright"> 
    249249        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    250         <span>Last updated on: September 15, 2007</span> 
     250        <span>Last updated on: March 5, 2008</span> 
    251251    </div> 
    252252    <div class="navbottom"> 
  • trunk/manuals/userman/userman.header

    r4102 r4125  
    3636        <span>http://logtalk.org/</span> 
    3737    </p> 
    38     <p class="date">Last updated on February 11, 2008</p> 
     38    <p class="date">Last updated on March 5, 2008</p> 
    3939</div> 
    4040 
  • trunk/RELEASE_NOTES.txt

    r4121 r4125  
    2626    Updated the Logtalk runtime to unlock all mutexes hold by a thread when  
    2727    upon thread cancellation. 
     28 
     29    Corrected a Logtalk compiler bug that allowed a predicate to be declared  
     30    both dynamic and synchronized. 
    2831 
    2932    Updated the XSB config file to use the new optimized call/N predicates