new scheme for flags.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@949 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
945adacdd5
commit
4c264a968a
@ -1092,7 +1092,7 @@ addclause(Term t, yamop *cp, int mode, int mod)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compile_mode)
|
if (compile_mode)
|
||||||
p->PredFlags = p->PredFlags | CompiledPredFlag | FastPredFlag;
|
p->PredFlags = p->PredFlags | CompiledPredFlag;
|
||||||
else
|
else
|
||||||
p->PredFlags = p->PredFlags | CompiledPredFlag;
|
p->PredFlags = p->PredFlags | CompiledPredFlag;
|
||||||
}
|
}
|
||||||
@ -1813,7 +1813,7 @@ p_new_multifile(void)
|
|||||||
pe->PredFlags |= MultiFileFlag;
|
pe->PredFlags |= MultiFileFlag;
|
||||||
if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
|
if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) {
|
||||||
/* static */
|
/* static */
|
||||||
pe->PredFlags |= SourcePredFlag;
|
pe->PredFlags |= (SourcePredFlag|CompiledPredFlag);
|
||||||
}
|
}
|
||||||
WRITE_UNLOCK(pe->PRWLock);
|
WRITE_UNLOCK(pe->PRWLock);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
2
C/init.c
2
C/init.c
@ -777,7 +777,7 @@ InitCodes(void)
|
|||||||
heap_regs->update_mode = UPDATE_MODE_LOGICAL;
|
heap_regs->update_mode = UPDATE_MODE_LOGICAL;
|
||||||
heap_regs->consultbase = heap_regs->consultsp =
|
heap_regs->consultbase = heap_regs->consultsp =
|
||||||
heap_regs->consultlow + heap_regs->consultcapacity;
|
heap_regs->consultlow + heap_regs->consultcapacity;
|
||||||
heap_regs->compiler_compile_mode = 1;
|
heap_regs->compiler_compile_mode = 0; /* fast will be for native code */
|
||||||
heap_regs->maxdepth = 0;
|
heap_regs->maxdepth = 0;
|
||||||
heap_regs->maxlist = 0;
|
heap_regs->maxlist = 0;
|
||||||
|
|
||||||
|
@ -1957,7 +1957,7 @@ p_flags(void)
|
|||||||
if (EndOfPAEntr(pe))
|
if (EndOfPAEntr(pe))
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
WRITE_LOCK(pe->PRWLock);
|
WRITE_LOCK(pe->PRWLock);
|
||||||
if (!Yap_unify_constant(ARG3, MkIntTerm(pe->PredFlags))) {
|
if (!Yap_unify_constant(ARG3, MkIntegerTerm(pe->PredFlags))) {
|
||||||
WRITE_UNLOCK(pe->PRWLock);
|
WRITE_UNLOCK(pe->PRWLock);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -1965,7 +1965,7 @@ p_flags(void)
|
|||||||
if (IsVarTerm(ARG4)) {
|
if (IsVarTerm(ARG4)) {
|
||||||
WRITE_UNLOCK(pe->PRWLock);
|
WRITE_UNLOCK(pe->PRWLock);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
} else if (!IsIntTerm(ARG4)) {
|
} else if (!IsIntegerTerm(ARG4)) {
|
||||||
union arith_ret v;
|
union arith_ret v;
|
||||||
|
|
||||||
if (Yap_Eval(ARG4, &v) == long_int_e) {
|
if (Yap_Eval(ARG4, &v) == long_int_e) {
|
||||||
@ -1976,8 +1976,8 @@ p_flags(void)
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
newFl = IntOfTerm(ARG4);
|
newFl = IntegerOfTerm(ARG4);
|
||||||
pe->PredFlags = (SMALLUNSGN) newFl;
|
pe->PredFlags = (CELL)newFl;
|
||||||
WRITE_UNLOCK(pe->PRWLock);
|
WRITE_UNLOCK(pe->PRWLock);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
@ -162,36 +162,36 @@ Inline(IsValProperty, PropFlags, int, flags, (flags == ValProperty) )
|
|||||||
CodeOfPred holds the address of the correspondent C-function.
|
CodeOfPred holds the address of the correspondent C-function.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
InUsePredFlag = 0x4000000L, /* count calls to pred */
|
MultiFileFlag = 0x20000000L, /* is multi-file */
|
||||||
CountPredFlag = 0x2000000L, /* count calls to pred */
|
UserCPredFlag = 0x10000000L, /* CPred defined by the user */
|
||||||
HiddenPredFlag = 0x1000000L, /* invisible predicate */
|
LogUpdatePredFlag= 0x08000000L, /* dynamic predicate with log. upd. sem.*/
|
||||||
CArgsPredFlag = 0x800000L, /* SWI-like C-interface pred. */
|
InUsePredFlag = 0x04000000L, /* count calls to pred */
|
||||||
SourcePredFlag = 0x400000L, /* static predicate with source declaration */
|
CountPredFlag = 0x02000000L, /* count calls to pred */
|
||||||
MetaPredFlag = 0x200000L, /* predicate subject to a meta declaration */
|
HiddenPredFlag = 0x01000000L, /* invisible predicate */
|
||||||
SyncPredFlag = 0x100000L, /* has to synch before it can execute*/
|
CArgsPredFlag = 0x00800000L, /* SWI-like C-interface pred. */
|
||||||
UserCPredFlag = 0x080000L, /* CPred defined by the user */
|
SourcePredFlag = 0x00400000L, /* static predicate with source declaration */
|
||||||
NumberDBPredFlag = 0x080000L, /* entry for a number key */
|
MetaPredFlag = 0x00200000L, /* predicate subject to a meta declaration */
|
||||||
AtomDBPredFlag = 0x040000L, /* entry for an atom key */
|
SyncPredFlag = 0x00100000L, /* has to synch before it can execute*/
|
||||||
MultiFileFlag = 0x040000L, /* is multi-file */
|
NumberDBPredFlag = 0x00080000L, /* entry for a number key */
|
||||||
FastPredFlag = 0x020000L, /* is "compiled" */
|
AtomDBPredFlag = 0x00040000L, /* entry for an atom key */
|
||||||
TestPredFlag = 0x010000L, /* is a test (optim. comit) */
|
FastPredFlag = 0x00020000L, /* native code */
|
||||||
AsmPredFlag = 0x008000L, /* inline */
|
TestPredFlag = 0x00010000L, /* is a test (optim. comit) */
|
||||||
StandardPredFlag= 0x004000L, /* system predicate */
|
AsmPredFlag = 0x00008000L, /* inline */
|
||||||
DynamicPredFlag= 0x002000L, /* dynamic predicate */
|
StandardPredFlag= 0x00004000L, /* system predicate */
|
||||||
CPredFlag = 0x001000L, /* written in C */
|
DynamicPredFlag= 0x00002000L, /* dynamic predicate */
|
||||||
SafePredFlag = 0x000800L, /* does not alter arguments */
|
CPredFlag = 0x00001000L, /* written in C */
|
||||||
CompiledPredFlag= 0x000400L, /* is static */
|
SafePredFlag = 0x00000800L, /* does not alter arguments */
|
||||||
IndexedPredFlag= 0x000200L, /* has indexing code */
|
CompiledPredFlag= 0x00000400L, /* is static */
|
||||||
SpiedPredFlag = 0x000100L, /* is a spy point */
|
IndexedPredFlag= 0x00000200L, /* has indexing code */
|
||||||
BinaryTestPredFlag=0x000080L, /* test predicate. */
|
SpiedPredFlag = 0x00000100L, /* is a spy point */
|
||||||
|
BinaryTestPredFlag=0x00000080L, /* test predicate. */
|
||||||
#ifdef TABLING
|
#ifdef TABLING
|
||||||
TabledPredFlag = 0x000040L, /* is tabled */
|
TabledPredFlag = 0x00000040L, /* is tabled */
|
||||||
#endif /* TABLING */
|
#endif /* TABLING */
|
||||||
#ifdef YAPOR
|
#ifdef YAPOR
|
||||||
SequentialPredFlag=0x000020L, /* may not create par. choice points!*/
|
SequentialPredFlag=0x00000020L, /* may not create par. choice points!*/
|
||||||
#endif /* YAPOR */
|
#endif /* YAPOR */
|
||||||
ProfiledPredFlag = 0x000010L, /* pred is being profiled */
|
ProfiledPredFlag = 0x00000010L /* pred is being profiled */
|
||||||
LogUpdatePredFlag= 0x000008L /* dynamic predicate with log. upd. sem.*/
|
|
||||||
} pred_flag;
|
} pred_flag;
|
||||||
|
|
||||||
/* profile data */
|
/* profile data */
|
||||||
|
@ -364,9 +364,9 @@ repeat :- '$repeat'.
|
|||||||
'$$compile'(G, G0, L, Mod) :-
|
'$$compile'(G, G0, L, Mod) :-
|
||||||
'$head_and_body'(G,H,_),
|
'$head_and_body'(G,H,_),
|
||||||
'$flags'(H, Mod, Fl, Fl),
|
'$flags'(H, Mod, Fl, Fl),
|
||||||
( Fl /\ 16'000008 =\= 0 -> '$compile'(G,L,G0,Mod)
|
( Fl /\ 0x08000000 =\= 0 -> '$compile'(G,L,G0,Mod)
|
||||||
;
|
;
|
||||||
Fl /\ 16'002000 =\= 0 -> '$assertz_dynamic'(L,G,G0,Mod) ;
|
Fl /\ 0x00002000 =\= 0 -> '$assertz_dynamic'(L,G,G0,Mod) ;
|
||||||
'$$compile_stat'(G,G0,L,H, Mod) ).
|
'$$compile_stat'(G,G0,L,H, Mod) ).
|
||||||
|
|
||||||
% process a clause for a static predicate
|
% process a clause for a static predicate
|
||||||
|
@ -232,7 +232,7 @@ no_style_check([H|T]) :- no_style_check(H), no_style_check(T).
|
|||||||
'$check_multifile_pred'(Hd, M, Fl) :-
|
'$check_multifile_pred'(Hd, M, Fl) :-
|
||||||
% so this is not a multi-file predicate any longer.
|
% so this is not a multi-file predicate any longer.
|
||||||
functor(Hd,Na,Ar),
|
functor(Hd,Na,Ar),
|
||||||
NFl is \(16'040000 ) /\ Fl,
|
NFl is \(0x20000000) /\ Fl,
|
||||||
'$flags'(Hd,M,Fl,NFl),
|
'$flags'(Hd,M,Fl,NFl),
|
||||||
'$warn_mfile'(Na,Ar).
|
'$warn_mfile'(Na,Ar).
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ reconsult(Fs) :-
|
|||||||
( '$find_in_path'(X,Y,reconsult(X)),
|
( '$find_in_path'(X,Y,reconsult(X)),
|
||||||
'$open'(Y,'$csult',Stream,0) ->
|
'$open'(Y,'$csult',Stream,0) ->
|
||||||
( '$access_yap_flags'(15, 0) -> true ; '$skip_unix_comments'(Stream) ),
|
( '$access_yap_flags'(15, 0) -> true ; '$skip_unix_comments'(Stream) ),
|
||||||
'$reconsult'(X,Stream), '$close'(Stream)
|
'$current_module'(M), '$reconsult'(X,M,Stream), '$close'(Stream)
|
||||||
;
|
;
|
||||||
'$output_error_message'(permission_error(input,stream,X),reconsult(X))
|
'$output_error_message'(permission_error(input,stream,X),reconsult(X))
|
||||||
),
|
),
|
||||||
|
@ -396,7 +396,7 @@ debugging :-
|
|||||||
'$execute0'(G, M).
|
'$execute0'(G, M).
|
||||||
'$spycall'(G, M, InControl) :-
|
'$spycall'(G, M, InControl) :-
|
||||||
'$flags'(G,M,F,F),
|
'$flags'(G,M,F,F),
|
||||||
F /\ 16'402008 =\= 0, !, % dynamic procedure, logical semantics, or source
|
F /\ 0x8402000 =\= 0, !, % dynamic procedure, logical semantics, or source
|
||||||
% use the interpreter
|
% use the interpreter
|
||||||
'$clause'(G, M, Cl),
|
'$clause'(G, M, Cl),
|
||||||
CP is '$last_choice_pt',
|
CP is '$last_choice_pt',
|
||||||
|
@ -105,11 +105,6 @@
|
|||||||
'$exec_directives'(G, Mode, M) :-
|
'$exec_directives'(G, Mode, M) :-
|
||||||
'$exec_directive'(G, Mode, M).
|
'$exec_directive'(G, Mode, M).
|
||||||
|
|
||||||
'$uncutable'(A/N, Mod) :-
|
|
||||||
functor(T,A,N),'$flags'(T,Mod,F,F),
|
|
||||||
NF is F \/ 16'2,
|
|
||||||
'$flags'(T, Mod, F, NF).
|
|
||||||
|
|
||||||
yap_flag(V,Out) :-
|
yap_flag(V,Out) :-
|
||||||
var(V), !,
|
var(V), !,
|
||||||
'$show_yap_flag_opts'(V,Out).
|
'$show_yap_flag_opts'(V,Out).
|
||||||
|
@ -158,3 +158,4 @@ library_directory(D) :-
|
|||||||
:- get_value(system_library_directory,D), assert(library_directory(D)).
|
:- get_value(system_library_directory,D), assert(library_directory(D)).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,13 +32,9 @@ table(X) :-
|
|||||||
'$table'(A/N, M) :- integer(N), atom(A), !,
|
'$table'(A/N, M) :- integer(N), atom(A), !,
|
||||||
functor(T,A,N), '$flags'(T,M,F,F),
|
functor(T,A,N), '$flags'(T,M,F,F),
|
||||||
(
|
(
|
||||||
X is F /\ 8'170000, X =:= 0, !, '$do_table'(T, M)
|
X is F /\ 0x1991F880, X =:= 0, !, '$do_table'(T, M)
|
||||||
;
|
;
|
||||||
write(user_error, '[ Error: '),
|
'$do_error'(permission_error(modify,static_procedure,A/N),tabled(Mod:A/N))
|
||||||
write(user_error, M:A/N),
|
|
||||||
write(user_error, ' cannot be declared as table ]'),
|
|
||||||
nl(user_error),
|
|
||||||
fail
|
|
||||||
).
|
).
|
||||||
'$table'(X, _) :- write(user_error, '[ Error: '),
|
'$table'(X, _) :- write(user_error, '[ Error: '),
|
||||||
write(user_error, X),
|
write(user_error, X),
|
||||||
@ -61,7 +57,7 @@ abolish_trie(X) :-
|
|||||||
'$abolish_trie'(A/N, M) :- integer(N), atom(A), !,
|
'$abolish_trie'(A/N, M) :- integer(N), atom(A), !,
|
||||||
functor(T,A,N), '$flags'(T,M,F,F),
|
functor(T,A,N), '$flags'(T,M,F,F),
|
||||||
(
|
(
|
||||||
X is F /\ 8'000100, X =\= 0, !, '$do_abolish_trie'(T,M)
|
X is F /\ 0x000040, X =\= 0, !, '$do_abolish_trie'(T,M)
|
||||||
;
|
;
|
||||||
write(user_error, '[ Error: '),
|
write(user_error, '[ Error: '),
|
||||||
write(user_error, M:A/N),
|
write(user_error, M:A/N),
|
||||||
@ -88,7 +84,7 @@ show_trie(X) :-
|
|||||||
'$show_trie'(A/N, M) :- integer(N), atom(A), !,
|
'$show_trie'(A/N, M) :- integer(N), atom(A), !,
|
||||||
functor(T,A,N), '$flags'(T,M,F,F),
|
functor(T,A,N), '$flags'(T,M,F,F),
|
||||||
(
|
(
|
||||||
X is F /\ 8'000100, X =\= 0, !, '$show_trie'(T,M,_)
|
X is F /\ 0x000040, X =\= 0, !, '$show_trie'(T,M,_)
|
||||||
;
|
;
|
||||||
write(user_error, '[ Error: '),
|
write(user_error, '[ Error: '),
|
||||||
write(user_error, M:A/N),
|
write(user_error, M:A/N),
|
||||||
@ -116,7 +112,7 @@ resume_trie(X) :-
|
|||||||
'$resume_trie'(A/N,M) :- atom(A), integer(N), !,
|
'$resume_trie'(A/N,M) :- atom(A), integer(N), !,
|
||||||
functor(T,A,N), '$flags'(T,M,F,F),
|
functor(T,A,N), '$flags'(T,M,F,F),
|
||||||
(
|
(
|
||||||
X is F /\ 8'000100, X =\= 0, !, '$resume_trie'(T,M)
|
X is F /\ 0x000040, X =\= 0, !, '$resume_trie'(T,M)
|
||||||
;
|
;
|
||||||
write(user_error, '[ Error: '),
|
write(user_error, '[ Error: '),
|
||||||
write(user_error, A/N),
|
write(user_error, A/N),
|
||||||
|
@ -49,13 +49,13 @@ default_sequential(_).
|
|||||||
functor(T,A,N),
|
functor(T,A,N),
|
||||||
'$flags'(T,M,F,F),
|
'$flags'(T,M,F,F),
|
||||||
(
|
(
|
||||||
X is F /\ 8'000040, X =\= 0, !,
|
X is F /\ 0x00000020, X =\= 0, !,
|
||||||
write(user_error, '[ Warning: '),
|
write(user_error, '[ Warning: '),
|
||||||
write(user_error, M:A/N),
|
write(user_error, M:A/N),
|
||||||
write(user_error, ' is already declared as sequential ]'),
|
write(user_error, ' is already declared as sequential ]'),
|
||||||
nl(user_error)
|
nl(user_error)
|
||||||
;
|
;
|
||||||
X is F /\ 8'170000, X =:= 0, !, '$sequential'(T,M)
|
X is F /\ 0x1991F880, X =:= 0, !, '$sequential'(T,M)
|
||||||
;
|
;
|
||||||
write(user_error, '[ Error: '),
|
write(user_error, '[ Error: '),
|
||||||
write(user_error, M:A/N),
|
write(user_error, M:A/N),
|
||||||
@ -79,13 +79,13 @@ default_sequential(_).
|
|||||||
'$parallel_directive'(A/N,M) :- integer(N), atom(A), !,
|
'$parallel_directive'(A/N,M) :- integer(N), atom(A), !,
|
||||||
functor(T,A,N), '$flags'(T,M,F,F),
|
functor(T,A,N), '$flags'(T,M,F,F),
|
||||||
(
|
(
|
||||||
NF is F /\ \(8'000040), '$flags'(T,F,NF) ;
|
NF is F /\ 0x00000020, '$flags'(T,F,NF) ;
|
||||||
write(user_error, '[ Warning: '),
|
write(user_error, '[ Warning: '),
|
||||||
write(user_error, M:A/N),
|
write(user_error, M:A/N),
|
||||||
write(user_error, ' is already declared as sequential ]'),
|
write(user_error, ' is already declared as sequential ]'),
|
||||||
nl(user_error)
|
nl(user_error)
|
||||||
;
|
;
|
||||||
X is F /\ 8'170000, X =:= 0, !, '$sequential'(T)
|
X is F /\ 0x1991FC80, X =:= 0, !, '$sequential'(T)
|
||||||
;
|
;
|
||||||
write(user_error, '[ Error: '),
|
write(user_error, '[ Error: '),
|
||||||
write(user_error, M:A/N),
|
write(user_error, M:A/N),
|
||||||
|
Reference in New Issue
Block a user