tagged release 0.6.4
[parrot.git] / languages / WMLScript / src / translation.rules
blob191e5f23859cd27850b40ff644f172ecf565c03c
1 # Copyright (C) 2006-2007, The Perl Foundation.
2 # $Id$
4 ## Control Flow Instructions
6 [JUMP_FW_S]
7 code = 80
8 class = branch
9 inline = 1F
10 pir = <<PIR
11     $I0 = ${NEXTPC} + ${INLINE}
12     $S0 = $I0
13     ${INS} = concat "  goto PC"
14     ${INS} = concat $S0
15     ${INS} = concat "\n"
16 PIR
18 [JUMP_FW]
19 code = 01
20 class = branch
21 arguments = uint8
22 pir = <<PIR
23     $I0 = ${NEXTPC} + ${ARG1}
24     $S0 = $I0
25     ${INS} = concat "  goto PC"
26     ${INS} = concat $S0
27     ${INS} = concat "\n"
28 PIR
30 [JUMP_FW_W]
31 code = 02
32 class = branch
33 arguments = uint16
34 pir = <<PIR
35     $I0 = ${NEXTPC} + ${ARG1}
36     $S0 = $I0
37     ${INS} = concat "  goto PC"
38     ${INS} = concat $S0
39     ${INS} = concat "\n"
40 PIR
42 [JUMP_BW_S]
43 code = A0
44 class = branch
45 inline = 1F
46 pir = <<PIR
47     $I0 = ${PC} - ${INLINE}
48     $S0 = $I0
49     ${INS} = concat "  goto PC"
50     ${INS} = concat $S0
51     ${INS} = concat "\n"
52 PIR
54 [JUMP_BW]
55 code = 03
56 class = branch
57 arguments = uint8
58 pir = <<PIR
59     $I0 = ${PC} - ${ARG1}
60     $S0 = $I0
61     ${INS} = concat "  goto PC"
62     ${INS} = concat $S0
63     ${INS} = concat "\n"
64 PIR
66 [JUMP_BW_W]
67 code = 04
68 class = branch
69 arguments = uint16
70 pir = <<PIR
71     $I0 = ${PC} - ${ARG1}
72     $S0 = $I0
73     ${INS} = concat "  goto PC"
74     ${INS} = concat $S0
75     ${INS} = concat "\n"
76 PIR
78 [TJUMP_FW_S]
79 code = C0
80 class = branch
81 inline = 1F
82 pop = 1
83 pir = <<PIR
84     $I0 = ${NEXTPC} + ${INLINE}
85     $S0 = $I0
86     ${INS} = concat "  ${ITEMP0} = isfalse "
87     ${INS} = concat ${STACK0}
88     ${INS} = concat "\n"
89     ${INS} = concat "  if ${ITEMP0} goto PC"
90     ${INS} = concat $S0
91     ${INS} = concat "\n"
92 PIR
94 [TJUMP_FW]
95 code = 05
96 class = branch
97 arguments = uint8
98 pop = 1
99 pir = <<PIR
100     $I0 = ${NEXTPC} + ${ARG1}
101     $S0 = $I0
102     ${INS} = concat "  ${ITEMP0} = isfalse "
103     ${INS} = concat ${STACK0}
104     ${INS} = concat "\n"
105     ${INS} = concat "  if ${ITEMP0} goto PC"
106     ${INS} = concat $S0
107     ${INS} = concat "\n"
110 [TJUMP_FW_W]
111 code = 06
112 class = branch
113 arguments = uint16
114 pop = 1
115 pir = <<PIR
116     $I0 = ${NEXTPC} + ${ARG1}
117     $S0 = $I0
118     ${INS} = concat "  ${ITEMP0} = isfalse "
119     ${INS} = concat ${STACK0}
120     ${INS} = concat "\n"
121     ${INS} = concat "  if ${ITEMP0} goto PC"
122     ${INS} = concat $S0
123     ${INS} = concat "\n"
126 [TJUMP_BW]
127 code = 07
128 class = branch
129 arguments = uint8
130 pop = 1
131 pir = <<PIR
132     $I0 = ${PC} - ${ARG1}
133     $S0 = $I0
134     ${INS} = concat "  ${ITEMP0} = isfalse "
135     ${INS} = concat ${STACK0}
136     ${INS} = concat "\n"
137     ${INS} = concat "  if ${ITEMP0} goto PC"
138     ${INS} = concat $S0
139     ${INS} = concat "\n"
142 [TJUMP_BW_W]
143 code = 08
144 class = branch
145 arguments = uint16
146 pop = 1
147 pir = <<PIR
148     $I0 = ${PC} - ${ARG1}
149     $S0 = $I0
150     ${INS} = concat "  ${ITEMP0} = isfalse "
151     ${INS} = concat ${STACK0}
152     ${INS} = concat "\n"
153     ${INS} = concat "  if ${ITEMP0} goto PC"
154     ${INS} = concat $S0
155     ${INS} = concat "\n"
158 ## Function Call Instructions
160 [CALL_S]
161 code = 60
162 class = calling
163 inline = 07
164 nb_arg = script.get_nb_arg(${INLINE})
165 pir = <<PIR
166     ${INS} = concat "  "
167     ${INS} = concat ${DEST0}
168     ${INS} = concat " = function"
169     $S0 = ${INLINE}
170     ${INS} = concat $S0
171     ${INS} = concat "("
172     ${INS} = concat ${PARAMS}
173     ${INS} = concat ")\n"
176 [CALL]
177 code = 09
178 class = calling
179 arguments = uint8
180 nb_arg = script.get_nb_arg(${ARG1})
181 pir = <<PIR
182     ${INS} = concat "  "
183     ${INS} = concat ${DEST0}
184     ${INS} = concat " = function"
185     $S0 = ${ARG1}
186     ${INS} = concat $S0
187     ${INS} = concat "("
188     ${INS} = concat ${PARAMS}
189     ${INS} = concat ")\n"
192 [CALL_LIB_S]
193 code = 68
194 class = calling
195 inline = 07
196 arguments = uint8
197 nb_arg = get_nb_arg_lib(${ARG1}, ${INLINE})
198 pir = <<PIR
199     ${INS} = concat "  ${PTEMP0} = find_lib("
200     $S0 = ${ARG1}   # lindex
201     ${INS} = concat $S0
202     ${INS} = concat ", "
203     $S0 = ${INLINE}
204     ${INS} = concat $S0
205     ${INS} = concat ")\n"
206     ${INS} = concat "  "
207     ${INS} = concat ${DEST0}
208     ${INS} = concat " = ${PTEMP0}("
209     ${INS} = concat ${PARAMS}
210     ${INS} = concat ")\n"
213 [CALL_LIB]
214 code = 0A
215 class = calling
216 arguments = uint8, uint8
217 nb_arg = get_nb_arg_lib(${ARG2}, ${ARG1})
218 pir = <<PIR
219     ${INS} = concat "  ${PTEMP0} = find_lib("
220     $S0 = ${ARG2}   # lindex
221     ${INS} = concat $S0
222     ${INS} = concat ", "
223     $S0 = ${ARG1}   # findex
224     ${INS} = concat $S0
225     ${INS} = concat ")\n"
226     ${INS} = concat "  "
227     ${INS} = concat ${DEST0}
228     ${INS} = concat " = ${PTEMP0}("
229     ${INS} = concat ${PARAMS}
230     ${INS} = concat ")\n"
233 [CALL_LIB_W]
234 code = 0B
235 class = calling
236 arguments = uint8, uint16
237 nb_arg = get_nb_arg_lib(${ARG2}, ${ARG1})
238 pir = <<PIR
239     ${INS} = concat "  ${PTEMP0} = find_lib("
240     $S0 = ${ARG2}   # lindex
241     ${INS} = concat $S0
242     ${INS} = concat ", "
243     $S0 = ${ARG1}   # findex
244     ${INS} = concat $S0
245     ${INS} = concat ")\n"
246     ${INS} = concat "  "
247     ${INS} = concat ${DEST0}
248     ${INS} = concat " = ${PTEMP0}("
249     ${INS} = concat ${PARAMS}
250     ${INS} = concat ")\n"
253 [CALL_URL]
254 code = 0C
255 class = calling
256 arguments = uint8, uint8, uint8
257 nb_arg = ${ARG3}
258 pir = <<PIR
259     $S0 = ${ARG1}   # urlindex
260     $S1 = "const"
261     $S1 = concat $S0
262     ${INS} = concat "  ${STEMP1} = "
263     ${INS} = concat $S1
264     ${INS} = concat "\n"
265     $I0 = exists ${CONST}[$S1]
266     if $I0 goto L6_${CURIC}
267     $S0 = constants.translate(${ARG1})
268     ${CONST}[$S1] = $S0
269   L6_${CURIC}:
270     $S0 = ${ARG2}   # findex
271     $S1 = "const"
272     $S1 = concat $S0
273     ${INS} = concat "  ${STEMP2} = "
274     ${INS} = concat $S1
275     ${INS} = concat "\n"
276     $I0 = exists ${CONST}[$S1]
277     if $I0 goto L7_${CURIC}
278     $S0 = constants.translate(${ARG2})
279     ${CONST}[$S1] = $S0
280   L7_${CURIC}:
281     ${INS} = concat "  ${PTEMP0} = find_lib_url(${STEMP1}, ${STEMP2})\n"
282     ${INS} = concat "  "
283     ${INS} = concat ${DEST0}
284     ${INS} = concat " = ${PTEMP0}("
285     ${INS} = concat ${PARAMS}
286     ${INS} = concat ")\n"
289 [CALL_URL_W]
290 code = 0D
291 class = calling
292 arguments = uint16, uint16, uint8
293 nb_arg = ${ARG3}
294 pir = <<PIR
295     $S0 = ${ARG1}   # urlindex
296     $S1 = "const"
297     $S1 = concat $S0
298     ${INS} = concat "  ${STEMP1} = "
299     ${INS} = concat $S1
300     ${INS} = concat "\n"
301     $I0 = exists ${CONST}[$S1]
302     if $I0 goto L6_${CURIC}
303     $S0 = constants.translate(${ARG1})
304     ${CONST}[$S1] = $S0
305   L6_${CURIC}:
306     $S0 = ${ARG2}   # findex
307     $S1 = "const"
308     $S1 = concat $S0
309     ${INS} = concat "  ${STEMP2} = "
310     ${INS} = concat $S1
311     ${INS} = concat "\n"
312     $I0 = exists ${CONST}[$S1]
313     if $I0 goto L7_${CURIC}
314     $S0 = constants.translate(${ARG2})
315     ${CONST}[$S1] = $S0
316   L7_${CURIC}:
317     ${INS} = concat "  ${PTEMP0} = find_lib_url(${STEMP1}, ${STEMP2})\n"
318     ${INS} = concat "  "
319     ${INS} = concat ${DEST0}
320     ${INS} = concat " = ${PTEMP0}("
321     ${INS} = concat ${PARAMS}
322     ${INS} = concat ")\n"
325 ## Variable Access and Manipulation
327 [LOAD_VAR_S]
328 code = E0
329 class = load
330 inline = 1F
331 push = 1
332 pir = <<PIR
333     $S0 = ${INLINE}
334     ${INS} = concat "  "
335     ${INS} = concat ${DEST0}
336     ${INS} = concat " = clone local"
337     ${INS} = concat $S0
338     ${INS} = concat "\n"
341 [LOAD_VAR]
342 code = 0E
343 class = load
344 arguments = uint8
345 push = 1
346 pir = <<PIR
347     $S0 = ${ARG1}
348     ${INS} = concat "  "
349     ${INS} = concat ${DEST0}
350     ${INS} = concat " = clone local"
351     ${INS} = concat $S0
352     ${INS} = concat "\n"
355 [STORE_VAR_S]
356 code = 40
357 class = store
358 inline = 0F
359 pop = 1
360 pir = <<PIR
361     $S0 = ${INLINE}
362     ${STOREREG} = "local"
363     ${STOREREG} = concat $S0
366 [STORE_VAR]
367 code = 0F
368 class = store
369 arguments = uint8
370 pop = 1
371 pir = <<PIR
372     $S0 = ${ARG1}
373     ${STOREREG} = "local"
374     ${STOREREG} = concat $S0
377 [INCR_VAR_S]
378 code = 70
379 class = op
380 inline = 07
381 pir = <<PIR
382     $S0 = ${INLINE}
383     ${INS} = concat "  inc local"
384     ${INS} = concat $S0
385     ${INS} = concat "\n"
388 [INCR_VAR]
389 code = 10
390 class = op
391 arguments = uint8
392 pir = <<PIR
393     $S0 = ${ARG1}
394     ${INS} = concat "  inc local"
395     ${INS} = concat $S0
396     ${INS} = concat "\n"
399 [DECR_VAR]
400 code = 11
401 class = op
402 arguments = uint8
403 pir = <<PIR
404     $S0 = ${ARG1}
405     ${INS} = concat "  dec local"
406     ${INS} = concat $S0
407     ${INS} = concat "\n"
410 ## Access To Constants
412 [LOAD_CONST_S]
413 code = 50
414 class = load
415 inline = 0F
416 push = 1
417 pir = <<PIR
418     $S0 = ${INLINE}
419     $S1 = "const"
420     $S1 = concat $S0
421     ${INS} = concat "  "
422     ${INS} = concat ${DEST0}
423     ${INS} = concat " = clone "
424     ${INS} = concat $S1
425     ${INS} = concat "\n"
426     $I0 = exists ${CONST}[$S1]
427     if $I0 goto L1_${CURIC}
428     $S0 = constants.translate(${INLINE})
429     ${CONST}[$S1] = $S0
430   L1_${CURIC}:
433 [LOAD_CONST]
434 code = 12
435 class = load
436 arguments = uint8
437 push = 1
438 pir = <<PIR
439     $S0 = ${ARG1}
440     $S1 = "const"
441     $S1 = concat $S0
442     ${INS} = concat "  "
443     ${INS} = concat ${DEST0}
444     ${INS} = concat " = clone "
445     ${INS} = concat $S1
446     ${INS} = concat "\n"
447     $I0 = exists ${CONST}[$S1]
448     if $I0 goto L1_${CURIC}
449     $S0 = constants.translate(${ARG1})
450     ${CONST}[$S1] = $S0
451   L1_${CURIC}:
454 [LOAD_CONST_W]
455 code = 13
456 class = load
457 arguments = uint16
458 push = 1
459 pir = <<PIR
460     $S0 = ${ARG1}
461     $S1 = "const"
462     $S1 = concat $S0
463     ${INS} = concat "  "
464     ${INS} = concat ${DEST0}
465     ${INS} = concat " = clone "
466     ${INS} = concat $S1
467     ${INS} = concat "\n"
468     $I0 = exists ${CONST}[$S1]
469     if $I0 goto L1_${CURIC}
470     $S0 = constants.translate(${ARG1})
471     ${CONST}[$S1] = $S0
472   L1_${CURIC}:
475 [CONST_0]
476 code = 14
477 class = load
478 push = 1
479 pir = <<PIR
480     ${INS} = concat "  "
481     ${INS} = concat ${DEST0}
482     ${INS} = concat " = clone const_0\n"
483     $I0 = exists ${CONST}['const_0']
484     if $I0 goto L1_${CURIC}
485     $S0 = "  .local pmc const_0\n  new const_0, 'WmlsInteger'\n  set const_0, 0\n"
486     ${CONST}['const_0'] = $S0
487   L1_${CURIC}:
490 [CONST_1]
491 code = 15
492 class = load
493 push = 1
494 pir = <<PIR
495     ${INS} = concat "  "
496     ${INS} = concat ${DEST0}
497     ${INS} = concat " = clone const_1\n"
498     $I0 = exists ${CONST}['const_1']
499     if $I0 goto L1_${CURIC}
500     $S0 = "  .local pmc const_1\n  new const_1, 'WmlsInteger'\n  set const_1, 1\n"
501     ${CONST}['const_1'] = $S0
502   L1_${CURIC}:
505 [CONST_M1]
506 code = 16
507 class = load
508 push = 1
509 pir = <<PIR
510     ${INS} = concat "  "
511     ${INS} = concat ${DEST0}
512     ${INS} = concat " = clone const_m1\n"
513     $I0 = exists ${CONST}['const_m1']
514     if $I0 goto L1_${CURIC}
515     $S0 = "  .local pmc const_m1\n  new const_m1, 'WmlsInteger'\n  set const_m1, -1\n"
516     ${CONST}['const_m1'] = $S0
517   L1_${CURIC}:
520 [CONST_ES]
521 code = 17
522 class = load
523 push = 1
524 pir = <<PIR
525     ${INS} = concat "  "
526     ${INS} = concat ${DEST0}
527     ${INS} = concat " = clone const_es\n"
528     $I0 = exists ${CONST}['const_es']
529     if $I0 goto L1_${CURIC}
530     $S0 = "  .local pmc const_es\n  new const_es, 'WmlsString'\n"
531     ${CONST}['const_es'] = $S0
532   L1_${CURIC}:
535 [CONST_INVALID]
536 code = 18
537 class = load
538 push = 1
539 pir = <<PIR
540     ${INS} = concat "  "
541     ${INS} = concat ${DEST0}
542     ${INS} = concat " = clone const_invalid\n"
543     $I0 = exists ${CONST}['const_invalid']
544     if $I0 goto L1_${CURIC}
545     $S0 = "  .local pmc const_invalid\n  new const_invalid, 'WmlsInvalid'\n"
546     ${CONST}['const_invalid'] = $S0
547   L1_${CURIC}:
550 [CONST_TRUE]
551 code = 19
552 class = load
553 push = 1
554 pir = <<PIR
555     ${INS} = concat "  "
556     ${INS} = concat ${DEST0}
557     ${INS} = concat " = clone const_true\n"
558     $I0 = exists ${CONST}['const_true']
559     if $I0 goto L1_${CURIC}
560     $S0 = "  .local pmc const_true\n  new const_true, 'WmlsBoolean'\n  set const_true, 1\n"
561     ${CONST}['const_true'] = $S0
562   L1_${CURIC}:
565 [CONST_FALSE]
566 code = 1A
567 class = load
568 push = 1
569 pir = <<PIR
570     ${INS} = concat "  "
571     ${INS} = concat ${DEST0}
572     ${INS} = concat " = clone const_false\n"
573     $I0 = exists ${CONST}['const_false']
574     if $I0 goto L1_${CURIC}
575     $S0 = "  .local pmc const_false\n  new const_false, 'WmlsBoolean'\n  set const_false, 0\n"
576     ${CONST}['const_false'] = $S0
577   L1_${CURIC}:
580 ## Arithmetic Instructions
582 [INCR]
583 code = 1B
584 class = op
585 pop = 1
586 push = 1
587 pir = <<PIR
588     ${INS} = concat "  ${PTEMP0} = "
589     ${INS} = concat ${STACK0}
590     ${INS} = concat "\n"
591     ${INS} = concat "  inc ${PTEMP0}\n"
592     ${INS} = concat "  "
593     ${INS} = concat ${DEST0}
594     ${INS} = concat " = ${PTEMP0}\n"
597 [DECR]
598 code = 1C
599 class = op
600 pop = 1
601 push = 1
602 pir = <<PIR
603     ${INS} = concat "  ${PTEMP0} = "
604     ${INS} = concat ${STACK0}
605     ${INS} = concat "\n"
606     ${INS} = concat "  dec ${PTEMP0}\n"
607     ${INS} = concat "  "
608     ${INS} = concat ${DEST0}
609     ${INS} = concat " = ${PTEMP0}\n"
612 [ADD_ASG]
613 code = 1D
614 class = op
615 arguments = uint8
616 pop = 1
617 pir = <<PIR
618     $S0 = ${ARG1}
619     ${INS} = concat "  local"
620     ${INS} = concat $S0
621     ${INS} = concat " = add local"
622     ${INS} = concat $S0
623     ${INS} = concat ", "
624     ${INS} = concat ${STACK0}
625     ${INS} = concat "\n"
628 [SUB_ASG]
629 code = 1E
630 class = op
631 arguments = uint8
632 pop = 1
633 pir = <<PIR
634     $S0 = ${ARG1}
635     ${INS} = concat "  local"
636     ${INS} = concat $S0
637     ${INS} = concat " = sub local"
638     ${INS} = concat $S0
639     ${INS} = concat ", "
640     ${INS} = concat ${STACK0}
641     ${INS} = concat "\n"
644 [UMINUS]
645 code = 1F
646 class = op
647 pop = 1
648 push = 1
649 instruction = ${DEST0} = neg ${STACK0}
651 [ADD]
652 code = 20
653 class = op
654 pop = 2
655 push = 1
656 instruction = ${DEST0} = add ${STACK1}, ${STACK0}
658 [SUB]
659 code = 21
660 class = op
661 pop = 2
662 push = 1
663 instruction = ${DEST0} = sub ${STACK1}, ${STACK0}
665 [MUL]
666 code = 22
667 class = op
668 pop = 2
669 push = 1
670 instruction = ${DEST0} = mul ${STACK1}, ${STACK0}
672 [DIV]
673 code = 23
674 class = op
675 pop = 2
676 push = 1
677 instruction = ${DEST0} = div ${STACK1}, ${STACK0}
679 [IDIV]
680 code = 24
681 class = op
682 pop = 2
683 push = 1
684 instruction = ${DEST0} = fdiv ${STACK1}, ${STACK0}
686 [REM]
687 code = 25
688 class = op
689 pop = 2
690 push = 1
691 instruction = ${DEST0} = cmod ${STACK1}, ${STACK0}
693 ## Bitwise Instructions
695 [B_AND]
696 code = 26
697 class = op
698 pop = 2
699 push = 1
700 instruction = ${DEST0} = band ${STACK1}, ${STACK0}
702 [B_OR]
703 code = 27
704 class = op
705 pop = 2
706 push = 1
707 instruction = ${DEST0} = bor ${STACK1}, ${STACK0}
709 [B_XOR]
710 code = 28
711 class = op
712 pop = 2
713 push = 1
714 instruction = ${DEST0} = bxor ${STACK1}, ${STACK0}
716 [B_NOT]
717 code = 29
718 class = op
719 pop = 1
720 push = 1
721 instruction = ${DEST0} = bnot ${STACK0}
723 [B_LSHIFT]
724 code = 2A
725 class = op
726 pop = 2
727 push = 1
728 instruction = ${DEST0} = shl ${STACK1}, ${STACK0}
730 [B_RSSHIFT]
731 code = 2B
732 class = op
733 pop = 2
734 push = 1
735 instruction = ${DEST0} = shr ${STACK1}, ${STACK0}
737 [B_RSZSHIFT]
738 code = 2C
739 class = op
740 pop = 2
741 push = 1
742 instruction = ${DEST0} = lsr ${STACK1}, ${STACK0}
744 ## Comparison Instructions
746 [EQ]
747 code = 2D
748 class = op
749 pop = 2
750 push = 1
751 instruction = ${DEST0} = iseq ${STACK1}, ${STACK0}
753 [LE]
754 code = 2E
755 class = op
756 pop = 2
757 push = 1
758 instruction = ${DEST0} = isle ${STACK1}, ${STACK0}
760 [LT]
761 code = 2F
762 class = op
763 pop = 2
764 push = 1
765 instruction = ${DEST0} = islt ${STACK1}, ${STACK0}
767 [GE]
768 code = 30
769 class = op
770 pop = 2
771 push = 1
772 instruction = ${DEST0} = isge ${STACK1}, ${STACK0}
774 [GT]
775 code = 31
776 class = op
777 pop = 2
778 push = 1
779 instruction = ${DEST0} = isgt ${STACK1}, ${STACK0}
781 [NE]
782 code = 32
783 class = op
784 pop = 2
785 push = 1
786 instruction = ${DEST0} = isne ${STACK1}, ${STACK0}
788 ## Logical Instructions
790 [NOT]
791 code = 33
792 class = op
793 pop = 1
794 push = 1
795 instruction = ${DEST0} = not ${STACK0}
797 [SCAND]
798 code = 34
799 class = sc_op
800 pop = 1
801 push = 2
802 pir = <<PIR
803     $I0 = ${NEXTPC} - 1
804     $S0 = $I0
805     ${INS} = concat "  ${PTEMP0} = istrue "
806     ${INS} = concat ${STACK0}
807     ${INS} = concat "\n"
808     ${INS} = concat "  ${ITEMP0} = isa ${PTEMP0}, 'WmlsBoolean'\n"
809     ${INS} = concat "  unless ${ITEMP0} goto PC"
810     ${INS} = concat $S0
811     ${INS} = concat "_A\n"
812     ${INS} = concat "  ${ITEMP0} = istrue ${PTEMP0}\n"
813     ${INS} = concat "  if ${ITEMP0} goto PC"
814     ${INS} = concat $S0
815     ${INS} = concat "_B\n"
816     ${INS} = concat "PC"
817     ${INS} = concat $S0
818     ${INS} = concat "_A:\n"
819     ${INS} = concat "  "
820     ${INS} = concat ${DEST0}
821     ${INS} = concat " = clone ${PTEMP0}\n"
822     ${INS} = concat "  "
823     ${INS} = concat ${DEST1}
824     ${INS} = concat " = clone const_false\n"
825 ${__PUSH_2__}
826     ${INS} = concat "goto PC"
827     ${INS} = concat $S0
828     ${INS} = concat "_C\n"
829     ${INS} = concat "PC"
830     ${INS} = concat $S0
831     ${INS} = concat "_B:\n"
832     ${INS} = concat "  "
833     ${INS} = concat ${DEST0}
834     ${INS} = concat " = clone const_true\n"
835 ${__PUSH_1__}
836     ${INS} = concat "PC"
837     ${INS} = concat $S0
838     ${INS} = concat "_C:\n"
839     $I0 = exists ${CONST}['const_true']
840     if $I0 goto L1_${CURIC}
841     $S0 = "  .local pmc const_true\n  new const_true, 'WmlsBoolean'\n  set const_true, 1\n"
842     ${CONST}['const_true'] = $S0
843   L1_${CURIC}:
844     $I0 = exists ${CONST}['const_false']
845     if $I0 goto L2_${CURIC}
846     $S0 = "  .local pmc const_false\n  new const_false, 'WmlsBoolean'\n  set const_false, 0\n"
847     ${CONST}['const_false'] = $S0
848   L2_${CURIC}:
851 [SCOR]
852 code = 35
853 class = sc_op
854 pop = 1
855 push = 2
856 pir = <<PIR
857     $I0 = ${NEXTPC} - 1
858     $S0 = $I0
859     ${INS} = concat "  ${PTEMP0} = istrue "
860     ${INS} = concat ${STACK0}
861     ${INS} = concat "\n"
862     ${INS} = concat "  ${ITEMP0} = isa ${PTEMP0}, 'WmlsBoolean'\n"
863     ${INS} = concat "  unless ${ITEMP0} goto PC"
864     ${INS} = concat $S0
865     ${INS} = concat "_A\n"
866     ${INS} = concat "  ${ITEMP0} = isfalse ${PTEMP0}\n"
867     ${INS} = concat "  if ${ITEMP0} goto PC"
868     ${INS} = concat $S0
869     ${INS} = concat "_B\n"
870     ${INS} = concat "PC"
871     ${INS} = concat $S0
872     ${INS} = concat "_A:\n"
873     ${INS} = concat "  "
874     ${INS} = concat ${DEST0}
875     ${INS} = concat " = clone ${PTEMP0}\n"
876     ${INS} = concat "  "
877     ${INS} = concat ${DEST1}
878     ${INS} = concat " = clone const_false\n"
879 ${__PUSH_2__}
880     ${INS} = concat "goto PC"
881     ${INS} = concat $S0
882     ${INS} = concat "_C\n"
883     ${INS} = concat "PC"
884     ${INS} = concat $S0
885     ${INS} = concat "_B:\n"
886     ${INS} = concat "  "
887     ${INS} = concat ${DEST0}
888     ${INS} = concat " = clone const_true\n"
889 ${__PUSH_1__}
890     ${INS} = concat "PC"
891     ${INS} = concat $S0
892     ${INS} = concat "_C:\n"
893     $I0 = exists ${CONST}['const_true']
894     if $I0 goto L1_${CURIC}
895     $S0 = "  .local pmc const_true\n  new const_true, 'WmlsBoolean'\n  set const_true, 1\n"
896     ${CONST}['const_true'] = $S0
897   L1_${CURIC}:
898     $I0 = exists ${CONST}['const_false']
899     if $I0 goto L2_${CURIC}
900     $S0 = "  .local pmc const_false\n  new const_false, 'WmlsBoolean'\n  set const_false, 0\n"
901     ${CONST}['const_false'] = $S0
902   L2_${CURIC}:
905 [TOBOOL]
906 code = 36
907 class = op
908 pop = 1
909 push = 1
910 instruction = ${DEST0} = istrue ${STACK0}
912 ## Stack Instructions
914 [POP]
915 code = 37
916 class = op
917 pop = 1
918 instruction = # just pop
920 ## Access to Operand Type
922 [TYPEOF]
923 code = 38
924 class = op
925 pop = 1
926 push = 1
927 instruction = ${DEST0} = typeof ${STACK0}
929 [ISVALID]
930 code = 39
931 class = op
932 pop = 1
933 push = 1
934 instruction = ${DEST0} = defined ${STACK0}
936 ## Function Return Instructions
938 [RETURN]
939 code = 3A
940 class = op
941 pop = 1
942 pir = <<PIR
943     ${INS} = concat "  .return ("
944     ${INS} = concat ${STACK0}
945     ${INS} = concat ")\n"
948 [RETURN_ES]
949 code = 3B
950 class = op
951 pir = <<PIR
952     ${INS} = concat "  new ${PTEMP0}, 'WmlsString'\n"
953     ${INS} = concat "  .return (${PTEMP0})\n"
956 ## Miscellaneous Instructions
958 [DEBUG]
959 code = 3C
960 class = op
961 instruction = # debug op