diff --git a/src/ops/bit.ops b/src/ops/bit.ops
index 24a63c5..c0c27ec 100644
a
|
b
|
|
52 | 52 | |
53 | 53 | =cut |
54 | 54 | |
55 | | inline op band(inout INT, in INT) :base_core { |
| 55 | inline op band(inout INT, in INT) { |
56 | 56 | $1 &= $2; |
57 | 57 | } |
58 | 58 | |
59 | | inline op band(out INT, in INT, in INT) :base_core { |
| 59 | inline op band(out INT, in INT, in INT) { |
60 | 60 | $1 = $2 & $3; |
61 | 61 | } |
62 | 62 | |
… |
… |
|
74 | 74 | |
75 | 75 | =cut |
76 | 76 | |
77 | | inline op bor(inout INT, in INT) :base_core { |
| 77 | inline op bor(inout INT, in INT) { |
78 | 78 | $1 |= $2; |
79 | 79 | } |
80 | 80 | |
81 | | inline op bor(out INT, in INT, in INT) :base_core { |
| 81 | inline op bor(out INT, in INT, in INT) { |
82 | 82 | $1 = $2 | $3; |
83 | 83 | } |
84 | 84 | |
… |
… |
|
94 | 94 | |
95 | 95 | =cut |
96 | 96 | |
97 | | inline op shl(inout INT, in INT) :base_core { |
| 97 | inline op shl(inout INT, in INT) { |
98 | 98 | $1 = bit_shift_left($1, $2); |
99 | 99 | } |
100 | 100 | |
101 | | inline op shl(out INT, in INT, in INT) :base_core { |
| 101 | inline op shl(out INT, in INT, in INT) { |
102 | 102 | $1 = bit_shift_left($2, $3); |
103 | 103 | } |
104 | 104 | |
… |
… |
|
114 | 114 | |
115 | 115 | =cut |
116 | 116 | |
117 | | inline op shr(inout INT, in INT) :base_core { |
| 117 | inline op shr(inout INT, in INT) { |
118 | 118 | const INTVAL signed_shift = -$2; |
119 | 119 | $1 = bit_shift_left($1, signed_shift); |
120 | 120 | } |
121 | 121 | |
122 | | inline op shr(out INT, in INT, in INT) :base_core { |
| 122 | inline op shr(out INT, in INT, in INT) { |
123 | 123 | const INTVAL signed_shift = -$3; |
124 | 124 | $1 = bit_shift_left($2, signed_shift); |
125 | 125 | } |
… |
… |
|
136 | 136 | |
137 | 137 | =cut |
138 | 138 | |
139 | | inline op lsr(out INT, in INT) :base_core { |
| 139 | inline op lsr(out INT, in INT) { |
140 | 140 | const UINTVAL a = (UINTVAL)$1; |
141 | 141 | const UINTVAL b = a >> $2; |
142 | 142 | $1 = (INTVAL)b; |
143 | 143 | } |
144 | 144 | |
145 | | inline op lsr(out INT, in INT, in INT) :base_core { |
| 145 | inline op lsr(out INT, in INT, in INT) { |
146 | 146 | $1 = (INTVAL)((UINTVAL)$2 >> $3); |
147 | 147 | } |
148 | 148 | |
… |
… |
|
160 | 160 | |
161 | 161 | =cut |
162 | 162 | |
163 | | inline op bxor(inout INT, in INT) :base_core { |
| 163 | inline op bxor(inout INT, in INT) { |
164 | 164 | $1 ^= $2; |
165 | 165 | } |
166 | 166 | |
167 | | inline op bxor(out INT, in INT, in INT) :base_core { |
| 167 | inline op bxor(out INT, in INT, in INT) { |
168 | 168 | $1 = $2 ^ $3; |
169 | 169 | } |
170 | 170 | |
diff --git a/src/ops/cmp.ops b/src/ops/cmp.ops
index 7702267..7638f7c 100644
a
|
b
|
|
64 | 64 | |
65 | 65 | =cut |
66 | 66 | |
67 | | inline op eq(in INT, in INT, inconst LABEL) :base_core { |
| 67 | inline op eq(in INT, in INT, inconst LABEL) { |
68 | 68 | if ($1 == $2) { |
69 | 69 | goto OFFSET($3); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | | inline op eq(in NUM, in NUM, inconst LABEL) :base_core { |
| 73 | inline op eq(in NUM, in NUM, inconst LABEL) { |
74 | 74 | if ($1 == $2) { |
75 | 75 | goto OFFSET($3); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | | op eq(in STR, in STR, inconst LABEL) :base_core { |
| 79 | op eq(in STR, in STR, inconst LABEL) { |
80 | 80 | if (STRING_equal(interp, $1, $2)) { |
81 | 81 | goto OFFSET($3); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | | op eq(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 85 | op eq(invar PMC, invar PMC, inconst LABEL) { |
86 | 86 | if (VTABLE_is_equal(interp, $1, $2)) { |
87 | 87 | goto OFFSET($3); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | | op eq(invar PMC, in INT, inconst LABEL) :base_core { |
| 91 | op eq(invar PMC, in INT, inconst LABEL) { |
92 | 92 | PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer); |
93 | 93 | VTABLE_set_integer_native(interp, temp, $2); |
94 | 94 | |
… |
… |
|
100 | 100 | Parrot_pmc_free_temporary(interp, temp); |
101 | 101 | } |
102 | 102 | |
103 | | op eq(invar PMC, in NUM, inconst LABEL) :base_core { |
| 103 | op eq(invar PMC, in NUM, inconst LABEL) { |
104 | 104 | /* |
105 | 105 | * the get_number and get_string should probably |
106 | 106 | * be also replaced with code like above, as |
… |
… |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | | op eq(invar PMC, in STR, inconst LABEL) :base_core { |
| 115 | op eq(invar PMC, in STR, inconst LABEL) { |
116 | 116 | if (STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) { |
117 | 117 | goto OFFSET($3); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | | op eq_str(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 121 | op eq_str(invar PMC, invar PMC, inconst LABEL) { |
122 | 122 | if (VTABLE_is_equal_string(interp, $1, $2)) { |
123 | 123 | goto OFFSET($3); |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | | op eq_num(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 127 | op eq_num(invar PMC, invar PMC, inconst LABEL) { |
128 | 128 | if (VTABLE_is_equal_num(interp, $1, $2)) { |
129 | 129 | goto OFFSET($3); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | | op eq_addr(in STR, in STR, inconst LABEL) :base_core { |
| 133 | op eq_addr(in STR, in STR, inconst LABEL) { |
134 | 134 | if ($1 == $2) { |
135 | 135 | goto OFFSET($3); |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | | op eq_addr(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 139 | op eq_addr(invar PMC, invar PMC, inconst LABEL) { |
140 | 140 | if ($1 == $2) { |
141 | 141 | goto OFFSET($3); |
142 | 142 | } |
… |
… |
|
170 | 170 | |
171 | 171 | =cut |
172 | 172 | |
173 | | inline op ne(in INT, in INT, inconst LABEL) :base_core { |
| 173 | inline op ne(in INT, in INT, inconst LABEL) { |
174 | 174 | if ($1 != $2) { |
175 | 175 | goto OFFSET($3); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | | inline op ne(in NUM, in NUM, inconst LABEL) :base_core { |
| 179 | inline op ne(in NUM, in NUM, inconst LABEL) { |
180 | 180 | if ($1 != $2) { |
181 | 181 | goto OFFSET($3); |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | | op ne(in STR, in STR, inconst LABEL) :base_core { |
| 185 | op ne(in STR, in STR, inconst LABEL) { |
186 | 186 | if (!STRING_equal(interp, $1, $2)) { |
187 | 187 | goto OFFSET($3); |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | | op ne(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 191 | op ne(invar PMC, invar PMC, inconst LABEL) { |
192 | 192 | if (!VTABLE_is_equal(interp, $1, $2)) { |
193 | 193 | goto OFFSET($3); |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | | op ne(invar PMC, in INT, inconst LABEL) :base_core { |
| 197 | op ne(invar PMC, in INT, inconst LABEL) { |
198 | 198 | PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer); |
199 | 199 | VTABLE_set_integer_native(interp, temp, $2); |
200 | 200 | |
… |
… |
|
206 | 206 | Parrot_pmc_free_temporary(interp, temp); |
207 | 207 | } |
208 | 208 | |
209 | | op ne(invar PMC, in NUM, inconst LABEL) :base_core { |
| 209 | op ne(invar PMC, in NUM, inconst LABEL) { |
210 | 210 | if (VTABLE_get_number(interp, $1) != $2) { |
211 | 211 | goto OFFSET($3); |
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | | op ne(invar PMC, in STR, inconst LABEL) :base_core { |
| 215 | op ne(invar PMC, in STR, inconst LABEL) { |
216 | 216 | if (!STRING_equal(interp, VTABLE_get_string(interp, $1), $2)) { |
217 | 217 | goto OFFSET($3); |
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | | op ne_str(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 221 | op ne_str(invar PMC, invar PMC, inconst LABEL) { |
222 | 222 | if (VTABLE_cmp_string(interp, $1, $2) != 0) { |
223 | 223 | goto OFFSET($3); |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | | op ne_num(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 227 | op ne_num(invar PMC, invar PMC, inconst LABEL) { |
228 | 228 | if (VTABLE_cmp_num(interp, $1, $2) != 0) { |
229 | 229 | goto OFFSET($3); |
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | | op ne_addr(in STR, in STR, inconst LABEL) :base_core { |
| 233 | op ne_addr(in STR, in STR, inconst LABEL) { |
234 | 234 | if ($1 != $2) { |
235 | 235 | goto OFFSET($3); |
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | | op ne_addr(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 239 | op ne_addr(invar PMC, invar PMC, inconst LABEL) { |
240 | 240 | if ($1 != $2) { |
241 | 241 | goto OFFSET($3); |
242 | 242 | } |
… |
… |
|
266 | 266 | |
267 | 267 | =cut |
268 | 268 | |
269 | | inline op lt(in INT, in INT, inconst LABEL) :base_core { |
| 269 | inline op lt(in INT, in INT, inconst LABEL) { |
270 | 270 | if ($1 < $2) { |
271 | 271 | goto OFFSET($3); |
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | | inline op lt(in NUM, in NUM, inconst LABEL) :base_core { |
| 275 | inline op lt(in NUM, in NUM, inconst LABEL) { |
276 | 276 | if ($1 < $2) { |
277 | 277 | goto OFFSET($3); |
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
281 | | op lt(in STR, in STR, inconst LABEL) :base_core { |
| 281 | op lt(in STR, in STR, inconst LABEL) { |
282 | 282 | if (STRING_compare(interp, $1, $2) < 0) { |
283 | 283 | goto OFFSET($3); |
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | | op lt(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 287 | op lt(invar PMC, invar PMC, inconst LABEL) { |
288 | 288 | if (VTABLE_cmp(interp, $1, $2) < 0) { |
289 | 289 | goto OFFSET($3); |
290 | 290 | } |
291 | 291 | } |
292 | 292 | |
293 | | op lt(invar PMC, in INT, inconst LABEL) :base_core { |
| 293 | op lt(invar PMC, in INT, inconst LABEL) { |
294 | 294 | PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer); |
295 | 295 | VTABLE_set_integer_native(interp, temp, $2); |
296 | 296 | |
… |
… |
|
302 | 302 | Parrot_pmc_free_temporary(interp, temp); |
303 | 303 | } |
304 | 304 | |
305 | | op lt(invar PMC, in NUM, inconst LABEL) :base_core { |
| 305 | op lt(invar PMC, in NUM, inconst LABEL) { |
306 | 306 | if (VTABLE_get_number(interp, $1) < $2) { |
307 | 307 | goto OFFSET($3); |
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | | op lt(invar PMC, in STR, inconst LABEL) :base_core { |
| 311 | op lt(invar PMC, in STR, inconst LABEL) { |
312 | 312 | if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) < 0) { |
313 | 313 | goto OFFSET($3); |
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
317 | | op lt_str(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 317 | op lt_str(invar PMC, invar PMC, inconst LABEL) { |
318 | 318 | if (VTABLE_cmp_string(interp, $1, $2) < 0) { |
319 | 319 | goto OFFSET($3); |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | | op lt_num(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 323 | op lt_num(invar PMC, invar PMC, inconst LABEL) { |
324 | 324 | if (VTABLE_cmp_num(interp, $1, $2) < 0) { |
325 | 325 | goto OFFSET($3); |
326 | 326 | } |
… |
… |
|
350 | 350 | |
351 | 351 | =cut |
352 | 352 | |
353 | | inline op le(in INT, in INT, inconst LABEL) :base_core { |
| 353 | inline op le(in INT, in INT, inconst LABEL) { |
354 | 354 | if ($1 <= $2) { |
355 | 355 | goto OFFSET($3); |
356 | 356 | } |
357 | 357 | } |
358 | 358 | |
359 | | inline op le(in NUM, in NUM, inconst LABEL) :base_core { |
| 359 | inline op le(in NUM, in NUM, inconst LABEL) { |
360 | 360 | if ($1 <= $2) { |
361 | 361 | goto OFFSET($3); |
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
365 | | op le(in STR, in STR, inconst LABEL) :base_core { |
| 365 | op le(in STR, in STR, inconst LABEL) { |
366 | 366 | if (STRING_compare(interp, $1, $2) <= 0) { |
367 | 367 | goto OFFSET($3); |
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | | op le(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 371 | op le(invar PMC, invar PMC, inconst LABEL) { |
372 | 372 | if (VTABLE_cmp(interp, $1, $2) <= 0) { |
373 | 373 | goto OFFSET($3); |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | | op le(invar PMC, in INT, inconst LABEL) :base_core { |
| 377 | op le(invar PMC, in INT, inconst LABEL) { |
378 | 378 | PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer); |
379 | 379 | VTABLE_set_integer_native(interp, temp, $2); |
380 | 380 | |
… |
… |
|
386 | 386 | Parrot_pmc_free_temporary(interp, temp); |
387 | 387 | } |
388 | 388 | |
389 | | op le(invar PMC, in NUM, inconst LABEL) :base_core { |
| 389 | op le(invar PMC, in NUM, inconst LABEL) { |
390 | 390 | if (VTABLE_get_number(interp, $1) <= $2) { |
391 | 391 | goto OFFSET($3); |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | | op le(invar PMC, in STR, inconst LABEL) :base_core { |
| 395 | op le(invar PMC, in STR, inconst LABEL) { |
396 | 396 | if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) <= 0) { |
397 | 397 | goto OFFSET($3); |
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
401 | | op le_str(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 401 | op le_str(invar PMC, invar PMC, inconst LABEL) { |
402 | 402 | if (VTABLE_cmp_string(interp, $1, $2) <= 0) { |
403 | 403 | goto OFFSET($3); |
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | | op le_num(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 407 | op le_num(invar PMC, invar PMC, inconst LABEL) { |
408 | 408 | if (VTABLE_cmp_num(interp, $1, $2) <= 0) { |
409 | 409 | goto OFFSET($3); |
410 | 410 | } |
… |
… |
|
428 | 428 | |
429 | 429 | =cut |
430 | 430 | |
431 | | op gt(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 431 | op gt(invar PMC, invar PMC, inconst LABEL) { |
432 | 432 | if (VTABLE_cmp(interp, $1, $2) > 0) { |
433 | 433 | goto OFFSET($3); |
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | | op gt(invar PMC, in INT, inconst LABEL) :base_core { |
| 437 | op gt(invar PMC, in INT, inconst LABEL) { |
438 | 438 | PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer); |
439 | 439 | VTABLE_set_integer_native(interp, temp, $2); |
440 | 440 | |
… |
… |
|
446 | 446 | Parrot_pmc_free_temporary(interp, temp); |
447 | 447 | } |
448 | 448 | |
449 | | op gt(invar PMC, in NUM, inconst LABEL) :base_core { |
| 449 | op gt(invar PMC, in NUM, inconst LABEL) { |
450 | 450 | if (VTABLE_get_number(interp, $1) > $2) { |
451 | 451 | goto OFFSET($3); |
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | | op gt(invar PMC, in STR, inconst LABEL) :base_core { |
| 455 | op gt(invar PMC, in STR, inconst LABEL) { |
456 | 456 | if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) > 0) { |
457 | 457 | goto OFFSET($3); |
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
461 | | op gt_str(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 461 | op gt_str(invar PMC, invar PMC, inconst LABEL) { |
462 | 462 | if (VTABLE_cmp_string(interp, $1, $2) > 0) { |
463 | 463 | goto OFFSET($3); |
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | | op gt_num(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 467 | op gt_num(invar PMC, invar PMC, inconst LABEL) { |
468 | 468 | if (VTABLE_cmp_num(interp, $1, $2) > 0) { |
469 | 469 | goto OFFSET($3); |
470 | 470 | } |
… |
… |
|
488 | 488 | |
489 | 489 | =cut |
490 | 490 | |
491 | | op ge(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 491 | op ge(invar PMC, invar PMC, inconst LABEL) { |
492 | 492 | if (VTABLE_cmp(interp, $1, $2) >= 0) { |
493 | 493 | goto OFFSET($3); |
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
497 | | op ge(invar PMC, in INT, inconst LABEL) :base_core { |
| 497 | op ge(invar PMC, in INT, inconst LABEL) { |
498 | 498 | PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer); |
499 | 499 | VTABLE_set_integer_native(interp, temp, $2); |
500 | 500 | |
… |
… |
|
506 | 506 | Parrot_pmc_free_temporary(interp, temp); |
507 | 507 | } |
508 | 508 | |
509 | | op ge(invar PMC, in NUM, inconst LABEL) :base_core { |
| 509 | op ge(invar PMC, in NUM, inconst LABEL) { |
510 | 510 | if (VTABLE_get_number(interp, $1) >= $2) { |
511 | 511 | goto OFFSET($3); |
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | | op ge(invar PMC, in STR, inconst LABEL) :base_core { |
| 515 | op ge(invar PMC, in STR, inconst LABEL) { |
516 | 516 | if (STRING_compare(interp, VTABLE_get_string(interp, $1), $2) >= 0) { |
517 | 517 | goto OFFSET($3); |
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
521 | | op ge_str(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 521 | op ge_str(invar PMC, invar PMC, inconst LABEL) { |
522 | 522 | if (VTABLE_cmp_string(interp, $1, $2) >= 0) { |
523 | 523 | goto OFFSET($3); |
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
527 | | op ge_num(invar PMC, invar PMC, inconst LABEL) :base_core { |
| 527 | op ge_num(invar PMC, invar PMC, inconst LABEL) { |
528 | 528 | if (VTABLE_cmp_num(interp, $1, $2) >= 0) { |
529 | 529 | goto OFFSET($3); |
530 | 530 | } |
… |
… |
|
613 | 613 | |
614 | 614 | =cut |
615 | 615 | |
616 | | inline op cmp(out INT, in INT, in INT) :base_core { |
| 616 | inline op cmp(out INT, in INT, in INT) { |
617 | 617 | $1 = $2 < $3 ? -1 : |
618 | 618 | $2 > $3 ? +1 : |
619 | 619 | 0; |
620 | 620 | } |
621 | 621 | |
622 | | inline op cmp(out INT, in NUM, in NUM) :base_core { |
| 622 | inline op cmp(out INT, in NUM, in NUM) { |
623 | 623 | $1 = $2 < $3 ? -1 : |
624 | 624 | $2 > $3 ? +1 : |
625 | 625 | 0; |
626 | 626 | } |
627 | 627 | |
628 | | inline op cmp(out INT, in STR, in STR) :base_core { |
| 628 | inline op cmp(out INT, in STR, in STR) { |
629 | 629 | $1 = STRING_compare(interp, $2, $3); |
630 | 630 | } |
631 | 631 | |
632 | | inline op cmp(out INT, invar PMC, invar PMC) :base_core { |
| 632 | inline op cmp(out INT, invar PMC, invar PMC) { |
633 | 633 | $1 = VTABLE_cmp(interp, $2, $3); |
634 | 634 | } |
635 | 635 | |
636 | | inline op cmp(out INT, invar PMC, in INT) :base_core { |
| 636 | inline op cmp(out INT, invar PMC, in INT) { |
637 | 637 | const INTVAL l = VTABLE_get_integer(interp, $2); |
638 | 638 | $1 = l < $3 ? -1 : |
639 | 639 | l > $3 ? +1 : |
640 | 640 | 0; |
641 | 641 | } |
642 | 642 | |
643 | | inline op cmp(out INT, invar PMC, in NUM) :base_core { |
| 643 | inline op cmp(out INT, invar PMC, in NUM) { |
644 | 644 | const FLOATVAL l = VTABLE_get_number(interp, $2); |
645 | 645 | $1 = l < $3 ? -1 : |
646 | 646 | l > $3 ? +1 : |
647 | 647 | 0; |
648 | 648 | } |
649 | 649 | |
650 | | inline op cmp(out INT, invar PMC, in STR) :base_core { |
| 650 | inline op cmp(out INT, invar PMC, in STR) { |
651 | 651 | STRING* const l = VTABLE_get_string(interp, $2); |
652 | 652 | $1 = STRING_compare(interp, l, $3); |
653 | 653 | } |
654 | 654 | |
655 | | inline op cmp_str(out INT, invar PMC, invar PMC) :base_core { |
| 655 | inline op cmp_str(out INT, invar PMC, invar PMC) { |
656 | 656 | $1 = VTABLE_cmp_string(interp, $2, $3); |
657 | 657 | } |
658 | 658 | |
659 | | inline op cmp_num(out INT, invar PMC, invar PMC) :base_core { |
| 659 | inline op cmp_num(out INT, invar PMC, invar PMC) { |
660 | 660 | $1 = VTABLE_cmp_num(interp, $2, $3); |
661 | 661 | } |
662 | 662 | |
… |
… |
|
668 | 668 | |
669 | 669 | =cut |
670 | 670 | |
671 | | inline op cmp_pmc(out PMC, invar PMC, invar PMC) :base_core { |
| 671 | inline op cmp_pmc(out PMC, invar PMC, invar PMC) { |
672 | 672 | $1 = VTABLE_cmp_pmc(interp, $2, $3); |
673 | 673 | } |
674 | 674 | |
… |
… |
|
922 | 922 | |
923 | 923 | =cut |
924 | 924 | |
925 | | inline op and(out INT, in INT, in INT) :base_core { |
| 925 | inline op and(out INT, in INT, in INT) { |
926 | 926 | $1 = $2 ? $3 : $2; |
927 | 927 | } |
928 | 928 | |
929 | | inline op and(invar PMC, invar PMC, invar PMC) :base_core { |
| 929 | inline op and(invar PMC, invar PMC, invar PMC) { |
930 | 930 | $1 = VTABLE_get_bool(interp, $2) ? $3 : $2; |
931 | 931 | } |
932 | 932 | |
… |
… |
|
944 | 944 | |
945 | 945 | =cut |
946 | 946 | |
947 | | inline op not(inout INT) :base_core { |
| 947 | inline op not(inout INT) { |
948 | 948 | $1 = ! $1; |
949 | 949 | } |
950 | 950 | |
951 | | inline op not(out INT, in INT) :base_core { |
| 951 | inline op not(out INT, in INT) { |
952 | 952 | $1 = ! $2; |
953 | 953 | } |
954 | 954 | |
955 | | inline op not(invar PMC) :base_core { |
| 955 | inline op not(invar PMC) { |
956 | 956 | VTABLE_set_bool(interp, $1, !VTABLE_get_bool(interp, $1)); |
957 | 957 | } |
958 | 958 | |
959 | | inline op not(out PMC, invar PMC) :base_core { |
| 959 | inline op not(out PMC, invar PMC) { |
960 | 960 | const INTVAL a = ! VTABLE_get_bool(interp, $2); |
961 | 961 | if (PMC_IS_NULL($1)) |
962 | 962 | $1 = Parrot_pmc_new(interp, Parrot_hll_get_ctx_HLL_type(interp, enum_class_Boolean)); |
… |
… |
|
973 | 973 | |
974 | 974 | =cut |
975 | 975 | |
976 | | inline op or(out INT, in INT, in INT) :base_core { |
| 976 | inline op or(out INT, in INT, in INT) { |
977 | 977 | $1 = $2 ? $2 : $3; |
978 | 978 | } |
979 | 979 | |
980 | | inline op or(invar PMC, invar PMC, invar PMC) :base_core { |
| 980 | inline op or(invar PMC, invar PMC, invar PMC) { |
981 | 981 | $1 = VTABLE_get_bool(interp, $2) ? $2 : $3; |
982 | 982 | } |
983 | 983 | |
… |
… |
|
992 | 992 | |
993 | 993 | =cut |
994 | 994 | |
995 | | inline op xor(out INT, in INT, in INT) :base_core { |
| 995 | inline op xor(out INT, in INT, in INT) { |
996 | 996 | $1 = ($2 && ! $3) ? $2 : ($3 && ! $2) ? $3 : 0; |
997 | 997 | } |
998 | 998 | |
999 | | inline op xor(invar PMC, invar PMC, invar PMC) :base_core { |
| 999 | inline op xor(invar PMC, invar PMC, invar PMC) { |
1000 | 1000 | const INTVAL a = VTABLE_get_bool(interp, $2); |
1001 | 1001 | const INTVAL b = VTABLE_get_bool(interp, $3); |
1002 | 1002 | if (a && ! b) |
diff --git a/src/ops/core.ops b/src/ops/core.ops
index 22c298f..27f268a 100644
a
|
b
|
|
54 | 54 | |
55 | 55 | =cut |
56 | 56 | |
57 | | inline op end() :base_core :check_event :flow { |
| 57 | inline op end() :check_event :flow { |
58 | 58 | goto ADDRESS(0); |
59 | 59 | } |
60 | 60 | |
… |
… |
|
83 | 83 | |
84 | 84 | =cut |
85 | 85 | |
86 | | inline op noop() :base_core { |
| 86 | inline op noop() { |
87 | 87 | } |
88 | 88 | |
89 | | inline op check_events() :base_core :flow { |
| 89 | inline op check_events() :flow { |
90 | 90 | opcode_t * const next = expr NEXT(); |
91 | 91 | Parrot_cx_check_tasks(interp, interp->scheduler); |
92 | 92 | goto ADDRESS(next); /* force this being a branch op */ |
… |
… |
|
151 | 151 | |
152 | 152 | =cut |
153 | 153 | |
154 | | inline op local_branch(invar PMC, in LABEL) :base_core :check_event :flow { |
| 154 | inline op local_branch(invar PMC, in LABEL) :check_event :flow { |
155 | 155 | INTVAL return_addr; |
156 | 156 | opcode_t * const dest = expr NEXT(); |
157 | 157 | |
diff --git a/src/ops/experimental.ops b/src/ops/experimental.ops
index 88a7c89..be84031 100644
a
|
b
|
|
110 | 110 | |
111 | 111 | =cut |
112 | 112 | |
113 | | inline op fetch(out PMC, in PMC, in PMC, in PMC) :base_core { |
| 113 | inline op fetch(out PMC, in PMC, in PMC, in PMC) { |
114 | 114 | $1 = VTABLE_get_pmc_keyed(interp, $2, $3); |
115 | 115 | |
116 | 116 | if (PMC_IS_NULL($1)) { |
… |
… |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | | inline op fetch(out PMC, in PMC, in INT, in PMC) :base_core { |
| 121 | inline op fetch(out PMC, in PMC, in INT, in PMC) { |
122 | 122 | $1 = VTABLE_get_pmc_keyed_int(interp, $2, $3); |
123 | 123 | |
124 | 124 | if (PMC_IS_NULL($1)) { |
… |
… |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | | inline op fetch(out PMC, in PMC, in STR, in PMC) :base_core { |
| 129 | inline op fetch(out PMC, in PMC, in STR, in PMC) { |
130 | 130 | $1 = VTABLE_get_pmc_keyed_str(interp, $2, $3); |
131 | 131 | |
132 | 132 | if (PMC_IS_NULL($1)) { |
… |
… |
|
145 | 145 | |
146 | 146 | =cut |
147 | 147 | |
148 | | inline op vivify(out PMC, in PMC, in PMC, in PMC) :base_core { |
| 148 | inline op vivify(out PMC, in PMC, in PMC, in PMC) { |
149 | 149 | $1 = VTABLE_get_pmc_keyed(interp, $2, $3); |
150 | 150 | |
151 | 151 | if (PMC_IS_NULL($1)) { |
… |
… |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | | inline op vivify(out PMC, in PMC, in INT, in PMC) :base_core { |
| 158 | inline op vivify(out PMC, in PMC, in INT, in PMC) { |
159 | 159 | $1 = VTABLE_get_pmc_keyed_int(interp, $2, $3); |
160 | 160 | |
161 | 161 | if (PMC_IS_NULL($1)) { |
… |
… |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | | inline op vivify(out PMC, in PMC, in STR, in PMC) :base_core { |
| 168 | inline op vivify(out PMC, in PMC, in STR, in PMC) { |
169 | 169 | $1 = VTABLE_get_pmc_keyed_str(interp, $2, $3); |
170 | 170 | |
171 | 171 | if (PMC_IS_NULL($1)) { |
diff --git a/src/ops/math.ops b/src/ops/math.ops
index 1a0825c..6bdadfa 100644
a
|
b
|
|
45 | 45 | |
46 | 46 | =cut |
47 | 47 | |
48 | | inline op abs(inout INT) :base_core { |
| 48 | inline op abs(inout INT) { |
49 | 49 | $1 = abs($1); |
50 | 50 | } |
51 | 51 | |
52 | | inline op abs(inout NUM) :base_core { |
| 52 | inline op abs(inout NUM) { |
53 | 53 | $1 = fabs($1); |
54 | 54 | } |
55 | 55 | |
56 | | inline op abs(out INT, in INT) :base_core { |
| 56 | inline op abs(out INT, in INT) { |
57 | 57 | $1 = abs($2); |
58 | 58 | } |
59 | 59 | |
60 | | inline op abs(out NUM, in NUM) :base_core { |
| 60 | inline op abs(out NUM, in NUM) { |
61 | 61 | $1 = fabs($2); |
62 | 62 | } |
63 | 63 | |
64 | | inline op abs(invar PMC) :base_core { |
| 64 | inline op abs(invar PMC) { |
65 | 65 | VTABLE_i_absolute(interp, $1); |
66 | 66 | } |
67 | 67 | |
68 | | inline op abs(out PMC, invar PMC) :base_core { |
| 68 | inline op abs(out PMC, invar PMC) { |
69 | 69 | $1 = VTABLE_absolute(interp, $2, $1); |
70 | 70 | } |
71 | 71 | |
… |
… |
|
97 | 97 | |
98 | 98 | =cut |
99 | 99 | |
100 | | inline op add(inout INT, in INT) :base_core { |
| 100 | inline op add(inout INT, in INT) { |
101 | 101 | $1 += $2; |
102 | 102 | } |
103 | 103 | |
104 | | inline op add(inout NUM, in NUM) :base_core { |
| 104 | inline op add(inout NUM, in NUM) { |
105 | 105 | $1 += $2; |
106 | 106 | } |
107 | 107 | |
108 | | inline op add(invar PMC, invar PMC) :base_core { |
| 108 | inline op add(invar PMC, invar PMC) { |
109 | 109 | VTABLE_i_add(interp, $1, $2); |
110 | 110 | } |
111 | 111 | |
112 | | inline op add(invar PMC, in INT) :base_core { |
| 112 | inline op add(invar PMC, in INT) { |
113 | 113 | VTABLE_i_add_int(interp, $1, $2); |
114 | 114 | } |
115 | 115 | |
116 | | inline op add(invar PMC, in NUM) :base_core { |
| 116 | inline op add(invar PMC, in NUM) { |
117 | 117 | VTABLE_i_add_float(interp, $1, $2); |
118 | 118 | } |
119 | 119 | |
120 | | inline op add(out INT, in INT, in INT) :base_core { |
| 120 | inline op add(out INT, in INT, in INT) { |
121 | 121 | $1 = $2 + $3; |
122 | 122 | } |
123 | 123 | |
124 | | inline op add(out NUM, in NUM, in NUM) :base_core { |
| 124 | inline op add(out NUM, in NUM, in NUM) { |
125 | 125 | $1 = $2 + $3; |
126 | 126 | } |
127 | 127 | |
128 | | inline op add(invar PMC, invar PMC, invar PMC) :base_core { |
| 128 | inline op add(invar PMC, invar PMC, invar PMC) { |
129 | 129 | $1 = VTABLE_add(interp, $2, $3, $1); |
130 | 130 | } |
131 | 131 | |
132 | | inline op add(invar PMC, invar PMC, in INT) :base_core { |
| 132 | inline op add(invar PMC, invar PMC, in INT) { |
133 | 133 | $1 = VTABLE_add_int(interp, $2, $3, $1); |
134 | 134 | } |
135 | 135 | |
136 | | inline op add(invar PMC, invar PMC, in NUM) :base_core { |
| 136 | inline op add(invar PMC, invar PMC, in NUM) { |
137 | 137 | $1 = VTABLE_add_float(interp, $2, $3, $1); |
138 | 138 | } |
139 | 139 | |
… |
… |
|
149 | 149 | |
150 | 150 | =cut |
151 | 151 | |
152 | | inline op dec(inout INT) :base_core { |
| 152 | inline op dec(inout INT) { |
153 | 153 | $1--; |
154 | 154 | } |
155 | 155 | |
156 | | inline op dec(inout NUM) :base_core { |
| 156 | inline op dec(inout NUM) { |
157 | 157 | $1--; |
158 | 158 | } |
159 | 159 | |
160 | | inline op dec(invar PMC) :base_core { |
| 160 | inline op dec(invar PMC) { |
161 | 161 | VTABLE_decrement(interp, $1); |
162 | 162 | } |
163 | 163 | |
… |
… |
|
191 | 191 | |
192 | 192 | =cut |
193 | 193 | |
194 | | inline op div(inout INT, in INT) :base_core { |
| 194 | inline op div(inout INT, in INT) { |
195 | 195 | const INTVAL den = $2; |
196 | 196 | if (den == 0) { |
197 | 197 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, expr NEXT(), |
… |
… |
|
202 | 202 | $1 /= den; |
203 | 203 | } |
204 | 204 | |
205 | | inline op div(inout NUM, in NUM) :base_core { |
| 205 | inline op div(inout NUM, in NUM) { |
206 | 206 | const FLOATVAL den = $2; |
207 | 207 | if (FLOAT_IS_ZERO(den)) { |
208 | 208 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, expr NEXT(), |
… |
… |
|
213 | 213 | $1 /= den; |
214 | 214 | } |
215 | 215 | |
216 | | inline op div(invar PMC, invar PMC) :base_core { |
| 216 | inline op div(invar PMC, invar PMC) { |
217 | 217 | VTABLE_i_divide(interp, $1, $2); |
218 | 218 | } |
219 | 219 | |
220 | | inline op div(invar PMC, in INT) :base_core { |
| 220 | inline op div(invar PMC, in INT) { |
221 | 221 | VTABLE_i_divide_int(interp, $1, $2); |
222 | 222 | } |
223 | 223 | |
224 | | inline op div(invar PMC, in NUM) :base_core { |
| 224 | inline op div(invar PMC, in NUM) { |
225 | 225 | VTABLE_i_divide_float(interp, $1, $2); |
226 | 226 | } |
227 | | inline op div(out INT, in INT, in INT) :base_core { |
| 227 | inline op div(out INT, in INT, in INT) { |
228 | 228 | const INTVAL den = $3; |
229 | 229 | if (den == 0) { |
230 | 230 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, expr NEXT(), |
… |
… |
|
235 | 235 | $1 = $2 / den; |
236 | 236 | } |
237 | 237 | |
238 | | inline op div(out NUM, in NUM, in NUM) :base_core { |
| 238 | inline op div(out NUM, in NUM, in NUM) { |
239 | 239 | const FLOATVAL den = $3; |
240 | 240 | if (FLOAT_IS_ZERO(den)) { |
241 | 241 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, expr NEXT(), |
… |
… |
|
246 | 246 | $1 = $2 / den; |
247 | 247 | } |
248 | 248 | |
249 | | inline op div(invar PMC, invar PMC, invar PMC) :base_core { |
| 249 | inline op div(invar PMC, invar PMC, invar PMC) { |
250 | 250 | $1 = VTABLE_divide(interp, $2, $3, $1); |
251 | 251 | } |
252 | 252 | |
253 | | inline op div(invar PMC, invar PMC, in INT) :base_core { |
| 253 | inline op div(invar PMC, invar PMC, in INT) { |
254 | 254 | $1 = VTABLE_divide_int(interp, $2, $3, $1); |
255 | 255 | } |
256 | 256 | |
257 | | inline op div(invar PMC, invar PMC, in NUM) :base_core { |
| 257 | inline op div(invar PMC, invar PMC, in NUM) { |
258 | 258 | $1 = VTABLE_divide_float(interp, $2, $3, $1); |
259 | 259 | } |
260 | 260 | |
… |
… |
|
287 | 287 | |
288 | 288 | =cut |
289 | 289 | |
290 | | inline op fdiv(inout INT, in INT) :base_core { |
| 290 | inline op fdiv(inout INT, in INT) { |
291 | 291 | const INTVAL den = $2; |
292 | 292 | FLOATVAL f; |
293 | 293 | |
… |
… |
|
302 | 302 | $1 = (INTVAL)f; |
303 | 303 | } |
304 | 304 | |
305 | | inline op fdiv(inout NUM, in NUM) :base_core { |
| 305 | inline op fdiv(inout NUM, in NUM) { |
306 | 306 | const FLOATVAL den = $2; |
307 | 307 | |
308 | 308 | if (FLOAT_IS_ZERO(den)) { |
… |
… |
|
314 | 314 | $1 = floor($1 / den); |
315 | 315 | } |
316 | 316 | |
317 | | inline op fdiv(invar PMC, invar PMC) :base_core { |
| 317 | inline op fdiv(invar PMC, invar PMC) { |
318 | 318 | VTABLE_i_floor_divide(interp, $1, $2); |
319 | 319 | } |
320 | 320 | |
321 | | inline op fdiv(invar PMC, in INT) :base_core { |
| 321 | inline op fdiv(invar PMC, in INT) { |
322 | 322 | VTABLE_i_floor_divide_int(interp, $1, $2); |
323 | 323 | } |
324 | 324 | |
325 | | inline op fdiv(invar PMC, in NUM) :base_core { |
| 325 | inline op fdiv(invar PMC, in NUM) { |
326 | 326 | VTABLE_i_floor_divide_float(interp, $1, $2); |
327 | 327 | } |
328 | 328 | |
329 | | inline op fdiv(out INT, in INT, in INT) :base_core { |
| 329 | inline op fdiv(out INT, in INT, in INT) { |
330 | 330 | const INTVAL den = $3; |
331 | 331 | FLOATVAL f; |
332 | 332 | |
… |
… |
|
341 | 341 | $1 = (INTVAL)f; |
342 | 342 | } |
343 | 343 | |
344 | | inline op fdiv(out NUM, in NUM, in NUM) :base_core { |
| 344 | inline op fdiv(out NUM, in NUM, in NUM) { |
345 | 345 | FLOATVAL den = $3; |
346 | 346 | if (FLOAT_IS_ZERO(den)) { |
347 | 347 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, expr NEXT(), |
… |
… |
|
352 | 352 | $1 = floor($2 / den); |
353 | 353 | } |
354 | 354 | |
355 | | inline op fdiv(invar PMC, invar PMC, invar PMC) :base_core { |
| 355 | inline op fdiv(invar PMC, invar PMC, invar PMC) { |
356 | 356 | $1 = VTABLE_floor_divide(interp, $2, $3, $1); |
357 | 357 | } |
358 | 358 | |
359 | | inline op fdiv(invar PMC, invar PMC, in INT) :base_core { |
| 359 | inline op fdiv(invar PMC, invar PMC, in INT) { |
360 | 360 | $1 = VTABLE_floor_divide_int(interp, $2, $3, $1); |
361 | 361 | } |
362 | 362 | |
363 | | inline op fdiv(invar PMC, invar PMC, in NUM) :base_core { |
| 363 | inline op fdiv(invar PMC, invar PMC, in NUM) { |
364 | 364 | $1 = VTABLE_floor_divide_float(interp, $2, $3, $1); |
365 | 365 | } |
366 | 366 | |
… |
… |
|
378 | 378 | |
379 | 379 | =cut |
380 | 380 | |
381 | | inline op ceil(inout NUM) :base_core { |
| 381 | inline op ceil(inout NUM) { |
382 | 382 | $1 = ceil($1); |
383 | 383 | } |
384 | 384 | |
385 | | inline op ceil(out INT, in NUM) :base_core { |
| 385 | inline op ceil(out INT, in NUM) { |
386 | 386 | const FLOATVAL f = ceil($2); |
387 | 387 | $1 = (INTVAL)f; |
388 | 388 | } |
389 | 389 | |
390 | | inline op ceil(out NUM, in NUM) :base_core { |
| 390 | inline op ceil(out NUM, in NUM) { |
391 | 391 | $1 = ceil($2); |
392 | 392 | } |
393 | 393 | |
… |
… |
|
405 | 405 | |
406 | 406 | =cut |
407 | 407 | |
408 | | inline op floor(inout NUM) :base_core { |
| 408 | inline op floor(inout NUM) { |
409 | 409 | $1 = floor($1); |
410 | 410 | } |
411 | 411 | |
412 | | inline op floor(out INT, in NUM) :base_core { |
| 412 | inline op floor(out INT, in NUM) { |
413 | 413 | const FLOATVAL f = floor($2); |
414 | 414 | $1 = (INTVAL)f; |
415 | 415 | } |
416 | 416 | |
417 | | inline op floor(out NUM, in NUM) :base_core { |
| 417 | inline op floor(out NUM, in NUM) { |
418 | 418 | $1 = floor($2); |
419 | 419 | } |
420 | 420 | |
… |
… |
|
430 | 430 | |
431 | 431 | =cut |
432 | 432 | |
433 | | inline op inc(inout INT) :base_core { |
| 433 | inline op inc(inout INT) { |
434 | 434 | $1++; |
435 | 435 | } |
436 | 436 | |
437 | | inline op inc(inout NUM) :base_core { |
| 437 | inline op inc(inout NUM) { |
438 | 438 | $1++; |
439 | 439 | } |
440 | 440 | |
441 | | inline op inc(invar PMC) :base_core { |
| 441 | inline op inc(invar PMC) { |
442 | 442 | VTABLE_increment(interp, $1); |
443 | 443 | } |
444 | 444 | |
… |
… |
|
490 | 490 | |
491 | 491 | =cut |
492 | 492 | |
493 | | op mod(inout INT, in INT) :base_core { |
| 493 | op mod(inout INT, in INT) { |
494 | 494 | $1 = Parrot_util_intval_mod($1, $2); |
495 | 495 | } |
496 | 496 | |
497 | | op mod(inout NUM, in NUM) :base_core { |
| 497 | op mod(inout NUM, in NUM) { |
498 | 498 | $1 = Parrot_util_floatval_mod($1, $2); |
499 | 499 | } |
500 | 500 | |
501 | | inline op mod(invar PMC, invar PMC) :base_core { |
| 501 | inline op mod(invar PMC, invar PMC) { |
502 | 502 | VTABLE_i_modulus(interp, $1, $2); |
503 | 503 | } |
504 | 504 | |
505 | | inline op mod(invar PMC, in INT) :base_core { |
| 505 | inline op mod(invar PMC, in INT) { |
506 | 506 | VTABLE_i_modulus_int(interp, $1, $2); |
507 | 507 | } |
508 | 508 | |
509 | | inline op mod(invar PMC, in NUM) :base_core { |
| 509 | inline op mod(invar PMC, in NUM) { |
510 | 510 | VTABLE_i_modulus_float(interp, $1, $2); |
511 | 511 | } |
512 | 512 | |
513 | | op mod(out INT, in INT, in INT) :base_core { |
| 513 | op mod(out INT, in INT, in INT) { |
514 | 514 | $1 = Parrot_util_intval_mod($2, $3); |
515 | 515 | } |
516 | 516 | |
517 | | op mod(out NUM, in NUM, in NUM) :base_core { |
| 517 | op mod(out NUM, in NUM, in NUM) { |
518 | 518 | $1 = Parrot_util_floatval_mod($2, $3); |
519 | 519 | } |
520 | 520 | |
521 | | inline op mod(invar PMC, invar PMC, invar PMC) :base_core { |
| 521 | inline op mod(invar PMC, invar PMC, invar PMC) { |
522 | 522 | $1 = VTABLE_modulus(interp, $2, $3, $1); |
523 | 523 | } |
524 | 524 | |
525 | | inline op mod(invar PMC, invar PMC, in INT) :base_core { |
| 525 | inline op mod(invar PMC, invar PMC, in INT) { |
526 | 526 | $1 = VTABLE_modulus_int(interp, $2, $3, $1); |
527 | 527 | } |
528 | 528 | |
529 | | inline op mod(invar PMC, invar PMC, in NUM) :base_core { |
| 529 | inline op mod(invar PMC, invar PMC, in NUM) { |
530 | 530 | $1 = VTABLE_modulus_float(interp, $2, $3, $1); |
531 | 531 | } |
532 | 532 | |
… |
… |
|
558 | 558 | |
559 | 559 | =cut |
560 | 560 | |
561 | | inline op mul(inout INT, in INT) :base_core { |
| 561 | inline op mul(inout INT, in INT) { |
562 | 562 | $1 *= $2; |
563 | 563 | } |
564 | 564 | |
565 | | inline op mul(inout NUM, in NUM) :base_core { |
| 565 | inline op mul(inout NUM, in NUM) { |
566 | 566 | $1 *= $2; |
567 | 567 | } |
568 | 568 | |
569 | | inline op mul(invar PMC, invar PMC) :base_core { |
| 569 | inline op mul(invar PMC, invar PMC) { |
570 | 570 | VTABLE_i_multiply(interp, $1, $2); |
571 | 571 | } |
572 | 572 | |
573 | | inline op mul(invar PMC, in INT) :base_core { |
| 573 | inline op mul(invar PMC, in INT) { |
574 | 574 | VTABLE_i_multiply_int(interp, $1, $2); |
575 | 575 | } |
576 | 576 | |
577 | | inline op mul(invar PMC, in NUM) :base_core { |
| 577 | inline op mul(invar PMC, in NUM) { |
578 | 578 | VTABLE_i_multiply_float(interp, $1, $2); |
579 | 579 | } |
580 | 580 | |
581 | | inline op mul(out INT, in INT, in INT) :base_core { |
| 581 | inline op mul(out INT, in INT, in INT) { |
582 | 582 | $1 = $2 * $3; |
583 | 583 | } |
584 | 584 | |
585 | | inline op mul(out NUM, in NUM, in NUM) :base_core { |
| 585 | inline op mul(out NUM, in NUM, in NUM) { |
586 | 586 | $1 = $2 * $3; |
587 | 587 | } |
588 | 588 | |
589 | | inline op mul(invar PMC, invar PMC, invar PMC) :base_core { |
| 589 | inline op mul(invar PMC, invar PMC, invar PMC) { |
590 | 590 | $1 = VTABLE_multiply(interp, $2, $3, $1); |
591 | 591 | } |
592 | 592 | |
593 | | inline op mul(invar PMC, invar PMC, in INT) :base_core { |
| 593 | inline op mul(invar PMC, invar PMC, in INT) { |
594 | 594 | $1 = VTABLE_multiply_int(interp, $2, $3, $1); |
595 | 595 | } |
596 | 596 | |
597 | | inline op mul(invar PMC, invar PMC, in NUM) :base_core { |
| 597 | inline op mul(invar PMC, invar PMC, in NUM) { |
598 | 598 | $1 = VTABLE_multiply_float(interp, $2, $3, $1); |
599 | 599 | } |
600 | 600 | |
… |
… |
|
618 | 618 | |
619 | 619 | =cut |
620 | 620 | |
621 | | inline op neg(inout INT) :base_core { |
| 621 | inline op neg(inout INT) { |
622 | 622 | $1 = - $1; |
623 | 623 | } |
624 | 624 | |
625 | | inline op neg(inout NUM) :base_core { |
| 625 | inline op neg(inout NUM) { |
626 | 626 | $1 = - $1; |
627 | 627 | } |
628 | 628 | |
629 | | inline op neg(invar PMC) :base_core { |
| 629 | inline op neg(invar PMC) { |
630 | 630 | VTABLE_i_neg(interp, $1); |
631 | 631 | } |
632 | 632 | |
633 | | inline op neg(out INT, in INT) :base_core { |
| 633 | inline op neg(out INT, in INT) { |
634 | 634 | $1 = - $2; |
635 | 635 | } |
636 | 636 | |
637 | | inline op neg(out NUM, in NUM) :base_core { |
| 637 | inline op neg(out NUM, in NUM) { |
638 | 638 | $1 = - $2; |
639 | 639 | } |
640 | 640 | |
641 | | inline op neg(out PMC, invar PMC) :base_core { |
| 641 | inline op neg(out PMC, invar PMC) { |
642 | 642 | $1 = VTABLE_neg(interp, $2, $1); |
643 | 643 | } |
644 | 644 | |
… |
… |
|
670 | 670 | |
671 | 671 | =cut |
672 | 672 | |
673 | | inline op sub(inout INT, in INT) :base_core { |
| 673 | inline op sub(inout INT, in INT) { |
674 | 674 | $1 -= $2; |
675 | 675 | } |
676 | 676 | |
677 | | inline op sub(inout NUM, in NUM) :base_core { |
| 677 | inline op sub(inout NUM, in NUM) { |
678 | 678 | $1 -= $2; |
679 | 679 | } |
680 | 680 | |
681 | | inline op sub(invar PMC, invar PMC) :base_core { |
| 681 | inline op sub(invar PMC, invar PMC) { |
682 | 682 | VTABLE_i_subtract(interp, $1, $2); |
683 | 683 | } |
684 | 684 | |
685 | | inline op sub(invar PMC, in INT) :base_core { |
| 685 | inline op sub(invar PMC, in INT) { |
686 | 686 | VTABLE_i_subtract_int(interp, $1, $2); |
687 | 687 | } |
688 | 688 | |
689 | | inline op sub(invar PMC, in NUM) :base_core { |
| 689 | inline op sub(invar PMC, in NUM) { |
690 | 690 | VTABLE_i_subtract_float(interp, $1, $2); |
691 | 691 | } |
692 | 692 | |
693 | | inline op sub(out INT, in INT, in INT) :base_core { |
| 693 | inline op sub(out INT, in INT, in INT) { |
694 | 694 | $1 = $2 - $3; |
695 | 695 | } |
696 | 696 | |
697 | | inline op sub(out NUM, in NUM, in NUM) :base_core { |
| 697 | inline op sub(out NUM, in NUM, in NUM) { |
698 | 698 | $1 = $2 - $3; |
699 | 699 | } |
700 | 700 | |
701 | | inline op sub(invar PMC, invar PMC, invar PMC) :base_core { |
| 701 | inline op sub(invar PMC, invar PMC, invar PMC) { |
702 | 702 | $1 = VTABLE_subtract(interp, $2, $3, $1); |
703 | 703 | } |
704 | 704 | |
705 | | inline op sub(invar PMC, invar PMC, in INT) :base_core { |
| 705 | inline op sub(invar PMC, invar PMC, in INT) { |
706 | 706 | $1 = VTABLE_subtract_int(interp, $2, $3, $1); |
707 | 707 | } |
708 | 708 | |
709 | | inline op sub(invar PMC, invar PMC, in NUM) :base_core { |
| 709 | inline op sub(invar PMC, invar PMC, in NUM) { |
710 | 710 | $1 = VTABLE_subtract_float(interp, $2, $3, $1); |
711 | 711 | } |
712 | 712 | |
… |
… |
|
718 | 718 | |
719 | 719 | =cut |
720 | 720 | |
721 | | inline op sqrt(out NUM, in NUM) :base_core { |
| 721 | inline op sqrt(out NUM, in NUM) { |
722 | 722 | $1 = sqrt((FLOATVAL)$2); |
723 | 723 | } |
724 | 724 | |
diff --git a/src/ops/pmc.ops b/src/ops/pmc.ops
index b366adb..54e5efa 100644
a
|
b
|
|
669 | 669 | |
670 | 670 | =cut |
671 | 671 | |
672 | | inline op iter(out PMC, invar PMC) :base_core { |
| 672 | inline op iter(out PMC, invar PMC) { |
673 | 673 | $1 = VTABLE_get_iter(interp, $2); |
674 | 674 | } |
675 | 675 | |
diff --git a/src/ops/set.ops b/src/ops/set.ops
index c63c52b..2a8a15e 100644
a
|
b
|
|
82 | 82 | |
83 | 83 | =cut |
84 | 84 | |
85 | | inline op set(out INT, in INT) :base_core { |
| 85 | inline op set(out INT, in INT) { |
86 | 86 | $1 = $2; |
87 | 87 | } |
88 | 88 | |
89 | | inline op set(out INT, in NUM) :base_core { |
| 89 | inline op set(out INT, in NUM) { |
90 | 90 | $1 = (INTVAL)($2); |
91 | 91 | } |
92 | 92 | |
93 | | inline op set(out INT, in STR) :base_core { |
| 93 | inline op set(out INT, in STR) { |
94 | 94 | $1 = Parrot_str_to_int(interp, $2); |
95 | 95 | } |
96 | 96 | |
97 | | inline op set(out NUM, in NUM) :base_core { |
| 97 | inline op set(out NUM, in NUM) { |
98 | 98 | $1 = $2; |
99 | 99 | } |
100 | 100 | |
101 | | inline op set(out NUM, in INT) :base_core { |
| 101 | inline op set(out NUM, in INT) { |
102 | 102 | $1 = (FLOATVAL)$2; |
103 | 103 | } |
104 | 104 | |
105 | | inline op set(out NUM, in STR) :base_core { |
| 105 | inline op set(out NUM, in STR) { |
106 | 106 | $1 = Parrot_str_to_num(interp, $2); |
107 | 107 | } |
108 | 108 | |
109 | | inline op set(out NUM, invar PMC) :base_core { |
| 109 | inline op set(out NUM, invar PMC) { |
110 | 110 | $1 = VTABLE_get_number(interp, $2); |
111 | 111 | } |
112 | 112 | |
113 | | inline op set(out STR, invar PMC) :base_core { |
| 113 | inline op set(out STR, invar PMC) { |
114 | 114 | $1 = VTABLE_get_string(interp, $2); |
115 | 115 | } |
116 | 116 | |
117 | | inline op set(out STR, invar STR) :base_core { |
| 117 | inline op set(out STR, invar STR) { |
118 | 118 | $1 = $2; |
119 | 119 | } |
120 | 120 | |
121 | | inline op set(out STR, inconst STR) :base_core { |
| 121 | inline op set(out STR, inconst STR) { |
122 | 122 | $1 = $2; |
123 | 123 | } |
124 | 124 | |
125 | | inline op set(out STR, in INT) :base_core { |
| 125 | inline op set(out STR, in INT) { |
126 | 126 | $1 = Parrot_str_from_int(interp, $2); |
127 | 127 | } |
128 | 128 | |
129 | | inline op set(out STR, in NUM) :base_core { |
| 129 | inline op set(out STR, in NUM) { |
130 | 130 | $1 = Parrot_str_from_num(interp, $2); |
131 | 131 | } |
132 | 132 | |
133 | | inline op set(out PMC, inconst PMC) :base_core { |
| 133 | inline op set(out PMC, inconst PMC) { |
134 | 134 | $1 = $2; |
135 | 135 | } |
136 | 136 | |
137 | | inline op set(out PMC, invar PMC) :base_core { |
| 137 | inline op set(out PMC, invar PMC) { |
138 | 138 | $1 = $2; |
139 | 139 | } |
140 | 140 | |
141 | | inline op set(invar PMC, in INT) :base_core { |
| 141 | inline op set(invar PMC, in INT) { |
142 | 142 | VTABLE_set_integer_native(interp, $1, $2); |
143 | 143 | } |
144 | 144 | |
145 | | inline op set(invar PMC, in NUM) :base_core { |
| 145 | inline op set(invar PMC, in NUM) { |
146 | 146 | VTABLE_set_number_native(interp, $1, $2); |
147 | 147 | } |
148 | 148 | |
149 | | inline op set(invar PMC, invar STR) :base_core { |
| 149 | inline op set(invar PMC, invar STR) { |
150 | 150 | VTABLE_set_string_native(interp, $1, $2); |
151 | 151 | } |
152 | 152 | |
153 | | inline op set(invar PMC, inconst STR) :base_core { |
| 153 | inline op set(invar PMC, inconst STR) { |
154 | 154 | VTABLE_set_string_native(interp, $1, $2); |
155 | 155 | } |
156 | | inline op set(out INT, invar PMC) :base_core { |
| 156 | inline op set(out INT, invar PMC) { |
157 | 157 | $1 = VTABLE_get_integer(interp, $2); |
158 | 158 | } |
159 | 159 | |
… |
… |
|
194 | 194 | |
195 | 195 | =cut |
196 | 196 | |
197 | | inline op assign(invar PMC, invar PMC) :base_core { |
| 197 | inline op assign(invar PMC, invar PMC) { |
198 | 198 | VTABLE_assign_pmc(interp, $1, $2); |
199 | 199 | } |
200 | 200 | |
201 | | inline op assign(invar PMC, in INT) :base_core { |
| 201 | inline op assign(invar PMC, in INT) { |
202 | 202 | VTABLE_set_integer_native(interp, $1, $2); |
203 | 203 | } |
204 | 204 | |
205 | | inline op assign(invar PMC, in NUM) :base_core { |
| 205 | inline op assign(invar PMC, in NUM) { |
206 | 206 | VTABLE_set_number_native(interp, $1, $2); |
207 | 207 | } |
208 | 208 | |
209 | | inline op assign(invar PMC, in STR) :base_core { |
| 209 | inline op assign(invar PMC, in STR) { |
210 | 210 | VTABLE_assign_string_native(interp, $1, $2); |
211 | 211 | } |
212 | 212 | |
213 | | inline op assign(out STR, in STR) :base_core { |
| 213 | inline op assign(out STR, in STR) { |
214 | 214 | $1 = $2; |
215 | 215 | } |
216 | 216 | |
217 | | inline op setref(invar PMC, invar PMC) :base_core { |
| 217 | inline op setref(invar PMC, invar PMC) { |
218 | 218 | VTABLE_set_pmc(interp, $1, $2); |
219 | 219 | } |
220 | 220 | |
… |
… |
|
242 | 242 | |
243 | 243 | =cut |
244 | 244 | |
245 | | inline op set(invar PMC, in INTKEY, in INT) :base_core { |
| 245 | inline op set(invar PMC, in INTKEY, in INT) { |
246 | 246 | VTABLE_set_integer_keyed_int(interp, $1, $2, $3); |
247 | 247 | } |
248 | 248 | |
249 | | inline op set(invar PMC, in INTKEY, in NUM) :base_core { |
| 249 | inline op set(invar PMC, in INTKEY, in NUM) { |
250 | 250 | VTABLE_set_number_keyed_int(interp, $1, $2, $3); |
251 | 251 | } |
252 | 252 | |
253 | | inline op set(invar PMC, in INTKEY, in STR) :base_core { |
| 253 | inline op set(invar PMC, in INTKEY, in STR) { |
254 | 254 | VTABLE_set_string_keyed_int(interp, $1, $2, $3); |
255 | 255 | } |
256 | 256 | |
257 | | inline op set(invar PMC, in INTKEY, invar PMC) :base_core { |
| 257 | inline op set(invar PMC, in INTKEY, invar PMC) { |
258 | 258 | VTABLE_set_pmc_keyed_int(interp, $1, $2, $3); |
259 | 259 | } |
260 | 260 | |
… |
… |
|
278 | 278 | |
279 | 279 | =cut |
280 | 280 | |
281 | | inline op set(out INT, invar PMC, in INTKEY) :base_core { |
| 281 | inline op set(out INT, invar PMC, in INTKEY) { |
282 | 282 | $1 = VTABLE_get_integer_keyed_int(interp, $2, $3); |
283 | 283 | } |
284 | 284 | |
285 | | inline op set(out NUM, invar PMC, in INTKEY) :base_core { |
| 285 | inline op set(out NUM, invar PMC, in INTKEY) { |
286 | 286 | $1 = VTABLE_get_number_keyed_int(interp, $2, $3); |
287 | 287 | } |
288 | 288 | |
289 | | inline op set(out STR, invar PMC, in INTKEY) :base_core { |
| 289 | inline op set(out STR, invar PMC, in INTKEY) { |
290 | 290 | $1 = VTABLE_get_string_keyed_int(interp, $2, $3); |
291 | 291 | } |
292 | 292 | |
293 | | inline op set(out PMC, invar PMC, in INTKEY) :base_core { |
| 293 | inline op set(out PMC, invar PMC, in INTKEY) { |
294 | 294 | $1 = VTABLE_get_pmc_keyed_int(interp, $2, $3); |
295 | 295 | } |
296 | 296 | |
… |
… |
|
314 | 314 | |
315 | 315 | =cut |
316 | 316 | |
317 | | inline op set(invar PMC, in KEY, in INT) :base_core { |
| 317 | inline op set(invar PMC, in KEY, in INT) { |
318 | 318 | VTABLE_set_integer_keyed(interp, $1, $2, $3); |
319 | 319 | } |
320 | 320 | |
321 | | inline op set(invar PMC, in KEY, in NUM) :base_core { |
| 321 | inline op set(invar PMC, in KEY, in NUM) { |
322 | 322 | VTABLE_set_number_keyed(interp, $1, $2, $3); |
323 | 323 | } |
324 | 324 | |
325 | | inline op set(invar PMC, in KEY, in STR) :base_core { |
| 325 | inline op set(invar PMC, in KEY, in STR) { |
326 | 326 | VTABLE_set_string_keyed(interp, $1, $2, $3); |
327 | 327 | } |
328 | 328 | |
329 | | inline op set(invar PMC, in KEY, invar PMC) :base_core { |
| 329 | inline op set(invar PMC, in KEY, invar PMC) { |
330 | 330 | VTABLE_set_pmc_keyed(interp, $1, $2, $3); |
331 | 331 | } |
332 | 332 | |
… |
… |
|
350 | 350 | |
351 | 351 | =cut |
352 | 352 | |
353 | | inline op set(out INT, invar PMC, in KEY) :base_core { |
| 353 | inline op set(out INT, invar PMC, in KEY) { |
354 | 354 | $1 = VTABLE_get_integer_keyed(interp, $2, $3); |
355 | 355 | } |
356 | 356 | |
357 | | inline op set(out NUM, invar PMC, in KEY) :base_core { |
| 357 | inline op set(out NUM, invar PMC, in KEY) { |
358 | 358 | $1 = VTABLE_get_number_keyed(interp, $2, $3); |
359 | 359 | } |
360 | 360 | |
361 | | inline op set(out STR, invar PMC, in KEY) :base_core { |
| 361 | inline op set(out STR, invar PMC, in KEY) { |
362 | 362 | $1 = VTABLE_get_string_keyed(interp, $2, $3); |
363 | 363 | } |
364 | 364 | |
365 | | inline op set(out PMC, invar PMC, in KEY) :base_core { |
| 365 | inline op set(out PMC, invar PMC, in KEY) { |
366 | 366 | $1 = VTABLE_get_pmc_keyed(interp, $2, $3); |
367 | 367 | } |
368 | 368 | |
… |
… |
|
466 | 466 | |
467 | 467 | =cut |
468 | 468 | |
469 | | inline op null(out STR) :base_core { |
| 469 | inline op null(out STR) { |
470 | 470 | $1 = STRINGNULL; |
471 | 471 | } |
472 | 472 | |
473 | | inline op null(out INT) :base_core { |
| 473 | inline op null(out INT) { |
474 | 474 | $1 = 0; |
475 | 475 | } |
476 | 476 | |
477 | | inline op null(out PMC) :base_core { |
| 477 | inline op null(out PMC) { |
478 | 478 | $1 = PMCNULL; |
479 | 479 | } |
480 | 480 | |
481 | | inline op null(out NUM) :base_core { |
| 481 | inline op null(out NUM) { |
482 | 482 | $1 = 0; |
483 | 483 | } |
484 | 484 | |
diff --git a/src/ops/string.ops b/src/ops/string.ops
index d3ce85f..84b7e03 100644
a
|
b
|
|
46 | 46 | |
47 | 47 | =cut |
48 | 48 | |
49 | | inline op ord(out INT, in STR) :base_core { |
| 49 | inline op ord(out INT, in STR) { |
50 | 50 | $1 = STRING_ord(interp, $2, 0); |
51 | 51 | } |
52 | 52 | |
53 | | inline op ord(out INT, in STR, in INT) :base_core { |
| 53 | inline op ord(out INT, in STR, in INT) { |
54 | 54 | $1 = STRING_ord(interp, $2, $3); |
55 | 55 | } |
56 | 56 | |
… |
… |
|
61 | 61 | |
62 | 62 | =cut |
63 | 63 | |
64 | | inline op chr(out STR, in INT) :base_core { |
| 64 | inline op chr(out STR, in INT) { |
65 | 65 | STRING * const s = Parrot_str_chr(interp, (UINTVAL)$2); |
66 | 66 | $1 = s; |
67 | 67 | } |
… |
… |
|
75 | 75 | |
76 | 76 | =cut |
77 | 77 | |
78 | | inline op chopn(out STR, in STR, in INT) :base_core { |
| 78 | inline op chopn(out STR, in STR, in INT) { |
79 | 79 | $1 = Parrot_str_chopn(interp, $2, $3); |
80 | 80 | } |
81 | 81 | |
… |
… |
|
96 | 96 | |
97 | 97 | =cut |
98 | 98 | |
99 | | inline op concat(invar PMC, invar PMC) :base_core { |
| 99 | inline op concat(invar PMC, invar PMC) { |
100 | 100 | VTABLE_i_concatenate(interp, $1, $2); |
101 | 101 | } |
102 | 102 | |
103 | | inline op concat(invar PMC, in STR) :base_core { |
| 103 | inline op concat(invar PMC, in STR) { |
104 | 104 | VTABLE_i_concatenate_str(interp, $1, $2); |
105 | 105 | } |
106 | 106 | |
… |
… |
|
108 | 108 | $1 = Parrot_str_concat(interp, $2, $3); |
109 | 109 | } |
110 | 110 | |
111 | | inline op concat(invar PMC, invar PMC, in STR) :base_core { |
| 111 | inline op concat(invar PMC, invar PMC, in STR) { |
112 | 112 | $1 = VTABLE_concatenate_str(interp, $2, $3, $1); |
113 | 113 | } |
114 | 114 | |
115 | | inline op concat(invar PMC, invar PMC, invar PMC) :base_core { |
| 115 | inline op concat(invar PMC, invar PMC, invar PMC) { |
116 | 116 | $1 = VTABLE_concatenate(interp, $2, $3, $1); |
117 | 117 | } |
118 | 118 | |
… |
… |
|
137 | 137 | $1 = Parrot_str_repeat(interp, $2, (UINTVAL)$3); |
138 | 138 | } |
139 | 139 | |
140 | | inline op repeat(invar PMC, invar PMC, in INT) :base_core { |
| 140 | inline op repeat(invar PMC, invar PMC, in INT) { |
141 | 141 | if ($3 < 0) { |
142 | 142 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL, |
143 | 143 | EXCEPTION_NEG_REPEAT, |
… |
… |
|
147 | 147 | $1 = VTABLE_repeat_int(interp, $2, $3, $1); |
148 | 148 | } |
149 | 149 | |
150 | | inline op repeat(invar PMC, invar PMC, invar PMC) :base_core { |
| 150 | inline op repeat(invar PMC, invar PMC, invar PMC) { |
151 | 151 | if (VTABLE_get_integer(interp, $3) < 0) { |
152 | 152 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL, |
153 | 153 | EXCEPTION_NEG_REPEAT, |
… |
… |
|
166 | 166 | |
167 | 167 | =cut |
168 | 168 | |
169 | | inline op repeat(invar PMC, in INT) :base_core { |
| 169 | inline op repeat(invar PMC, in INT) { |
170 | 170 | VTABLE_i_repeat_int(interp, $1, $2); |
171 | 171 | } |
172 | 172 | |
173 | | inline op repeat(invar PMC, invar PMC) :base_core { |
| 173 | inline op repeat(invar PMC, invar PMC) { |
174 | 174 | VTABLE_i_repeat(interp, $1, $2); |
175 | 175 | } |
176 | 176 | |
… |
… |
|
251 | 251 | |
252 | 252 | =cut |
253 | 253 | |
254 | | inline op substr(out STR, in STR, in INT) :base_core { |
| 254 | inline op substr(out STR, in STR, in INT) { |
255 | 255 | const INTVAL len = Parrot_str_byte_length(interp, $2); |
256 | 256 | $1 = STRING_substr(interp, $2, $3, len); |
257 | 257 | } |
258 | 258 | |
259 | | inline op substr(out STR, in STR, in INT, in INT) :base_core { |
| 259 | inline op substr(out STR, in STR, in INT, in INT) { |
260 | 260 | $1 = STRING_substr(interp, $2, $3, $4); |
261 | 261 | } |
262 | 262 | |
263 | | inline op substr(out STR, invar PMC, in INT, in INT) :base_core { |
| 263 | inline op substr(out STR, invar PMC, in INT, in INT) { |
264 | 264 | $1 = VTABLE_substr_str(interp, $2, $3, $4); |
265 | 265 | } |
266 | 266 | |
267 | | inline op replace(out STR, in STR, in INT, in INT, in STR) :base_core { |
| 267 | inline op replace(out STR, in STR, in INT, in INT, in STR) { |
268 | 268 | $1 = Parrot_str_replace(interp, $2, $3, $4, $5); |
269 | 269 | } |
270 | 270 | |
… |
… |
|
284 | 284 | |
285 | 285 | =cut |
286 | 286 | |
287 | | inline op index(out INT, in STR, in STR) :base_core { |
| 287 | inline op index(out INT, in STR, in STR) { |
288 | 288 | $1 = ($2 && $3) ? STRING_index(interp, $2, $3, 0) : -1; |
289 | 289 | } |
290 | 290 | |
291 | | inline op index(out INT, in STR, in STR, in INT) :base_core { |
| 291 | inline op index(out INT, in STR, in STR, in INT) { |
292 | 292 | $1 = ($2 && $3) ? STRING_index(interp, $2, $3, $4) : -1; |
293 | 293 | } |
294 | 294 | |
… |
… |
|
308 | 308 | |
309 | 309 | =cut |
310 | 310 | |
311 | | inline op sprintf(out STR, in STR, invar PMC) :base_core { |
| 311 | inline op sprintf(out STR, in STR, invar PMC) { |
312 | 312 | $1=Parrot_psprintf(interp, $2, $3); |
313 | 313 | } |
314 | 314 | |
315 | | inline op sprintf(out PMC, invar PMC, invar PMC) :base_core { |
| 315 | inline op sprintf(out PMC, invar PMC, invar PMC) { |
316 | 316 | VTABLE_set_string_native(interp, $1, |
317 | 317 | Parrot_psprintf(interp, VTABLE_get_string(interp, $2), $3)); |
318 | 318 | } |
… |
… |
|
362 | 362 | |
363 | 363 | =cut |
364 | 364 | |
365 | | inline op stringinfo(out INT, in STR, in INT) :base_core { |
| 365 | inline op stringinfo(out INT, in STR, in INT) { |
366 | 366 | if ($2 == NULL) |
367 | 367 | $1 = 0; |
368 | 368 | else { |
… |
… |
|
403 | 403 | |
404 | 404 | =cut |
405 | 405 | |
406 | | inline op upcase(out STR, in STR) :base_core { |
| 406 | inline op upcase(out STR, in STR) { |
407 | 407 | $1 = Parrot_str_upcase(interp, $2); |
408 | 408 | } |
409 | 409 | |
… |
… |
|
413 | 413 | |
414 | 414 | =cut |
415 | 415 | |
416 | | inline op downcase(out STR, in STR) :base_core { |
| 416 | inline op downcase(out STR, in STR) { |
417 | 417 | $1 = Parrot_str_downcase(interp, $2); |
418 | 418 | } |
419 | 419 | |
… |
… |
|
423 | 423 | |
424 | 424 | =cut |
425 | 425 | |
426 | | inline op titlecase(out STR, in STR) :base_core { |
| 426 | inline op titlecase(out STR, in STR) { |
427 | 427 | $1 = Parrot_str_titlecase(interp, $2); |
428 | 428 | } |
429 | 429 | |
… |
… |
|
445 | 445 | |
446 | 446 | =cut |
447 | 447 | |
448 | | op join(out STR, in STR, invar PMC) :base_core { |
| 448 | op join(out STR, in STR, invar PMC) { |
449 | 449 | $1 = Parrot_str_join(interp, $2, $3); |
450 | 450 | } |
451 | 451 | |
452 | | op split(out PMC, in STR, in STR) :base_core { |
| 452 | op split(out PMC, in STR, in STR) { |
453 | 453 | $1 = Parrot_str_split(interp, $2, $3); |
454 | 454 | } |
455 | 455 | |
… |
… |
|
476 | 476 | |
477 | 477 | =cut |
478 | 478 | |
479 | | op encoding(out INT, in STR) :base_core { |
| 479 | op encoding(out INT, in STR) { |
480 | 480 | $1 = Parrot_encoding_number_of_str(interp, $2); |
481 | 481 | } |
482 | 482 | |
483 | | op encodingname(out STR, in INT) :base_core { |
| 483 | op encodingname(out STR, in INT) { |
484 | 484 | $1 = Parrot_encoding_name(interp, $2); |
485 | 485 | } |
486 | 486 | |
487 | | op find_encoding(out INT, in STR) :base_core { |
| 487 | op find_encoding(out INT, in STR) { |
488 | 488 | const INTVAL n = Parrot_encoding_number(interp, $2); |
489 | 489 | if (n < 0) { |
490 | 490 | opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, NULL, |
diff --git a/src/ops/var.ops b/src/ops/var.ops
index 212ca34..840eef4 100644
a
|
b
|
|
472 | 472 | |
473 | 473 | =cut |
474 | 474 | |
475 | | inline op find_sub_not_null(out PMC, in STR) :base_core { |
| 475 | inline op find_sub_not_null(out PMC, in STR) { |
476 | 476 | opcode_t *dest = expr NEXT(); |
477 | 477 | PMC *sub = Parrot_ns_find_named_item(interp, $2, dest); |
478 | 478 | |