3 * EHANCED: CHR performance: compacted indexing code
7 * ADDED: CHR: chr_constants/1 built-in type for enumerated constants
11 * ENHANCED: CHR: performance improvements (success continuation, Prolog code optimization)
13 * COMPAT: Removed min_list/2 from library(hprolog) as this is now in library lists.
17 * TS: Exploit success continuation information.
21 * TS: Bug fix in continuation optimization.
22 * TS: Fixed singleton variable.
23 * TS: Suppress debug message.
27 * TS: Rewrite Prolog code: common prefix elimination in
28 successive clauses of the same predicate.
29 * TS: Tries stores enabled by default again.
30 * TS: Success and failure continuation optimization for
31 propagation occurrences.
35 * TS: Fix performance bug in locking of guard variables.
36 * TS: Fix performance bug in spurious hash_term call.
40 * TS: Type check constraint declarations.
41 * TS: Trie stores hidden behind `experimental' option.
42 * TS: New option `verbose' prints constraint indices.
43 * TS: Don't compute term_hash for int and natural types.
47 * TS: Avoid trivial warning for declare_stored_constraints.
48 * TS: Bug fix: missing full store was causing compiler to loop.
52 * TS: Bug fix: atomic_constants store was causing compiler
54 * TS: Clean-up and avoid adding additional global_ground store
55 if atomic_constants store covers all cases.
56 * TS: Clean-up and bug fix.
60 * TS: Performance improvement: use new store
61 implementation for multi-argument lookups
62 on manifest ground terms. Should be faster than
67 * TS: Performance improvement: use new store
68 implementation for single-argument lookups
69 on manifest atomics. Should be faster than
70 hashtable. Will be generalized to arbitrary
71 manifest ground lookups and non-manifest
72 atomically typed lookups .
76 * TS: Modified error messages of declare_stored_constraints
77 option, to distinguish between stored, temporarily stored
79 * TS: write/1, writeln/1 and format/2 are now treated as non-binding
81 * TS: Properly inline inthash constraint lookup.
85 * TS: Additional assertion # default(Goal) for the
86 declare_stored_constraints, which specifies that
87 an unconditional simplification rule for the constraint
88 must be added to the end of the program. The Goal
89 parameter specifies the goal of that rule, e.g.
90 true or fail or throw(...). Experimental.
94 * TS: Experimental option declare_stored_constraints for
95 telling the compiler to warn for stored constraints
96 that are not asserted to be stored. Use the
97 :- chr_constraint f(...) # stored.
98 notation for asserting that a constraint is expected to
103 * TS: Inline constraint lookup.
105 * TS: Precompile term hashing.
109 * TS: Code cleaning was hampered by line numbers.
110 Reported by Mike Elston.
114 * PVW: Bug fix in observation analysis.
115 * PVW: Consistency checks of experimental history pragma.
119 * TS: Lessened worst bottlenecks in CHR compiler,
120 in the guard simplification phase.
124 * TS: Experimental dynattr option, for dynamic size attribute terms.
128 * TS: Extended observation analysis (abstract interpretation)
129 to deal with disjunctions. With Paolo Tacchella.
133 * TS: Renamed hprolog:substitute/4 to substitute_eq/4, because of
134 name conflict with library(edit).
138 * TS: Use line numbers in error and warning messages.
142 * TS: Added maintenance of line numbers through CHR compilation
143 as an option: chr_option(line_numbers,on).
147 * TS: Bug fix: setarg/3 instantiation error reported by Mike Elston.
148 Caused by missing suspension argument in debug off, optimize off
153 * LDK: O(1) removal from hashtables, with experimental
154 chr_option(ht_removal,on).
158 * PVW: Bugfixes for optional use of CHR constraints in rule guards.
162 * PVW: Optional use of CHR constraints in rule guards.
166 * TS: Bug fix in compiler_errors.pl.
170 * TS: Bug fix in occurrence subsumption by Jon Sneyers.
174 * TS: New preprocessor feature.
176 * TS: Parametrization of experimental chr_identifier type.
182 * TS: Stronger static type checking.
184 * TS: Omitted buggy FD analysis from bootstrapping process.
190 * TS: Experimental chr_identifier type.
194 * TS: Allow for empty type definitions aka phantom types. These are
195 useful for some type-level tricks. A warning is issued so the
196 user can check whether a phantom type is intended. No other
197 phantom type-specific checks are in place yet.
199 * TS: Fixed static type checking of built-in types.
203 * TS: The dense_int type can now appear on the rhs of type alias
208 * TS: Fixed bug concerning matchings between ground and possibly
209 non-ground arguments.
213 * TS: Fixed a bug in code generation, overeager removal of a clause.
217 * TS: Refactored some code.
221 * TS: Add exception handler to initialize chr_leash in new threads.
225 * TS: Bug fix for programs in debugging mode.
229 * JW: Fixed make clean
230 * JW: Enlarged stacks to make build succeed
234 * JW: Add target ln-install
238 * TS: Fixed wrong arities in not inlined predicates. Mike Elston.
242 * TS: Code clean-up, more inlining, only generate used imports.
246 * TS: Inlining and more specialization of auxiliary predicates.
250 * TS: Fixed bug for constraints without rules in debug mode.
252 * TS: Compiler clean-up
254 * TS: Experimental var_assoc_store.
259 * TS: Various minor code generation improvements, including smaller
264 * TS: Absolutely no lock checking when check_guard_bindings is disabled.
268 * TS: Minor optimizations for (-) arguments.
270 * TS: Important optimization for awakening fewer suspended constraints
274 * TS: Fixed typo in static type checker.
276 * TS: Documented static and dynamic type checking.
280 * TS: Fixed bug (type alias related) in static type checker. Mike Elston.
282 * TS: Added static type checking on variable matching in rule heads.
284 * TS: Added static type checking on CHR constraints in rule bodies.
288 * TS: New (limited) compile time type checking of rule heads.
292 * TS: New experimental robustness feature in debug mode:
293 runtime type checking of CHR constraints.
297 * TS: Minor bug fixes.
301 * TS: Improved performance of ai_observation_analysis,
302 mainly via additional tabling and passive declarations.
306 * TS: Disabled some code only intended for SICStus.
308 * TS: Fixed bug in removal of constraints. Spotted by Leslie De Koninck.
312 * TS: Next fix to tracer. Cconstraints in propagation
313 rules are shown in textual order.
317 * TS: Next few fixes to tracer. Constraints in simpagation rules
318 are now shown on the right side of the backslash.
322 * TS: Synchronization with SICStus version of K.U.Leuven CHR.
324 * TS: First few fixes to tracer. Cconstraints in simplification
325 rules are shown in textual order. Constraint insertions
330 * TS: Termination bug fixed in guard_entailment.
332 * TS: Runtime library predicate run_suspensions is now specialized
333 per constraint, avoiding requirement of fixed suspension layout.
335 * TS: Further update to suspension term layout. Only constraints for
336 which the propagation history is used get a history field.
340 * TS: Ignore propagation rules with trivial body 'true'.
344 * TS: Guard entailment now first simplifies the formula it processes,
345 in order to reduce the number of disjunctions, to obtain a smaller
350 * TS: Bug fix by Jon Sneyers: type aliases now support built-in types.
351 Spotted by Mike Elston.
353 * TS: Small refactorings based on Ciao port experience.
355 * TS: Removed -singleton stylecheck option now that portray_clause
356 prints singleton variables as _.
360 * JW: Make library(chr) load its private stuff silent.
364 * TS: Bug fix: too many guards were locked.
368 * TS: Most runtime library predicates are now specialized
369 per constraint, avoiding generic =.. and lists code.
371 Mayor update to suspension term layout. Layout may now
372 differ from one constraint to the other. Some unused suspension
373 fields (continuation goal and generation number) are omitted.
374 Further analysis can remove more fields.
376 Default store constraints now each have
377 their own global variable: a list of all the suspensions.
378 Removal from this list is now O(1) thanks to setarg/1 and
379 back pointers in the suspension terms. This can cause time
380 time complexity improvements in solvers that always have
381 variable indexing on their constraints.
383 Ground, non-indexed constraints are now removed from
384 their global list store in O(1), as for the default store.
386 Minor bug fixes in a number of places.
390 * TS: Fixed subtle bug in ai_observation analysis,
391 that caused goal sequences to only generate
392 the optimistic default answer pattern, leading
393 to invalid 'not observed' conclusions.
394 * TS: Variable indexing/suspension analysis now ignores functor/3
395 in guards. Could be extended to other built-ins
396 that cause an error when arguments are not
397 properly instantiated.
401 * TS: Renamed global variable id to chr_id in chr_runtime.pl.
404 * JS: Synchronization with experimental version:
405 - minor optimizations, e.g. efficient lookups with statically known
407 - new alternative syntax for passive declarations
408 - new dense_int built-in type + underlying store
409 - new type alias definitions, like in Mercury
412 * BD: small changes in chr_compiler_options.pl and chr_translate.chr
413 affecting only the SICStus port
416 * BD: lots of changes related to porting to SICStus
417 * TS: Now exception/3 hook is only used in SWI-Prolog
421 * TS: Use exception/3 hook to catch undefined
422 global variables of chr_runtime.pl and CHR modules,
423 for multi-threaded programs and saved states.
427 * JW: Fix "make check" path issues.
428 * TS: Removed all is_chr_file tests when loading file.
432 * BD: chr_swi.pl: option(optimize --> :- chr_option(optimize
433 * TS: Removed obsolete experimental optimization option.
434 * TS: Correctly report variable pragmas!
435 * TS: No constraints declared is no longer a special case.
439 * BD: chr_swi.pl - use_module(hprolog added for SICStus port
440 * TS: Removed operator declaration for '::'. No longer used.
444 * TS: Removed chr_constraints declaration again, in favor
445 of only the chr_constraint declaration and modified
446 documentation accordingly.
447 * TS: Modified documentation based on recommendations of Bart Demoen.
448 * TS: Added chr_info/3 predicate to chr_compiler_errors, as suggested by
449 Jon Sneyers. Now print banner on calling compiler.
453 * TS: warnings are now written to user_error stream.
457 * TS: option and constraints declarations are now deprecated. They
458 are replaced by chr_option and chr_constraint(s).
459 * TR: Made an interface for warnings and errors. Errors now implemented
461 * TR: Revised documentation.
464 * BD: chr_translate.chr, chr_translate_bootstrap2.chr
465 mutables "abstracted"
466 * BD: chr_translate_bootstrap1.chr
467 atomic_concat - some duplicate code of it is in more than one file :-(
468 create_get_mutable definitions if-deffed
469 verbosity_on/0 for porting
471 definitions of init_store/2, get_store/2, update_store/2
472 and of make_init_store_goal/make_get_store_goal/make_update_store_goal
473 removed prolog_flag/3 (seemed nowhere used)
474 chr_translate_bootstrap2.chr
475 make_init_store_goal/make_get_store_goal/make_update_store_goal introduced
476 verbosity_on/0 for porting
477 chr_translate_bootstrap.pl
478 atom_concat -> atomic_concat
479 verbosity_on/0 for porting
480 conditional import van library(terms)
482 make_init_store_goal etc. introduced
483 create_get_mutable_ref wherever needed (chr_translate*)
487 * BD: chr_runtime.pl:
489 included contents of chr_debug.pl
491 create_mutable changed into 'chr create_mutable'
492 got rid of explicit inlining and did it by goal expansion
493 inlining also of 'chr default_store'
495 removed :- use_module(chr(chr_debug))
496 module header: version for SICStus
497 * BD: chr_debug.pl: emptied
498 * BD: chr_translate.chr:
499 system specific declarations factored out in insert_declarations
500 changed two atom_concat/3 into atomic_concat/3 (because arg 2 was sometimes an int)
501 * BD: chr_compiler_utility.pl:
502 put atomic_concat/3 there
503 adapted atom_concat_list/2 to use it
504 * BD: chr_swi_bootstrap.pl:
505 introduced chr_swi_bootstrap/2 for ease of porting
506 exported also chr_compile/3
507 porting code for get_time stuff/read_term/absolute_file_name
508 * BD: builtins.pl, a_star.pl, clean_code.pl:
513 * BD: hprolog.pl: removed strip_attributes/2 and restore_attributes/2
516 * BD: chr_swi.pl: Removed code that took Handler for Module (in chr_expand(end_of_file)
517 Added :- chr_option(_,_) with same meaning as option(_,_)
518 is_chr_file: .chr is no longer a recognised suffix
519 added use_module(library(lists))
520 changed calls to source_location/2 into prolog_load_context/2
521 * BD: chr_translate.chr: chr_translate/2: added end_of_file to translated program
522 adapted SICStus compatibility message
523 made :- chr_option(_,_) available
524 changed precedence of + - ? to 980 (these ops are
525 probably not local enough to the module)
529 * TS: Further synchronization with hProlog.
533 * TS: Removed dead code in guard_entailment.chr
534 * TS: Fixed performance bug: now lookup is indexed
535 on maximal number of arguments.
536 * TS: Removed some redundant intermediate predicates
538 * TS: It is now possible to disable the printing
539 of the CHR constraint store per module,
540 through the option toplevel_show_store on/off
541 * TS: Synchronized with hProlog
542 * TS: bug fix in functional dependency analysis
546 * TS: Removed two dead predicates in chr_translate.chr
547 and hooked up the late_storage_analysis
548 that was being bypassed.
549 * TS: Renamed global_term_ref_1 to default_store.
550 * TS: Removed redundant predicate values_ht.
551 * TS: Compiler no longer generates dead code for never stored constraints,
552 i.e. attach/detach predicates.
553 This reduces the generated .pl by about 700 lines.
557 * TS: Two more bug fixes for constraints without
558 active occurrences that trigger.
562 * TS: Small optimization of code for constraints
563 without any active occurrence.
564 * TS: Fixed bug caused by previous bug fix:
565 added only_ground_indexed_arguments/1 test
566 to separate out that meaning from may_trigger/1.
570 * TS: Removed strip_attributes code.
571 * TS: Fixed bug that causes new constraints to be added on triggering.
575 * TS: Two minor bug fixes.
579 * TS: Fixed bug due to overly aggressive inlining of get_mutable_value.
583 * JS: Compiled code is broken, if debug is off and optimize too.
584 Debug off now entails optimize on.
586 * TS: Some fixes of the documentation. Thanks to Bart Demoen
591 * TS: Synchronized with hProlog.
595 * TS: Added missing operator declarations for prefix (?).
599 * JW: import lists into chr_compiler_utility.pl
601 * JW: make message hook for query(yes) detect CHR global variables.
603 * JW: Exported pairlist_delete_eq/3 from pairlist and use this in
604 chr_hashtable_store.pl
608 * TS: Renamed pairlist:delete/3 to pairlist:pairlist_delete/3.
612 * TS: Extended more efficient ground matching code to
613 removed simpagation occurrence code.
617 * TS: New input verification: duplicate constraint declaration
618 now reported as an error. Requested by Mike Elston.
619 * TS: More efficient matching code for ground constraints
620 when matching an argument of a partner constraint with
622 * JS: Bug fix in guard simplification.
626 * TS: Factored out option functionality into separate module.
627 * TS: Factored out utility code into separate module.
631 * TS: Changed chr_show_store/1 to use print/1 instead of write/1.
635 * TS: Removed spurious and conflicting operator definitions
636 for +, - and ? as mode declarations.
640 * TS: Added find_chr_constraint/1 functionality.
644 * TS: Improved compiler scalability: use nb_setval/2 to
645 remember compiled code through backtracking over
646 compilation process instead of assert/1.
647 * TS: Removed spurious comma from file.
651 * TS: Added option to disable toplevel constraint store printing.
652 * TS: Slightly improved hash table constraint store implementation.
656 * JW: Added patch from Jon Sneyers.
660 * TS: Improved head reordering heuristic.
661 * TS: Added support primitive for alternate built-in solver dependency.
665 * TS: Fixed bug that causes wrong output in chr_show_store.
669 * TS: Fixed several bugs in generation of debugable code.
673 * JW: Cleanup integration in SWI-Prolog environment:
674 - Extended SWI-Prolog library ordsets. Renamed ord_delete/3 to
675 ord_del_element/3 and ord_difference/3 to ord_subtract/3 for
676 better compatibility.
677 - Renamed module find to chr_find to avoid name conflict and declared
678 preds as meta-predicate.
679 - Re-inserted and exported strip_attributes/2 and
680 restore_attributes/2 in hprolog.pl. Deleted hprolog: from
682 - Added dummy option declarations to bootstrap compiler.
683 - Fixed path problems in makefile (-p chr=.) and install new
685 - Fixed typo 'chr show_store' --> chr_show_store.
689 * JS: Added guard entailment optimizations and
690 new syntax for type and mode declarations.
694 * TS: Use prolog:message/3 hook to automatically print
695 contents of CHR constraint stores with query bindings
700 * TS: Bugfix in code generation. Reported by Lyosha Ilyukhin.
704 * TS: Updated hashtable stores. They now start small and expand.
708 * JW: Removed chr_pp: module prefixes
709 * JW: Updated Windows makefile.mak (more similar organisation, added check)
713 * TS: Added chr_hashtable_store library.
714 * TS: Added find library.
715 * TS: Added builtins library.
716 * TS: Added clean_code library.
717 * TS: Added binomial_heap library.
718 * TS: Added a_star library.
719 * TS: Added new intermediate bootstrapping step
720 * TS: Synchronized CHR compiler with most recent development version
724 "The new version of the compiler contains several new optimizations, both
725 fully automatic, such as the antimonotny-based delay avoidance (see
726 http://www.cs.kuleuven.be/publicaties/rapporten/cw/CW385.abs.html for
727 the technical report), and enabled by mode declarations (see CHR
728 documentation), such as hashtable-based constraint indexes."
732 * JW: Added chr_messages.pl. Make all debug messages use the print_message/2
733 interface to enable future embedding.
737 * JW: Added chr:debug_interact/3 hook. Defined in chr_swi.pl to void
738 showing constraints first as goal and then as CHR call.
739 * JW: Added chr:debug_event/2 hook. Defined in chr_swi.pl to make the
740 CHR debugger honour a skip command from the Prolog tracer.
744 * JW: Added b (break) to the CHR debugger.
745 * TS: added chr_expandable/2 clause for pragma/2
749 * JW: fixed reference to format_rule/2.
750 * JW: Use select/3 rather than delete/3 in diff/2 in Tests/zebra.pl
751 * TS: CHR translation now leaves CHR store empty
755 * JW: added :- use_module(library(chr)) to all examples.
756 * JW: mapped -O --> option(optimize, full).
757 * JW: introduced file-search-path `chr' for clarity and to enable running
758 make check from the local environment instead of the public installation.
759 * JW: mapped prolog flag generate_debug_info --> option(debug, on)
760 * JW: Replaced the chr -> pl step with term_expansion/2.
761 * JW: Moved insert_declarations/2 to chr_swi.pl
765 * JW: fixed Undefined procedure: chr_runtime:run_suspensions_loop_d/1
766 * TS: Added <space> for creep and shortened debug line prefix to CHR:
770 * JW: Use \+ \+ in chr_compile/3 to undo changes to the constraint
771 pool. Regression test suite using "make check" works again.
775 * TS: Added skip and ancestor debug commands
779 * TS: Added bootstrapping process for CHR compiler using CHR.
780 * TS: CHR compiler now uses CHR.
781 * TS: Fixed bug in compilation of multi-headed simpagation rules.
782 * TS: Cleaned up compiler.
783 * TS: Added analysis + optimization for never attached constraints.
784 * TS: Exploit uniqueness (functional dependency) results to detect
785 set semantics type simpagation rules where one rule can be passive
786 * TS: Compiler generates 'chr debug_event'/1 calls
787 * TS: Rudimentary support for debugging.
788 option(debug,on) causes a trace of CHR events to be printed
792 * JW: Fix operator handling.
796 * JW: Integrated new version from Tom Schrijvers.