YAP 7.1.0
or_absmi_insts.h
1/************************************************************************ \
2 * Instructions for implemeting 'or;' *
3\************************************************************************/
4
5#ifdef INDENT_CODE
6{
7 {
8 {
9#endif /* INDENT_CODE */
10
11 BOp(jump, l);
12 PREG = PREG->y_u.l.l;
13 JMPNext();
14 ENDBOp();
15
16 /* This instruction is called when the previous goal
17 was interrupted when waking up goals
18 */
19 BOp(move_back, l);
20 PREG = (yamop *)(((char *)PREG)-(Int)(NEXTOP((yamop *)NULL,Osbpp)));
21 JMPNext();
22 ENDBOp();
23
24 /* This instruction is called when the previous goal
25 was interrupted when waking up goals
26 */
27 BOp(skip, l);
28 PREG = NEXTOP(PREG,l);
29 JMPNext();
30 ENDBOp();
31
32 Op(either, Osblp);
33#ifdef LOW_LEVEL_TRACER
34 if (Yap_do_low_level_trace) {
35 low_level_trace(try_or, PREG->y_u.Osblp.p0, NULL);
36 }
37#endif
38#if 0
39 CACHE_Y_AS_ENV(YREG);
40 check_stack(NoStackEither, HR);
41 ENDCACHE_Y_AS_ENV();
42 either_notest:
43#endif
44 BEGD(d0);
45 /* Try to preserve the environment */
46 d0 = PREG->y_u.Osblp.s;
47 BEGCHO(pt1);
48 pt1 = (choiceptr) ((char *) YREG + (yslot) d0);
49#ifdef FROZEN_STACKS
50 {
51 choiceptr top_b = PROTECT_FROZEN_B(B);
52#ifdef YAPOR_SBA
53 if (pt1 > top_b || pt1 < (choiceptr)HR) pt1 = top_b;
54#else
55 if (pt1 > top_b) pt1 = top_b;
56#endif /* YAPOR_SBA */
57 }
58#else
59 if (pt1 > B) {
60 pt1 = B;
61 }
62#endif /* FROZEN_STACKS */
63 pt1 = (choiceptr)(((CELL *) pt1)-1);
64 *(CELL **) pt1 = YREG;
65 store_yaam_regs_for_either(PREG->y_u.Osblp.l, PREG);
66 SREG = (CELL *) (B = pt1);
67#ifdef YAPOR
68 SCH_set_load(pt1);
69#endif /* YAPOR */
70 SET_BB(pt1);
71 ENDCHO(pt1);
72 /* skip the current instruction plus the next one */
73 PREG = NEXTOP(NEXTOP(PREG, Osblp),l);
74 GONext();
75 ENDD(d0);
76
77#if 0
78 NoStackEither:
79 PROCESS_INT(interrupt_either, either_notest);
80#endif
81
82 ENDOp();
83
84 Op(or_else, Osblp);
85 HR = HBREG = PROTECT_FROZEN_H(B);
86 ENV = B->cp_env;
87 B->cp_cp = PREG;
88#ifdef DEPTH_LIMIT
89 DEPTH = B->cp_depth;
90#endif /* DEPTH_LIMIT */
91 SET_BB(PROTECT_FROZEN_B(B));
92#ifdef YAPOR
93 if (SCH_top_shared_cp(B)) {
94 SCH_new_alternative(PREG, PREG->y_u.Osblp.l);
95 } else
96#endif /* YAPOR */
97 B->cp_ap = PREG->y_u.Osblp.l;
98 PREG = NEXTOP(PREG, Osblp);
99 YREG = (CELL *) B->cp_a1;
100 GONext();
101 ENDOp();
102
103#ifdef YAPOR
104 Op(or_last, Osblp);
105#else
106 Op(or_last, p);
107#endif /* YAPOR */
108 BEGCHO(pt0);
109 pt0 = B;
110#ifdef YAPOR
111 if (SCH_top_shared_cp(B)) {
112 HR = HBREG = PROTECT_FROZEN_H(pt0);
113 YREG = (CELL *) pt0->cp_a1;
114 ENV = pt0->cp_env;
115#ifdef DEPTH_LIMIT
116 DEPTH = pt0->cp_depth;
117#endif /* DEPTH_LIMIT */
118 SCH_new_alternative(PREG, NULL);
119 }
120 else
121#endif /* YAPOR */
122 {
123 B = pt0->cp_b;
124 HR = PROTECT_FROZEN_H(pt0);
125 YREG = (CELL *) pt0->cp_a1;
126 ENV = pt0->cp_env;
127#ifdef DEPTH_LIMIT
128 DEPTH = pt0->cp_depth;
129#endif /* DEPTH_LIMIT */
130 HBREG = PROTECT_FROZEN_H(B);
131 }
132#ifdef YAPOR
133 PREG = NEXTOP(PREG, Osblp);
134#else
135 PREG = NEXTOP(PREG, p);
136#endif /* YAPOR */
137 SET_BB(PROTECT_FROZEN_B(B));
138 GONext();
139 ENDCHO(pt0);
140 ENDOp();
141
142 /************************************************************************\
143 * Pop operations *
144\************************************************************************/
145
146 OpRW(pop_n, s);
147 /* write mode might have been called from read mode */
148 BEGD(d0);
149 d0 = PREG->y_u.os.s;
150 SP = (CELL *) (((char *) SP) + d0);
151 ENDD(d0);
152 BEGD(d0);
153 d0 = SP[0];
154 if (d0) {
155 START_PREFETCH(s);
156 SREG = (CELL *) (SP[1]);
157 SP += 2;
158 PREG = NEXTOP(PREG, s);
159 GONext();
160 END_PREFETCH();
161 }
162 else {
163 START_PREFETCH_W(s);
164 SREG = (CELL *) (SP[1]);
165 SP += 2;
166 PREG = NEXTOP(PREG, s);
167 GONextW();
168 END_PREFETCH_W();
169 }
170 ENDD(d0);
171 ENDOpRW();
172
173 OpRW(pop, e);
174 BEGD(d0);
175 d0 = SP[0];
176 SREG = (CELL *) (SP[1]);
177 SP += 2;
178 if (d0) {
179 START_PREFETCH(e);
180 PREG = NEXTOP(PREG, e);
181 GONext();
182 END_PREFETCH();
183 }
184 else {
185 START_PREFETCH_W(e);
186 PREG = NEXTOP(PREG, e);
187 GONextW();
188 END_PREFETCH_W();
189 }
190 ENDD(d0);
191 ENDOpRW();
192
Definition: amidefs.h:264