disjunctions

parent 8bb0dc63
......@@ -36,35 +36,31 @@ head_at_true(Q,#t,_,A,C,Lab,Lab2,L1,LLX) :- L1=LLX, Lab2=Lab.
head_at_true(Q,#f,#f,A,C,Lab,Lab2,L1,LLX) :-
(var(Q) -> tr('unwind-light',Unwind) ; tr(unwind,Unwind)),
(var(Lab) -> true ; throw(error_head)),
L1=[[label,Lab,U],[Unwind,A,Lab2]|LLX].
L1=[[label,Lab,U],[Unwind,A,Lab2,Q]|LLX].
head_at_true(Q,#f,#t,A,C,Lab,Lab2,L1,LLX) :-
(var(Q) -> tr('unwind-light-tail',Unwind) ; tr('unwind-tail',Unwind)),
(var(Lab) -> true ; throw(error_head)),
L1=[[label,Lab,U],[Unwind,A]|LLX].
L1=[[label,Lab,U],[Unwind,A,Q]|LLX].
compile_goaler(X,First,V,LX,PP0) :-
compile_goal(X,First,V,LX),
get_P(V,P0),
(
P0=PP0 ->
set_P(V,P0);
set_P(V,\"complex\")
).
compile_goaler(X,Tail,V,LX,PP0) :-
compile_goal(X,Tail,V,LX),
get_P(V,P1),
combine_pp(P1,PP0,PP1),
set_P(V,PP1).
compile_disjunction0
([X],First,Aq,Ae,Out,Lab,A,Tail,S0,[U],B2,V,[L,LL],P0,PP0) :- !,
([X],First,Aq,Ae,Out,Lab,A,Tail,S0,[U],B2,V,[L,LL],P0,PP0,Q,QQ) :- !,
set_P(V,P0),
(First=#t -> compile_goaler(X,First,V,[L,LL],PP0) ;
(First=#t -> compile_goaler(X,Tail,V,[L,LL],PP0) ;
catch((
read_Q(0,V,Qit),
pop_Q(0,V,_),
Q=Qit,
get_CES(V,[C|_],E,S),
set_AB2ES(V,Aq,B2,0,S0),
(
((nonvar(X),X=(G1->G2)) -> XX=(once(G1),G2) ; XX=X),
compile_goal(XX,Tail,V,[LX,LL]),
compile_goaler(XX,Tail,V,[LX,LL],PP0),
get_ACES(V,Aq1,[C1|_],E1,S1),
(C == C1 -> true ; throw(bug_c_state_error)),
(
......@@ -97,19 +93,47 @@ compile_disjunction0
)
))).
goal(X,Y,First,Lab,Tail,Out,A,Ae,Aq,S0,[U|UU],V,L,LL,LG,B2,LLX,P0,PP0) :-
read_Q(1,V,Qit),
combine_pp(P1,PP0,PP1) :-
var(PP0) ->
(P1=PP0, PP1 = P1);
P1=ground(_) ->
(
P1==PP0 ->
PP1 = P1 ;
PP0=ground(_) ->
PP1 = [ground];
PP0=[ground] ->
PP1 = PP0;
PP1 = \"complex\"
);
P1=[ground] ->
(
(PP0=[ground] ; PP0=ground(_)) ->
PP1 = P1;
PP1 = \"complex\"
);
P1=procedure ->
(
PP0 = procedure ->
PP1 = \"procedure\";
PP1 = \"complex\"
);
PP1 = \"complex\".
goal(X,Y,First,Lab,Tail,Out,A,Ae,Aq,S0,[U|UU],V,L,LL,LG,B2,LLX,P0,PP0,Q,QQ) :-
Q=Qit,
get_CES(V,[C|_],E,S),
set_AB2ES(V,Aq,B2,0,S0),
((nonvar(X),X=(G1->G2)) ->
XX=(call(G1),softie(A),collect_F(FF),G2) ;
(XX=(X,newtag_F(FF)))),
(QQ=#t,XX=(X,newtag_F(FF)))),
set_P(V,ground(Lab)),
push_Q(V,Q),
compile_goal(XX,Tail,V,[LX,LG]),
pop_Q(V,Q),
get_P(V,P1),
(
PP0 = P1 -> PP1 = P1 ; PP1 = \"complex\"
),
combine_pp(P1,PP0,PP1),
(var(FF) -> true ; set_F(V,FF)),
get_ACES(V,A1q,[C1|_],E1,S1),
(C == C1 -> true ; throw(bug_c_state_error)),
......@@ -130,13 +154,13 @@ goal(X,Y,First,Lab,Tail,Out,A,Ae,Aq,S0,[U|UU],V,L,LL,LG,B2,LLX,P0,PP0) :-
)
),
ifc(compile_disjunction0(Y,#f,Aq,Ae,Out,Lab2,A,Tail,S0,UU,B2,
V,[LLX,LL],P0,PP1),Err,
V,[LLX,LL],P0,PP1,Q,QQ),Err,
(
(
Err==#t ->
throw(bug_true_not_be_send_in_non_first_disjunction);
(
pop_Q(1,V,_),
%pop_Q(1,V,_),
head_at_true(Qit,First,#f,A,C,Lab,Lab2,L,LX),
UU=[[0,_]],
Err==c ->
......@@ -148,11 +172,11 @@ goal(X,Y,First,Lab,Tail,Out,A,Ae,Aq,S0,[U|UU],V,L,LL,LG,B2,LLX,P0,PP0) :-
head_at_true(Qit,First,#f,A,C,Lab,Lab2,L,LX)
).
compile_disjunction0([X|Y],First,Aq,Ae,Out, Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0) :- !,
compile_disjunction0([X|Y],First,Aq,Ae,Out, Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0,Q,QQ) :- !,
tr('goto-inst',Goto),
read_Q(2,V,Qit),
(Tail==#t -> LG=LLX ; LG = [[Goto,Out]|LLX]),
catch(goal(X,Y,First,Lab,Tail,Out,A,Ae,Aq,S0,U,V,L,LL,LG,B2,LLX,P0,PP0), Er,
Q=Qit,
(Tail==#t -> LG=LLX ; LG = [[Goto,Out]|LLX]),
catch(goal(X,Y,First,Lab,Tail,Out,A,Ae,Aq,S0,U,V,L,LL,LG,B2,LLX,P0,PP0,Q,QQ), Er,
(
tfc(Er),
(Tail==#t -> LLG = [[cc]|LG] ; LLG=LG),
......@@ -163,7 +187,7 @@ compile_disjunction0([X|Y],First,Aq,Ae,Out, Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0)
(
U = [[0,_]|UU],
ifc(compile_disjunction0
(Y,#f,Aq,Aq,Out,Lab2,A,Tail,S0,UU,B2,V,[LLX,LL]),Er2,
(Y,#f,Aq,Aq,Out,Lab2,A,Tail,S0,UU,B2,V,[LLX,LL],P0,PP0,Q,QQ),Er2,
(
tfc(Er2),
(
......@@ -186,13 +210,13 @@ compile_disjunction0([X|Y],First,Aq,Ae,Out, Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0)
throw(syntax_error_begin_en_missmatch))),
head_at_true(Qit,First,#f,A,C,Lab,Lab2,L,LG)
)));
compile_disjunction0(Y,First,Aq,Ae,Out,Lab,A,Tail,S0,U,B2,V,[L,LL])
compile_disjunction0(Y,First,Aq,Ae,Out,Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0,Q,QQ)
)
)).
compile_disjunction(Y,First,Aq,Ae,Out,Lab,A,Tail,S0,U,B2,V,[L,LL]) :-
compile_disjunction(Y,First,Aq,Ae,Out,Lab,A,Tail,S0,U,B2,V,[L,LL],Q,QQ) :-
get_P(V,P0),
catch(compile_disjunction0(Y,First,Aq,Ae,Out,Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0),Er,
catch(compile_disjunction0(Y,First,Aq,Ae,Out,Lab,A,Tail,S0,U,B2,V,[L,LL],P0,PP0,Q,QQ),Er,
(
tfc(Er),
(
......
......@@ -44,6 +44,7 @@ wrap(Code,[L,LL]) :-
)
)).
-extended(',',m_and,;,m_or,\\+,m_not).
compile_goal(Code,Iout):- !,
compile_goal(Code,Iout,StackSize,Narg,Consts,#t).
......@@ -76,16 +77,17 @@ compile_goal(pr(X),Tail,V,[L,L]) :- !,
write(pr(X)),nl.
compile_goal(!,Tail,V,[L,LL]) :- !,
check_tail(Tail),
check_tail(Tail),
(Tail==#t -> L=[[cut],[cc]|LL] ; L=[[cut]|LL]).
compile_goal(softie(A),Tail,V,[LL,L]) :- !,
check_tail(Tail),
(Tail==#t -> L=[[softie,A],[cc]|LL] ; L=[[softie,A]|LL]).
get_P(V,P),
(Tail==#t -> L=[[softie,A],[cc,P]|LL] ; L=[[softie,A]|LL]).
compile_goal(begin_att,Tail,V,[L,LL]) :- !,
compile_goal(begin_att,Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
tail(Tail,V,LL,LLL),
(
Tail==#t -> L=LLL ;
(
......@@ -121,18 +123,19 @@ compile_goal(end_att,Tail,V,[L,LL]) :- !,
LLL=LL
)
),
get_P(V,P),
(
At == #t -> L = [[Post,Tag]|LLL] ;
Tail == #t -> L = [[cc]|LLL] ;
Tail == #t -> L = [[cc,P]|LLL] ;
L = LLL
).
compile_goal(pop(N),Tail,V,[L,LL]) :- !,
compile_goal(pop(N),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
M is -N,
push_v(M,V),
tail(Tail,LL,LLL),
L=[[pop,N]|LLL].
tail(Tail,V,LL,LLL),
L=[[pop,N]|LL].
compile_goal(with_cut(C,CS),Tail,V,[L,LL]) :- !,
var_p(C),
......@@ -168,7 +171,9 @@ compile_goal((F :- Goal),Tail,V,L) :- !,
push_v(4,V),
wrap(compile_goal((pop(4),Goal),Tail,V,L),L).
compile_goal(newtag_F(F),Tail,V,[L,L]) :-
compile_goal(newtag_F(F),Tail,V,[L,LL]) :- !,
check_tail(Tail),
tail(Tail,V,L,LL),
gen(F).
compile_goal(extended_off,Tail,V,[L,L]) :- !,
......@@ -209,32 +214,39 @@ compile_goal((X,Y),Tail,V,L) :- !,
collect_conj((X,Y),Gs,[]),
compile_conj(Gs,Tail,V,L).
compile_goal(m_or(fail,false),#t,V,[[[fail,P],[cc] |L], L]) :-
compile_goal(m_or(fail,false),#t,V,[[[fail,P],[cc,P] |L], L]) :-
get_P(V,P).
compile_goal(m_or(fail,false),#f,V,[[[fail,P] |L], L]) :-
get_P(V,P).
compile_goal(true,_,_,_) :- throw(#t).
compile_goal(';'(|X),Tail,V,[L,LL]) :- !,
write(disjTail(Tail)),nl,
collect_disj(X,XX,[]),
(
XX=[] -> L=[[false]|LL] ;
XX=[] -> L=[[flse]|LL] ;
XX=[Z] -> compile_goal(Z,Tail,V,[L,LL]) ;
(
get_AB2ESM(V,Aq,B2,E,S,M),
get_F(V,F),
push_Q(0,V,Q),
compile_disjunction(XX,#t,Aq,Ae,Out,Lab,LabA,Tail,S,U,B2,V,LM),!,
compile_disjunction(XX,#t,Aq,Ae,Out,Lab,LabA,Tail,S,U,B2,V,LM,Q),!,
(zero(V) -> Tp is 0 ; Tp is 1),
(
var(Q) ->
(
var_p(Var),
add_var_f(Var,V,F,LabA),
L = [['newframe-light',LabA,Lab] | LX]
var_p(Var1),
var_p(Var2),
add_var_f(Var1,V,F,LabA1),
add_var_f(Var2,V,F,LabA2),
LabA = [LabA1,LabA2],
L = [['newframe-light',LabA,Lab,Q] | LX]
);
(
Lab = LabA,
L = [[newframe ,LabA,Tp] | LX]
var_p(Var1),
var_p(Var2),
add_var_f(Var1,V,F,LabA1),
add_var_f(Var2,V,F,LabA2),
LabA = [LabA1,LabA2],
L = [[newframe,LabA,Lab,Tp] | LX]
)
),
LM = [LX, [[label,Out] | LL]],
......@@ -333,9 +345,10 @@ compile_goal(set(V,X),Tail,V,[L,LL]) :- !,
(isFirst(Tag) -> true ; force_variable(Tag)),
push_args(X,V,L,LX),
push_v(-1,V),
get_P(V,P),
(
Tail=#t ->
LX=[[Set,Tag],[cc]|LL];
LX=[[Set,Tag],[cc,P]|LL];
LX=[[Set,Tag] |LL]
).
......@@ -535,9 +548,10 @@ compile_goal(\\+X,Tail,V,L) :- !,
compile_goal((m_and(Op,m_or(<,>,=<,>=,=:=,=\\=,@<,@=<,@>,@>=)))(X,Y),
Tail,V,[L,LL]) :- !,
Tail,V,[L,LLL]) :- !,
write(compTail(Tail)),nl,
check_tail(Tail),
tail(Tail,LL,LLL),
tail(Tail,V,LL,LLL),
get_P(V,P),
ifc(compile_scm(X,V,L,LX),EX,
(
......@@ -573,7 +587,7 @@ compile_goal(X is Y,Tail,V,L) :- !,
compile_goal((begin_att,iss(X,Y),end_att),Tail,V,L);
compile_goal(iss(X,Y),Tail,V,L)).
compile_goal(iss(X,Y),Tail,V,[L,LL]) :- !,
compile_goal(iss(X,Y),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
(
......@@ -620,10 +634,10 @@ compile_goal(unify_with_occurs_check(X,Y),Tail,V,L) :- !,
compile_goal(uni_0(X,Y),Tail,V,L)
).
compile_goal(uni_0(X,Y),Tail,V,[L,LL]) :- !,
compile_goal(uni_0(X,Y),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
compile_unify(X,Y,V,[L,LLL],0).
compile_unify(X,Y,V,[L,LLL],0),
tail(Tail,V,LL,LLL).
compile_goal(X = Y,Tail,V,L) :- !,
......@@ -635,10 +649,10 @@ compile_goal(X = Y,Tail,V,L) :- !,
compile_goal(uni_x(X,Y),Tail,V,L)
).
compile_goal(uni_x(X,Y),Tail,V,[L,LL]) :- !,
compile_goal(uni_x(X,Y),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
compile_unify(X,Y,V,[L,LLL],#t).
compile_unify(X,Y,V,[L,LL],#t),
tail(Tail,V,LL,LLL).
compile_goal(X == Y,Tail,V,L) :- !,
(
......@@ -648,20 +662,20 @@ compile_goal(X == Y,Tail,V,L) :- !,
compile_goal(uni(X,Y),Tail,V,L)
).
compile_goal(uni(X,Y),Tail,V,[L,LL]) :- !,
compile_goal(uni(X,Y),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
compile_unify(X,Y,V,[L,LLL],#t).
compile_unify(X,Y,V,[L,LL],#t),
tail(Tail,V,LL,LLL).
compile_goal(unim(X,Y),Tail,V,[L,LL]) :- !,
compile_goal(unim(X,Y),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
compile_unify(X,Y,V,[L,LLL],#f).
compile_unify(X,Y,V,[L,LL],#f),
tail(Tail,V,LL,LLL).
compile_goal(imprint(X,M),Tail,V,[L,LL]) :- !,
compile_goal(imprint(X,M),Tail,V,[L,LLL]) :- !,
check_tail(Tail),
tail(Tail,LL,LLL),
compile_imprint(X,V,L,LLL,M).
compile_imprint(X,V,L,LL,M),
tail(Tail,V,LL,LLL).
compile_goal(m_and(X,F(|AArgs)),Tail,V,L) :- !,
(
......
......@@ -27,19 +27,23 @@ chech_push(F) :-
-trace.
-extended.
handle([label,N],[I,L],[II,LL]) :- !,
N=I,I=II,LL=L.
handle(['cc'],I,II,L,LL) :- !,
'cc-call'(\"complex\",I,II,L,LL).
handle(['cc'],I,II,L,LL) :-
'cc-call'(I,II,L,LL).
handle(['cc',P],I,II,L,LL) :- !,
'cc-call'(P,I,II,L,LL).
handle([('unify-constant';'unify-instruction'),C,M],I,II,L,LL) :-
handle([('unify-constant';'unify-instruction'),C,M],I,II,L,LL) :- !,
'unify-instruction'(C,M,I,II,L,LL).
handle([\"label\",C],I,II,L,LL) :-
handle([\"label\",C],I,I,L,LL) :- !,
I=II,
inlabel(C,L,LL).
handle([\"label\",C,D],I,I,L,LL) :- !,
I=II,
inlabel(C,D,L,LL).
handle(['clear-sp'],I,0,L,LL) :- !,
'clear-sp'(I,0,L,LL).
......@@ -130,16 +134,22 @@ handle([softie,A],I,II,L,LL) :- !,
handle(push_at(K),I,II,L,LL) :- !,
push_at(K,I,II,L,LL).
handle([(FF,('newframe-light';'unwind-light-tail';'unwind-light')),
[[S,V,Q],N,F|_],A],I,II,L,LL) :-
new_var(V,Q,S),
handle([(FF,('newframe-light';'unwind-light')),
[[[S1,V1,Q1],N1,F1|_],[[S2,V2,Q2],N2,F2|_]],A,QQ],I,II,L,LL) :- !,
new_var(V1,Q1,S1),
new_var(V2,Q2,S2),
(V1=[VC1|_] -> E1=var(VC1) ; E1=svar(V1)),
(V2=[VC2|_] -> E2=var(VC2) ; E2=svar(V2)),
FF(E1,A,I,II,L,LL).
handle(['unwind-light-tail',[[[S,V,Q],N,F|_],_],QQ],I,II,L,LL) :- !,
new_var(V,Q,S),
(V=[VC|_] -> E=var(VC) ; E=svar(V)),
FF(E,A,I,II,L,LL).
'unwind-light-tail'(E,I,II,L,LL).
handle((X,[('goto-inst';'store-state';'unwind-tail';
'post-q'),N]),I,II,L,LL) :- !,
X=[F,_],
handle([(X,('goto-inst';'store-state';'unwind-tail';
'post-q')),N],I,II,L,LL) :- !,
X(N,I,II,L,LL).
......@@ -282,7 +292,7 @@ handle(['push-variable-scm',[[S,V,Q],N,F|_]],I,II,L,LL) :- !,
throw(first_variable_in_scheme_context);
(
new_var(V,Q,S),
(V=[VC|_] -> QQ=svar(VC) ; QQ=V),
(V=[VC|_] -> QQ=svar(VC) ; QQ=var(V)),
'push-variable'(QQ,I,II,L,LL)
)
).
......
......@@ -477,10 +477,13 @@ listp(X) :- var(X) -> (!, fail).
listp([X|Y]) :- listp(Y).
listp([]).
tail(Tail,LL,LLL) :-
Tail = #t ->
(tr(cc,CC),LLL=[[CC]|LL]) ;
LLL=LL.
tail(Tail,V,LL,LLL) :-
get_P(V,P),
(
Tail = #t ->
(tr(cc,CC),LL=[[CC,P]|LLL]) ;
LLL=LL
).
push_v(N,V) :-
get_SM(V,S,M),
......
......@@ -36,8 +36,8 @@
'pushtail-3'(P,I,II,L,LL) :-
args([cc,pp(P),s],I,II,L,LL).
'cc-call'(I,0,L,LL) :-
scmtailcall(cc,[s,p],0,_,L,LL).
'cc-call'(P,I,0,L,LL) :-
scmtailcall(cc,[pp(P),s],0,_,L,LL).
move_block(0,I,I,L,L).
move_block(N,I,II,L,LL) :-
......
......@@ -18,9 +18,8 @@
gset(cut,V,I,L,L1),
gset(scut,VC,I,L1,LL).
'goto-inst'(Inst,I,L,LL) :-
gref(I,c(Inst),I,L,L1),
generate(goto(I),L1,LL).
'goto-inst'(Inst,I,I,L,LL) :-
generate(jmp(Inst),L,LL).
cut(I,L,LL) :-
isZero(cut,I,L,L2),
......
......@@ -32,8 +32,9 @@
'unwind-tail'(Tag,I,L,LL) :-
scmcall('restore-state-tail',[vec,c(Tag)],I,L,LL).
'unwind-light-tail'(Tag,I,L,LL) :-
gset(p,svar(Tag),I,L,LL).
-trace.
'unwind-light-tail'(Tag,I,I,L,LL) :-
gset(p,Tag,I,L,LL).
'unwind-ps'(P,S,I,L,LL) :-
scmcall('gp-unwind',[S],I,I1,L,L1),
......@@ -89,8 +90,9 @@
unwind(Tag,P,I,L,LL) :-
scmcall('gp-unwind-it',[vec,c(Tag),c(P)],I,L,LL).
'unwind-light'(P,I,L,LL) :-
gset(p,c(P),I,L,LL).
-trace.
'unwind-light'(P,A,I,I,L,LL) :-
gset(P,l(A),I,L,LL).
'unwind-negation'(N,CUT,I,L,LL) :-
scmcall('gp-unwind-negation',[vec,c(N),c(CUT)],I,L,LL).
......
......@@ -5,10 +5,16 @@
#:export (reset gset gref move movex scmcall make_p make_cc j je jne
scmtailcall scmtailcall2 scmcall1 generate
label gfalse gtrue isTrue pltest lookup2 svar args
test sp cc p s c vec lvec cut stack call? scut pp pltest_s
test sp cc p s c l vec lvec cut stack call? scut pp pltest_s
base init-proc
tailstub stub inlabel))
(define il 0)
(<define> (ilab x)
(<=> x ,(vector (list l il)))
(<code> (set! il (+ il 1))))
(define base (gp-make-var))
(define i 0)
......@@ -58,7 +64,8 @@
generate('scm-ref/immediate'(II,I,2),L2,L3),
generate('scm-ref/immediate'(I,I,1),L3,LL).
pp(complex,I,II,L,LL) :-
-trace.
pp(complex,I,II,L,LL) :- !,
II is I + 1,
gset(sp(I),p,II,L,L1),
isProcedure(sp(I),Lab,II,L1,L2),
......@@ -67,13 +74,19 @@
move(base+I,base+J,L3,L4),
label(Lab,L4,LL).
pp(ground(Lab),I,II,L,LL) :-
pp(ground(Lab),I,II,L,LL) :- !,
II is I + 1,
gset(sp(I),l(Lab),I,L,L1),
scmcall1('gp-make-p',[self],II,I1,L1,L2),
gset(sp(I),sp(I1-1),II,L2,LL).
pp([ground],I,II,L,LL) :- !,
II is I + 1,
gset(sp(I),p,I,L,L1),
scmcall1('gp-make-p',[self],II,I1,L1,L2),
gset(sp(I),sp(I1-1),II,L2,L3).
pp(procedure,I,II,L,LL) :-
pp(procedure,I,II,L,LL) :- !,
II is I + 1,
gset(sp(I),p,I,L,LL).
......@@ -134,7 +147,6 @@
call(JJ is J),
generate(mov(base+II,base+JJ),L,LL).
-trace.
gref(cl(X),I,L,LL) :- !,
call(II is I),
generate(closure(base+II,X),L,LL).
......@@ -155,7 +167,7 @@
call(II is I),
id(const,svar(S)),
generate('scm-ref/immediate'(II,S,X),L,LL).
gref(var(X),sp(I),L,LL) :-
varref(X,sp(I),_,L,LL).
......@@ -203,7 +215,14 @@
vset(J,X,I,L,LL) :-
id(X,XX),
vset(J,XX,I,L,LL).
vset(J,X,I,L,LL) :-
gref(X,I,L,L1),
vset(J,sp(I),I,L1,LL).
sset(K,l(J),I,L,LL) :- !,
generate('get-label'(base+K,J),L,LL).
sset(K,sp(J),I,L,LL) :- !,
call(KK is K),
call(JJ is J),
......@@ -229,6 +248,9 @@
id(X,XX),
sset(J,XX,sp(I),L,LL).
sset(K,l(J),I,L,LL) :- !,
generate('get-label'(K,J),L,LL).
cset(K,sp(J),I,L,LL) :- !,
move(K,base+J,L,LL).
......@@ -311,7 +333,7 @@
gref(c(F),I1,L2,L3),
I2 is I1 + 1,
generate(handle_interupts,L3,L4),
generate(tailcall(I2,NN),L4,L5).
generate(tailcall(I2,NN),L4,LL).
scmtailcall(F,Args,I,II,L,LL) :- scmtailcalln(0,F,Args,I,II,L,LL).
scmtailcall2(F,Args,I,II,L,LL) :- scmtailcalln(2,F,Args,I,II,L,LL).
......@@ -326,10 +348,19 @@
generate(jne(Label),L,LL).
label(Label,L,LL) :-
ilab(Label),
generate(label(Label),L,LL).
label(Label,Goto,L,LL) :-
generate(jmp(Goto),L,L1),
ilab(Label),
generate(label(Label),L1,LL).
inlabel(Label,L,LL) :-
generate(label(Label),L,LL).
label(Label,G,L,LL).
inlabel(Label,G,L,LL) :-
label(Label,G,L,LL).
gfalse(I,II,L,LL) :-
gref(p,I,L,L2),
......
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