../configure --prefix /opt/gupu/yap-6.3 --with-gmp --enable-clpbn-bp=false
g1:/opt/gupu/yap-src/Build> cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/gupu/yap ../
SICStus | YAP | SWI | |
---|---|---|---|
1 | 0.040 | 0.052 | 0.694 |
2 | 0.200 | 0.272 | 0.809 |
3 | 36.290 | 24.493 | 5.560 |
?- catch(when((nonvar(X),murks),true),error(E,_),true). freeze(X,when(murks,user:true)).Expected:
E =
domain_error(when_condition,(nonvar(_A),murks))
This is particularly necessary to ensure that new conditions are
properly handled.
?- between(0,inf,X). X = 0 ? ; X = 1 ?Expected:
type_error(integer,inf)
.
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ echo `date` `git pull && git reset --hard` Fri Feb 13 18:12:25 CET 2015 Already up-to-date. HEAD is now at 071bb36 fix alignment
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ echo `date` `git pull && git reset --hard` Mon Feb 9 23:16:22 CET 2015 Already up-to-date. HEAD is now at 888a58b script improvements
ulrich@p0:/opt/gupu/src/yap-6.3$ git describe --tags fatal: No names found, cannot describe anything.It used to work.
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ date&& git pull && git reset --hard Wed Jan 28 02:04:03 CET 2015 Already up-to-date. HEAD is now at 9f945c1 cmake
?- N is 2^64, length([], N). ERROR at clause 1 of prolog:length/2 !! TYPE ERROR- length/2: expected integer, got 18446744073709551616 Expected: failure.
?- X= 0x1000000000000000000000. X = 0.Expected:
X = 19342813113834066795298816
.
?- X is 256^2^62. X = 1.Expected: Either the correct number or a
resource_error
.
A representation error is not OK.
ulrich@p0:/opt/gupu/src/yap-6.3$ date;git pull;git describe --tags;date Mon Feb 24 12:16:24 CET 2014 Already up-to-date. 6.3.2-1447-gb8ebc87 Mon Feb 24 12:16:25 CET 2014Expected: The current version is 6.3.4, so also git should know this
-
(1)^2
to - (1^2)
.
(see #43)
From -a^b
to - (a^b)
. So if the principal functor is a prefix minus
and the argument is an infix or postfix, always put
brackets. See 7.10.5. It's the only way to
implement this with low effort in Prolog directly. Otherwise an
extra state or difference is needed.
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ date && git pull && git describe --tags Wed Feb 19 18:27:12 CET 2014 Already up-to-date. 6.3.2-1447-g1e8d70a
Expected: instantiation_error, and type_error(list,[a|a])?- _=..[1|_]. ERROR!! TYPE ERROR- (=..)/2: expected atom, got 1?- a=..[a|a]. false.
?- 1000=I,time(( between(1,I,X), between(1,I,Y), X \== Y, false )).
?- true ; true. yesExpected: Two answers by default. Otherwise you cannot easily detect accidental choice points.
g3:/opt/gupu/src/yap-6.3/narch-g3> git describe --tags 6.3.2-5-g7b6239c g3:/opt/gupu/src/yap-6.3/narch-g3> uname -a Linux g3 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux
?- append(Xs,Ys,[]). Xs = Ys = [] ? ; noExpected: Determinate. Same problem for
p(_). p(2).And
?- p(1), T = t. T = t ? ; noSWI is determinate for p/1 but not for append/3.
Why this is so relevant: When parsing with DCGs, many cases remain nondeterminate because of similar reasons. Think of:
seq([]) --> []. seq([E|Es]) --> [E], seq(Es). ?- phrase(seq(Es), []).
?- use_module(library(lists)). % reconsulting /opt/gupu/yap-6.3/share/Yap/lists.yap... % reconsulting /opt/gupu/yap-6.3/share/Yap/error.pl... % reconsulted /opt/gupu/yap-6.3/share/Yap/error.pl in module error, 0 msec 25096 bytes % reconsulted /opt/gupu/yap-6.3/share/Yap/lists.yap in module lists, 4 msec 65720 bytes yes ?- member(X,[1]). X = 1 ? ; noExpected: Determinate.
BTW: Where is member/2 defined? I cannot find
it in lists.yap
.
?- use_module(library(clpfd)). yes ?- abs(X) #=< 7^7^7. ERROR at clause 3 of clpfd:cis_uminus/2 !! RESOURCE ERROR- not enough stack ?- 7^7^7 #> 0. yesSWI handles this easily on the same 32 bit machine.
?- catch(call(.(H,T),Xs0),error(E,_),true). E = existence_error(procedure,[]/3) ?- catch(call(.(H,T),Xs0,Xs),error(E,_),true). E = existence_error(procedure,[]/4) ?- catch(call(.(H,T),Xs0,Xs,_),error(E,_),true). E = existence_error(procedure,[]/5)Expected:
'.'/3,4,5
in place of []/3,4,5
?- current_op(P,xfy,.). P = 999 ? ; noYAP and XSB are the only systems left...
?- catch(get_char(df),Pat,true). |: a Pat = error(type_error(character,df),context(get_char/1,_A))Expected: No reading, type
in_character
lrich@gupu2:/opt/gupu/src/yap-6.3/narch$ make check gcc -c -DBP_FREE -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DCUT_C=1 -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DTABLING=1 -DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1 -I. -I../H -I../include -I../os -I../OPTYap -I../BEAM -I../MYDDAS ../os/libtai/check.c -o check.o gcc -rdynamic -L/opt/gupu/src/yap-6.3/narch -Wl,-R/opt/gupu/yap-6.3/lib -Wl,-R,/opt/gupu/yap-6.3/lib/Yap check.o -o check check.o: In function `main': /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:27: undefined reference to `leapsecs_init' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:31: undefined reference to `caltime_scan' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:34: undefined reference to `caltime_tai' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:35: undefined reference to `caltime_utc' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:36: undefined reference to `tai_pack' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:37: undefined reference to `tai_unpack' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:38: undefined reference to `tai_sub' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:45: undefined reference to `caltime_fmt' /opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:46: undefined reference to `caltime_fmt' collect2: ld returned 1 exit status make: *** [check] Error 1 rm check.o
There are much too many pseudo-escape sequences in YAP - they behave everywhere differently.
- control escape sequences:
\a \b \r \f \t \n \v
- same meaning as in C (ISO/IEC 9899)
- meta escape sequences:
\\ \' \" \`
- meaning the character literally
- continuation escape sequence
\
newline- meaning the empty word (in quoted, double quoted and back quoted tokens)
- octal escape sequence starting with
\
decimal digit- hexadecimal escape sequence starting with
\x
?- number_chars(2,[_|1]) ; a =.. [t|1]. no
ulrich@gupu2:/opt/gupu/src/yap-6.3/narch$ make install_info make info; \ /usr/bin/install -c yap.info* /opt/gupu/yap-6.3/share/info; \ if test -e /opt/gupu/yap-6.3/share/info/emacs.bz2; then \ bzip2 --quiet --force /opt/gupu/yap-6.3/share/info/yap.info*; \ else \ if test -e /opt/gupu/yap-6.3/share/info/emacs.gz; then \ gzip --quiet --force /opt/gupu/yap-6.3/share/info/yap.info*; \ fi \ fi; \ /usr/sbin/install-info --quiet --section "Programming Languages" yap.info /opt/gupu/yap-6.3/share/info/dir; \ cd ../LGPL/pillow/doc ; \ /usr/bin/install -c pillow_doc.info /opt/gupu/yap-6.3/share/info; \ if test -e /opt/gupu/yap-6.3/share/info/emacs.bz2; then \ bzip2 --quiet --force /opt/gupu/yap-6.3/share/info/pillow_doc.info; \ else \ if test -e /opt/gupu/yap-6.3/share/info/emacs.gz; then \ gzip --quiet --force /opt/gupu/yap-6.3/share/info/pillow_doc.info; \ fi \ fi; \ /usr/sbin/install-info --quiet --section "Programming Languages" --entry="`cat pillow_doc.infoindex`" --info-dir=/opt/gupu/yap-6.3/share/info pillow_doc.info make[1]: Entering directory `/opt/gupu/src/yap-6.3/narch' make[1]: Nothing to be done for `info'. make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch' /usr/bin/install: target `/opt/gupu/yap-6.3/share/info' is not a directory install-info: warning: don't call programs like install-info with an absolute path, install-info: warning: /usr/sbin/install-info provided by dpkg is deprecated and will go away soon; install-info: warning: its replacement lives in /usr/bin/. This is not dpkg install-info anymore, but GNU install-info See the man page for ginstall-info for command line arguments install-info: Not a directory for /opt/gupu/yap-6.3/share/info/dir install-info: warning: don't call programs like install-info with an absolute path, install-info: warning: /usr/sbin/install-info provided by dpkg is deprecated and will go away soon; install-info: warning: its replacement lives in /usr/bin/. This is not dpkg install-info anymore, but GNU install-info See the man page for ginstall-info for command line arguments install-info: Not a directory for /opt/gupu/yap-6.3/share/info/dir make: *** [install_info] Error 1 ulrich@gupu2:/opt/gupu/src/yap-6.3/narch$ mkdir /opt/gupu/yap-6.3/share/info
?- char_code(C,0),writeq(C). ''C = ''You have two possibilities here: Either write C = '\0\' or issue a representation_error(character_code). SWI and SICStus 4 write '\000\' and '\x0\'. IF, B, GNU an error. Proceed as you like. (#225)
?- L = _B, length(L,2). L = [_A,_B]Expected:
L = [_A, _C]
or similar.
?- X is 1'+'1. ERROR!! TYPE ERROR- atom 1 for arithmetic expression: expected evaluable term, got 1(#130)
?- [user]. % consulting user_output... | intertwine([], [], []). | intertwine([E|Es], Fs, [E|Gs]) :- intertwine(Es, Fs, Gs). | intertwine(Es, [F|Fs], [F|Gs]) :- intertwine(Es, Fs, Gs). | % consulted user_output in module user, 4 msec 7136 bytes yes ?- intertwine([], [], Xs). Xs = [] ? ; noExpected: No choice point. Jekejeke is currently the only system avoiding that choice point.
?- X = (:-). X = :-Expected:
X = (:-)
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none YAP 6.3.1 (i686-linux): Mon Nov 14 12:58:39 CET 2011 ?- length(L,L). ^CAction (h for help): a no ?- length(L,L). ^CAction (h for help): a Illegal instruction
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP 6.2.0 (i686-linux): Sun Apr 3 22:28:54 CEST 2011 % reconsulting /home/ulrich/.yaprc... % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap... % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap... % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 0 msec 4096 bytes % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 7136 bytes % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl... % reconsulting /opt/gupu/yap-6/share/Yap/assoc.yap... % reconsulting /opt/gupu/yap-6/share/Yap/rbtrees.yap... % reconsulted /opt/gupu/yap-6/share/Yap/rbtrees.yap in module rbtrees, 12 msec 138376 bytes % reconsulted /opt/gupu/yap-6/share/Yap/assoc.yap in module assoc, 20 msec 156944 bytes % reconsulting /opt/gupu/yap-6/share/Yap/pairs.pl... % reconsulted /opt/gupu/yap-6/share/Yap/pairs.pl in module pairs, 0 msec 8928 bytes % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 180 msec 1411792 bytes % reconsulting /opt/gupu/yap-6/share/Yap/lambda.pl... % reconsulted /opt/gupu/yap-6/share/Yap/lambda.pl in module lambda, 0 msec 20232 bytes % reconsulting /home/ulrich/ftp/yap-prolog/library/uwnutil.pl... % reconsulted /home/ulrich/ftp/yap-prolog/library/uwnutil.pl in module uwnutil, 0 msec 18728 bytes % reconsulted /home/ulrich/.yaprc in module user, 180 msec 1487848 bytes ?- statistics. memory (total) 5521404 bytes program space 4096000 bytes: 2770360 in use, 1325640 free 0 max stack space 1228800 bytes: 525532 in use, 703268 free global stack: 525140 in use, 527356 max local stack: 392 in use, 3732 max trail stack 196604 bytes: 36 in use, 196568 free 0.000 sec. for 0 code, 0 stack, and 0 trail space overflows 0.000 sec. for 0 garbage collections which collected 0 bytes 0.000 sec. for 0 atom garbage collections which collected 0 bytes 0.184 sec. runtime 0.184 sec. cputime 0.004 sec. systime 6.717 sec. elapsed time yes ?- length(Cs,I),maplist(\C^member(C,".1e-+ "),Cs), catch(number_chars(N,Cs),error(syntax_error(E),_),false),I=8. Cs = [49,46,49,49,49,49,49,49], I = 8, N = 1.111111 ? yes ?- statistics. memory (total) 22036476 bytes program space 20611072 bytes: 13176496 in use, 7434576 free 0 max stack space 1228800 bytes: 525532 in use, 703268 free global stack: 525140 in use, 530580 max local stack: 392 in use, 3732 max trail stack 196604 bytes: 36 in use, 196568 free 0.004 sec. for 6 code, 0 stack, and 0 trail space overflows 0.000 sec. for 0 garbage collections which collected 0 bytes 0.032 sec. for 3 atom garbage collections which collected 3570134 bytes 7.944 sec. runtime 7.948 sec. cputime 0.020 sec. systime 40.116 sec. elapsed time yes
?- X*Y = * * * . X = Y = * ? yesExpected: syntax error. If a name is used not as an operator it must be bracketed. Again a source of much chagrin. IF, GNU and h do this right.
?- [:- -x] = [(:- -x)]. noExpected: syntax error. This is the source of many problems. As long as systems do not enforce this, users get hit one-by-one. Their common conclusion is that Prolog is cursed and they give up. (In the meantime SWI rejects this in ISO mode, but since this is not the default, nobody uses it.).
number/atom_chars/codes(Number,Chars) :- ( nonvar(Number), \+ number(Number) -> throw(error(type_error(number, Number),_)) ; true ), scan_chars_to_string(Chars, String), % produces *only* type and representation errors % but not instantiation errors ( var(String) -> ( var(Number) -> throw(error(instantiation_error,_)) ; number_to_chars(Number,Chars) ) ; parse_string_into_number(String, Numberx), % produces syntax errors Numberx = Number ).A few cases are still open.
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ /opt/gupu/yap-6/bin/yap -f % Restoring file /opt/gupu/src/yap-6/narch/startup.yss YAP 6.0.7 (i686-linux): Sat Sep 4 22:33:20 CEST 2010 ?- [user]. % consulting user_input... | p1 :- ( var(X), X=!, X, fail ; true ). | | p2 :- call(( var(X), X=!, X, fail ; true )). | % consulted user_input in module user, 0 msec 5240 bytes yes ?- p1. yes ?- p2. noExpected yes in both cases.
?- catch(X is-1**1.5,error(E,_),true). X = (nan) ?Expected:
E = evaluation_error(undefined)
?- number_chars(1,[1]). SYNTAX ERROR at "#x0001;", goal number_chars(1,[1]): expected_number_syntax
?- Xs=[a|Xs],atom_chars(A,Xs).Loops and eats memory. Expected:
type_error(list,[a| ...])
.
?- catch(X is foo-77,Pat,true). Pat = error(type_error(evaluable,foo),['atom foo for arithmetic expression'|local_sp(268636712,268789140,[],[])]) ? yesExpected:
Pat = error(type_error(evaluable,foo/0), ...
?- freeze(X, false). freeze(X,user:false) ? ; no ?- \ freeze(X, false). true ? ; no
?- call(((C=!;C=true), C)). C = !.
[user] ?- exception_handler(arg(a,f(1),_), error(type_error(_,_),_), fail).Permitting an arbitrary goal. Not clear what the context of exception/3 is, but that might make it more general...
?- setup_call_catcher_cleanup(true,repeat, C,write(c(C))), throw(xx). c(fail) ERROR!!
?- setup_call_cleanup(true, (X=1;X=2), write(a)), setup_call_cleanup(true,(Y=1;Y=2),write(b)), !. abX = Y = 1 ?According to current draft, it should be
ba
- but this
might be a case which is currently overspecified.
?- [user]. | ax :- ( b -> c ; d -> e ; f ). | yes % debug ?- listing(ax). ax :- ( b -> c ; ( d -> e ) ; f ). yesSWI makes
ax :- ( b -> c ; d -> e ; f ).I understand you have a different convention, but the inner parentheses are superfluous.
(5) exit: lambda:nl ? (6) call: lambda:lambda:1^2=_131589:_131590 ? (6) exit: lambda:lambda:1^2=lambda:1^2 ?
?- copy_term_nat(Bigterm^Extra,Bigterm^Copia).
I.e. an
ideal copy_term does not only copy fast and sharingly, but also would
read the second argument in order to detect identity.
The traditional approach copies cleverly into a free variable, but
performs the remaining as naive unification.
?- [ulrich@gupu item133]$ yap-6 -f none % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0it should read:
YAP version Yap-6.0.0.0-160-ga22f66a
[ulrich@gupu yap-prolog]$ yap-6 -f none % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 ?- set_prolog_flag(unknown,error). yes ?- maplist(=(X),Xs). ERROR!! EXISTENCE ERROR- procedure maplist/2 is undefined, called from context prolog:$enter_top_level/0 Goal was user:maplist(=(_131211),_131209) ?- use_module(library(clpfd)). % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl... % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 410 msec 815432 bytes yes ?- maplist(=(X),Xs). Xs = [] ?
647 /tmp/gupu/src/git-1.6.3.2/git clone git://yap.dcc.fc.up.pt/yap-6 648 cd yap-6/ 649 ls 650 mkdir t100 651 mkdir t1000 652 cd t1000 653 ../configure --prefix /tmp/gupu/yap-6 --with-gmp --enable-couroutining 654 gmake 655 gmake -j40 656 gmake 657 history bash-3.00$ gmake gcc -c -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H -I. -I../H -I../OPTYap -I../BEAM -I../packages/MYDDAS ../C/exec.c -o exec.o ../C/exec.c: In function 'clean_trail': ../C/exec.c:1498: error: 'HBREG' undeclared (first use in this function) ../C/exec.c:1498: error: (Each undeclared identifier is reported only once ../C/exec.c:1498: error: for each function it appears in.) gmake: *** [exec.o] Error 1
?- length(_,N),time_out((between(1,100,_),open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), time_out((between(1,100),fail),10,FX). Action (h for help): a Action (h for help): a ERROR!! INSTANTIATION ERROR- close(_128): expected bound valueBut also:
?- length(_,N),time_out((between(1,100,_),open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), time_out((between(1,100),fail),10,FX). Action (h for help): a % ERROR WITHIN ERROR: tried to access illegal address 0x4200!!!! 186.480u 43.230s 4:16.04 89.7% 0+0k 0+0io 477pf+0w
?- length(_,N),time_out((between(1,100,_),open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), time_out((between(1,100),fail),10,FX). Action (h for help): a % % % YAP OOOPS: tried to access illegal address 0x8!!!!. % % 1972KB of Code Space (0x2000000--0x21ed1e0) % % PC: prolog:$execute_woken_system_goal/1 at clause 1 % Continuation: prolog:$execute_woken_system_goal/1 at clause 1 % 518KB of Global Stack (0x221e000--0x229f848) % 1KB of Local Stack (0x22e5b00--0x22e6000) % 0KB of Trail (0x22e6004--0x22e60d4) % Performed 0 garbage collections % All Active Calls and % Goals With Alternatives Open (Global In Use--Local In Use) % Exiting ....
:-
on_signal('prolog:gc', _, pio:my_gc).
?- call_cleanup(length(L,N),C). L = [], N = 0In SICStus 3 there is:
| ?- call_cleanup(length(L,N),C). ! Instantiation error in argument 2 of call_cleanup/2 ! goal: call_cleanup(user:length(_79,_80),user:_77)On the other hand:
| ?- call_cleanup(length(L,N),(C,C)). L = [], N = 0 ?The motivation for the instantiation error is: We will get the instantiation error every time determinacy cannot be detected (i.e. every time in an imperfect implementation). It is therefore safer to issue the error in advance. There are cases where this is too eager, but those cases will always depend on the effectiveness to remove choice points. It will thus depend on an implementation dependent feature never discussed in 13211-1. (i.e., there is the notion of choicepoint which is sometimes created and sometimes not, but there is no provision for a mechanism for implicit removal - as performed by indexing) E.g.
?- call_cleanup(C = true, C). C = true ? ; noOn a less efficient, but otherwise completely complying implementation this would be executed as
?- call_cleanup(( C = true ; false ), C). C = true ? ; ERROR at clause 1 of prolog:'$clean_call'/2 !! INSTANTIATION ERROR- call/1: expected bound valueClearly, such problems are difficult to locate - if they only occur at the end.
:- meta_predicate p/1.Should produce a warning. (The warning can only be caused by
p
- after all this could be a
meta_predicate declaration for a predicate (/)/2.
...System predicates belong to the module @code{primitives}...
The i.d.b. is implemented as a set of terms, accessed by keys that...is unreadable. And I don't know how to correct that.
[ulrich@gupu library]$ yap-6 -f none % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 ?- abc Action (h for help): ap): % YAP execution abortedFor reproduction: I type abc RETURN C-c a RETURN
?- swi_open(a,read,S),swi_close(S),swi_close(S). noexistence error expected according to 13211-1:8.11.6.3f
../configure --prefix /opt/gupu/yap-6 --with-gmp --enable-couroutining && make clean && make depend && cd packages/PLStream && make depend
[ulrich@gupu ~]$ yap-6 -f none % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 ?- load_foreign_files([plstream], [], initIO). yes ?- open('/etc/passwd',read,S),swi_set_stream(S, buffer_size(10)). % % % YAP OOOPS in USER C-CODE: tried to access illegal address 0x1f!!!!.I admit, this is partially my error. (I should use swi_open/3). But you should detect this somehow.
?- catch(swi_open(A,B,C),Pat,true). Pat = error(instantiation_error,context(_A,_B)) ? yes
?- [user]. | :- meta_predicate f(:). | f(1). | yesExected:
% Warning: (user_input:6). % Always failing clause due to meta argument 1 in user:f/1, clause 1.
consult.yap:55: '$do_error'(domain_error(unimplemented_option,Opt),Call).That does not make sense. representation_error would be better.
non_empty_listmessages.yap:315:domain_error(not_empty_list, Opt) --> !,
?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.Sometimes when pressing C-c the prompt is not offered.
[ulrich@gupu docs]$ yap-6 % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 % reconsulting /home/ulrich/.yaprc... % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap... % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap... % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 10 msec 4080 bytes % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 10 msec 7104 bytes % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl... % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 380 msec 816736 bytes % reconsulting /home/ulrich/ftp/yap-prolog/library/pio.pl... % reconsulted /home/ulrich/ftp/yap-prolog/library/pio.pl in module pio, 10 msec 23240 bytes % reconsulting /home/ulrich/ftp/yap-prolog/library/item80.pl... % reconsulted /home/ulrich/ftp/yap-prolog/library/item80.pl in module user, 0 msec 6200 bytes % reconsulted /home/ulrich/.yaprc in module user, 410 msec 883912 bytes ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false. Action (h for help): a ERROR!! EXISTENCE ERROR- procedure 3/0 is undefined, called from context prolog:$call/4 Goal was timeout:3 ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false. Action (h for help): a % YAP execution aborted ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false. Action (h for help): a ERROR!! UNHANDLED EXCEPTION - message xixi unknown ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false. Action (h for help): a % YAP execution aborted ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false. Action (h for help): a % YAP execution aborted
[mein_modul] ?- alarm(1000,spezialprozedur,X). X = 0 ? yes [mein_modul] ?- alarm(0, R,X). R = spezialprozedur, X = 0 ? ; no [mein_modul] ?- module(user). yes ?- alarm(0, R,X). no ?- module(mein_modul). yes [mein_modul] ?- alarm(0, R,X). R = spezialprozedur, X = 0 ?For this reason, setting and resetting should be separated! meta_predicate arguments only work intuitively as input arguments.
?- read_from_chars("s(_, _, _, _, _, _, _)",Term). end of file found before end of term at charsio, near line 1: <==== HERE ====> s( _ , _ , _ , _ , _ , _ , _ ). ?-Why HERE? Why is a . shown? Why the linebreak? The name should be read_from_codes.
?- X=s(X), unify_with_occurs_check(X,Z). no ?- X=s(X), unify_with_occurs_check(X,X). noThis is highly problematic, as we can no longer assume that X = X succeeds always. By the same token, Freshvar = Term now sometimes fails. This essentially ruins all classical optimizations. See these WLPE-slides in Udine (I believe you did not attend it). It is nice that unify_with_occurs_check/2 always terminates in YAP, but it would be nicer if those properties would be obeyed as well. (Currently, SWI does not terminate always.)
?- time_out(length(L,L),-1,R). R = time_out ? yesWhy does this take a second or so? A domain_error not_less_than_zero, or between(1,2147483646) would be most appropriate.
yap-6 -f none -g 'catch((between(0,3000,F),N is 1024*1024*F, M is N, garbage_collect,statistics,write(F=M),nl, catch((functor(_,f,M),fail),error(resource_error(_),_),fail)),Pat,true).'C-c it sometime and type statistics: Clearly, the "memory (total)" increases, but then never decreases.
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 % reconsulting /home/ulrich/.yaprc... % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes ?- [fastunification]. % consulting /home/tour/yap-prolog/fastunification.pl... % consulted /home/tour/yap-prolog/fastunification.pl in module user, 0 msec 2192 bytes yes ?- test(A). A = 2^18-440 ? ; A = 2^19-1270 ? ; A = 2^20-4850 ? ; A = 2^21-18640 ? ; A = 2^22-74530 ?A local variable-term unification should be performed in constant time! Somewhere in C/unify.c:OCUnify the test is missing.
[ulrich@gupu ~]$ yap-6 -G5000 % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 % reconsulting /home/ulrich/.yaprc... % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes ?- T=call_cleanup(T,T),T. 1084KB of Code Space (0x2000000--0x210f190) 4147KB of Global Stack (0x212e000--0x253ad8c) 45KB of Local Stack (0x2604990--0x2610000) 13KB of Trail (0x2610004--0x2613558) Performed 1 garbage collections Running code at clause 2 of prolog:$update_att/2 Continuation is at clause 1 of prolog:$call_cleanup/3 clause 1 of prolog:$call_cleanup/3 indexing code of prolog:$catch/3 (*) clause 1 of prolog:catch/3 clause 1 of prolog:$call_cleanup/3 indexing code of prolog:$catch/3 (*) ... indefinitelyYap-6.0.0.0-2-g13b9098:
% prolog:$call_cleanup/3 at clause 1 % prolog:$catch/3 (1048KB--27KB) % prolog:catch/3 at clause 1 Action (h for help): a % ERROR WITHIN ERROR: abort from console g3:/opt/gupu/src/yap-6/arch>Expected: resource errors
?- between(1,10000,N), write(call(N)),nl, catch(length(L,L),Pat,true), write(N:Pat),nl,false. call(1) 1:error(resource_error(stack),Database crashed against stacks) call(2) LOOPSAnd on g3:
g3:~> yap-6 -f none -G5000 % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 ?- between(1,10000,N), write(call(N)),nl, catch(length(L,L),Pat,true), write(N:Pat),nl,false. call(1) % % % YAP OOOPS: tried to access illegal address (nil)!!!!. % % 2888KB of Code Space (0x2000000--0x22d21a0) % % PC: meta-call % Continuation: prolog:catch/3 at clause 1 % 4842KB of Global Stack (0x232d000--0x27e7a08) % 1KB of Local Stack (0x280eb20--0x280f000) % 0KB of Trail (0x280f008--0x280f0a0) % Performed 1 garbage collections % All Active Calls and % Goals With Alternatives Open (Global In Use--Local In Use) % % prolog:$handle_throw/3 (4842KB--1KB) % prolog:catch/3 at clause 1 % prolog:$call/4 at clause 3 % prolog:$between/3 (1024KB--0KB) % prolog:$query/2 at clause 4 % prolog:$command/4 at clause 2 % prolog:$enter_top_level/0 at clause 6 % prolog:$catch/3 (1024KB--0KB) % prolog:$system_catch/4 at clause 1 % meta-call Exiting ....
?- [ulrich@gupu ~]$ /opt/gupu/yap-6/bin/yap -G5000 % Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss YAP version Yap-6.0.0 % reconsulting /home/ulrich/.yaprc... % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes ?- between(1,10000,N), catch(length(L,L),Pat,true), write(N:Pat),nl,false. 2752KB of Code Space (0x2000000--0x22b0190) 4686KB of Global Stack (0x22cf000--0x2762938) 0KB of Local Stack (0x27b0d90--0x27b1000) 0KB of Trail (0x27b1004--0x27b105c) Performed 2 garbage collections Running code at clause 2 of prolog:$$_length1/3 Continuation is at clause 1 of prolog:catch/3 indexing code of prolog:$catch/3 (*) clause 1 of prolog:catch/3 clause 3 of prolog:$call/4 indexing code of prolog:between/3 (*) clause 4 of prolog:$query/2 clause 2 of prolog:$command/4 clause 6 of prolog:$enter_top_level/0 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 meta-call 1:error(out_of_stack_error,Database crashed against stacks) 2752KB of Code Space (0x2000000--0x22b0190) 4686KB of Global Stack (0x22cf000--0x2762b84) 0KB of Local Stack (0x27b0d90--0x27b1000) 0KB of Trail (0x27b1004--0x27b1050) Performed 3 garbage collections Running code at clause 2 of prolog:$$_length1/3 Continuation is at clause 1 of prolog:catch/3 indexing code of prolog:$catch/3 (*) clause 1 of prolog:catch/3 clause 3 of prolog:$call/4 indexing code of prolog:between/3 (*) clause 4 of prolog:$query/2 clause 2 of prolog:$command/4 clause 6 of prolog:$enter_top_level/0 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 meta-call 2752KB of Code Space (0x2000000--0x22b0190) 4096KB of Global Stack (0x22cf000--0x26cf170) 0KB of Local Stack (0x27b0d54--0x27b1000) 0KB of Trail (0x27b1004--0x27b1048) Performed 4 garbage collections Running code at clause 1 of prolog:catch_ball/2 Continuation is at clause 2 of prolog:$handle_throw/3 clause 2 of prolog:$handle_throw/3 (*) clause 2 of prolog:$handle_throw/3 clause 3 of prolog:$call/4 indexing code of prolog:between/3 (*) clause 4 of prolog:$query/2 clause 2 of prolog:$command/4 clause 6 of prolog:$enter_top_level/0 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 meta-call ERROR!! OUT OF STACK SPACE ERROR- Database crashed against stacks ?-Expected:
1:error(resource_error(Qua),QuidQuid) 2:error(resource_error(Qua),QuidQuid) ...
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -G 100m Terminatedloops, while -G 90m works.
?- X is 13^1150000000. Segmentation faultOn 64-bit
X is 235^2^61.
The problem is that the overflow happens effectively in the word to represent the size. Sometimes looping, or even havoc effects possible (with small effort). This problem has nothing to do with YAP or SWI. It is a general problem that requires a joint effort. Something for the Prolog commons?
?- X is 13^1150000000. % % % YAP OOOPS: tried to access illegal address 0x5c73626f!!!!. % % 1080KB of Code Space (0x2000000--0x210e190) 4096KB of Global Stack (0x212e000--0x252e0d8) 0KB of Local Stack (0x25f5e9c--0x25f6000) 0KB of Trail (0x25f6004--0x25f6018) Performed 1 garbage collections Running code at meta-call Continuation is at clause 4 of prolog:$query/2 clause 4 of prolog:$query/2 clause 2 of prolog:$command/4 clause 6 of prolog:$enter_top_level/0 indexing code of prolog:$catch/3 (*) clause 1 of prolog:$system_catch/4 meta-call Exiting .... 35.590u 0.740s 0:42.91 84.6% 0+0k 0+0io 430pf+0w
?- X is 235^2^61. gmp: overflow in mpz type Aborted (core dumped)
../configure --prefix /opt/gupu/yap-6 --with-gmp --enable-couroutining