YAP 7.1.0
unify_absmi_insts.h
1/************************************************************************\
2 * Get Instructions *
3\************************************************************************/
4
5#ifdef INDENT_CODE
6{
7 {
8 {
9#endif /* INDENT_CODE */
10
11 Op(get_x_var, xx);
12 BEGD(d0);
13 d0 = XREG(PREG->y_u.xx.xr);
14 XREG(PREG->y_u.xx.xl) = d0;
15 PREG = NEXTOP(PREG, xx);
16 ENDD(d0);
17 GONext();
18 ENDOp();
19
20 Op(get_y_var, yx);
21 BEGD(d0);
22 BEGP(pt0);
23 pt0 = YREG + PREG->y_u.yx.y;
24 d0 = XREG(PREG->y_u.yx.x);
25 PREG = NEXTOP(PREG, yx);
26 INITIALIZE_PERMVAR(pt0,d0);
27 GONext();
28 ENDP(pt0);
29 ENDD(d0);
30 ENDOp();
31
32 Op(get_yy_var, yyxx);
33 CACHE_Y(YREG);
34 BEGD(d0);
35 BEGP(pt0);
36 pt0 = S_YREG + PREG->y_u.yyxx.y1;
37 d0 = XREG(PREG->y_u.yyxx.x1);
38 BEGD(d1);
39 BEGP(pt1);
40 pt1 = S_YREG + PREG->y_u.yyx.y2;
41 d1 = XREG(PREG->y_u.yyxx.x2);
42 PREG = NEXTOP(PREG, yyxx);
43 INITIALIZE_PERMVAR(pt0,d0);
44 INITIALIZE_PERMVAR(pt1,d1);
45 ENDP(pt1);
46 ENDD(d1);
47 GONext();
48 ENDP(pt0);
49 ENDD(d0);
50 ENDCACHE_Y();
51 ENDOp();
52
53 /* The code for get_x_val is hard to follow because I use a
54 * lot of jumps. The convention is that in the label
55 * gval_X_YREG X refers to the state of the first argument, and
56 * YREG to the state of the second argument */
57 Op(get_x_val, xx);
58 BEGD(d0);
59 d0 = XREG(PREG->y_u.xx.xl);
60 deref_head(d0, gvalx_unk);
61
62 /* d0 will keep the first argument */
63 gvalx_nonvar:
64 /* first argument is bound */
65 BEGD(d1);
66 d1 = XREG(PREG->y_u.xx.xr);
67 deref_head(d1, gvalx_nonvar_unk);
68
69 gvalx_nonvar_nonvar:
70 /* both arguments are bound */
71 /* we may have to bind structures */
72 PREG = NEXTOP(PREG, xx);
73 UnifyBound(d0, d1);
74
75 BEGP(pt0);
76 /* deref second argument */
77 deref_body(d1, pt0, gvalx_nonvar_unk, gvalx_nonvar_nonvar);
78 /* first argument bound, second unbound */
79 PREG = NEXTOP(PREG, xx);
80 YapBind(pt0, d0);
81 GONext();
82
83 ENDP(pt0);
84 ENDD(d1);
85
86 BEGP(pt0);
87 /* first argument may be unbound */
88 deref_body(d0, pt0, gvalx_unk, gvalx_nonvar);
89 /* first argument is unbound and in pt0 and in d0 */
90 BEGD(d1);
91 d1 = XREG(PREG->y_u.xx.xr);
92 deref_head(d1, gvalx_var_unk);
93
94 gvalx_var_nonvar:
95 /* first unbound, second bound */
96 PREG = NEXTOP(PREG, xx);
97 YapBind(pt0, d1);
98 GONext();
99
100 BEGP(pt1);
101 deref_body(d1, pt1, gvalx_var_unk, gvalx_var_nonvar);
102 /* both arguments are unbound */
103 PREG = NEXTOP(PREG, xx);
104 UnifyCells(pt0, pt1);
105 GONext();
106 ENDP(pt1);
107 ENDD(d1);
108 ENDP(pt0);
109 ENDD(d0);
110 ENDOp();
111
112 /* The code for get_y_val mostly uses the code for get_x_val
113 */
114
115 Op(get_y_val, yx);
116 BEGD(d0);
117 BEGD(d1);
118 BEGP(pt0);
119 pt0 = YREG + PREG->y_u.yx.y;
120 d0 = *pt0;
121
122 /* From now on, it's just a copy of the code for get_x_val */
123
124 deref_head(d0, gvaly_unk);
125 gvaly_nonvar:
126
127 /* first argument is bound */
128 d1 = XREG(PREG->y_u.yx.x);
129 deref_head(d1, gvaly_nonvar_unk);
130 gvaly_nonvar_nonvar:
131
132 /* both arguments are bound */
133 /* we may have to bind structures */
134 PREG = NEXTOP(PREG, yx);
135 UnifyBound(d0, d1);
136
137 BEGP(pt1);
138 /* deref second argument */
139 deref_body(d1, pt1, gvaly_nonvar_unk, gvaly_nonvar_nonvar);
140 /* first argument bound, second unbound */
141 PREG = NEXTOP(PREG, yx);
142 YapBind(pt1, d0);
143 GONext();
144 ENDP(pt1);
145
146
147 /* first argument may be unbound */
148 derefa_body(d0, pt0, gvaly_unk, gvaly_nonvar);
149 /* first argument is unbound */
150 d1 = XREG(PREG->y_u.yx.x);
151 deref_head(d1, gvaly_var_unk);
152
153 gvaly_var_nonvar:
154 /* first unbound, second bound */
155 PREG = NEXTOP(PREG, yx);
156 YapBind(pt0, d1);
157 GONext();
158
159 BEGP(pt1);
160 deref_body(d1, pt1, gvaly_var_unk, gvaly_var_nonvar);
161 /* both arguments are unbound */
162 PREG = NEXTOP(PREG, yx);
163 UnifyCells(pt0, pt1);
164 GONext();
165 ENDP(pt1);
166 ENDP(pt0);
167 ENDD(d1);
168 ENDD(d0);
169 ENDOp();
170
171 Op(get_atom, xc);
172 BEGD(d0);
173 BEGD(d1);
174 /* fetch arguments */
175 d0 = XREG(PREG->y_u.xc.x);
176 d1 = PREG->y_u.xc.c;
177
178 BEGP(pt0);
179 deref_head(d0, gatom_unk);
180 /* argument is nonvar */
181 gatom_nonvar:
182 if (d0 == d1) {
183 PREG = NEXTOP(PREG, xc);
184 GONext();
185 }
186 else {
187 FAIL();
188 }
189
190 deref_body(d0, pt0, gatom_unk, gatom_nonvar);
191 /* argument is a variable */
192 PREG = NEXTOP(PREG, xc);
193 YapBind(pt0, d1);
194 GONext();
195 ENDP(pt0);
196 ENDD(d1);
197 ENDD(d0);
198 ENDOp();
199
200 Op(get_atom_exo, x);
201 BEGD(d0);
202 BEGD(d1);
203 /* fetch arguments */
204 d0 = XREG(PREG->y_u.x.x);
205 d1 = *SREG;
206 SREG++;
207
208 BEGP(pt0);
209 deref_head(d0, gatom_exo_unk);
210 /* argument is nonvar */
211 gatom_exo_nonvar:
212 if (d0 == d1) {
213 PREG = NEXTOP(PREG, x);
214 GONext();
215 }
216 else {
217 FAIL();
218 }
219
220 deref_body(d0, pt0, gatom_exo_unk, gatom_exo_nonvar);
221 /* argument is a variable */
222 pt0 = (CELL *)d0;
223 PREG = NEXTOP(PREG, x);
224 YapBind(pt0, d1);
225 GONext();
226 ENDP(pt0);
227 ENDD(d1);
228 ENDD(d0);
229 ENDOp();
230
231 Op(get_2atoms, cc);
232 BEGD(d0);
233 BEGD(d1);
234 /* fetch arguments */
235 d0 = ARG1;
236
237 BEGP(pt0);
238 deref_head(d0, gatom_2unk);
239 /* argument is nonvar */
240 gatom_2nonvar:
241 if (d0 == PREG->y_u.cc.c1) {
242 goto gatom_2b;
243 }
244 else {
245 FAIL();
246 }
247
248 deref_body(d0, pt0, gatom_2unk, gatom_2nonvar);
249 /* argument is a variable */
250 YapBind(pt0, PREG->y_u.cc.c1);
251 ENDP(pt0);
252 gatom_2b:
253 /* fetch arguments */
254 d0 = ARG2;
255 d1 = PREG->y_u.cc.c2;
256
257 BEGP(pt0);
258 deref_head(d0, gatom_2bunk);
259 /* argument is nonvar */
260 gatom_2bnonvar:
261 if (d0 == d1) {
262 PREG = NEXTOP(PREG, cc);
263 GONext();
264 }
265 else {
266 FAIL();
267 }
268
269 deref_body(d0, pt0, gatom_2bunk, gatom_2bnonvar);
270 /* argument is a variable */
271 PREG = NEXTOP(PREG, cc);
272 YapBind(pt0, d1);
273 GONext();
274 ENDP(pt0);
275 ENDD(d1);
276 ENDD(d0);
277 ENDOp();
278
279 Op(get_3atoms, ccc);
280 BEGD(d0);
281 BEGD(d1);
282 /* fetch arguments */
283 d0 = ARG1;
284
285 BEGP(pt0);
286 deref_head(d0, gatom_3unk);
287 /* argument is nonvar */
288 gatom_3nonvar:
289 if (d0 == PREG->y_u.ccc.c1) {
290 goto gatom_3b;
291 }
292 else {
293 FAIL();
294 }
295
296 deref_body(d0, pt0, gatom_3unk, gatom_3nonvar);
297 /* argument is a variable */
298 YapBind(pt0, PREG->y_u.ccc.c1);
299 ENDP(pt0);
300 gatom_3b:
301 /* fetch arguments */
302 d0 = ARG2;
303
304 BEGP(pt0);
305 deref_head(d0, gatom_3bunk);
306 /* argument is nonvar */
307 gatom_3bnonvar:
308 if (d0 == PREG->y_u.ccc.c2) {
309 goto gatom_3c;
310 }
311 else {
312 FAIL();
313 }
314
315 deref_body(d0, pt0, gatom_3bunk, gatom_3bnonvar);
316 /* argument is a variable */
317 YapBind(pt0, PREG->y_u.ccc.c2);
318 ENDP(pt0);
319 gatom_3c:
320 /* fetch arguments */
321 d0 = ARG3;
322 d1 = PREG->y_u.ccc.c3;
323
324 BEGP(pt0);
325 deref_head(d0, gatom_3cunk);
326 /* argument is nonvar */
327 gatom_3cnonvar:
328 if (d0 == d1) {
329 PREG = NEXTOP(PREG, ccc);
330 GONext();
331 }
332 else {
333 FAIL();
334 }
335
336 deref_body(d0, pt0, gatom_3cunk, gatom_3cnonvar);
337 /* argument is a variable */
338 PREG = NEXTOP(PREG, ccc);
339 YapBind(pt0, d1);
340 GONext();
341 ENDP(pt0);
342 ENDD(d1);
343 ENDD(d0);
344 ENDOp();
345
346 Op(get_4atoms, cccc);
347 BEGD(d0);
348 BEGD(d1);
349 /* fetch arguments */
350 d0 = ARG1;
351
352 BEGP(pt0);
353 deref_head(d0, gatom_4unk);
354 /* argument is nonvar */
355 gatom_4nonvar:
356 if (d0 == PREG->y_u.cccc.c1) {
357 goto gatom_4b;
358 }
359 else {
360 FAIL();
361 }
362
363 deref_body(d0, pt0, gatom_4unk, gatom_4nonvar);
364 /* argument is a variable */
365 YapBind(pt0, PREG->y_u.cccc.c1);
366 ENDP(pt0);
367 gatom_4b:
368 /* fetch arguments */
369 d0 = ARG2;
370
371 BEGP(pt0);
372 deref_head(d0, gatom_4bunk);
373 /* argument is nonvar */
374 gatom_4bnonvar:
375 if (d0 == PREG->y_u.cccc.c2) {
376 goto gatom_4c;
377 }
378 else {
379 FAIL();
380 }
381
382 deref_body(d0, pt0, gatom_4bunk, gatom_4bnonvar);
383 /* argument is a variable */
384 YapBind(pt0, PREG->y_u.cccc.c2);
385 ENDP(pt0);
386 gatom_4c:
387 /* fetch arguments */
388 d0 = ARG3;
389
390 BEGP(pt0);
391 deref_head(d0, gatom_4cunk);
392 /* argument is nonvar */
393 gatom_4cnonvar:
394 if (d0 == PREG->y_u.cccc.c3) {
395 goto gatom_4d;
396 }
397 else {
398 FAIL();
399 }
400
401 deref_body(d0, pt0, gatom_4cunk, gatom_4cnonvar);
402 /* argument is a variable */
403 YapBind(pt0, PREG->y_u.cccc.c3);
404 ENDP(pt0);
405 gatom_4d:
406 /* fetch arguments */
407 d0 = ARG4;
408 d1 = PREG->y_u.cccc.c4;
409
410 BEGP(pt0);
411 deref_head(d0, gatom_4dunk);
412 /* argument is nonvar */
413 gatom_4dnonvar:
414 if (d0 == d1) {
415 PREG = NEXTOP(PREG, cccc);
416 GONext();
417 }
418 else {
419 FAIL();
420 }
421
422 deref_body(d0, pt0, gatom_4dunk, gatom_4dnonvar);
423 /* argument is a variable */
424 PREG = NEXTOP(PREG, cccc);
425 YapBind(pt0, d1);
426 GONext();
427 ENDP(pt0);
428 ENDD(d1);
429 ENDD(d0);
430 ENDOp();
431
432 Op(get_5atoms, ccccc);
433 BEGD(d0);
434 BEGD(d1);
435 /* fetch arguments */
436 d0 = ARG1;
437
438 BEGP(pt0);
439 deref_head(d0, gatom_5unk);
440 /* argument is nonvar */
441 gatom_5nonvar:
442 if (d0 == PREG->y_u.ccccc.c1) {
443 goto gatom_5b;
444 }
445 else {
446 FAIL();
447 }
448
449 deref_body(d0, pt0, gatom_5unk, gatom_5nonvar);
450 /* argument is a variable */
451 YapBind(pt0, PREG->y_u.ccccc.c1);
452 ENDP(pt0);
453 gatom_5b:
454 /* fetch arguments */
455 d0 = ARG2;
456
457 BEGP(pt0);
458 deref_head(d0, gatom_5bunk);
459 /* argument is nonvar */
460 gatom_5bnonvar:
461 if (d0 == PREG->y_u.ccccc.c2) {
462 goto gatom_5c;
463 }
464 else {
465 FAIL();
466 }
467
468 deref_body(d0, pt0, gatom_5bunk, gatom_5bnonvar);
469 /* argument is a variable */
470 YapBind(pt0, PREG->y_u.ccccc.c2);
471 ENDP(pt0);
472 gatom_5c:
473 /* fetch arguments */
474 d0 = ARG3;
475
476 BEGP(pt0);
477 deref_head(d0, gatom_5cunk);
478 /* argument is nonvar */
479 gatom_5cnonvar:
480 if (d0 == PREG->y_u.ccccc.c3) {
481 goto gatom_5d;
482 }
483 else {
484 FAIL();
485 }
486
487 deref_body(d0, pt0, gatom_5cunk, gatom_5cnonvar);
488 /* argument is a variable */
489 YapBind(pt0, PREG->y_u.ccccc.c3);
490 ENDP(pt0);
491 gatom_5d:
492 /* fetch arguments */
493 d0 = ARG4;
494
495 BEGP(pt0);
496 deref_head(d0, gatom_5dunk);
497 /* argument is nonvar */
498 gatom_5dnonvar:
499 if (d0 == PREG->y_u.ccccc.c4) {
500 goto gatom_5e;
501 }
502 else {
503 FAIL();
504 }
505
506 deref_body(d0, pt0, gatom_5dunk, gatom_5dnonvar);
507 /* argument is a variable */
508 YapBind(pt0, PREG->y_u.ccccc.c4);
509 ENDP(pt0);
510 gatom_5e:
511 /* fetch arguments */
512 d0 = ARG5;
513 d1 = PREG->y_u.ccccc.c5;
514
515 BEGP(pt0);
516 deref_head(d0, gatom_5eunk);
517 /* argument is nonvar */
518 gatom_5enonvar:
519 if (d0 == d1) {
520 PREG = NEXTOP(PREG, ccccc);
521 GONext();
522 }
523 else {
524 FAIL();
525 }
526
527 deref_body(d0, pt0, gatom_5eunk, gatom_5enonvar);
528 /* argument is a variable */
529 PREG = NEXTOP(PREG, ccccc);
530 YapBind(pt0, d1);
531 GONext();
532 ENDP(pt0);
533 ENDD(d1);
534 ENDD(d0);
535 ENDOp();
536
537 Op(get_6atoms, cccccc);
538 BEGD(d0);
539 BEGD(d1);
540 /* fetch arguments */
541 d0 = ARG1;
542
543 BEGP(pt0);
544 deref_head(d0, gatom_6unk);
545 /* argument is nonvar */
546 gatom_6nonvar:
547 if (d0 == PREG->y_u.cccccc.c1) {
548 goto gatom_6b;
549 }
550 else {
551 FAIL();
552 }
553
554 deref_body(d0, pt0, gatom_6unk, gatom_6nonvar);
555 /* argument is a variable */
556 YapBind(pt0, PREG->y_u.cccccc.c1);
557 ENDP(pt0);
558 gatom_6b:
559 /* fetch arguments */
560 d0 = ARG2;
561
562 BEGP(pt0);
563 deref_head(d0, gatom_6bunk);
564 /* argument is nonvar */
565 gatom_6bnonvar:
566 if (d0 == PREG->y_u.cccccc.c2) {
567 goto gatom_6c;
568 }
569 else {
570 FAIL();
571 }
572
573 deref_body(d0, pt0, gatom_6bunk, gatom_6bnonvar);
574 /* argument is a variable */
575 YapBind(pt0, PREG->y_u.cccccc.c2);
576 ENDP(pt0);
577 gatom_6c:
578 /* fetch arguments */
579 d0 = ARG3;
580
581 BEGP(pt0);
582 deref_head(d0, gatom_6cunk);
583 /* argument is nonvar */
584 gatom_6cnonvar:
585 if (d0 == PREG->y_u.cccccc.c3) {
586 goto gatom_6d;
587 }
588 else {
589 FAIL();
590 }
591
592 deref_body(d0, pt0, gatom_6cunk, gatom_6cnonvar);
593 /* argument is a variable */
594 YapBind(pt0, PREG->y_u.cccccc.c3);
595 ENDP(pt0);
596 gatom_6d:
597 /* fetch arguments */
598 d0 = ARG4;
599
600 BEGP(pt0);
601 deref_head(d0, gatom_6dunk);
602 /* argument is nonvar */
603 gatom_6dnonvar:
604 if (d0 == PREG->y_u.cccccc.c4) {
605 goto gatom_6e;
606 }
607 else {
608 FAIL();
609 }
610
611 deref_body(d0, pt0, gatom_6dunk, gatom_6dnonvar);
612 /* argument is a variable */
613 YapBind(pt0, PREG->y_u.cccccc.c4);
614 ENDP(pt0);
615 gatom_6e:
616 /* fetch arguments */
617 d0 = ARG5;
618
619 BEGP(pt0);
620 deref_head(d0, gatom_6eunk);
621 /* argument is nonvar */
622 gatom_6enonvar:
623 if (d0 == PREG->y_u.cccccc.c5) {
624 goto gatom_6f;
625 }
626 else {
627 FAIL();
628 }
629
630 deref_body(d0, pt0, gatom_6eunk, gatom_6enonvar);
631 /* argument is a variable */
632 YapBind(pt0, PREG->y_u.cccccc.c5);
633 ENDP(pt0);
634 gatom_6f:
635 /* fetch arguments */
636 d0 = ARG6;
637 d1 = PREG->y_u.cccccc.c6;
638
639 BEGP(pt0);
640 deref_head(d0, gatom_6funk);
641 /* argument is nonvar */
642 gatom_6fnonvar:
643 if (d0 == d1) {
644 PREG = NEXTOP(PREG, cccccc);
645 GONext();
646 }
647 else {
648 FAIL();
649 }
650
651 deref_body(d0, pt0, gatom_6funk, gatom_6fnonvar);
652 /* argument is a variable */
653 PREG = NEXTOP(PREG, cccccc);
654 YapBind(pt0, d1);
655 GONext();
656 ENDP(pt0);
657 ENDD(d1);
658 ENDD(d0);
659 ENDOp();
660
661 /* The next instructions can lead to either the READ stream
662 * or the write stream */
663
664 OpRW(get_list, x);
665 BEGD(d0);
666 d0 = XREG(PREG->y_u.x.x);
667 deref_head(d0, glist_unk);
668
669 glist_nonvar:
670 /* did we find a list? */
671 if (!IsPairTerm(d0)) {
672 FAIL();
673 }
674 START_PREFETCH(x);
675 PREG = NEXTOP(PREG, x);
676 /* enter read mode */
677 SREG = RepPair(d0);
678 GONext();
679 END_PREFETCH();
680
681 BEGP(pt0);
682 deref_body(d0, pt0, glist_unk, glist_nonvar);
683 /* glist var */
684 /* enter write mode */
685 CACHE_S();
686 S_SREG = HR;
687 START_PREFETCH_W(x);
688 d0 = AbsPair(S_SREG);
689 YapBind(pt0, d0);
690 PREG = NEXTOP(PREG, x);
691 BEGD(d0);
692 d0 = AbsPair(S_SREG);
693 YapBind(pt0, d0);
694 S_SREG = HR;
695 /* don't put an ENDD just after a label */
696 HR = S_SREG + 2;
697 ENDD(d0);
698 WRITEBACK_S(S_SREG);
699 GONextW();
700
701
702 END_PREFETCH_W();
703 ENDCACHE_S();
704 ENDP(pt0);
705
706 ENDD(d0);
707 ENDOpRW();
708
709 OpRW(get_struct, xfa);
710 BEGD(d0);
711 d0 = XREG(PREG->y_u.xfa.x);
712 deref_head(d0, gstruct_unk);
713
714 gstruct_nonvar:
715 if (!IsApplTerm(d0))
716 FAIL();
717 /* we have met a compound term */
718 START_PREFETCH(xfa);
719 CACHE_S();
720 S_SREG = RepAppl(d0);
721 /* check functor */
722 d0 = (CELL) (PREG->y_u.xfa.f);
723 if (*S_SREG != d0) {
724 FAIL();
725 }
726 WRITEBACK_S(S_SREG+1);
727 ENDCACHE_S();
728 PREG = NEXTOP(PREG, xfa);
729 /* enter read mode */
730 GONext();
731 END_PREFETCH();
732
733 BEGP(pt0);
734 deref_body(d0, pt0, gstruct_unk, gstruct_nonvar);
735 /* Enter Write mode */
736 /* set d1 to be the new structure we are going to create */
737 START_PREFETCH_W(xfa);
738 BEGD(d1);
739 d1 = AbsAppl(HR);
740 YapBind(pt0, d1);
741 /* now, set pt0 to point to the heap where we are going to
742 * build our term */
743 pt0 = HR;
744 ENDD(d1);
745 /* first, put the functor */
746 d0 = (CELL) (PREG->y_u.xfa.f);
747 *pt0++ = d0;
748 HR = pt0 + PREG->y_u.xfa.a;
749 PREG = NEXTOP(PREG, xfa);
750 /* set SREG */
751 SREG = pt0;
752 /* update HR */
753 GONextW();
754 END_PREFETCH_W();
755 ENDP(pt0);
756
757 ENDD(d0);
758 ENDOpRW();
759
760 Op(get_float, xd);
761 BEGD(d0);
762 d0 = XREG(PREG->y_u.xd.x);
763 deref_head(d0, gfloat_unk);
764
765 gfloat_nonvar:
766 if (!IsApplTerm(d0))
767 FAIL();
768 /* we have met a preexisting float */
769 START_PREFETCH(xd);
770 BEGP(pt0);
771 pt0 = RepAppl(d0);
772 /* check functor */
773 if (*pt0 != (CELL)FunctorDouble) {
774 FAIL();
775 }
776 BEGP(pt1);
777 pt1 = PREG->y_u.xd.d;
778 PREG = NEXTOP(PREG, xd);
779 if (
780 pt1[1] != pt0[1]
781#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
782 || pt1[2] != pt0[2]
783#endif
784 ) FAIL();
785 ENDP(pt1);
786 ENDP(pt0);
787 /* enter read mode */
788 GONext();
789 END_PREFETCH();
790
791 BEGP(pt0);
792 deref_body(d0, pt0, gfloat_unk, gfloat_nonvar);
793 /* Enter Write mode */
794 /* set d1 to be the new structure we are going to create */
795 START_PREFETCH(xc);
796 BEGD(d1);
797 d1 = AbsAppl(PREG->y_u.xd.d);
798 PREG = NEXTOP(PREG, xd);
799 YapBind(pt0, d1);
800 GONext();
801 ENDD(d1);
802 END_PREFETCH();
803 ENDP(pt0);
804
805 ENDD(d0);
806 ENDOp();
807
808 Op(get_string, xu);
809 BEGD(d0);
810 d0 = XREG(PREG->y_u.xu.x);
811 deref_head(d0, gstring_unk);
812
813 gstring_nonvar:
814 if (!IsApplTerm(d0))
815 FAIL();
816 /* we have met a preexisting string */
817 START_PREFETCH(xu);
818 BEGP(pt0);
819 pt0 = RepAppl(d0);
820 /* check functor */
821 if (*pt0 != (CELL)FunctorString) {
822 FAIL();
823 }
824 BEGP(pt1);
825 pt1 = RepAppl(PREG->y_u.xu.ut);
826 PREG = NEXTOP(PREG, xu);
827 if (
828 pt1[1] != pt0[1] ||
829 strcmp((const char *)(pt1+2), (const char *)(pt0+2))
830 ) FAIL();
831 ENDP(pt1);
832 ENDP(pt0);
833 /* enter read mode */
834 GONext();
835 END_PREFETCH();
836
837 BEGP(pt0);
838 deref_body(d0, pt0, gstring_unk, gstring_nonvar);
839 /* Enter Write mode */
840 /* set d1 to be the new structure we are going to create */
841 START_PREFETCH(xc);
842 BEGD(d1);
843 d1 = PREG->y_u.xu.ut;
844 PREG = NEXTOP(PREG, xu);
845 YapBind(pt0, d1);
846 GONext();
847 ENDD(d1);
848 END_PREFETCH();
849 ENDP(pt0);
850
851 ENDD(d0);
852 ENDOp();
853
854 Op(get_longint, xi);
855 BEGD(d0);
856 d0 = XREG(PREG->y_u.xi.x);
857 deref_head(d0, glongint_unk);
858
859 glongint_nonvar:
860 if (!IsApplTerm(d0))
861 FAIL();
862 /* we have met a preexisting longint */
863 START_PREFETCH(xi);
864 BEGP(pt0);
865 pt0 = RepAppl(d0);
866 /* check functor */
867 if (*pt0 != (CELL)FunctorLongInt) {
868 FAIL();
869 }
870 if (PREG->y_u.xi.i[1] != (CELL)pt0[1]) FAIL();
871 ENDP(pt0);
872 PREG = NEXTOP(PREG, xi);
873 /* enter read mode */
874 GONext();
875 END_PREFETCH();
876
877 BEGP(pt0);
878 deref_body(d0, pt0, glongint_unk, glongint_nonvar);
879 /* Enter Write mode */
880 /* set d1 to be the new structure we are going to create */
881 START_PREFETCH(xi);
882 BEGD(d1);
883 d1 = AbsAppl(PREG->y_u.xi.i);
884 PREG = NEXTOP(PREG, xi);
885 YapBind(pt0, d1);
886 GONext();
887 ENDD(d1);
888 END_PREFETCH();
889 ENDP(pt0);
890
891 ENDD(d0);
892 ENDOp();
893
894 Op(get_bigint, xN);
895#ifdef USE_GMP
896 BEGD(d0);
897 d0 = XREG(PREG->y_u.xN.x);
898 deref_head(d0, gbigint_unk);
899
900 gbigint_nonvar:
901 if (!IsApplTerm(d0))
902 FAIL();
903 /* we have met a preexisting bigint */
904 START_PREFETCH(xN);
905 BEGP(pt0);
906 pt0 = RepAppl(d0);
907 /* check functor */
908 if (*pt0 != (CELL)FunctorBigInt)
909 {
910 FAIL();
911 }
912 if (Yap_gmp_tcmp_big_big(d0,PREG->y_u.xN.b))
913 FAIL();
914 PREG = NEXTOP(PREG, xN);
915 ENDP(pt0);
916 /* enter read mode */
917 GONext();
918 END_PREFETCH();
919
920 BEGP(pt0);
921 deref_body(d0, pt0, gbigint_unk, gbigint_nonvar);
922 /* Enter Write mode */
923 /* set d1 to be the new structure we are going to create */
924 START_PREFETCH(xN);
925 BEGD(d1);
926 d1 = PREG->y_u.xN.b;
927 PREG = NEXTOP(PREG, xN);
928 YapBind(pt0, d1);
929 GONext();
930 ENDD(d1);
931 END_PREFETCH();
932 ENDP(pt0);
933
934 ENDD(d0);
935#else
936 FAIL();
937#endif
938 ENDOp();
939
940
941 Op(get_dbterm, xD);
942 BEGD(d0);
943 d0 = XREG(PREG->y_u.xD.x);
944 deref_head(d0, gdbterm_unk);
945
946 gdbterm_nonvar:
947 BEGD(d1);
948 /* we have met a preexisting dbterm */
949 d1 = PREG->y_u.xD.D;
950 PREG = NEXTOP(PREG, xD);
951 UnifyBound(d0,d1);
952 ENDD(d1);
953
954 BEGP(pt0);
955 deref_body(d0, pt0, gdbterm_unk, gdbterm_nonvar);
956 /* Enter Write mode */
957 /* set d1 to be the new structure we are going to create */
958 START_PREFETCH(xD);
959 BEGD(d1);
960 d1 = PREG->y_u.xD.D;
961 PREG = NEXTOP(PREG, xD);
962 YapBind(pt0, d1);
963 GONext();
964 ENDD(d1);
965 END_PREFETCH();
966 ENDP(pt0);
967
968 ENDD(d0);
969 ENDOp();
970
971 /************************************************************************\
972 * Optimised Get List Instructions *
973\************************************************************************/
974 OpRW(glist_valx, xx);
975 BEGD(d0);
976 d0 = XREG(PREG->y_u.xx.xl);
977 deref_head(d0, glist_valx_write);
978 glist_valx_read:
979 BEGP(pt0);
980 /* did we find a list? */
981 if (!IsPairTerm(d0))
982 FAIL();
983 /* enter read mode */
984 START_PREFETCH(xx);
985 pt0 = RepPair(d0);
986 SREG = pt0 + 1;
987 /* start unification with first argument */
988 d0 = *pt0;
989 deref_head(d0, glist_valx_unk);
990
991 /* first argument is in d0 */
992 glist_valx_nonvar:
993 /* first argument is bound */
994 BEGD(d1);
995 d1 = XREG(PREG->y_u.xx.xr);
996 deref_head(d1, glist_valx_nonvar_unk);
997
998 glist_valx_nonvar_nonvar:
999 /* both arguments are bound */
1000 /* we may have to bind structures */
1001 PREG = NEXTOP(PREG, xx);
1002 UnifyBound(d0, d1);
1003
1004 BEGP(pt1);
1005 /* deref second argument */
1006 deref_body(d1, pt1, glist_valx_nonvar_unk, glist_valx_nonvar_nonvar);
1007 /* head bound, argument unbound */
1008 PREG = NEXTOP(PREG, xx);
1009 YapBind(pt1, d0);
1010 GONext();
1011 ENDP(pt1);
1012
1013
1014 ENDD(d1);
1015
1016 /* head may be unbound */
1017 derefa_body(d0, pt0, glist_valx_unk, glist_valx_nonvar);
1018 /* head is unbound, pt0 has the value */
1019 d0 = XREG(PREG->y_u.xx.xr);
1020 deref_head(d0, glist_valx_var_unk);
1021
1022 glist_valx_var_nonvar:
1023 /* head is unbound, second arg bound */
1024 PREG = NEXTOP(PREG, xx);
1025 Bind_Global(pt0, d0);
1026 GONext();
1027
1028 BEGP(pt1);
1029 deref_body(d0, pt1, glist_valx_var_unk, glist_valx_var_nonvar);
1030 /* head and second argument are unbound */
1031 PREG = NEXTOP(PREG, xx);
1032 UnifyGlobalCellToCell(pt0, pt1);
1033 GONext();
1034 ENDP(pt1);
1035 ENDP(pt0);
1036 END_PREFETCH();
1037
1038 BEGP(pt0);
1039 deref_body(d0, pt0, glist_valx_write, glist_valx_read);
1040 CACHE_S();
1041 /* enter write mode */
1042 S_SREG = HR;
1043 BEGD(d1);
1044 d1 = XREG(PREG->y_u.xx.xr);
1045 d0 = AbsPair(S_SREG);
1046 S_SREG[0] = d1;
1047 ENDD(d1);
1048 ALWAYS_START_PREFETCH_W(xx);
1049 PREG = NEXTOP(PREG, xx);
1050 HR = S_SREG + 2;
1051 WRITEBACK_S(S_SREG+1);
1052 YapBind(pt0, d0);
1053 ALWAYS_GONextW();
1054 ALWAYS_END_PREFETCH_W();
1055 ENDCACHE_S();
1056 ENDP(pt0);
1057
1058 ENDD(d0);
1059 ENDOpRW();
1060
1061 OpRW(glist_valy, yx);
1062 BEGD(d0);
1063 d0 = XREG(PREG->y_u.yx.x);
1064 deref_head(d0, glist_valy_write);
1065 glist_valy_read:
1066 BEGP(pt0);
1067 /* did we find a list? */
1068 if (!IsPairTerm(d0))
1069 FAIL();
1070 START_PREFETCH(yx);
1071 /* enter read mode */
1072 pt0 = RepPair(d0);
1073 SREG = pt0 + 1;
1074 /* start unification with first argument */
1075 d0 = *pt0;
1076 deref_head(d0, glist_valy_unk);
1077
1078 glist_valy_nonvar:
1079 /* first argument is bound */
1080 BEGD(d1);
1081 BEGP(pt1);
1082 pt1 = YREG + PREG->y_u.yx.y;
1083 d1 = *pt1;
1084 PREG = NEXTOP(PREG, yx);
1085 deref_head(d1, glist_valy_nonvar_unk);
1086
1087 glist_valy_nonvar_nonvar:
1088 /* both arguments are bound */
1089 /* we may have to bind structures */
1090 SREG = pt0 + 1;
1091 UnifyBound(d0, d1);
1092
1093 /* deref second argument */
1094 derefa_body(d1, pt1, glist_valy_nonvar_unk, glist_valy_nonvar_nonvar);
1095 /* first argument bound, second unbound */
1096 YapBind(pt1, d0);
1097 GONext();
1098
1099
1100 ENDP(pt1);
1101
1102 /* first argument may be unbound */
1103 derefa_body(d0, pt0, glist_valy_unk, glist_valy_nonvar);
1104 /* first argument is unbound */
1105 BEGP(pt1);
1106 pt1 = YREG+PREG->y_u.yx.y;
1107 d1 = *pt1;
1108 deref_head(d1, glist_valy_var_unk);
1109 glist_valy_var_nonvar:
1110 /* first unbound, second bound */
1111 PREG = NEXTOP(PREG, yx);
1112 Bind_Global(pt0, d1);
1113 GONext();
1114
1115 derefa_body(d1, pt1, glist_valy_var_unk, glist_valy_var_nonvar);
1116 /* both arguments are unbound */
1117 PREG = NEXTOP(PREG, yx);
1118 UnifyGlobalCellToCell(pt0, pt1);
1119 GONext();
1120 ENDP(pt1);
1121 ENDD(d1);
1122
1123 END_PREFETCH();
1124 ENDP(pt0);
1125
1126 BEGP(pt0);
1127 deref_body(d0, pt0, glist_valy_write, glist_valy_read);
1128 /* enter write mode */
1129 START_PREFETCH_W(yx);
1130 BEGP(pt1);
1131 pt1 = HR;
1132 d0 = AbsPair(pt1);
1133 YapBind(pt0, d0);
1134 BEGD(d0);
1135 /* include XREG on it */
1136 d0 = YREG[PREG->y_u.yx.y];
1137 pt1[0] = d0;
1138 ENDD(d0);
1139 HR = pt1 + 2;
1140 SREG = pt1 + 1;
1141 ENDP(pt1);
1142 PREG = NEXTOP(PREG, yx);
1143 GONextW();
1144 END_PREFETCH_W();
1145 ENDP(pt0);
1146
1147 ENDD(d0);
1148 ENDOpRW();
1149
1150 Op(gl_void_varx, xx);
1151 BEGD(d0);
1152 d0 = XREG(PREG->y_u.xx.xl);
1153 deref_head(d0, glist_void_varx_write);
1154 glist_void_varx_read:
1155 /* did we find a list? */
1156 if (!IsPairTerm(d0))
1157 FAIL();
1158 ALWAYS_START_PREFETCH(xx);
1159 /* enter read mode */
1160 BEGP(pt0);
1161 pt0 = RepPair(d0);
1162 d0 = pt0[1];
1163 XREG(PREG->y_u.xx.xr) = d0;
1164 PREG = NEXTOP(PREG, xx);
1165 ALWAYS_GONext();
1166 ENDP(pt0);
1167 ALWAYS_END_PREFETCH();
1168
1169 BEGP(pt0);
1170 deref_body(d0, pt0, glist_void_varx_write, glist_void_varx_read);
1171 /* enter write mode */
1172 BEGP(pt1);
1173 pt1 = HR;
1174 /* include XREG on it */
1175 XREG(PREG->y_u.xx.xr) =
1176 Unsigned(pt1 + 1);
1177 RESET_VARIABLE(pt1);
1178 RESET_VARIABLE(pt1+1);
1179 HR = pt1 + 2;
1180 BEGD(d0);
1181 d0 = AbsPair(pt1);
1182 YapBind(pt0, d0);
1183 PREG = NEXTOP(PREG, xx);
1184 ENDD(d0);
1185 ENDP(pt1);
1186 GONext();
1187 ENDP(pt0);
1188 ENDD(d0);
1189 ENDOp();
1190
1191 Op(gl_void_vary, yx);
1192 BEGD(d0);
1193 d0 = XREG(PREG->y_u.yx.x);
1194 deref_head(d0, glist_void_vary_write);
1195 glist_void_vary_read:
1196 /* did we find a list? */
1197 if (!IsPairTerm(d0))
1198 FAIL();
1199 /* enter read mode */
1200 BEGP(pt0);
1201 pt0 = RepPair(d0);
1202 d0 = pt0[1];
1203 ENDP(pt0);
1204 INITIALIZE_PERMVAR(YREG+PREG->y_u.yx.y,d0);
1205 PREG = NEXTOP(PREG, yx);
1206 GONext();
1207
1208 BEGP(pt0);
1209 deref_body(d0, pt0, glist_void_vary_write, glist_void_vary_read);
1210 /* enter write mode */
1211 BEGP(pt1);
1212 pt1 = HR;
1213 /* include XREG on it */
1214 INITIALIZE_PERMVAR(YREG+PREG->y_u.yx.y,Unsigned(pt1 + 1));
1215 PREG = NEXTOP(PREG, yx);
1216 RESET_VARIABLE(pt1);
1217 RESET_VARIABLE(pt1+1);
1218 d0 = AbsPair(pt1);
1219 HR = pt1 + 2;
1220 YapBind(pt0, d0);
1221 GONext();
1222 ENDP(pt1);
1223 ENDP(pt0);
1224
1225 ENDD(d0);
1226 ENDOp();
1227
1228 Op(gl_void_valx, xx);
1229 BEGD(d0);
1230 d0 = XREG(PREG->y_u.xx.xl);
1231 deref_head(d0, glist_void_valx_write);
1232 glist_void_valx_read:
1233 BEGP(pt0);
1234 /* did we find a list? */
1235 if (!IsPairTerm(d0))
1236 FAIL();
1237 /* enter read mode */
1238 pt0 = RepPair(d0)+1;
1239 /* start unification with first argument */
1240 d0 = *pt0;
1241 deref_head(d0, glist_void_valx_unk);
1242
1243 glist_void_valx_nonvar:
1244 /* first argument is bound */
1245 BEGD(d1);
1246 d1 = XREG(PREG->y_u.xx.xr);
1247 deref_head(d1, glist_void_valx_nonvar_unk);
1248
1249 glist_void_valx_nonvar_nonvar:
1250 /* both arguments are bound */
1251 /* we may have to bind structures */
1252 PREG = NEXTOP(PREG, xx);
1253 UnifyBound(d0, d1);
1254
1255 /* deref second argument */
1256 BEGP(pt1);
1257 deref_body(d1, pt1, glist_void_valx_nonvar_unk, glist_void_valx_nonvar_nonvar);
1258 /* first argument bound, second unbound */
1259 PREG = NEXTOP(PREG, xx);
1260 YapBind(pt1, d0);
1261 GONext();
1262 ENDP(pt1);
1263 ENDD(d1);
1264
1265 /* first argument may be unbound */
1266 derefa_body(d0, pt0, glist_void_valx_unk, glist_void_valx_nonvar);
1267 /* first argument is unbound */
1268 BEGD(d1);
1269 d1 = XREG(PREG->y_u.xx.xr);
1270 deref_head(d1, glist_void_valx_var_unk);
1271
1272 glist_void_valx_var_nonvar:
1273 /* first unbound, second bound */
1274 PREG = NEXTOP(PREG, xx);
1275 Bind_Global(pt0, d1);
1276 GONext();
1277
1278 BEGP(pt1);
1279 deref_body(d1, pt1, glist_void_valx_var_unk, glist_void_valx_var_nonvar);
1280 /* both arguments are unbound */
1281 PREG = NEXTOP(PREG, xx);
1282 UnifyGlobalCellToCell(pt0, pt1);
1283 GONext();
1284 ENDP(pt1);
1285 ENDD(d1);
1286 ENDP(pt0);
1287
1288 BEGP(pt0);
1289 deref_body(d0, pt0, glist_void_valx_write, glist_void_valx_read);
1290 /* enter write mode */
1291 BEGP(pt1);
1292 pt1 = HR;
1293 d0 = AbsPair(pt1);
1294 YapBind(pt0, d0);
1295 pt1 = HR;
1296 BEGD(d0);
1297 /* include XREG on it */
1298 d0 = XREG(PREG->y_u.xx.xr);
1299 RESET_VARIABLE(pt1);
1300 pt1[1] = d0;
1301 HR = pt1 + 2;
1302 ENDD(d0);
1303 ENDP(pt1);
1304 PREG = NEXTOP(PREG, xx);
1305 GONext();
1306 ENDP(pt0);
1307
1308 ENDD(d0);
1309 ENDOp();
1310
1311 Op(gl_void_valy, yx);
1312 BEGD(d0);
1313 d0 = XREG(PREG->y_u.yx.x);
1314 deref_head(d0, glist_void_valy_write);
1315 glist_void_valy_read:
1316 BEGP(pt0);
1317 /* did we find a list? */
1318 if (!IsPairTerm(d0))
1319 FAIL();
1320 /* enter read mode */
1321 pt0 = RepPair(d0)+1;
1322 /* start unification with first argument */
1323 d0 = *pt0;
1324 deref_head(d0, glist_void_valy_unk);
1325
1326 glist_void_valy_nonvar:
1327 /* first argument is bound */
1328 BEGD(d1);
1329 BEGP(pt1);
1330 pt1 = YREG+PREG->y_u.yx.y;
1331 d1 = *pt1;
1332 deref_head(d1, glist_void_valy_nonvar_unk);
1333
1334 glist_void_valy_nonvar_nonvar:
1335 /* both arguments are bound */
1336 /* we may have to bind structures */
1337 PREG = NEXTOP(PREG, yx);
1338 UnifyBound(d0, d1);
1339
1340 /* deref second argument */
1341 derefa_body(d1, pt1, glist_void_valy_nonvar_unk, glist_void_valy_nonvar_nonvar);
1342 /* first argument bound, second unbound */
1343 PREG = NEXTOP(PREG, yx);
1344 YapBind(pt1, d0);
1345 GONext();
1346
1347 ENDP(pt1);
1348
1349 /* first argument may be unbound */
1350 derefa_body(d0, pt0, glist_void_valy_unk, glist_void_valy_nonvar);
1351 /* first argument is unbound */
1352 BEGP(pt1);
1353 pt1 = YREG+PREG->y_u.yx.y;
1354 d1 = *pt1;
1355 deref_head(d1, glist_void_valy_var_unk);
1356
1357 glist_void_valy_var_nonvar:
1358 /* first unbound, second bound */
1359 PREG = NEXTOP(PREG, yx);
1360 Bind_Global(pt0, d1);
1361 GONext();
1362
1363 deref_body(d1, pt1, glist_void_valy_var_unk, glist_void_valy_var_nonvar);
1364 /* both arguments are unbound */
1365 PREG = NEXTOP(PREG, yx);
1366 UnifyGlobalCellToCell(pt0, pt1);
1367 GONext();
1368 ENDP(pt1);
1369 ENDD(d1);
1370 ENDP(pt0);
1371
1372 BEGP(pt0);
1373 deref_body(d0, pt0, glist_void_valy_write, glist_void_valy_read);
1374 /* enter write mode */
1375 CACHE_S();
1376 S_SREG = HR;
1377 d0 = AbsPair(S_SREG);
1378 YapBind(pt0, d0);
1379 S_SREG = HR;
1380 /* include XREG on it */
1381 BEGD(d1);
1382 d1 = YREG[PREG->y_u.yx.y];
1383 RESET_VARIABLE(S_SREG);
1384 S_SREG[1] = d1;
1385 ENDD(d1);
1386 PREG = NEXTOP(PREG, yx);
1387 HR = S_SREG + 2;
1388 ENDCACHE_S();
1389 GONext();
1390 ENDP(pt0);
1391 ENDD(d0);
1392 ENDOp();
1393
1394
1395
1396 /************************************************************************\
1397 * Unify instructions *
1398\************************************************************************/
1399
1400 Op(unify_x_var, ox);
1401 CACHE_S();
1402 READ_IN_S();
1403 BEGD(d0);
1404 d0 = *S_SREG;
1405#ifdef YAPOR_SBA
1406 if (d0 == 0)
1407 d0 = (CELL)S_SREG;
1408#endif
1409 WRITEBACK_S(S_SREG+1);
1410 ALWAYS_START_PREFETCH(ox);
1411 XREG(PREG->y_u.ox.x) = d0;
1412 PREG = NEXTOP(PREG, ox);
1413 ALWAYS_GONext();
1414 ALWAYS_END_PREFETCH();
1415 ENDD(d0);
1416 ENDCACHE_S();
1417 ENDOp();
1418
1419 OpW(unify_x_var_write, ox);
1420 CACHE_S();
1421 READ_IN_S();
1422 BEGP(pt0);
1423 pt0 = &XREG(PREG->y_u.ox.x);
1424 PREG = NEXTOP(PREG, ox);
1425 RESET_VARIABLE(S_SREG);
1426 *pt0 = (CELL) S_SREG;
1427 WRITEBACK_S(S_SREG+1);
1428 ENDP(pt0);
1429 ENDCACHE_S();
1430 GONextW();
1431 ENDOpW();
1432
1433 BOp(unify_l_x_var, ox);
1434 ALWAYS_START_PREFETCH(ox);
1435 BEGP(pt0);
1436 BEGD(d0);
1437 d0 = SREG[0];
1438 pt0 = &XREG(PREG->y_u.ox.x);
1439 PREG = NEXTOP(PREG, ox);
1440#ifdef YAPOR_SBA
1441 if (d0 == 0)
1442 d0 = (CELL)SREG;
1443#endif
1444 *pt0 = d0;
1445 ALWAYS_GONext();
1446 ENDD(d0);
1447 ENDP(pt0);
1448 ALWAYS_END_PREFETCH();
1449 ENDBOp();
1450
1451 BOp(unify_l_x_var_write, ox);
1452 ALWAYS_START_PREFETCH(ox);
1453 CACHE_S();
1454 READ_IN_S();
1455 BEGP(pt0);
1456 pt0 = &XREG(PREG->y_u.ox.x);
1457 PREG = NEXTOP(PREG, ox);
1458 RESET_VARIABLE(S_SREG);
1459 *pt0 = (CELL)S_SREG;
1460 ENDP(pt0);
1461 ENDCACHE_S();
1462 ALWAYS_GONext();
1463 ENDBOp();
1464 ALWAYS_END_PREFETCH();
1465
1466 BOp(unify_x_var2, oxx);
1467 CACHE_S();
1468 ALWAYS_START_PREFETCH(oxx);
1469 READ_IN_S();
1470 BEGP(pt0);
1471 pt0 = &XREG(PREG->y_u.oxx.xr);
1472 BEGD(d0);
1473 d0 = S_SREG[0];
1474 BEGD(d1);
1475 d1 = S_SREG[1];
1476#ifdef YAPOR_SBA
1477 if (d0 == 0)
1478 d0 = (CELL)S_SREG;
1479 if (d1 == 0)
1480 d1 = (CELL)(S_SREG+1);
1481#endif
1482 WRITEBACK_S(S_SREG+2);
1483 XREG(PREG->y_u.oxx.xl) = d0;
1484 PREG = NEXTOP(PREG, oxx);
1485 *pt0 = d1;
1486 ENDD(d0);
1487 ENDD(d1);
1488 ENDP(pt0);
1489 ALWAYS_GONext();
1490 ENDBOp();
1491 ALWAYS_END_PREFETCH();
1492 ENDCACHE_S();
1493
1494 OpW(unify_x_var2_write, oxx);
1495 CACHE_S();
1496 READ_IN_S();
1497 BEGP(pt0);
1498 pt0 = &XREG(PREG->y_u.oxx.xr);
1499 RESET_VARIABLE(S_SREG);
1500 XREG(PREG->y_u.oxx.xl) = (CELL) S_SREG;
1501 S_SREG++;
1502 PREG = NEXTOP(PREG, oxx);
1503 RESET_VARIABLE(S_SREG);
1504 *pt0 = (CELL) S_SREG;
1505 ENDP(pt0);
1506 WRITEBACK_S(S_SREG+1);
1507 ENDCACHE_S();
1508 GONextW();
1509 ENDOpW();
1510
1511 BOp(unify_l_x_var2, oxx);
1512 ALWAYS_START_PREFETCH(oxx);
1513 CACHE_S();
1514 READ_IN_S();
1515 BEGP(pt0);
1516 pt0 = &XREG(PREG->y_u.oxx.xr);
1517 BEGD(d0);
1518 d0 = S_SREG[0];
1519 BEGD(d1);
1520 d1 = S_SREG[1];
1521#ifdef YAPOR_SBA
1522 if (d0 == 0)
1523 XREG(PREG->y_u.oxx.xl) = (CELL)S_SREG;
1524 else
1525#endif
1526 XREG(PREG->y_u.oxx.xl) = d0;
1527 PREG = NEXTOP(PREG, oxx);
1528#ifdef YAPOR_SBA
1529 if (d1 == 0)
1530 *pt0 = (CELL)(S_SREG+1);
1531 else
1532#endif
1533 *pt0 = d1;
1534 ENDD(d0);
1535 ENDD(d1);
1536 ENDP(pt0);
1537 ENDCACHE_S();
1538 ALWAYS_GONext();
1539 ENDBOp();
1540 ALWAYS_END_PREFETCH();
1541
1542 Op(unify_l_x_var2_write, oxx);
1543 CACHE_S();
1544 READ_IN_S();
1545 BEGP(pt0);
1546 pt0 = &XREG(PREG->y_u.oxx.xr);
1547 XREG(PREG->y_u.oxx.xl) = (CELL) S_SREG;
1548 RESET_VARIABLE(S_SREG);
1549 S_SREG++;
1550 *pt0 = (CELL) S_SREG;
1551 PREG = NEXTOP(PREG, oxx);
1552 RESET_VARIABLE(S_SREG);
1553 ENDP(pt0);
1554 ENDCACHE_S();
1555 GONext();
1556 ENDOp();
1557
1558 Op(unify_y_var, oy);
1559 BEGD(d0);
1560 d0 = *SREG++;
1561#ifdef YAPOR_SBA
1562 if (d0 == 0) {
1563 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,(CELL)(SREG-1));
1564 } else
1565#else
1566 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,d0);
1567#endif /* YAPOR_SBA */
1568 PREG = NEXTOP(PREG, oy);
1569 GONext();
1570 ENDD(d0);
1571 ENDOp();
1572
1573 OpW(unify_y_var_write, oy);
1574 CACHE_S();
1575 READ_IN_S();
1576 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,(CELL) S_SREG);
1577 PREG = NEXTOP(PREG, oy);
1578 RESET_VARIABLE(S_SREG);
1579 WRITEBACK_S(S_SREG+1);
1580 ENDCACHE_S();
1581 GONextW();
1582 ENDOpW();
1583
1584 Op(unify_l_y_var, oy);
1585 BEGD(d0);
1586 d0 = SREG[0];
1587#ifdef YAPOR_SBA
1588 if (d0 == 0) {
1589 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,(CELL)SREG);
1590 } else
1591#else
1592 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,d0);
1593#endif /* YAPOR_SBA */
1594 PREG = NEXTOP(PREG, oy);
1595 GONext();
1596 ENDD(d0);
1597 ENDOp();
1598
1599 Op(unify_l_y_var_write, oy);
1600 CACHE_S();
1601 READ_IN_S();
1602 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,(CELL) S_SREG);
1603 PREG = NEXTOP(PREG, oy);
1604 RESET_VARIABLE(S_SREG);
1605 ENDCACHE_S();
1606 GONext();
1607 ENDOp();
1608
1609 /* We assume the value in X is pointing to an object in the
1610 * global stack */
1611 Op(unify_x_val, ox);
1612 BEGD(d0);
1613 BEGD(d1);
1614 BEGP(pt0);
1615 pt0 = SREG;
1616 d0 = *pt0;
1617 deref_head(d0, uvalx_unk);
1618
1619 uvalx_nonvar:
1620 /* first argument is bound */
1621 d1 = XREG(PREG->y_u.ox.x);
1622 deref_head(d1, uvalx_nonvar_unk);
1623
1624 uvalx_nonvar_nonvar:
1625 /* both arguments are bound */
1626 /* we may have to bind structures */
1627 PREG = NEXTOP(PREG, ox);
1628 SREG++;
1629 UnifyBound(d0, d1);
1630
1631 /* deref second argument */
1632 /* pt0 is in the structure and pt1 the register */
1633 BEGP(pt1);
1634 deref_body(d1, pt1, uvalx_nonvar_unk, uvalx_nonvar_nonvar);
1635 /* first argument bound, second unbound */
1636 PREG = NEXTOP(PREG, ox);
1637 SREG++;
1638 YapBind(pt1, d0);
1639 GONext();
1640 ENDP(pt1);
1641
1642 /* first argument may be unbound */
1643 derefa_body(d0, pt0, uvalx_unk, uvalx_nonvar);
1644 /* first argument is unbound */
1645 d1 = XREG(PREG->y_u.ox.x);
1646 deref_head(d1, uvalx_var_unk);
1647
1648 uvalx_var_nonvar:
1649 /* first unbound, second bound */
1650 PREG = NEXTOP(PREG, ox);
1651 SREG++;
1652 Bind_Global(pt0, d1);
1653 GONext();
1654
1655 BEGP(pt1);
1656 deref_body(d1, pt1, uvalx_var_unk, uvalx_var_nonvar);
1657 /* both arguments are unbound */
1658 PREG = NEXTOP(PREG, ox);
1659 SREG++;
1660 UnifyGlobalCellToCell(pt0, pt1);
1661 GONext();
1662 ENDP(pt1);
1663 ENDP(pt0);
1664 ENDD(d1);
1665 ENDD(d0);
1666 ENDOp();
1667
1668 OpW(unify_x_val_write, ox);
1669 /* we are in write mode */
1670 *SREG++ = XREG(PREG->y_u.ox.x);
1671 PREG = NEXTOP(PREG, ox);
1672 GONextW();
1673 ENDOpW();
1674
1675 /* We assume the value in X is pointing to an object in the
1676 * global stack */
1677 Op(unify_l_x_val, ox);
1678 BEGD(d0);
1679 BEGD(d1);
1680 BEGP(pt0);
1681 pt0 = SREG;
1682 d0 = *pt0;
1683 deref_head(d0, ulvalx_unk);
1684
1685 ulvalx_nonvar:
1686 /* first argument is bound */
1687 d1 = XREG(PREG->y_u.ox.x);
1688 deref_head(d1, ulvalx_nonvar_unk);
1689
1690 ulvalx_nonvar_nonvar:
1691 /* both arguments are bound */
1692 /* we may have to bind structures */
1693 PREG = NEXTOP(PREG, ox);
1694 UnifyBound(d0, d1);
1695
1696 BEGP(pt1);
1697 /* deref second argument */
1698 deref_body(d1, pt1, ulvalx_nonvar_unk, ulvalx_nonvar_nonvar);
1699 /* first argument bound, second unbound */
1700 PREG = NEXTOP(PREG, ox);
1701 YapBind(pt1, d0);
1702 GONext();
1703 ENDP(pt1);
1704
1705 /* first argument may be unbound */
1706 derefa_body(d0, pt0, ulvalx_unk, ulvalx_nonvar);
1707 /* first argument is unbound */
1708 d1 = XREG(PREG->y_u.ox.x);
1709 deref_head(d1, ulvalx_var_unk);
1710
1711 ulvalx_var_nonvar:
1712 /* first unbound, second bound */
1713 PREG = NEXTOP(PREG, ox);
1714 Bind_Global(pt0, d1);
1715 GONext();
1716
1717 BEGP(pt1);
1718 deref_body(d1, pt1, ulvalx_var_unk, ulvalx_var_nonvar);
1719 /* both arguments are unbound */
1720 PREG = NEXTOP(PREG, ox);
1721 UnifyGlobalCellToCell(pt0, pt1);
1722 GONext();
1723 ENDP(pt1);
1724 ENDP(pt0);
1725 ENDD(d1);
1726 ENDD(d0);
1727 ENDOp();
1728
1729 Op(unify_l_x_val_write, ox);
1730 /* we are in write mode */
1731 SREG[0] = XREG(PREG->y_u.ox.x);
1732 PREG = NEXTOP(PREG, ox);
1733 GONext();
1734 ENDOp();
1735
1736 /* We assume the value in X is pointing to an object in the
1737 * global stack */
1738 Op(unify_y_val, oy);
1739 BEGD(d0);
1740 BEGD(d1);
1741 BEGP(pt0);
1742 pt0 = SREG;
1743 d0 = *pt0;
1744 deref_head(d0, uvaly_unk);
1745
1746 uvaly_nonvar:
1747 /* first argument is bound */
1748 BEGP(pt1);
1749 pt1 = YREG+PREG->y_u.oy.y;
1750 d1 = *pt1;
1751 deref_head(d1, uvaly_nonvar_unk);
1752
1753 uvaly_nonvar_nonvar:
1754 /* both arguments are bound */
1755 /* we may have to bind structures */
1756 PREG = NEXTOP(PREG, oy);
1757 SREG++;
1758 UnifyBound(d0, d1);
1759
1760 /* deref second argument */
1761 derefa_body(d1, pt1, uvaly_nonvar_unk, uvaly_nonvar_nonvar);
1762 /* first argument bound, second unbound */
1763 PREG = NEXTOP(PREG, oy);
1764 SREG++;
1765 YapBind(pt1, d0);
1766 GONext();
1767 ENDP(pt1);
1768
1769 /* first argument may be unbound */
1770 derefa_body(d0, pt0, uvaly_unk, uvaly_nonvar);
1771 /* first argument is unbound */
1772 BEGP(pt1);
1773 pt1 = YREG+PREG->y_u.oy.y;
1774 d1 = *pt1;
1775 deref_head(d1, uvaly_var_unk);
1776
1777 uvaly_var_nonvar:
1778 /* first unbound, second bound */
1779 PREG = NEXTOP(PREG, oy);
1780 SREG++;
1781 Bind_Global(pt0, d1);
1782 GONext();
1783
1784 derefa_body(d1, pt1, uvaly_var_unk, uvaly_var_nonvar);
1785 /* both arguments are unbound */
1786 PREG = NEXTOP(PREG, oy);
1787 SREG++;
1788 UnifyGlobalCellToCell(pt0, pt1);
1789 GONext();
1790 ENDP(pt1);
1791 ENDP(pt0);
1792 ENDD(d1);
1793 ENDD(d0);
1794 ENDOp();
1795
1796 OpW(unify_y_val_write, oy);
1797 /* we are in write mode */
1798 BEGD(d0);
1799 d0 = YREG[PREG->y_u.oy.y];
1800#ifdef YAPOR_SBA
1801 if (d0 == 0) /* free variable */
1802 *SREG++ = (CELL)(YREG+PREG->y_u.oy.y);
1803 else
1804#endif
1805 *SREG++ = d0;
1806 ENDD(d0);
1807 PREG = NEXTOP(PREG, oy);
1808 GONextW();
1809 ENDOpW();
1810
1811 /* We assume the value in X is pointing to an object in the
1812 * global stack */
1813 Op(unify_l_y_val, oy);
1814 BEGD(d0);
1815 BEGD(d1);
1816 BEGP(pt0);
1817 pt0 = SREG;
1818 d0 = *pt0;
1819 deref_head(d0, ulvaly_unk);
1820
1821 ulvaly_nonvar:
1822 /* first argument is bound */
1823 BEGP(pt1);
1824 pt1 = YREG+PREG->y_u.oy.y;
1825 d1 = *pt1;
1826 deref_head(d1, ulvaly_nonvar_unk);
1827
1828 ulvaly_nonvar_nonvar:
1829 /* both arguments are bound */
1830 /* we may have to bind structures */
1831 PREG = NEXTOP(PREG, oy);
1832 UnifyBound(d0, d1);
1833
1834 /* deref second argument */
1835 derefa_body(d1, pt1, ulvaly_nonvar_unk, ulvaly_nonvar_nonvar);
1836 /* first argument bound, second unbound */
1837 PREG = NEXTOP(PREG, oy);
1838 YapBind(pt1, d0);
1839 GONext();
1840 ENDP(pt1);
1841
1842 /* first argument may be unbound */
1843 derefa_body(d0, pt0, ulvaly_unk, ulvaly_nonvar);
1844 /* first argument is unbound */
1845 BEGP(pt1);
1846 pt1 = YREG+PREG->y_u.oy.y;
1847 d1 = *pt1;
1848 deref_head(d1, ulvaly_var_unk);
1849
1850 ulvaly_var_nonvar:
1851 /* first unbound, second bound */
1852 PREG = NEXTOP(PREG, oy);
1853 Bind_Global(pt0, d1);
1854 GONext();
1855
1856 /* Here we are in trouble: we have a clash between pt1 and
1857 * SREG. We address this by storing SREG in d0 for the duration. */
1858 derefa_body(d1, pt1, ulvaly_var_unk, ulvaly_var_nonvar);
1859 /* both arguments are unbound */
1860 PREG = NEXTOP(PREG, oy);
1861 UnifyGlobalCellToCell(pt0, pt1);
1862 GONext();
1863 ENDP(pt1);
1864 ENDP(pt0);
1865 ENDD(d1);
1866 ENDD(d0);
1867 ENDOp();
1868
1869 Op(unify_l_y_val_write, oy);
1870 /* we are in write mode */
1871 BEGD(d0);
1872 d0 = YREG[PREG->y_u.oy.y];
1873#ifdef YAPOR_SBA
1874 if (d0 == 0) /* new variable */
1875 SREG[0] = (CELL)(YREG+PREG->y_u.oy.y);
1876 else
1877#endif
1878 SREG[0] = d0;
1879 ENDD(d0);
1880 PREG = NEXTOP(PREG, oy);
1881 GONext();
1882 ENDOp();
1883
1884 /* In the next instructions, we do not know anything about
1885 * what is in X */
1886 Op(unify_x_loc, ox);
1887 BEGD(d0);
1888 BEGD(d1);
1889 BEGP(pt0);
1890 pt0 = SREG;
1891 d0 = *pt0;
1892 deref_head(d0, uvalx_loc_unk);
1893
1894 uvalx_loc_nonvar:
1895 /* first argument is bound */
1896 d1 = XREG(PREG->y_u.ox.x);
1897 deref_head(d1, uvalx_loc_nonvar_unk);
1898
1899 uvalx_loc_nonvar_nonvar:
1900 /* both arguments are bound */
1901 /* we may have to bind structures */
1902 PREG = NEXTOP(PREG, ox);
1903 SREG++;
1904 UnifyBound(d0, d1);
1905
1906 BEGP(pt1);
1907 /* deref second argument */
1908 deref_body(d1, pt1, uvalx_loc_nonvar_unk, uvalx_loc_nonvar_nonvar);
1909 /* first argument bound, second unbound */
1910 PREG = NEXTOP(PREG, ox);
1911 SREG++;
1912 YapBind(pt1, d0);
1913 GONext();
1914 ENDP(pt1);
1915
1916
1917 /* first argument may be unbound */
1918 derefa_body(d0, pt0, uvalx_loc_unk, uvalx_loc_nonvar);
1919 /* first argument is unbound */
1920 d1 = XREG(PREG->y_u.ox.x);
1921 deref_head(d1, uvalx_loc_var_unk);
1922
1923 uvalx_loc_var_nonvar:
1924 /* first unbound, second bound */
1925 PREG = NEXTOP(PREG, ox);
1926 SREG++;
1927 Bind_Global(pt0, d1);
1928 GONext();
1929
1930 /* Here we are in trouble: we have a clash between pt1 and
1931 * SREG. We address this by storing SREG in d0 for the duration. */
1932 BEGP(pt1);
1933 deref_body(d1, pt1, uvalx_loc_var_unk, uvalx_loc_var_nonvar);
1934 /* both arguments are unbound */
1935 PREG = NEXTOP(PREG, ox);
1936 SREG++;
1937 UnifyCells(pt0, pt1);
1938 GONext();
1939 ENDP(pt1);
1940 ENDP(pt0);
1941 ENDD(d1);
1942 ENDD(d0);
1943 ENDOp();
1944
1945 OpW(unify_x_loc_write, ox);
1946 /* we are in write mode */
1947 BEGD(d0);
1948 d0 = XREG(PREG->y_u.ox.x);
1949 deref_head(d0, unify_x_loc_unk);
1950 unify_x_loc_nonvar:
1951 *SREG++ = d0;
1952 PREG = NEXTOP(PREG, ox);
1953 GONextW();
1954
1955 BEGP(pt0);
1956 deref_body(d0, pt0, unify_x_loc_unk, unify_x_loc_nonvar);
1957 /* move ahead in the instructions */
1958 PREG = NEXTOP(PREG, ox);
1959 /* d0 is a variable, check whether we need to globalise it */
1960 if (pt0 < HR) {
1961 /* variable is global */
1962 *SREG++ = Unsigned(pt0);
1963 GONextW();
1964 }
1965 else {
1966 /* bind our variable to the structure */
1967 CACHE_S();
1968 READ_IN_S();
1969 Bind_Local(pt0, Unsigned(S_SREG));
1970 RESET_VARIABLE(S_SREG);
1971 WRITEBACK_S(S_SREG+1);
1972 ENDCACHE_S();
1973 GONextW();
1974 }
1975 ENDP(pt0);
1976 ENDD(d0);
1977 ENDOpW();
1978
1979 /* In the next instructions, we do not know anything about
1980 * what is in X */
1981 Op(unify_l_x_loc, ox);
1982 BEGD(d0);
1983 BEGD(d1);
1984 BEGP(pt0);
1985 pt0 = SREG;
1986 d0 = *pt0;
1987 deref_head(d0, ulvalx_loc_unk);
1988
1989 ulvalx_loc_nonvar:
1990 /* first argument is bound */
1991 d1 = XREG(PREG->y_u.ox.x);
1992 deref_head(d1, ulvalx_loc_nonvar_unk);
1993
1994 ulvalx_loc_nonvar_nonvar:
1995 /* both arguments are bound */
1996 /* we may have to bind structures */
1997 PREG = NEXTOP(PREG, ox);
1998 UnifyBound(d0, d1);
1999
2000 /* deref second argument */
2001 deref_body(d1, pt0, ulvalx_loc_nonvar_unk, ulvalx_loc_nonvar_nonvar);
2002 /* first argument bound, second unbound */
2003 PREG = NEXTOP(PREG, ox);
2004 YapBind(pt0, d0);
2005 GONext();
2006
2007 /* first argument may be unbound */
2008 derefa_body(d0, pt0, ulvalx_loc_unk, ulvalx_loc_nonvar);
2009 /* first argument is unbound */
2010 d1 = XREG(PREG->y_u.ox.x);
2011 deref_head(d1, ulvalx_loc_var_unk);
2012
2013 ulvalx_loc_var_nonvar:
2014 /* first unbound, second bound */
2015 PREG = NEXTOP(PREG, ox);
2016 Bind_Global(pt0, d1);
2017 GONext();
2018
2019 BEGP(pt1);
2020 deref_body(d1, pt1, ulvalx_loc_var_unk, ulvalx_loc_var_nonvar);
2021 /* both arguments are unbound */
2022 PREG = NEXTOP(PREG, ox);
2023 UnifyGlobalCellToCell(pt0, pt1);
2024 GONext();
2025 ENDP(pt1);
2026 ENDP(pt0);
2027 ENDD(d1);
2028 ENDD(d0);
2029 ENDOp();
2030
2031 Op(unify_l_x_loc_write, ox);
2032 /* we are in write mode */
2033 BEGD(d0);
2034 d0 = XREG(PREG->y_u.ox.x);
2035 deref_head(d0, ulnify_x_loc_unk);
2036 ulnify_x_loc_nonvar:
2037 SREG[0] = d0;
2038 PREG = NEXTOP(PREG, ox);
2039 GONext();
2040
2041 BEGP(pt0);
2042 deref_body(d0, pt0, ulnify_x_loc_unk, ulnify_x_loc_nonvar);
2043 /* d0 is a variable, check whether we need to globalise it */
2044 PREG = NEXTOP(PREG, ox);
2045 if (pt0 < HR) {
2046 /* variable is global */
2047 SREG[0] = Unsigned(pt0);
2048 GONext();
2049 }
2050 else {
2051 /* create a new Heap variable and bind our variable to it */
2052 Bind_Local(pt0, Unsigned(SREG));
2053 RESET_VARIABLE(SREG);
2054 GONext();
2055 }
2056 ENDP(pt0);
2057 ENDD(d0);
2058 ENDOpW();
2059
2060 Op(unify_y_loc, oy);
2061 /* we are in read mode */
2062 BEGD(d0);
2063 BEGD(d1);
2064 BEGP(pt0);
2065 pt0 = SREG;
2066 d0 = *pt0;
2067 deref_head(d0, uvaly_loc_unk);
2068
2069 uvaly_loc_nonvar:
2070 /* structure is bound */
2071 BEGP(pt1);
2072 pt1 = YREG+PREG->y_u.oy.y;
2073 d1 = *pt1;
2074 deref_head(d1, uvaly_loc_nonvar_unk);
2075
2076 uvaly_loc_nonvar_nonvar:
2077 /* both arguments are bound */
2078 /* we may have to bind structures */
2079 PREG = NEXTOP(PREG, oy);
2080 SREG++;
2081 UnifyBound(d0, d1);
2082
2083 /* deref second argument */
2084 derefa_body(d1, pt1, uvaly_loc_nonvar_unk, uvaly_loc_nonvar_nonvar);
2085 /* first argument bound, second unbound */
2086 PREG = NEXTOP(PREG, oy);
2087 SREG++;
2088 YapBind(pt1, d0);
2089 GONext();
2090 ENDP(pt1);
2091
2092 /* first argument may be unbound */
2093 derefa_body(d0, pt0, uvaly_loc_unk, uvaly_loc_nonvar);
2094 /* first argument is unbound */
2095 BEGP(pt1);
2096 pt1 = YREG+PREG->y_u.oy.y;
2097 d1 = *pt1;
2098 deref_head(d1, uvaly_loc_var_unk);
2099
2100 uvaly_loc_var_nonvar:
2101 /* first unbound, second bound */
2102 PREG = NEXTOP(PREG, oy);
2103 SREG++;
2104 Bind_Global(pt0, d1);
2105 GONext();
2106
2107 /* Here we are in trouble: we have a clash between pt1 and
2108 * SREG. We address this by storing SREG in d0 for the duration. */
2109 derefa_body(d1, pt1, uvaly_loc_var_unk, uvaly_loc_var_nonvar);
2110 /* both arguments are unbound */
2111 PREG = NEXTOP(PREG, oy);
2112 SREG++;
2113 UnifyCells(pt0, pt1);
2114 GONext();
2115 ENDP(pt1);
2116 ENDP(pt0);
2117 ENDD(d1);
2118 ENDD(d0);
2119 ENDOp();
2120
2121 OpW(unify_y_loc_write, oy);
2122 /* we are in write mode */
2123 BEGD(d0);
2124 BEGP(pt0);
2125 pt0 = YREG+PREG->y_u.oy.y;
2126 d0 = *pt0;
2127 deref_head(d0, unify_y_loc_unk);
2128 unify_y_loc_nonvar:
2129 *SREG++ = d0;
2130 PREG = NEXTOP(PREG, oy);
2131 GONextW();
2132
2133 derefa_body(d0, pt0, unify_y_loc_unk, unify_y_loc_nonvar);
2134 /* d0 is a variable, check whether we need to globalise it */
2135 PREG = NEXTOP(PREG, oy);
2136 if (pt0 < HR) {
2137 /* variable is global */
2138 *SREG++ = Unsigned(pt0);
2139 GONextW();
2140 }
2141 else {
2142 /* create a new Heap variable and bind our variable to it */
2143 CACHE_S();
2144 READ_IN_S();
2145 Bind_Local(pt0, Unsigned(S_SREG));
2146 RESET_VARIABLE(S_SREG);
2147 WRITEBACK_S(S_SREG+1);
2148 ENDCACHE_S();
2149 GONextW();
2150 }
2151 ENDP(pt0);
2152 ENDD(d0);
2153 ENDOpW();
2154
2155 Op(unify_l_y_loc, oy);
2156 /* else we are in read mode */
2157 BEGD(d0);
2158 BEGD(d1);
2159 BEGP(pt0);
2160 pt0 = SREG;
2161 d0 = *pt0;
2162 deref_head(d0, ulvaly_loc_unk);
2163
2164 ulvaly_loc_nonvar:
2165 /* structure is bound */
2166 BEGP(pt1);
2167 pt1 = YREG+PREG->y_u.oy.y;
2168 d1 = *pt1;
2169 deref_head(d1, ulvaly_loc_nonvar_unk);
2170
2171 ulvaly_loc_nonvar_nonvar:
2172 /* both arguments are bound */
2173 /* we may have to bind structures */
2174 PREG = NEXTOP(PREG, oy);
2175 UnifyBound(d0, d1);
2176
2177 /* deref second argument */
2178 derefa_body(d1, pt1, ulvaly_loc_nonvar_unk, ulvaly_loc_nonvar_nonvar);
2179 /* first argument bound, second unbound */
2180 PREG = NEXTOP(PREG, oy);
2181 YapBind(pt1, d0);
2182 GONext();
2183 ENDP(pt1);
2184
2185 /* first argument may be unbound */
2186 derefa_body(d0, pt0, ulvaly_loc_unk, ulvaly_loc_nonvar);
2187 /* first argument is unbound */
2188 BEGP(pt1);
2189 pt1 = YREG+PREG->y_u.oy.y;
2190 d1 = *pt1;
2191 deref_head(d1, ulvaly_loc_var_unk);
2192
2193 ulvaly_loc_var_nonvar:
2194 /* first unbound, second bound */
2195 PREG = NEXTOP(PREG, oy);
2196 Bind_Global(pt0, d1);
2197 GONext();
2198
2199 /* Here we are in trouble: we have a clash between pt1 and
2200 * SREG. We address this by storing SREG in d0 for the duration. */
2201 derefa_body(d1, pt1, ulvaly_loc_var_unk, ulvaly_loc_var_nonvar);
2202 /* both arguments are unbound */
2203 PREG = NEXTOP(PREG, oy);
2204 UnifyGlobalCellToCell(pt0, pt1);
2205 GONext();
2206 ENDP(pt1);
2207 ENDP(pt0);
2208 ENDD(d1);
2209 ENDD(d0);
2210 ENDOp();
2211
2212 Op(unify_l_y_loc_write, oy);
2213 /* we are in write mode */
2214 BEGD(d0);
2215 BEGP(pt0);
2216 pt0 = YREG+PREG->y_u.oy.y;
2217 d0 = *pt0;
2218 deref_head(d0, ulunify_y_loc_unk);
2219 ulunify_y_loc_nonvar:
2220 SREG[0] = d0;
2221 PREG = NEXTOP(PREG, oy);
2222 GONext();
2223
2224 derefa_body(d0, pt0, ulunify_y_loc_unk, ulunify_y_loc_nonvar);
2225 /* d0 is a variable, check whether we need to globalise it */
2226 PREG = NEXTOP(PREG, oy);
2227 if (pt0 < HR) {
2228 /* variable is global */
2229 SREG[0] = Unsigned(pt0);
2230 GONext();
2231 }
2232 else {
2233 /* create a new Heap variable and bind our variable to it */
2234 CACHE_S();
2235 READ_IN_S();
2236 Bind_Local(pt0, Unsigned(S_SREG));
2237 RESET_VARIABLE(S_SREG);
2238 ENDCACHE_S();
2239 GONext();
2240 }
2241 ENDP(pt0);
2242 ENDD(d0);
2243 ENDOp();
2244
2245 Op(unify_void, o);
2246 START_PREFETCH(o);
2247 PREG = NEXTOP(PREG, o);
2248 SREG++;
2249 GONext();
2250 END_PREFETCH();
2251 ENDOp();
2252
2253 OpW(unify_void_write, o);
2254 CACHE_S();
2255 READ_IN_S();
2256 PREG = NEXTOP(PREG, o);
2257 RESET_VARIABLE(S_SREG);
2258 WRITEBACK_S(S_SREG+1);
2259 ENDCACHE_S();
2260 GONextW();
2261 ENDOpW();
2262
2263 Op(unify_l_void, o);
2264 PREG = NEXTOP(PREG, o);
2265 GONext();
2266 ENDOp();
2267
2268 Op(unify_l_void_write, o);
2269 PREG = NEXTOP(PREG, o);
2270 RESET_VARIABLE(SREG);
2271 GONext();
2272 ENDOp();
2273
2274 Op(unify_n_voids, os);
2275 SREG += PREG->y_u.os.s;
2276 PREG = NEXTOP(PREG, os);
2277 GONext();
2278 ENDOp();
2279
2280 OpW(unify_n_voids_write, os);
2281 BEGD(d0);
2282 CACHE_S();
2283 d0 = PREG->y_u.os.s;
2284 READ_IN_S();
2285 PREG = NEXTOP(PREG, os);
2286 for (; d0 > 0; d0--) {
2287 RESET_VARIABLE(S_SREG);
2288 S_SREG++;
2289 }
2290 WRITEBACK_S(S_SREG);
2291 ENDCACHE_S();
2292 ENDD(d0);
2293 GONextW();
2294 ENDOpW();
2295
2296 Op(unify_l_n_voids, os);
2297 PREG = NEXTOP(PREG, os);
2298 GONext();
2299 ENDOp();
2300
2301 Op(unify_l_n_voids_write, os);
2302 BEGD(d0);
2303 d0 = PREG->y_u.os.s;
2304 PREG = NEXTOP(PREG, os);
2305 CACHE_S();
2306 READ_IN_S();
2307 for (; d0 > 0; d0--) {
2308 RESET_VARIABLE(S_SREG);
2309 S_SREG++;
2310 }
2311 ENDCACHE_S();
2312 ENDD(d0);
2313 GONext();
2314 ENDOp();
2315
2316 Op(unify_atom, oc);
2317 BEGD(d0);
2318 BEGP(pt0);
2319 pt0 = SREG++;
2320 d0 = *pt0;
2321 deref_head(d0, uatom_unk);
2322 uatom_nonvar:
2323 if (d0 != PREG->y_u.oc.c) {
2324 FAIL();
2325 }
2326 PREG = NEXTOP(PREG, oc);
2327 GONext();
2328
2329 derefa_body(d0, pt0, uatom_unk, uatom_nonvar);
2330 d0 = PREG->y_u.oc.c;
2331 PREG = NEXTOP(PREG, oc);
2332 Bind_Global(pt0, d0);
2333 GONext();
2334 ENDP(pt0);
2335 ENDD(d0);
2336 ENDOp();
2337
2338 OpW(unify_atom_write, oc);
2339 * SREG++ = PREG->y_u.oc.c;
2340 PREG = NEXTOP(PREG, oc);
2341 GONextW();
2342 ENDOpW();
2343
2344 Op(unify_l_atom, oc);
2345 BEGD(d0);
2346 BEGP(pt0);
2347 pt0 = SREG;
2348 d0 = *SREG;
2349 deref_head(d0, ulatom_unk);
2350 ulatom_nonvar:
2351 if (d0 != PREG->y_u.oc.c) {
2352 FAIL();
2353 }
2354 PREG = NEXTOP(PREG, oc);
2355 GONext();
2356
2357 derefa_body(d0, pt0, ulatom_unk, ulatom_nonvar);
2358 d0 = PREG->y_u.oc.c;
2359 PREG = NEXTOP(PREG, oc);
2360 Bind_Global(pt0, d0);
2361 GONext();
2362 ENDP(pt0);
2363 ENDD(d0);
2364 ENDOp();
2365
2366 Op(unify_l_atom_write, oc);
2367 SREG[0] = PREG->y_u.oc.c;
2368 PREG = NEXTOP(PREG, oc);
2369 GONext();
2370 ENDOp();
2371
2372 Op(unify_n_atoms, osc);
2373 {
2374 register Int i = PREG->y_u.osc.s; /* not enough registers */
2375
2376 BEGD(d1);
2377 d1 = PREG->y_u.osc.c;
2378 for (; i > 0; i--) {
2379 BEGD(d0);
2380 BEGP(pt0);
2381 pt0 = SREG++;
2382 d0 = *pt0;
2383 deref_head(d0, uatom_n_var);
2384 uatom_n_nonvar:
2385 if (d0 != d1) {
2386 FAIL();
2387 }
2388 continue;
2389
2390 derefa_body(d0, pt0, uatom_n_var, uatom_n_nonvar);
2391 Bind_Global(pt0, d1);
2392 continue;
2393 ENDP(pt0);
2394 ENDD(d0);
2395 }
2396 ENDD(d1);
2397 }
2398 PREG = NEXTOP(PREG, osc);
2399 GONext();
2400 ENDOp();
2401
2402 OpW(unify_n_atoms_write, osc);
2403 BEGD(d0);
2404 BEGD(d1);
2405 d0 = PREG->y_u.osc.s;
2406 d1 = PREG->y_u.osc.c;
2407 /* write N atoms */
2408 CACHE_S();
2409 READ_IN_S();
2410 PREG = NEXTOP(PREG, osc);
2411 for (; d0 > 0; d0--)
2412 *S_SREG++ = d1;
2413 WRITEBACK_S(S_SREG);
2414 ENDCACHE_S();
2415 ENDD(d1);
2416 ENDD(d0);
2417 GONextW();
2418 ENDOpW();
2419
2420 Op(unify_float, od);
2421 BEGD(d0);
2422 BEGP(pt0);
2423 pt0 = SREG++;
2424 d0 = *pt0;
2425 deref_head(d0, ufloat_unk);
2426 ufloat_nonvar:
2427 if (!IsApplTerm(d0)) {
2428 FAIL();
2429 }
2430 /* look inside term */
2431 BEGP(pt0);
2432 pt0 = RepAppl(d0);
2433 BEGD(d0);
2434 d0 = *pt0;
2435 if (d0 != (CELL)FunctorDouble) {
2436 FAIL();
2437 }
2438 ENDD(d0);
2439 BEGP(pt1);
2440 pt1 = PREG->y_u.od.d;
2441 PREG = NEXTOP(PREG, od);
2442 if (
2443 pt1[1] != pt0[1]
2444#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
2445 || pt1[2] != pt0[2]
2446#endif
2447 ) FAIL();
2448 ENDP(pt1);
2449 ENDP(pt0);
2450 GONext();
2451
2452 derefa_body(d0, pt0, ufloat_unk, ufloat_nonvar);
2453 BEGD(d1);
2454 d1 = AbsAppl(PREG->y_u.od.d);
2455 PREG = NEXTOP(PREG, od);
2456 Bind_Global(pt0, d1);
2457 GONext();
2458 ENDD(d1);
2459 ENDP(pt0);
2460 ENDD(d0);
2461 ENDOp();
2462
2463 OpW(unify_float_write, od);
2464 * SREG++ = AbsAppl(PREG->y_u.od.d);
2465 PREG = NEXTOP(PREG, od);
2466 GONextW();
2467 ENDOpW();
2468
2469 Op(unify_l_float, od);
2470 BEGD(d0);
2471 CACHE_S();
2472 READ_IN_S();
2473 d0 = *S_SREG;
2474 deref_head(d0, ulfloat_unk);
2475 ulfloat_nonvar:
2476 if (!IsApplTerm(d0)) {
2477 FAIL();
2478 }
2479 BEGP(pt0);
2480 pt0 = RepAppl(d0);
2481 BEGD(d0);
2482 d0 = *pt0;
2483 if (d0 != (CELL)FunctorDouble) {
2484 FAIL();
2485 }
2486 ENDD(d0);
2487 BEGP(pt1);
2488 pt1 = PREG->y_u.od.d;
2489 PREG = NEXTOP(PREG, od);
2490 if (
2491 pt1[1] != pt0[1]
2492#if SIZEOF_DOUBLE == 2*SIZEOF_INT_P
2493 || pt1[2] != pt0[2]
2494#endif
2495 ) FAIL();
2496 ENDP(pt1);
2497 ENDP(pt0);
2498 GONext();
2499
2500 derefa_body(d0, S_SREG, ulfloat_unk, ulfloat_nonvar);
2501 BEGD(d1);
2502 d1 = AbsAppl(PREG->y_u.od.d);
2503 PREG = NEXTOP(PREG, od);
2504 Bind_Global(S_SREG, d1);
2505 GONext();
2506 ENDD(d1);
2507 ENDCACHE_S();
2508 ENDD(d0);
2509 ENDOp();
2510
2511 Op(unify_l_float_write, od);
2512 SREG[0] = AbsAppl(PREG->y_u.od.d);
2513 PREG = NEXTOP(PREG, od);
2514 GONext();
2515 ENDOp();
2516
2517 Op(unify_string, ou);
2518 BEGD(d0);
2519 BEGP(pt0);
2520 pt0 = SREG++;
2521 d0 = *pt0;
2522 deref_head(d0, ustring_unk);
2523 ustring_nonvar:
2524 if (!IsApplTerm(d0)) {
2525 FAIL();
2526 }
2527 /* look inside term */
2528 BEGP(pt0);
2529 pt0 = RepAppl(d0);
2530 BEGD(d0);
2531 d0 = *pt0;
2532 if (d0 != (CELL)FunctorString) {
2533 FAIL();
2534 }
2535 ENDD(d0);
2536 BEGP(pt1);
2537 pt1 = RepAppl(PREG->y_u.ou.ut);
2538 PREG = NEXTOP(PREG, ou);
2539 if (
2540 pt1[1] != pt0[1]
2541 || strcmp( (const char *)(pt1 + 2), (const char *)(pt0+2) )
2542 ) FAIL();
2543 ENDP(pt1);
2544 ENDP(pt0);
2545 GONext();
2546
2547 derefa_body(d0, pt0, ustring_unk, ustring_nonvar);
2548 BEGD(d1);
2549 d1 = PREG->y_u.ou.ut;
2550 PREG = NEXTOP(PREG, ou);
2551 Bind_Global(pt0, d1);
2552 GONext();
2553 ENDD(d1);
2554 ENDP(pt0);
2555 ENDD(d0);
2556 ENDOp();
2557
2558 Op(unify_l_string, ou);
2559 BEGD(d0);
2560 CACHE_S();
2561 READ_IN_S();
2562 d0 = *S_SREG;
2563 deref_head(d0, ulstring_unk);
2564 ulstring_nonvar:
2565 if (!IsApplTerm(d0)) {
2566 FAIL();
2567 }
2568 BEGP(pt0);
2569 pt0 = RepAppl(d0);
2570 BEGD(d0);
2571 d0 = *pt0;
2572 if (d0 != (CELL)FunctorString) {
2573 FAIL();
2574 }
2575 ENDD(d0);
2576 BEGP(pt1);
2577 pt1 = RepAppl(PREG->y_u.ou.ut);
2578 PREG = NEXTOP(PREG, ou);
2579 if (
2580 pt1[1] != pt0[1]
2581 || strcmp( (const char *)(pt1 + 2), (const char *)(pt0+2) )
2582 ) FAIL();
2583 ENDP(pt1);
2584 ENDP(pt0);
2585 GONext();
2586
2587 derefa_body(d0, S_SREG, ulstring_unk, ulstring_nonvar);
2588 BEGD(d1);
2589 d1 = PREG->y_u.ou.ut;
2590 PREG = NEXTOP(PREG, ou);
2591 Bind_Global(S_SREG, d1);
2592 GONext();
2593 ENDD(d1);
2594 ENDCACHE_S();
2595 ENDD(d0);
2596 ENDOp();
2597
2598 Op(unify_longint, oi);
2599 BEGD(d0);
2600 BEGP(pt0);
2601 pt0 = SREG++;
2602 d0 = *pt0;
2603 deref_head(d0, ulongint_unk);
2604 ulongint_nonvar:
2605 /* look inside term */
2606 if (!IsApplTerm(d0)) {
2607 FAIL();
2608 }
2609 BEGP(pt0);
2610 pt0 = RepAppl(d0);
2611 BEGD(d0);
2612 d0 = *pt0;
2613 if (d0 != (CELL)FunctorLongInt) {
2614 FAIL();
2615 }
2616 ENDD(d0);
2617 BEGP(pt1);
2618 pt1 = PREG->y_u.oi.i;
2619 PREG = NEXTOP(PREG, oi);
2620 if (pt1[1] != pt0[1]) FAIL();
2621 ENDP(pt1);
2622 ENDP(pt0);
2623 GONext();
2624
2625 derefa_body(d0, pt0, ulongint_unk, ulongint_nonvar);
2626 BEGD(d1);
2627 d1 = AbsAppl(PREG->y_u.oi.i);
2628 PREG = NEXTOP(PREG, oi);
2629 Bind_Global(pt0, d1);
2630 GONext();
2631 ENDD(d1);
2632 ENDP(pt0);
2633 ENDD(d0);
2634 ENDOp();
2635
2636 OpW(unify_longint_write, oi);
2637 * SREG++ = AbsAppl(PREG->y_u.oi.i);
2638 PREG = NEXTOP(PREG, oi);
2639 GONextW();
2640 ENDOpW();
2641
2642 Op(unify_l_longint, oi);
2643 BEGD(d0);
2644 CACHE_S();
2645 READ_IN_S();
2646 d0 = *S_SREG;
2647 deref_head(d0, ullongint_unk);
2648 ullongint_nonvar:
2649 if (!IsApplTerm(d0)) {
2650 FAIL();
2651 }
2652 BEGP(pt0);
2653 pt0 = RepAppl(d0);
2654 BEGD(d0);
2655 d0 = *pt0;
2656 if (d0 != (CELL)FunctorLongInt) {
2657 FAIL();
2658 }
2659 ENDD(d0);
2660 BEGP(pt1);
2661 pt1 = PREG->y_u.oi.i;
2662 PREG = NEXTOP(PREG, oi);
2663 if (pt1[1] != pt0[1]) FAIL();
2664 ENDP(pt1);
2665 ENDP(pt0);
2666 GONext();
2667
2668 derefa_body(d0, S_SREG, ullongint_unk, ullongint_nonvar);
2669 BEGD(d1);
2670 d1 = AbsAppl(PREG->y_u.oi.i);
2671 PREG = NEXTOP(PREG, oi);
2672 Bind_Global(S_SREG, d1);
2673 GONext();
2674 ENDD(d1);
2675 ENDCACHE_S();
2676 ENDD(d0);
2677 ENDOp();
2678
2679 Op(unify_l_longint_write, oi);
2680 SREG[0] = AbsAppl(PREG->y_u.oi.i);
2681 PREG = NEXTOP(PREG, oi);
2682 GONext();
2683 ENDOp();
2684
2685 Op(unify_bigint, oN);
2686#ifdef USE_GMP
2687 BEGD(d0);
2688 BEGP(pt0);
2689 pt0 = SREG++;
2690 d0 = *pt0;
2691 deref_head(d0, ubigint_unk);
2692 ubigint_nonvar:
2693 /* look inside term */
2694 if (!IsApplTerm(d0)) {
2695 FAIL();
2696 }
2697 BEGP(pt0);
2698 pt0 = RepAppl(d0);
2699 BEGD(d1);
2700 d1 = *pt0;
2701 if (d1 != (CELL)FunctorBigInt)
2702 {
2703 FAIL();
2704 }
2705 ENDD(d1);
2706 if (Yap_gmp_tcmp_big_big(d0,PREG->y_u.oN.b))
2707 FAIL();
2708 PREG = NEXTOP(PREG, oN);
2709 ENDP(pt0);
2710 GONext();
2711
2712 derefa_body(d0, pt0, ubigint_unk, ubigint_nonvar);
2713 BEGD(d1);
2714 d1 = PREG->y_u.oN.b;
2715 PREG = NEXTOP(PREG, oN);
2716 Bind_Global(pt0, d1);
2717 GONext();
2718 ENDD(d1);
2719 ENDP(pt0);
2720 ENDD(d0);
2721#else
2722 FAIL();
2723#endif
2724 ENDOp();
2725
2726 Op(unify_l_bigint, oN);
2727#ifdef USE_GMP
2728 BEGD(d0);
2729 CACHE_S();
2730 READ_IN_S();
2731 d0 = *S_SREG;
2732 deref_head(d0, ulbigint_unk);
2733 ulbigint_nonvar:
2734 if (!IsApplTerm(d0)) {
2735 FAIL();
2736 }
2737 BEGP(pt0);
2738 pt0 = RepAppl(d0);
2739 BEGD(d0);
2740 d0 = *pt0;
2741 if (d0 != (CELL)FunctorBigInt)
2742 {
2743 FAIL();
2744 }
2745 ENDD(d0);
2746 if (Yap_gmp_tcmp_big_big(d0,PREG->y_u.oN.b))
2747 FAIL();
2748 PREG = NEXTOP(PREG, oN);
2749 ENDP(pt0);
2750 GONext();
2751
2752 derefa_body(d0, S_SREG, ulbigint_unk, ulbigint_nonvar);
2753 BEGD(d1);
2754 d1 = PREG->y_u.oN.b;
2755 PREG = NEXTOP(PREG, oN);
2756 Bind_Global(S_SREG, d1);
2757 GONext();
2758 ENDD(d1);
2759 ENDCACHE_S();
2760 ENDD(d0);
2761#else
2762 FAIL();
2763#endif
2764 ENDOp();
2765
2766 Op(unify_dbterm, oD);
2767 BEGD(d0);
2768 BEGP(pt0);
2769 pt0 = SREG++;
2770 d0 = *pt0;
2771 deref_head(d0, udbterm_unk);
2772 udbterm_nonvar:
2773 BEGD(d1);
2774 /* we have met a preexisting dbterm */
2775 d1 = PREG->y_u.oD.D;
2776 PREG = NEXTOP(PREG, oD);
2777 UnifyBound(d0,d1);
2778 ENDD(d1);
2779
2780 derefa_body(d0, pt0, udbterm_unk, udbterm_nonvar);
2781 BEGD(d1);
2782 d1 = PREG->y_u.oD.D;
2783 PREG = NEXTOP(PREG, oD);
2784 Bind_Global(pt0, d1);
2785 GONext();
2786 ENDD(d1);
2787 ENDP(pt0);
2788 ENDD(d0);
2789 ENDOp();
2790
2791 Op(unify_l_dbterm, oD);
2792 BEGD(d0);
2793 CACHE_S();
2794 READ_IN_S();
2795 d0 = *S_SREG;
2796 deref_head(d0, uldbterm_unk);
2797 uldbterm_nonvar:
2798 BEGD(d1);
2799 /* we have met a preexisting dbterm */
2800 d1 = PREG->y_u.oD.D;
2801 PREG = NEXTOP(PREG, oD);
2802 UnifyBound(d0,d1);
2803 ENDD(d1);
2804
2805 derefa_body(d0, S_SREG, uldbterm_unk, uldbterm_nonvar);
2806 BEGD(d1);
2807 d1 = PREG->y_u.oD.D;
2808 PREG = NEXTOP(PREG, oD);
2809 Bind_Global(S_SREG, d1);
2810 GONext();
2811 ENDD(d1);
2812 ENDCACHE_S();
2813 ENDD(d0);
2814 ENDOp();
2815
2816 OpRW(unify_list, o);
2817 *--SP = Unsigned(SREG + 1);
2818 *--SP = READ_MODE;
2819 BEGD(d0);
2820 BEGP(pt0);
2821 pt0 = SREG;
2822 d0 = *pt0;
2823 deref_head(d0, ulist_unk);
2824 ulist_nonvar:
2825 if (!IsPairTerm(d0)) {
2826 FAIL();
2827 }
2828 /* we continue in read mode */
2829 START_PREFETCH(o);
2830 SREG = RepPair(d0);
2831 PREG = NEXTOP(PREG, o);
2832 GONext();
2833 END_PREFETCH();
2834
2835 derefa_body(d0, pt0, ulist_unk, ulist_nonvar);
2836 /* we enter write mode */
2837 START_PREFETCH_W(o);
2838 CACHE_S();
2839 READ_IN_S();
2840 S_SREG = HR;
2841 PREG = NEXTOP(PREG, o);
2842 HR = S_SREG + 2;
2843 d0 = AbsPair(S_SREG);
2844 WRITEBACK_S(S_SREG);
2845 ENDCACHE_S();
2846 Bind_Global(pt0, d0);
2847 GONextW();
2848 END_PREFETCH_W();
2849
2850 ENDP(pt0);
2851
2852 ENDD(d0);
2853 ENDOpRW();
2854
2855 OpW(unify_list_write, o);
2856 PREG = NEXTOP(PREG, o);
2857 BEGD(d0);
2858 d0 = AbsPair(HR);
2859 CACHE_S();
2860 READ_IN_S();
2861 SP -= 2;
2862 SP[0] = WRITE_MODE;
2863 SP[1] = Unsigned(S_SREG + 1);
2864 S_SREG[0] = d0;
2865 S_SREG = HR;
2866 HR = S_SREG + 2;
2867 WRITEBACK_S(S_SREG);
2868 ENDCACHE_S();
2869 GONextW();
2870 ENDD(d0);
2871 ENDOpW();
2872
2873 OpRW(unify_l_list, o);
2874 BEGD(d0);
2875 BEGP(pt0);
2876 pt0 = SREG;
2877 d0 = *pt0;
2878 deref_head(d0, ullist_unk);
2879 ullist_nonvar:
2880 START_PREFETCH(o);
2881 if (!IsPairTerm(d0)) {
2882 FAIL();
2883 }
2884 /* we continue in read mode */
2885 PREG = NEXTOP(PREG, o);
2886 SREG = RepPair(d0);
2887 GONext();
2888 END_PREFETCH();
2889
2890 derefa_body(d0, pt0, ullist_unk, ullist_nonvar);
2891 /* we enter write mode */
2892 START_PREFETCH_W(o);
2893 PREG = NEXTOP(PREG, o);
2894 CACHE_S();
2895 READ_IN_S();
2896 S_SREG = HR;
2897 HR = S_SREG + 2;
2898 d0 = AbsPair(S_SREG);
2899 WRITEBACK_S(S_SREG);
2900 ENDCACHE_S();
2901 Bind_Global(pt0, d0);
2902 GONextW();
2903 END_PREFETCH_W();
2904
2905 ENDP(pt0);
2906 ENDD(d0);
2907 ENDOpRW();
2908
2909 OpW(unify_l_list_write, o);
2910 /* we continue in write mode */
2911 BEGD(d0);
2912 d0 = AbsPair(HR);
2913 PREG = NEXTOP(PREG, o);
2914 CACHE_S();
2915 READ_IN_S();
2916 S_SREG[0] = d0;
2917 S_SREG = HR;
2918 HR = S_SREG + 2;
2919 WRITEBACK_S(S_SREG);
2920 ENDCACHE_S();
2921 GONextW();
2922 ENDD(d0);
2923 ENDOpW();
2924
2925 OpRW(unify_struct, ofa);
2926 *--SP = Unsigned(SREG + 1);
2927 *--SP = READ_MODE;
2928 BEGD(d0);
2929 BEGP(pt0);
2930 pt0 = SREG;
2931 d0 = *pt0;
2932 START_PREFETCH(ofa);
2933 deref_head(d0, ustruct_unk);
2934 ustruct_nonvar:
2935 /* we are in read mode */
2936 if (!IsApplTerm(d0)) {
2937 FAIL();
2938 }
2939 CACHE_S();
2940 READ_IN_S();
2941 /* we continue in read mode */
2942 S_SREG = RepAppl(d0);
2943 /* just check functor */
2944 d0 = (CELL) (PREG->y_u.ofa.f);
2945 if (*S_SREG != d0) {
2946 FAIL();
2947 }
2948 PREG = NEXTOP(PREG, ofa);
2949 WRITEBACK_S(S_SREG+1);
2950 ENDCACHE_S();
2951 GONext();
2952 END_PREFETCH();
2953
2954 derefa_body(d0, pt0, ustruct_unk, ustruct_nonvar);
2955 /* Enter Write mode */
2956 START_PREFETCH_W(ofa);
2957 /* set d1 to be the new structure we are going to create */
2958 BEGD(d1);
2959 d1 = AbsAppl(HR);
2960 /* we know the variable must be in the heap */
2961 Bind_Global(pt0, d1);
2962 /* now, set pt0 to point to the heap where we are going to
2963 * build our term */
2964 pt0 = HR;
2965 ENDD(d1);
2966 /* first, put the functor */
2967 d0 = (CELL) (PREG->y_u.ofa.f);
2968 *pt0++ = d0;
2969 HR = pt0 + PREG->y_u.ofa.a;
2970 PREG = NEXTOP(PREG, ofa);
2971 /* set SREG */
2972 SREG = pt0;
2973 /* update H */
2974 GONextW();
2975 END_PREFETCH_W();
2976
2977 ENDP(pt0);
2978
2979 ENDD(d0);
2980 ENDOpRW();
2981
2982 OpW(unify_struct_write, ofa);
2983 CACHE_S();
2984 READ_IN_S();
2985 *--SP = Unsigned(S_SREG + 1);
2986 *--SP = WRITE_MODE;
2987 /* we continue in write mode */
2988 BEGD(d0);
2989 d0 = AbsAppl(HR);
2990 S_SREG[0] = d0;
2991 S_SREG = HR;
2992 d0 = (CELL) (PREG->y_u.ofa.f);
2993 *S_SREG++ = d0;
2994 HR = S_SREG + PREG->y_u.ofa.a;
2995 PREG = NEXTOP(PREG, ofa);
2996 WRITEBACK_S(S_SREG);
2997 ENDCACHE_S();
2998 ENDD(d0);
2999 GONextW();
3000 ENDOpW();
3001
3002 OpRW(unify_l_struc, ofa);
3003 BEGD(d0);
3004 BEGP(pt0);
3005 pt0 = SREG;
3006 d0 = *pt0;
3007 deref_head(d0, ulstruct_unk);
3008 ulstruct_nonvar:
3009 /* we are in read mode */
3010 START_PREFETCH(ofa);
3011 if (!IsApplTerm(d0)) {
3012 FAIL();
3013 }
3014 /* we continue in read mode */
3015 SREG = RepAppl(d0);
3016 /* just check functor */
3017 d0 = (CELL) (PREG->y_u.ofa.f);
3018 if (*SREG++ != d0) {
3019 FAIL();
3020 }
3021 PREG = NEXTOP(PREG, ofa);
3022 GONext();
3023 END_PREFETCH();
3024
3025 derefa_body(d0, pt0, ulstruct_unk, ulstruct_nonvar);
3026 /* Enter Write mode */
3027 /* set d1 to be the new structure we are going to create */
3028 START_PREFETCH_W(ofa);
3029 BEGD(d1);
3030 d1 = AbsAppl(HR);
3031 /* we know the variable must be in the heap */
3032 Bind_Global(pt0, d1);
3033 /* now, set pt0 to point to the heap where we are going to
3034 * build our term */
3035 pt0 = HR;
3036 ENDD(d1);
3037 /* first, put the functor */
3038 d0 = (CELL) (PREG->y_u.ofa.f);
3039 *pt0++ = d0;
3040 HR = pt0 + PREG->y_u.ofa.a;
3041 PREG = NEXTOP(PREG, ofa);
3042 /* set SREG */
3043 SREG = pt0;
3044 /* update H */
3045 GONextW();
3046 END_PREFETCH_W();
3047 ENDP(pt0);
3048
3049 ENDD(d0);
3050 ENDOpRW();
3051
3052 OpW(unify_l_struc_write, ofa);
3053 BEGD(d0);
3054 d0 = AbsAppl(HR);
3055 CACHE_S();
3056 READ_IN_S();
3057 S_SREG[0] = d0;
3058 S_SREG = HR;
3059 d0 = (CELL) (PREG->y_u.ofa.f);
3060 *S_SREG++ = d0;
3061 HR = S_SREG + PREG->y_u.ofa.a;
3062 PREG = NEXTOP(PREG, ofa);
3063 WRITEBACK_S(S_SREG);
3064 ENDCACHE_S();
3065 ENDD(d0);
3066 GONextW();
3067 ENDOpW();
3068
3069
3070 /************************************************************************\
3071 * Put Instructions *
3072\************************************************************************/
3073
3074 Op(put_x_var, xx);
3075 BEGP(pt0);
3076 pt0 = HR;
3077 XREG(PREG->y_u.xx.xl) = Unsigned(pt0);
3078 HR = pt0 + 1;
3079 XREG(PREG->y_u.xx.xr) = Unsigned(pt0);
3080 PREG = NEXTOP(PREG, xx);
3081 RESET_VARIABLE(pt0);
3082 ENDP(pt0);
3083 GONext();
3084 ENDOp();
3085
3086 Op(put_y_var, yx);
3087 BEGP(pt0);
3088 pt0 = YREG + PREG->y_u.yx.y;
3089 XREG(PREG->y_u.yx.x) = (CELL) pt0;
3090 PREG = NEXTOP(PREG, yx);
3091#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
3092 /* We must initialize a shared variable to point to the SBA */
3093 if (Unsigned((Int)(pt0)-(Int)(H_FZ)) >
3094 Unsigned((Int)(B_FZ)-(Int)(H_FZ))) {
3095 *pt0 = (CELL)STACK_TO_SBA(pt0);
3096 } else
3097#endif /* YAPOR_SBA && FROZEN_STACKS */
3098 INITIALIZE_PERMVAR(pt0, (CELL)pt0);
3099 ENDP(pt0);
3100 GONext();
3101 ENDOp();
3102
3103 Op(put_x_val, xx);
3104 BEGD(d0);
3105 d0 = XREG(PREG->y_u.xx.xl);
3106 XREG(PREG->y_u.xx.xr) = d0;
3107 ENDD(d0);
3108 PREG = NEXTOP(PREG, xx);
3109 GONext();
3110 ENDOp();
3111
3112 Op(put_xx_val, xxxx);
3113 BEGD(d0);
3114 BEGD(d1);
3115 d0 = XREG(PREG->y_u.xxxx.xl1);
3116 d1 = XREG(PREG->y_u.xxxx.xl2);
3117 XREG(PREG->y_u.xxxx.xr1) = d0;
3118 XREG(PREG->y_u.xxxx.xr2) = d1;
3119 ENDD(d1);
3120 ENDD(d0);
3121 PREG = NEXTOP(PREG, xxxx);
3122 GONext();
3123 ENDOp();
3124
3125 Op(put_y_val, yx);
3126 BEGD(d0);
3127 d0 = YREG[PREG->y_u.yx.y];
3128#ifdef YAPOR_SBA
3129 if (d0 == 0) /* new variable */
3130 XREG(PREG->y_u.yx.x) = (CELL)(YREG+PREG->y_u.yx.y);
3131 else
3132#endif
3133 XREG(PREG->y_u.yx.x) = d0;
3134 ENDD(d0);
3135 PREG = NEXTOP(PREG, yx);
3136 GONext();
3137 ENDOp();
3138
3139 Op(put_y_vals, yyxx);
3140 ALWAYS_START_PREFETCH(yyxx);
3141 BEGD(d0);
3142 d0 = YREG[PREG->y_u.yyxx.y1];
3143#ifdef YAPOR_SBA
3144 if (d0 == 0) /* new variable */
3145 XREG(PREG->y_u.yyxx.x1) = (CELL)(YREG+PREG->y_u.yyxx.y1);
3146 else
3147#endif
3148 XREG(PREG->y_u.yyxx.x1) = d0;
3149 ENDD(d0);
3150 /* allow for some prefetching */
3151 PREG = NEXTOP(PREG, yyxx);
3152 BEGD(d1);
3153 d1 = YREG[PREVOP(PREG,yyxx)->y_u.yyxx.y2];
3154#ifdef YAPOR_SBA
3155 if (d1 == 0) /* new variable */
3156 XREG(PREVOP(PREG->y_u.yyxx,yyxx).x2) = (CELL)(YREG+PREG->y_u.yyxx.y2);
3157 else
3158#endif
3159 XREG(PREVOP(PREG,yyxx)->y_u.yyxx.x2) = d1;
3160 ENDD(d1);
3161 ALWAYS_GONext();
3162 ALWAYS_END_PREFETCH();
3163 ENDOp();
3164
3165 Op(put_unsafe, yx);
3166 BEGD(d0);
3167 BEGP(pt0);
3168 pt0 = YREG+PREG->y_u.yx.y;
3169 d0 = *pt0;
3170 deref_head(d0, punsafe_unk);
3171 punsafe_nonvar:
3172 XREG(PREG->y_u.yx.x) = d0;
3173 PREG = NEXTOP(PREG, yx);
3174 GONext();
3175
3176
3177 derefa_body(d0, pt0, punsafe_unk, punsafe_nonvar);
3178 /* d0 is a variable, check whether we need to globalise it */
3179 if (pt0 <= HR || pt0 >= YREG) {
3180 /* variable is safe */
3181 XREG(PREG->y_u.yx.x) = Unsigned(pt0);
3182 PREG = NEXTOP(PREG, yx);
3183 GONext();
3184 }
3185 else {
3186 /* create a new Heap variable and bind our variable to it */
3187 Bind_Local(pt0, Unsigned(HR));
3188 XREG(PREG->y_u.yx.x) = (CELL) HR;
3189 RESET_VARIABLE(HR);
3190 HR++;
3191 PREG = NEXTOP(PREG, yx);
3192 GONext();
3193 }
3194 ENDP(pt0);
3195 ENDD(d0);
3196 ENDOp();
3197
3198 Op(put_atom, xc);
3199 BEGD(d0);
3200 d0 = PREG->y_u.xc.c;
3201 XREG(PREG->y_u.xc.x) = d0;
3202 PREG = NEXTOP(PREG, xc);
3203 GONext();
3204 ENDD(d0);
3205 ENDOp();
3206
3207 Op(put_dbterm, xD);
3208 BEGD(d0);
3209 d0 = PREG->y_u.xD.D;
3210 XREG(PREG->y_u.xD.x) = d0;
3211 PREG = NEXTOP(PREG, xD);
3212 GONext();
3213 ENDD(d0);
3214 ENDOp();
3215
3216 Op(put_bigint, xN);
3217 BEGD(d0);
3218 d0 = PREG->y_u.xN.b;
3219 XREG(PREG->y_u.xN.x) = d0;
3220 PREG = NEXTOP(PREG, xN);
3221 GONext();
3222 ENDD(d0);
3223 ENDOp();
3224
3225 Op(put_float, xd);
3226 BEGD(d0);
3227 d0 = AbsAppl(PREG->y_u.xd.d);
3228 XREG(PREG->y_u.xd.x) = d0;
3229 PREG = NEXTOP(PREG, xd);
3230 GONext();
3231 ENDD(d0);
3232 ENDOp();
3233
3234 Op(put_longint, xi);
3235 BEGD(d0);
3236 d0 = AbsAppl(PREG->y_u.xi.i);
3237 XREG(PREG->y_u.xi.x) = d0;
3238 PREG = NEXTOP(PREG, xi);
3239 GONext();
3240 ENDD(d0);
3241 ENDOp();
3242
3243 Op(put_list, x);
3244 CACHE_S();
3245 READ_IN_S();
3246 S_SREG = HR;
3247 HR += 2;
3248 BEGD(d0);
3249 d0 = AbsPair(S_SREG);
3250 XREG(PREG->y_u.x.x) = d0;
3251 PREG = NEXTOP(PREG, x);
3252 ENDD(d0);
3253 WRITEBACK_S(S_SREG);
3254 ENDCACHE_S();
3255 GONext();
3256 ENDOp();
3257
3258 Op(put_struct, xfa);
3259 BEGD(d0);
3260 d0 = AbsAppl(HR);
3261 XREG(PREG->y_u.xfa.x) = d0;
3262 d0 = (CELL) (PREG->y_u.xfa.f);
3263 *HR++ = d0;
3264 SREG = HR;
3265 HR += PREG->y_u.xfa.a;
3266 ENDD(d0);
3267 PREG = NEXTOP(PREG, xfa);
3268 GONext();
3269 ENDOp();
3270
3271 /************************************************************************\
3272 * Write Instructions *
3273\************************************************************************/
3274
3275 Op(write_x_var, x);
3276 XREG(PREG->y_u.x.x) = Unsigned(SREG);
3277 PREG = NEXTOP(PREG, x);
3278 RESET_VARIABLE(SREG);
3279 SREG++;
3280 GONext();
3281 ENDOp();
3282
3283 Op(write_void, e);
3284 PREG = NEXTOP(PREG, e);
3285 RESET_VARIABLE(SREG);
3286 SREG++;
3287 GONext();
3288 ENDOp();
3289
3290 Op(write_n_voids, s);
3291 BEGD(d0);
3292 d0 = PREG->y_u.s.s;
3293 PREG = NEXTOP(PREG, s);
3294 for (; d0 > 0; d0--) {
3295 RESET_VARIABLE(SREG);
3296 SREG++;
3297 }
3298 ENDD(d0);
3299 GONext();
3300 ENDOp();
3301
3302 Op(write_y_var, y);
3303 INITIALIZE_PERMVAR(YREG+PREG->y_u.y.y,Unsigned(SREG));
3304 PREG = NEXTOP(PREG, y);
3305 RESET_VARIABLE(SREG);
3306 SREG++;
3307 GONext();
3308 ENDOp();
3309
3310 Op(write_x_val, x);
3311 BEGD(d0);
3312 d0 = XREG(PREG->y_u.x.x);
3313 *SREG++ = d0;
3314 ENDD(d0);
3315 PREG = NEXTOP(PREG, x);
3316 GONext();
3317 ENDOp();
3318
3319 Op(write_x_loc, x);
3320 BEGD(d0);
3321 d0 = XREG(PREG->y_u.x.x);
3322 PREG = NEXTOP(PREG, x);
3323 deref_head(d0, w_x_unk);
3324 w_x_bound:
3325 *SREG++ = d0;
3326 GONext();
3327
3328 BEGP(pt0);
3329 deref_body(d0, pt0, w_x_unk, w_x_bound);
3330#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
3331 if (pt0 > HR && pt0<(CELL *)B_FZ) {
3332#else
3333 if (pt0 > HR) {
3334#endif /* YAPOR_SBA && FROZEN_STACKS */
3335 /* local variable: let us bind it to the list */
3336#ifdef FROZEN_STACKS /* TRAIL */
3337 Bind_Local(pt0, Unsigned(SREG));
3338#else
3339 TRAIL_LOCAL(pt0, Unsigned(SREG));
3340 *pt0 = Unsigned(SREG);
3341#endif /* FROZEN_STACKS */
3342 RESET_VARIABLE(SREG);
3343 SREG++;
3344 GONext();
3345 }
3346 else {
3347 *SREG++ = Unsigned(pt0);
3348 GONext();
3349 }
3350 ENDP(pt0);
3351 ENDD(d0);
3352 ENDOp();
3353
3354 Op(write_y_val, y);
3355 BEGD(d0);
3356 d0 = YREG[PREG->y_u.y.y];
3357#ifdef YAPOR_SBA
3358 if (d0 == 0) /* new variable */
3359 *SREG++ = (CELL)(YREG+PREG->y_u.y.y);
3360 else
3361#endif
3362 *SREG++ = d0;
3363 ENDD(d0);
3364 PREG = NEXTOP(PREG, y);
3365 GONext();
3366 ENDOp();
3367
3368 Op(write_y_loc, y);
3369 BEGD(d0);
3370 BEGP(pt0);
3371 pt0 = YREG+PREG->y_u.y.y;
3372 d0 = *pt0;
3373 deref_head(d0, w_y_unk);
3374 w_y_bound:
3375 PREG = NEXTOP(PREG, y);
3376 *SREG++ = d0;
3377 GONext();
3378
3379 derefa_body(d0, pt0, w_y_unk, w_y_bound);
3380 if (pt0 > HR
3381#if defined(YAPOR_SBA) && defined(FROZEN_STACKS)
3382 && pt0<(CELL *)B_FZ
3383#endif /* YAPOR_SBA && FROZEN_STACKS */
3384 ) {
3385 PREG = NEXTOP(PREG, y);
3386 /* local variable: let us bind it to the list */
3387#ifdef FROZEN_STACKS
3388 Bind_Local(pt0, Unsigned(SREG));
3389#else
3390 *pt0 = Unsigned(SREG);
3391 TRAIL_LOCAL(pt0, Unsigned(SREG));
3392#endif /* FROZEN_STACKS */
3393 RESET_VARIABLE(SREG);
3394 SREG++;
3395 GONext();
3396 } else {
3397 PREG = NEXTOP(PREG, y);
3398 *SREG++ = Unsigned(pt0);
3399 GONext();
3400 }
3401 ENDP(pt0);
3402 ENDD(d0);
3403 ENDOp();
3404
3405 Op(write_atom, c);
3406 BEGD(d0);
3407 d0 = PREG->y_u.c.c;
3408 *SREG++ = d0;
3409 ENDD(d0);
3410 PREG = NEXTOP(PREG, c);
3411 GONext();
3412 ENDOp();
3413
3414 Op(write_bigint, N);
3415 BEGD(d0);
3416 d0 = PREG->y_u.N.b;
3417 *SREG++ = d0;
3418 ENDD(d0);
3419 PREG = NEXTOP(PREG, N);
3420 GONext();
3421 ENDOp();
3422
3423 Op(write_dbterm, D);
3424 BEGD(d0);
3425 d0 = PREG->y_u.D.D;
3426 *SREG++ = d0;
3427 ENDD(d0);
3428 PREG = NEXTOP(PREG, D);
3429 GONext();
3430 ENDOp();
3431
3432 Op(write_float, d);
3433 BEGD(d0);
3434 d0 = AbsAppl(PREG->y_u.d.d);
3435 *SREG++ = d0;
3436 ENDD(d0);
3437 PREG = NEXTOP(PREG, d);
3438 GONext();
3439 ENDOp();
3440
3441 Op(write_longint, i);
3442 BEGD(d0);
3443 d0 = AbsAppl(PREG->y_u.i.i);
3444 *SREG++ = d0;
3445 ENDD(d0);
3446 PREG = NEXTOP(PREG, i);
3447 GONext();
3448 ENDOp();
3449
3450 Op(write_n_atoms, sc);
3451 BEGD(d0);
3452 BEGD(d1);
3453 d0 = PREG->y_u.sc.s;
3454 d1 = PREG->y_u.sc.c;
3455 for (; d0 > 0; d0--)
3456 *SREG++ = d1;
3457 ENDD(d1);
3458 ENDD(d0);
3459 PREG = NEXTOP(PREG, sc);
3460 GONext();
3461 ENDOp();
3462
3463 Op(write_list, e);
3464 BEGD(d0);
3465 d0 = AbsPair(HR);
3466 *SREG++ = d0;
3467 /* I will not actually store the mode in the stack */
3468 SP[-1] = Unsigned(SREG);
3469 SP[-2] = 1; /* Put instructions follow the main stream */
3470 SP -= 2;
3471 SREG = HR;
3472 HR += 2;
3473 ENDD(d0);
3474 PREG = NEXTOP(PREG, e);
3475 GONext();
3476 ENDOp();
3477
3478 Op(write_l_list, e);
3479 ALWAYS_START_PREFETCH(e);
3480 PREG = NEXTOP(PREG, e);
3481 BEGD(d0);
3482 CACHE_S();
3483 READ_IN_S();
3484 d0 = AbsPair(HR);
3485 *S_SREG = d0;
3486 WRITEBACK_S(HR);
3487 HR += 2;
3488 ENDCACHE_S();
3489 ENDD(d0);
3490 ALWAYS_GONext();
3491 ALWAYS_END_PREFETCH();
3492 ENDOp();
3493
3494 Op(write_struct, fa);
3495 BEGD(d0);
3496 d0 = AbsAppl(HR);
3497 *SREG++ = d0;
3498 SP[-1] = Unsigned(SREG);
3499 SP[-2] = 1; /* Put instructions follow the main stream */
3500 SP -= 2;
3501 d0 = (CELL) (PREG->y_u.fa.f);
3502 *HR++ = d0;
3503 ENDD(d0);
3504 BEGD(d0);
3505 d0 = PREG->y_u.fa.a;
3506 PREG = NEXTOP(PREG, fa);
3507 SREG = HR;
3508 HR += d0;
3509 ENDD(d0);
3510 GONext();
3511 ENDOp();
3512
3513 Op(write_l_struc, fa);
3514 BEGD(d0);
3515 d0 = AbsAppl(HR);
3516 *SREG = d0;
3517 d0 = (CELL) (PREG->y_u.fa.f);
3518 *HR++ = d0;
3519 SREG = HR;
3520 ENDD(d0);
3521 BEGD(d0);
3522 d0 = PREG->y_u.fa.a;
3523 PREG = NEXTOP(PREG, fa);
3524 HR += d0;
3525 ENDD(d0);
3526 GONext();
3527 ENDOp();
3528
3529 /************************************************************************\
3530 * Save last unified struct or list *
3531\************************************************************************/
3532
3533 /* vitor: I think I should kill these two instructions, by expanding the
3534 * othe instructions.
3535 */
3536
3537 Op(save_pair_x, ox);
3538 XREG(PREG->y_u.ox.x) = AbsPair(SREG);
3539 PREG = NEXTOP(PREG, ox);
3540 GONext();
3541 ENDOp();
3542
3543 OpW(save_pair_x_write, ox);
3544 XREG(PREG->y_u.ox.x) = AbsPair(SREG);
3545 PREG = NEXTOP(PREG, ox);
3546 GONextW();
3547 ENDOpW();
3548
3549 Op(save_pair_y, oy);
3550 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,AbsPair(SREG));
3551 PREG = NEXTOP(PREG, oy);
3552 GONext();
3553 ENDOp();
3554
3555 OpW(save_pair_y_write, oy);
3556 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,AbsPair(SREG));
3557 PREG = NEXTOP(PREG, oy);
3558 GONextW();
3559 ENDOpW();
3560
3561 Op(save_appl_x, ox);
3562 XREG(PREG->y_u.ox.x) = AbsAppl(SREG - 1);
3563 PREG = NEXTOP(PREG, ox);
3564 GONext();
3565 ENDOp();
3566
3567 OpW(save_appl_x_write, ox);
3568 XREG(PREG->y_u.ox.x) = AbsAppl(SREG - 1);
3569 PREG = NEXTOP(PREG, ox);
3570 GONextW();
3571 ENDOpW();
3572
3573 Op(save_appl_y, oy);
3574 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,AbsAppl(SREG-1));
3575 PREG = NEXTOP(PREG, oy);
3576 GONext();
3577 ENDOp();
3578
3579 OpW(save_appl_y_write, oy);
3580 INITIALIZE_PERMVAR(YREG+PREG->y_u.oy.y,AbsAppl(SREG-1));
3581 PREG = NEXTOP(PREG, oy);
3582 GONextW();
3583 ENDOpW();
3584
3585