call now works

parent 698d9ceb
......@@ -1543,12 +1543,12 @@ constant = #(nlocals nstack constants code)
(LABEL tail-call)
(PRSTACK sp fp)
(<let> ((SCM p (MK-P p pp
(MAKEP-P nlocals
session
middle
(<-> inst-pt instructions)
ctrl-stack
sp-stack)))
(MAKEP-P- nlocals
session
middle
p
ctrl-stack
sp-stack)))
(SCM cc (GET-CC variables)))
(<=> (FARG 1 fp) s)
(<=> (FARG 2 fp) p)
......@@ -1650,11 +1650,9 @@ constant = #(nlocals nstack constants code)
(LABEL post-q)
(PRSTACK sp fp)
(<let> ((SCM np (<ref> inst-pt (<c> 0))))
(<=> cut (<ref> inst-pt (<c> 1)))
(<=> inst-pt (<+> inst-pt (<c> 2)))
(RESTORE-STATE-TAIL s p np ctrl-stack)
(NEXT inst-pt))
(<=> cut (<ref> inst-pt (<c> 0)))
(<=> inst-pt (<+> inst-pt (<c> 1)))
(NEXT inst-pt)
;; We will
(LABEL unwind-tail)
......
......@@ -62,14 +62,14 @@ compile_goal(Code,Iout,StackSize,Narg,Constants,Pretty) :- !,
get_M(V,StackSize),
handle_all(L,LL),
(var(Constants)->Constants=scm[(get-consts)];true),
write(LL),nl,
write(LL),nl,!,
(Pretty==#t -> Iout=LL ; (b_setval(pretty,#f),mmtr(LL,Iout))).
compile_goal(X,Tail,V,L) :- var_p(X),!,
compile_goal(call(X),Tail,V,L).
compile_goal(!,Tail,V,[LL,L]) :- !,
compile_goal(!,Tail,V,[L,LL]) :- !,
check_tail(Tail),
(Tail==#t -> L=[[cut],[cc]|LL] ; L=[[cut]|LL]).
......@@ -196,7 +196,7 @@ compile_goal(';'(|X),Tail,V,[L,LL]) :- !,
).
compile_goal(verbatim_call(X),Tail,V,[L,LL]) :-
( (\\+var_p(X)),
( \\+var_p(X),
(
F(|Args)=X ->
(
......@@ -225,12 +225,12 @@ compile_goal(call(X),Tail,V,[L,LL]) :-
CC = [Al|C],
compile_goal(X,#f,V,[LX,LLX]),
set_C(V,C),
(Tail=#t -> LG==[[cc]|LL] ; LG=LL),
LLX = [[goto-inst ,Bl ],
(Tail=#t -> LG=[[cc]|LL] ; LG=LL),
LLX = [['goto-inst' ,Bl ],
[label ,Al ],
['unwind-negation' ,Al,C0],
[label ,Bl ],
['post-q' ,Al,C0]|LG].
['post-q' ,C0 ]|LG].
compile_goal((X =.. Y),Tail,V, L, LL) :- !,
......@@ -409,7 +409,7 @@ compile_goal(uni_0(X,Y),Tail,V,[L,LL]) :- !,
compile_unify(X,Y,V,[L,LLL],0).
compile_goal(X = Y,Tail,V,L) :- !,write(unify),nl,
compile_goal(X = Y,Tail,V,L) :- !,
(
X==Y -> throw(#t) ;
zero(V) ->
......@@ -435,7 +435,7 @@ compile_goal(uni(X,Y),Tail,V,[L,LL]) :- !,
tail(Tail,LL,LLL),
compile_unify(X,Y,V,[L,LLL],#t).
compile_goal(imprint(X,M),Tail,V,[L,LL]) :-
compile_goal(imprint(X,M),Tail,V,[L,LL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
compile_imprint(X,V,L,LLL,M).
......
......@@ -32,7 +32,7 @@ handle_all([X|Y],I,II,L,LL) :-
handle([label,N],I,II,L,LL) :- !,
N=I,I=II,LL=L.
handle((X,[('goto-inst';'store-state';'unwind-tail';softie),N]),
handle((X,[('goto-inst';'store-state';'unwind-tail';softie;'post-q'),N]),
I,II,L,LL) :- !,
II is I + 2,
L=[X|LL].
......
......@@ -18,7 +18,7 @@ compile_imprint(Y,V,L,LL,M) :-
push_v(-1,V),
tr(unify,Unify),
(isFirst(Tag) -> true ; touch_A(V)),
L=[[Unify,Tag,M]|LL]
L=[[Unify,Tag,M]|LL],!
).
compile_imprint({Y},V, L, LL, M) :- !,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment