(instr_nop): New function
(instr_allof, instr_anyof): Removed
Showing
1 changed file
with
27 additions
and
48 deletions
... | @@ -31,6 +31,14 @@ | ... | @@ -31,6 +31,14 @@ |
31 | && (m)->debug_printer) | 31 | && (m)->debug_printer) |
32 | #define INSTR_DISASS(m) ((m)->debug_level & MU_SIEVE_DEBUG_DISAS) | 32 | #define INSTR_DISASS(m) ((m)->debug_level & MU_SIEVE_DEBUG_DISAS) |
33 | 33 | ||
34 | void | ||
35 | instr_nop (sieve_machine_t mach) | ||
36 | { | ||
37 | if (INSTR_DEBUG (mach)) | ||
38 | sieve_debug (mach, "%4lu: NOP\n", | ||
39 | (unsigned long) (mach->pc - 1)); | ||
40 | } | ||
41 | |||
34 | static int | 42 | static int |
35 | instr_run (sieve_machine_t mach) | 43 | instr_run (sieve_machine_t mach) |
36 | { | 44 | { |
... | @@ -113,54 +121,6 @@ instr_pop (sieve_machine_t mach) | ... | @@ -113,54 +121,6 @@ instr_pop (sieve_machine_t mach) |
113 | } | 121 | } |
114 | 122 | ||
115 | void | 123 | void |
116 | instr_allof (sieve_machine_t mach) | ||
117 | { | ||
118 | int num = SIEVE_ARG (mach, 0, number); | ||
119 | int val = 1; | ||
120 | |||
121 | SIEVE_ADJUST(mach, 1); | ||
122 | |||
123 | if (INSTR_DEBUG (mach)) | ||
124 | { | ||
125 | sieve_debug (mach, "%4lu: ALLOF %d\n", (unsigned long)(mach->pc - 2), | ||
126 | num); | ||
127 | if (INSTR_DISASS (mach)) | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | while (num-- > 0) | ||
132 | { | ||
133 | instr_pop (mach); | ||
134 | val &= mach->reg; | ||
135 | } | ||
136 | mach->reg = val; | ||
137 | } | ||
138 | |||
139 | void | ||
140 | instr_anyof (sieve_machine_t mach) | ||
141 | { | ||
142 | int num = SIEVE_ARG (mach, 0, number); | ||
143 | int val = 0; | ||
144 | |||
145 | SIEVE_ADJUST(mach, 1); | ||
146 | |||
147 | if (INSTR_DEBUG (mach)) | ||
148 | { | ||
149 | sieve_debug (mach, "%4lu: ANYOF %d\n", (unsigned long)(mach->pc - 2), | ||
150 | num); | ||
151 | if (INSTR_DISASS (mach)) | ||
152 | return; | ||
153 | } | ||
154 | |||
155 | while (num-- > 0) | ||
156 | { | ||
157 | instr_pop (mach); | ||
158 | val |= mach->reg; | ||
159 | } | ||
160 | mach->reg = val; | ||
161 | } | ||
162 | |||
163 | void | ||
164 | instr_not (sieve_machine_t mach) | 124 | instr_not (sieve_machine_t mach) |
165 | { | 125 | { |
166 | if (INSTR_DEBUG (mach)) | 126 | if (INSTR_DEBUG (mach)) |
... | @@ -210,6 +170,25 @@ instr_brz (sieve_machine_t mach) | ... | @@ -210,6 +170,25 @@ instr_brz (sieve_machine_t mach) |
210 | } | 170 | } |
211 | 171 | ||
212 | void | 172 | void |
173 | instr_brnz (sieve_machine_t mach) | ||
174 | { | ||
175 | long num = SIEVE_ARG (mach, 0, number); | ||
176 | SIEVE_ADJUST (mach, 1); | ||
177 | |||
178 | if (INSTR_DEBUG (mach)) | ||
179 | { | ||
180 | sieve_debug (mach, "%4lu: BRNZ %lu\n", | ||
181 | (unsigned long)(mach->pc-2), | ||
182 | (unsigned long)(mach->pc + num)); | ||
183 | if (INSTR_DISASS (mach)) | ||
184 | return; | ||
185 | } | ||
186 | |||
187 | if (mach->reg) | ||
188 | mach->pc += num; | ||
189 | } | ||
190 | |||
191 | void | ||
213 | sieve_abort (sieve_machine_t mach) | 192 | sieve_abort (sieve_machine_t mach) |
214 | { | 193 | { |
215 | longjmp (mach->errbuf, 1); | 194 | longjmp (mach->errbuf, 1); | ... | ... |
-
Please register or sign in to post a comment