1 /*************************************************************************
2 *									 *
3 *	       BEAM -> Basic Extended Andorra Model                      *
4 *         BEAM extends the YAP Prolog system to support the EAM          *
5 *									 *
6 * Copyright: Ricardo Lopes and NCC - University of Porto, Portugal       *
7 *									 *
8 **************************************************************************
9 * comments:	abstract machine instructions                            *
10 *************************************************************************/
11 
12 #define _exit_eam           0
13 #define _top_tree           1
14 #define _scheduler          2
15 #define _prepare_tries      3
16 #define _prepare_calls      4
17 
18 #define _first_get _prepare_calls
19 #define _get_var_X_op       _first_get+1
20 #define _get_var_Y_op       _first_get+2
21 #define _get_val_X_op       _first_get+3
22 #define _get_val_Y_op       _first_get+4
23 #define _get_atom_op        _first_get+5
24 #define _get_list_op        _first_get+6
25 #define _get_struct_op      _first_get+7
26 
27 #define _first_unify  _get_struct_op
28 #define _unify_void_op          _first_unify + 1
29 #define _unify_val_X_op         _first_unify + 2
30 #define _unify_val_Y_op         _first_unify + 3
31 #define _unify_var_X_op         _first_unify + 4
32 #define _unify_var_Y_op         _first_unify + 5
33 #define _unify_atom_op          _first_unify + 6
34 #define _unify_list_op          _first_unify + 7
35 #define _unify_last_list_op     _first_unify + 8
36 #define _unify_struct_op        _first_unify + 9
37 #define _unify_last_struct_op   _first_unify + 10
38 #define _unify_last_atom_op     _first_unify + 11
39 #define _unify_local_X_op       _first_unify + 12
40 #define _unify_local_Y_op       _first_unify + 13
41 
42 #define _first_put _unify_local_Y_op
43 #define _put_var_X_op         _first_put + 1
44 #define _put_var_Y_op         _first_put + 2
45 #define _put_val_X_op         _first_put + 3
46 #define _put_val_Y_op         _first_put + 4
47 #define _put_atom_op          _first_put + 5
48 #define _put_list_op          _first_put + 6
49 #define _put_struct_op        _first_put + 7
50 #define _put_unsafe_op        _first_put + 8
51 #define _put_var_P_op         _first_put + 9
52 
53 #define _first_write _put_var_P_op
54 #define _write_void           _first_write + 1
55 #define _write_var_X_op       _first_write + 2
56 #define _write_var_Y_op       _first_write + 3
57 #define _write_val_X_op       _first_write + 4
58 #define _write_val_Y_op       _first_write + 5
59 #define _write_atom_op        _first_write + 6
60 #define _write_list_op        _first_write + 7
61 #define _write_struct_op      _first_write + 8
62 #define _write_last_list_op   _first_write + 9
63 #define _write_last_struct_op _first_write + 10
64 #define _write_local_X_op     _first_write + 11
65 #define _write_local_Y_op     _first_write + 12
66 #define _write_var_P_op       _first_write + 13
67 
68 #define _geral _write_var_P_op
69 #define _pop_op          _geral + 1
70 #define _jump_op         _geral + 2
71 #define _proceed_op      _geral + 3
72 #define _call_op         _geral + 4
73 #define _safe_call_op    _geral + 5
74 #define _safe_call_unary_op   _geral + 6
75 #define _safe_call_binary_op  _geral + 7
76 #define _only_1_clause_op     _geral + 8
77 #define _try_me_op            _geral + 9
78 #define _retry_me_op          _geral + 10
79 #define _trust_me_op          _geral + 11
80 #define _do_nothing_op        _geral + 12
81 #define _direct_safe_call_op  _geral + 13
82 #define _direct_safe_call_unary_op   _geral + 14
83 #define _direct_safe_call_binary_op  _geral + 15
84 #define _skip_while_var       _geral + 16
85 #define _wait_while_var       _geral + 17
86 #define _force_wait           _geral + 18
87 #define _write_call           _geral + 19
88 #define _is_call              _geral + 20
89 #define _equal_call           _geral + 21
90 #define _cut_op               _geral + 22
91 #define _commit_op            _geral + 23
92 #define _fail_op              _geral + 24
93 
94 #define _others _fail_op
95 #define _save_b_X_op     _others + 1
96 #define _save_b_Y_op     _others + 2
97 #define _comit_b_X_op    _others + 3
98 #define _comit_b_Y_op    _others + 4
99 #define _save_appl_X_op  _others + 5
100 #define _save_appl_Y_op  _others + 6
101 #define _save_pair_X_op  _others + 7
102 #define _save_pair_Y_op  _others + 8
103 #define _either_op       _others + 9
104 #define _orelse_op       _others + 10
105 #define _orlast_op       _others + 11
106 
107 #define	_std_base	_orlast_op
108 #define	_p_atom		(_std_base+1)
109 #define	_p_atomic	(_std_base+2)
110 #define _p_equal	(_std_base+3)
111 #define _p_integer	(_std_base+4)
112 #define	_p_nonvar	(_std_base+5)
113 #define _p_number	(_std_base+6)
114 #define _p_var		(_std_base+7)
115 #define _p_db_ref	(_std_base+8)
116 #define _p_primitive	(_std_base+9)
117 #define _p_cut_by	(_std_base+10)
118 #define _p_succ		(_std_base+11)
119 #define _p_predc	(_std_base+12)
120 #define _p_plus		(_std_base+13)
121 #define _p_minus	(_std_base+14)
122 #define _p_times	(_std_base+15)
123 #define _p_div		(_std_base+16)
124 #define _p_dif		(_std_base+17)
125 #define _p_eq		(_std_base+18)
126 #define _p_arg		(_std_base+19)
127 #define _p_functor	(_std_base+20)
128 
129 
130