001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.utils.bytecode;
022
023/**
024 * Factory for objects which encapsulate individual Java bytecode instructions.
025 * Most methods in this class are auto-generated.
026 *
027 * <p>There are two classes of methods. The first ones are for creating objects
028 * that directly represent opcodes. These effectively wrap one of the opcode
029 * constants. The others do something more clever. For example, make_if emits
030 * something that is equivalent to a normal Java if statement.</p>
031 *
032 * <p>Generic types are supported using the factory methods that take
033 * ParametricType arguments.
034 *
035 * @author Thomas Down
036 * @author Matthew Pocock
037 */
038
039public class ByteCode {
040    //
041    // iconst and friends
042    //
043
044    public static Instruction make_iconst(int i) {
045      if (i >= -1 && i <= 5) {
046        return new NoOperandsInstruction((byte) (op_iconst_0 + i), 1);
047      } else if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) {
048        return new ByteInstruction(op_bipush, (byte) i, 1);
049      } else if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) {
050        return new ShortInstruction(op_sipush, i, 1);
051      }
052      
053      return new IntConstantInstruction(i);
054    }
055
056    //
057    // String constants
058    //
059
060    public static Instruction make_sconst(String s) {
061        return new StringConstantInstruction(s);
062    }
063
064    //
065    // Double constants
066    //
067
068    public static Instruction make_dconst(double d) {
069      if (d == 0.0) {
070        return new NoOperandsInstruction(op_dconst_0, 1);
071      } else if (d == 1.0) {
072        return new NoOperandsInstruction(op_dconst_1, 1);
073      } else {
074        return new DoubleInstruction(d);
075      }
076    }
077
078    //
079    // Long constants
080    //
081
082    public static Instruction make_lconst(long l) {
083      if (l == 0L) {
084        return new NoOperandsInstruction(op_lconst_0, 1);
085      } else if (l == 1L) {
086        return new NoOperandsInstruction(op_lconst_1, 1);
087      } else {
088        return new LongConstantInstruction(l);
089      }
090    }
091
092    //
093    // Float constants
094    //
095
096    public static Instruction make_fconst(float f) {
097      if (f == 0.0F) {
098        return new NoOperandsInstruction(op_fconst_0, 1);
099      } else if (f == 1.0F) {
100        return new NoOperandsInstruction(op_fconst_1, 1);
101      } else if (f == 2.0F) {
102        return new NoOperandsInstruction(op_fconst_2, 1);
103      } else {
104        return new FloatConstantInstruction(f);
105      }
106    }
107
108    //
109    // Generate instruction objects for invokes
110    //
111
112    public static Instruction make_invokevirtual(CodeMethod cm) {
113        return new MethodInstruction(op_invokevirtual, cm);
114    }
115
116    public static Instruction make_invokespecial(CodeMethod cm) {
117        return new MethodInstruction(op_invokespecial, cm);
118    }
119
120    public static Instruction make_invokestatic(CodeMethod cm) {
121        return new MethodInstruction(op_invokestatic, cm);
122    }
123
124    public static Instruction make_invokeinterface(CodeMethod cm) {
125        return new MethodInstruction(op_invokeinterface, cm);
126    }
127
128    //
129    // Generate instruction objects for fields
130    //
131
132    public static Instruction make_getfield(CodeField cf) {
133        return new FieldInstruction(op_getfield, cf);
134    }
135
136    public static Instruction make_putfield(CodeField cf) {
137        return new FieldInstruction(op_putfield, cf);
138    }
139
140    public static Instruction make_getstatic(CodeField cf) {
141        return new FieldInstruction(op_getstatic, cf);
142    }
143
144    public static Instruction make_putstatic(CodeField cf) {
145        return new FieldInstruction(op_putstatic, cf);
146    }
147
148    //
149    // Generate instruction objects for loads
150    //
151
152    public static Instruction make_iload(LocalVariable lv) 
153        throws CodeException
154    {
155        CodeClass cc = lv.getType();
156        if (cc != CodeUtils.TYPE_INT && 
157            cc != CodeUtils.TYPE_SHORT && 
158            cc != CodeUtils.TYPE_CHAR &&
159            cc != CodeUtils.TYPE_BYTE &&
160            cc != CodeUtils.TYPE_BOOLEAN)
161        {
162            throw new CodeException(cc.getName() + " is not a VM `i' type");
163        }
164
165        return new LocalVariableInstruction(op_iload, op_iload_0, lv);
166    }
167
168    public static Instruction make_lload(LocalVariable lv) 
169        throws CodeException
170    {
171        if (lv.getType() != CodeUtils.TYPE_LONG) {
172            throw new CodeException(lv.getType().getName() + " is not a long");
173        }
174
175        return new LocalVariableInstruction(op_lload, op_lload_0, lv);
176    }
177
178    public static Instruction make_fload(LocalVariable lv) 
179        throws CodeException
180    {
181        if (lv.getType() != CodeUtils.TYPE_FLOAT) {
182            throw new CodeException(lv.getType().getName() + " is not a float");
183        }
184
185        return new LocalVariableInstruction(op_fload, op_fload_0, lv);
186    }
187
188    public static Instruction make_dload(LocalVariable lv) 
189        throws CodeException
190    {
191        if (lv.getType() != CodeUtils.TYPE_DOUBLE) {
192            throw new CodeException(lv.getType().getName() + " is not a double");
193        }
194
195        return new LocalVariableInstruction(op_dload, op_dload_0, lv);
196    }
197
198    public static Instruction make_aload(LocalVariable lv) 
199        throws CodeException
200    {
201        if (lv.getType().isPrimitive()) {
202            throw new CodeException(lv.getType().getName() + " is a primitive type");
203        }
204
205        return new LocalVariableInstruction(op_aload, op_aload_0, lv);
206    }
207
208    //
209    // Generate instruction objects for stores
210    //
211
212    public static Instruction make_istore(LocalVariable lv) 
213        throws CodeException
214    {
215        CodeClass cc = lv.getType();
216        if (cc != CodeUtils.TYPE_INT && 
217            cc != CodeUtils.TYPE_SHORT && 
218            cc != CodeUtils.TYPE_CHAR &&
219            cc != CodeUtils.TYPE_BYTE &&
220            cc != CodeUtils.TYPE_BOOLEAN)
221        {
222            throw new CodeException(cc.getName() + " is not a VM `i' type");
223        }
224
225
226        return new LocalVariableInstruction(op_istore, op_istore_0, lv);
227    }
228
229    public static Instruction make_lstore(LocalVariable lv)
230        throws CodeException
231    {
232        if (lv.getType() != CodeUtils.TYPE_LONG) {
233            throw new CodeException(lv.getType().getName() + " is not a long");
234        }
235
236        return new LocalVariableInstruction(op_lstore, op_lstore_0, lv);
237    }
238
239    public static Instruction make_fstore(LocalVariable lv) 
240        throws CodeException
241    {
242        if (lv.getType() != CodeUtils.TYPE_FLOAT) {
243            throw new CodeException(lv.getType().getName() + " is not a float");
244        }
245
246        return new LocalVariableInstruction(op_fstore, op_fstore_0, lv);
247    }
248
249    public static Instruction make_dstore(LocalVariable lv) 
250        throws CodeException
251    {
252        if (lv.getType() != CodeUtils.TYPE_DOUBLE) {
253            throw new CodeException(lv.getType().getName() + " is not a double");
254        }
255
256        return new LocalVariableInstruction(op_dstore, op_dstore_0, lv);
257    }
258
259    public static Instruction make_astore(LocalVariable lv) 
260        throws CodeException
261    {
262        if (lv.getType().isPrimitive()) {
263            throw new CodeException(lv.getType().getName() + " is a primitive type");
264        }
265
266        return new LocalVariableInstruction(op_astore, op_astore_0, lv);
267    }
268
269    //
270    // Generate the Instruction objects for all this `if's
271    //
272
273    /**
274     * Return the Instruction object for the ifeq instruction.
275     */
276
277    public static Instruction make_ifeq(Label lab) {
278        return make_if(op_ifeq, lab);
279    }
280
281    /**
282     * Return the Instruction object for the ifne instruction.
283     */
284
285    public static Instruction make_ifne(Label lab) {
286        return make_if(op_ifne, lab);
287    }
288
289    /**
290     * Return the Instruction object for the iflt instruction.
291     *
292     */
293
294    public static Instruction make_iflt(Label lab) {
295        return new LabelInstruction(op_iflt, lab, -1);
296    }
297
298    /**
299     * Return the Instruction object for the ifge instruction.
300     *
301     */
302
303    public static Instruction make_ifge(Label lab) {
304        return new LabelInstruction(op_ifge, lab, -1);
305    }
306
307    /**
308     * Return the Instruction object for the ifgt instruction.
309     *
310     */
311
312    public static Instruction make_ifgt(Label lab) {
313        return new LabelInstruction(op_ifgt, lab, -1);
314    }
315
316    /**
317     * Return the Instruction object for the ifle instruction.
318     */
319
320    public static Instruction make_ifle(Label lab) {
321        return new LabelInstruction(op_ifle, lab, -1);
322    }
323
324    /**
325     * Return the Instruction object for the if_icmpeq instruction.
326     */
327
328    public static Instruction make_if_icmpeq(Label l) {
329        return new LabelInstruction(op_if_icmpeq, l, -2);
330    }
331
332    /**
333     * Return the Instruction object for the if_icmpne instruction.
334     */
335
336    public static Instruction make_if_icmpne(Label l) {
337        return new LabelInstruction(op_if_icmpne, l, -2);
338    }
339
340    /**
341     * Return the Instruction object for the if_icmplt instruction.
342     */
343
344    public static Instruction make_if_icmplt(Label l) {
345        return new LabelInstruction(op_if_icmplt, l, -2);
346    }
347
348    /**
349     * Return the Instruction object for the if_icmpge instruction.
350     */
351
352    public static Instruction make_if_icmpge(Label l) {
353        return new LabelInstruction(op_if_icmpge, l, -2);
354    }
355
356    /**
357     * Return the Instruction object for the if_icmpgt instruction.
358     */
359
360    public static Instruction make_if_icmpgt(Label l) {
361        return new LabelInstruction(op_if_icmpgt, l, -2);
362    }
363
364    /**
365     * Return the Instruction object for the if_icmple instruction.
366     */
367
368    public static Instruction make_if_icmple(Label l) {
369        return new LabelInstruction(op_if_icmple, l, -2);
370    }
371
372    /**
373     * Return the Instruction object for the if_acmpeq instruction.
374     */
375
376    public static Instruction make_if_acmpeq(Label l) {
377        return new LabelInstruction(op_if_acmpeq, l, -2);
378    }
379
380    /**
381     * Return the Instruction object for the if_acmpne instruction.
382     */
383
384    public static Instruction make_if_acmpne(Label l) {
385        return new LabelInstruction(op_if_acmpne, l, -2);
386    }
387
388    /**
389     * Return the Instruction object for the ifnull instruction.
390     */
391
392    public static Instruction make_ifnull(Label l) {
393        return new LabelInstruction(op_ifnull, l, -1);
394    }
395
396    /**
397     * Return the Instruction object for the ifnonnull instruction.
398     */
399
400    public static Instruction make_ifnonnull(Label l) {
401        return new LabelInstruction(op_ifnonnull, l, -1);
402    }
403
404    //
405    // The other label instructions
406    //
407
408    public static Instruction make_goto(Label l) {
409        return new LabelInstruction(op_goto, l, 0);
410    }
411
412    public static Instruction make_jsr(Label l) {
413        return new LabelInstruction(op_jsr, l, 1);
414    }
415
416    //
417    // Generate the Instruction objects for all the no-operands instructions
418    //
419
420    /**
421     * Return the Instruction object for the nop instruction.
422     */
423
424    public static Instruction make_nop() {
425        return new NoOperandsInstruction(op_nop, 0);
426    }
427
428    /**
429     * Return the Instruction object for the aconst_null instruction.
430     */
431
432    public static Instruction make_aconst_null() {
433        return new NoOperandsInstruction(op_aconst_null, 1);
434    }
435
436    /**
437     * Return the Instruction object for the iaload instruction.
438     */
439
440    public static Instruction make_iaload() {
441        return new NoOperandsInstruction(op_iaload, -1);
442    }
443
444    /**
445     * Return the Instruction object for the laload instruction.
446     */
447
448    public static Instruction make_laload() {
449        return new NoOperandsInstruction(op_laload, -1);
450    }
451
452    /**
453     * Return the Instruction object for the faload instruction.
454     */
455
456    public static Instruction make_faload() {
457        return new NoOperandsInstruction(op_faload, -1);
458    }
459
460    /**
461     * Return the Instruction object for the daload instruction.
462     */
463
464    public static Instruction make_daload() {
465        return new NoOperandsInstruction(op_daload, -1);
466    }
467
468    /**
469     * Return the Instruction object for the aaload instruction.
470     */
471
472    public static Instruction make_aaload() {
473        return new NoOperandsInstruction(op_aaload, -1);
474    }
475
476    /**
477     * Return the Instruction object for the baload instruction.
478     */
479
480    public static Instruction make_baload() {
481        return new NoOperandsInstruction(op_baload, -1);
482    }
483
484    /**
485     * Return the Instruction object for the caload instruction.
486     */
487
488    public static Instruction make_caload() {
489        return new NoOperandsInstruction(op_caload, -1);
490    }
491
492    /**
493     * Return the Instruction object for the saload instruction.
494     */
495
496    public static Instruction make_saload() {
497        return new NoOperandsInstruction(op_saload, -1);
498    }
499
500    /**
501     * Return the Instruction object for the iastore instruction.
502     */
503
504    public static Instruction make_iastore() {
505        return new NoOperandsInstruction(op_iastore, -3);
506    }
507
508    /**
509     * Return the Instruction object for the lastore instruction.
510     */
511
512    public static Instruction make_lastore() {
513        return new NoOperandsInstruction(op_lastore, -3);
514    }
515
516    /**
517     * Return the Instruction object for the fastore instruction.
518     */
519
520    public static Instruction make_fastore() {
521        return new NoOperandsInstruction(op_fastore, -3);
522    }
523
524    /**
525     * Return the Instruction object for the dastore instruction.
526     */
527
528    public static Instruction make_dastore() {
529        return new NoOperandsInstruction(op_dastore, -3);
530    }
531
532    /**
533     * Return the Instruction object for the aastore instruction.
534     */
535
536    public static Instruction make_aastore() {
537        return new NoOperandsInstruction(op_aastore, -3);
538    }
539
540    /**
541     * Return the Instruction object for the bastore instruction.
542     */
543
544    public static Instruction make_bastore() {
545        return new NoOperandsInstruction(op_bastore, -3);
546    }
547
548    /**
549     * Return the Instruction object for the castore instruction.
550     */
551
552    public static Instruction make_castore() {
553        return new NoOperandsInstruction(op_castore, -3);
554    }
555
556    /**
557     * Return the Instruction object for the sastore instruction.
558     */
559
560    public static Instruction make_sastore() {
561        return new NoOperandsInstruction(op_sastore, -3);
562    }
563
564    /**
565     * Return the Instruction object for the pop instruction.
566     */
567
568    public static Instruction make_pop() {
569        return new NoOperandsInstruction(op_pop, -1);
570    }
571
572    /**
573     * Return the Instruction object for the pop2 instruction.
574     */
575
576    public static Instruction make_pop2() {
577        return new NoOperandsInstruction(op_pop2, -2);
578    }
579
580    /**
581     * Return the Instruction object for the dup instruction.
582     */
583
584    public static Instruction make_dup() {
585        return new NoOperandsInstruction(op_dup, 1);
586    }
587
588    /**
589     * Return the Instruction object for the dup_x1 instruction.
590     */
591
592    public static Instruction make_dup_x1() {
593        return new NoOperandsInstruction(op_dup_x1, 1);
594    }
595
596    /**
597     * Return the Instruction object for the dup_x2 instruction.
598     */
599
600    public static Instruction make_dup_x2() {
601        return new NoOperandsInstruction(op_dup_x2, 1);
602    }
603
604    /**
605     * Return the Instruction object for the dup2 instruction.
606     */
607
608    public static Instruction make_dup2() {
609      return new NoOperandsInstruction(op_dup2, 2);
610    }
611
612    /**
613     * Return the Instruction object for the dup2_x1 instruction.
614     */
615
616    public static Instruction make_dup2_x1() {
617      return new NoOperandsInstruction(op_dup2_x1, 2);
618    }
619
620    /**
621     * Return the Instruction object for the dup2_x2 instruction.
622     */
623
624    public static Instruction make_dup2_x2() {
625        return new NoOperandsInstruction(op_dup2_x2, 2);
626    }
627
628    /**
629     * Return the Instruction object for the swap instruction.
630     */
631
632    public static Instruction make_swap() {
633        return new NoOperandsInstruction(op_swap, 0);
634    }
635
636    /**
637     * Return the Instruction object for the iadd instruction.
638     */
639
640    public static Instruction make_iadd() {
641        return new NoOperandsInstruction(op_iadd, -1);
642    }
643
644    /**
645     * Return the Instruction object for the ladd instruction.
646     */
647
648    public static Instruction make_ladd() {
649        return new NoOperandsInstruction(op_ladd, -1);
650    }
651
652    /**
653     * Return the Instruction object for the fadd instruction.
654     */
655
656    public static Instruction make_fadd() {
657        return new NoOperandsInstruction(op_fadd, -1);
658    }
659
660    /**
661     * Return the Instruction object for the dadd instruction.
662     */
663
664    public static Instruction make_dadd() {
665        return new NoOperandsInstruction(op_dadd, -1);
666    }
667
668    /**
669     * Return the Instruction object for the isub instruction.
670     */
671
672    public static Instruction make_isub() {
673        return new NoOperandsInstruction(op_isub, -1);
674    }
675
676    /**
677     * Return the Instruction object for the lsub instruction.
678     */
679
680    public static Instruction make_lsub() {
681        return new NoOperandsInstruction(op_lsub, -1);
682    }
683
684    /**
685     * Return the Instruction object for the fsub instruction.
686     */
687
688    public static Instruction make_fsub() {
689        return new NoOperandsInstruction(op_fsub, -1);
690    }
691
692    /**
693     * Return the Instruction object for the dsub instruction.
694     */
695
696    public static Instruction make_dsub() {
697        return new NoOperandsInstruction(op_dsub, -1);
698    }
699
700    /**
701     * Return the Instruction object for the imul instruction.
702     */
703
704    public static Instruction make_imul() {
705        return new NoOperandsInstruction(op_imul, -1);
706    }
707
708    /**
709     * Return the Instruction object for the lmul instruction.
710     */
711
712    public static Instruction make_lmul() {
713        return new NoOperandsInstruction(op_lmul, -1);
714    }
715
716    /**
717     * Return the Instruction object for the fmul instruction.
718     */
719
720    public static Instruction make_fmul() {
721        return new NoOperandsInstruction(op_fmul, -1);
722    }
723
724    /**
725     * Return the Instruction object for the dmul instruction.
726     */
727
728    public static Instruction make_dmul() {
729        return new NoOperandsInstruction(op_dmul, -1);
730    }
731
732    /**
733     * Return the Instruction object for the idiv instruction.
734     */
735
736    public static Instruction make_idiv() {
737        return new NoOperandsInstruction(op_idiv, -1);
738    }
739
740    /**
741     * Return the Instruction object for the ldiv instruction.
742     */
743
744    public static Instruction make_ldiv() {
745        return new NoOperandsInstruction(op_ldiv, -1);
746    }
747
748    /**
749     * Return the Instruction object for the fdiv instruction.
750     */
751
752    public static Instruction make_fdiv() {
753        return new NoOperandsInstruction(op_fdiv, -1);
754    }
755
756    /**
757     * Return the Instruction object for the ddiv instruction.
758     */
759
760    public static Instruction make_ddiv() {
761        return new NoOperandsInstruction(op_ddiv, -1);
762    }
763
764    /**
765     * Return the Instruction object for the irem instruction.
766     */
767
768    public static Instruction make_irem() {
769        return new NoOperandsInstruction(op_irem, -1);
770    }
771
772    /**
773     * Return the Instruction object for the lrem instruction.
774     */
775
776    public static Instruction make_lrem() {
777        return new NoOperandsInstruction(op_lrem, -1);
778    }
779
780    /**
781     * Return the Instruction object for the frem instruction.
782     */
783
784    public static Instruction make_frem() {
785        return new NoOperandsInstruction(op_frem, -1);
786    }
787
788    /**
789     * Return the Instruction object for the drem instruction.
790     */
791
792    public static Instruction make_drem() {
793        return new NoOperandsInstruction(op_drem, -1);
794    }
795
796    /**
797     * Return the Instruction object for the ineg instruction.
798     */
799
800    public static Instruction make_ineg() {
801        return new NoOperandsInstruction(op_ineg, 0);
802    }
803
804    /**
805     * Return the Instruction object for the lneg instruction.
806     */
807
808    public static Instruction make_lneg() {
809        return new NoOperandsInstruction(op_lneg, 0);
810    }
811
812    /**
813     * Return the Instruction object for the fneg instruction.
814     */
815
816    public static Instruction make_fneg() {
817        return new NoOperandsInstruction(op_fneg, 0);
818    }
819
820    /**
821     * Return the Instruction object for the dneg instruction.
822     */
823
824    public static Instruction make_dneg() {
825        return new NoOperandsInstruction(op_dneg, 0);
826    }
827
828    /**
829     * Return the Instruction object for the ishl instruction.
830     */
831
832    public static Instruction make_ishl() {
833        return new NoOperandsInstruction(op_ishl, -1);
834    }
835
836    /**
837     * Return the Instruction object for the lshl instruction.
838     */
839
840    public static Instruction make_lshl() {
841        return new NoOperandsInstruction(op_lshl, -1);
842    }
843
844    /**
845     * Return the Instruction object for the ishr instruction.
846     */
847
848    public static Instruction make_ishr() {
849        return new NoOperandsInstruction(op_ishr, -1);
850    }
851
852    /**
853     * Return the Instruction object for the lshr instruction.
854     */
855
856    public static Instruction make_lshr() {
857        return new NoOperandsInstruction(op_lshr, -1);
858    }
859
860    /**
861     * Return the Instruction object for the iushr instruction.
862     */
863
864    public static Instruction make_iushr() {
865        return new NoOperandsInstruction(op_iushr, -1);
866    }
867
868    /**
869     * Return the Instruction object for the lushr instruction.
870     */
871
872    public static Instruction make_lushr() {
873        return new NoOperandsInstruction(op_lushr, -1);
874    }
875
876    /**
877     * Return the Instruction object for the iand instruction.
878     */
879
880    public static Instruction make_iand() {
881        return new NoOperandsInstruction(op_iand, -1);
882    }
883
884    /**
885     * Return the Instruction object for the land instruction.
886     */
887
888    public static Instruction make_land() {
889        return new NoOperandsInstruction(op_land, -1);
890    }
891
892    /**
893     * Return the Instruction object for the ior instruction.
894     */
895
896    public static Instruction make_ior() {
897        return new NoOperandsInstruction(op_ior, -1);
898    }
899
900    /**
901     * Return the Instruction object for the lor instruction.
902     */
903
904    public static Instruction make_lor() {
905        return new NoOperandsInstruction(op_lor, -1);
906    }
907
908    /**
909     * Return the Instruction object for the ixor instruction.
910     */
911
912    public static Instruction make_ixor() {
913        return new NoOperandsInstruction(op_ixor, -1);
914    }
915
916    /**
917     * Return the Instruction object for the lxor instruction.
918     */
919
920    public static Instruction make_lxor() {
921        return new NoOperandsInstruction(op_lxor, -1);
922    }
923
924    /**
925     * Return the Instruction object for the i2l instruction.
926     */
927
928    public static Instruction make_i2l() {
929        return new NoOperandsInstruction(op_i2l, 0);
930    }
931
932    /**
933     * Return the Instruction object for the i2f instruction.
934     */
935
936    public static Instruction make_i2f() {
937        return new NoOperandsInstruction(op_i2f, 0);
938    }
939
940    /**
941     * Return the Instruction object for the i2d instruction.
942     */
943
944    public static Instruction make_i2d() {
945        return new NoOperandsInstruction(op_i2d, 0);
946    }
947
948    /**
949     * Return the Instruction object for the l2i instruction.
950     */
951
952    public static Instruction make_l2i() {
953        return new NoOperandsInstruction(op_l2i, 0);
954    }
955
956    /**
957     * Return the Instruction object for the l2f instruction.
958     */
959
960    public static Instruction make_l2f() {
961        return new NoOperandsInstruction(op_l2f, 0);
962    }
963
964    /**
965     * Return the Instruction object for the l2d instruction.
966     */
967
968    public static Instruction make_l2d() {
969        return new NoOperandsInstruction(op_l2d, 0);
970    }
971
972    /**
973     * Return the Instruction object for the f2i instruction.
974     */
975
976    public static Instruction make_f2i() {
977        return new NoOperandsInstruction(op_f2i, 0);
978    }
979
980    /**
981     * Return the Instruction object for the f2l instruction.
982     */
983
984    public static Instruction make_f2l() {
985        return new NoOperandsInstruction(op_f2l, 0);
986    }
987
988    /**
989     * Return the Instruction object for the f2d instruction.
990     */
991
992    public static Instruction make_f2d() {
993        return new NoOperandsInstruction(op_f2d, 0);
994    }
995
996    /**
997     * Return the Instruction object for the d2i instruction.
998     */
999
1000    public static Instruction make_d2i() {
1001        return new NoOperandsInstruction(op_d2i, 0);
1002    }
1003
1004    /**
1005     * Return the Instruction object for the d2l instruction.
1006     */
1007
1008    public static Instruction make_d2l() {
1009        return new NoOperandsInstruction(op_d2l, 0);
1010    }
1011
1012    /**
1013     * Return the Instruction object for the d2f instruction.
1014     */
1015
1016    public static Instruction make_d2f() {
1017        return new NoOperandsInstruction(op_d2f, 0);
1018    }
1019
1020    /**
1021     * Return the Instruction object for the i2b instruction.
1022     */
1023
1024    public static Instruction make_i2b() {
1025        return new NoOperandsInstruction(op_i2b, 0);
1026    }
1027
1028    /**
1029     * Return the Instruction object for the i2c instruction.
1030     */
1031
1032    public static Instruction make_i2c() {
1033        return new NoOperandsInstruction(op_i2c, 0);
1034    }
1035
1036    /**
1037     * Return the Instruction object for the i2s instruction.
1038     */
1039
1040    public static Instruction make_i2s() {
1041        return new NoOperandsInstruction(op_i2s, 0);
1042    }
1043
1044    /**
1045     * Return the Instruction object for the lcmp instruction.
1046     */
1047
1048    public static Instruction make_lcmp() {
1049        return new NoOperandsInstruction(op_lcmp, -1);
1050    }
1051
1052    /**
1053     * Return the Instruction object for the fcmpl instruction.
1054     */
1055
1056    public static Instruction make_fcmpl() {
1057        return new NoOperandsInstruction(op_fcmpl, -1);
1058    }
1059
1060    /**
1061     * Return the Instruction object for the fcmpg instruction.
1062     */
1063
1064    public static Instruction make_fcmpg() {
1065        return new NoOperandsInstruction(op_fcmpg, -1);
1066    }
1067
1068    /**
1069     * Return the Instruction object for the dcmpl instruction.
1070     */
1071
1072    public static Instruction make_dcmpl() {
1073        return new NoOperandsInstruction(op_dcmpl, -1);
1074    }
1075
1076    /**
1077     * Return the Instruction object for the dcmpg instruction.
1078     */
1079
1080    public static Instruction make_dcmpg() {
1081        return new NoOperandsInstruction(op_dcmpg, -1);
1082    }
1083
1084    /**
1085     * Return the Instruction object for the ireturn instruction.
1086     */
1087
1088    public static Instruction make_ireturn() {
1089        return new NoOperandsInstruction(op_ireturn, -1);
1090    }
1091
1092    /**
1093     * Return the Instruction object for the lreturn instruction.
1094     */
1095
1096    public static Instruction make_lreturn() {
1097        return new NoOperandsInstruction(op_lreturn, -1);
1098    }
1099
1100    /**
1101     * Return the Instruction object for the freturn instruction.
1102     */
1103
1104    public static Instruction make_freturn() {
1105        return new NoOperandsInstruction(op_freturn, -1);
1106    }
1107
1108    /**
1109     * Return the Instruction object for the dreturn instruction.
1110     */
1111
1112    public static Instruction make_dreturn() {
1113        return new NoOperandsInstruction(op_dreturn, -1);
1114    }
1115
1116    /**
1117     * Return the Instruction object for the areturn instruction.
1118     */
1119
1120    public static Instruction make_areturn() {
1121        return new NoOperandsInstruction(op_areturn, -1);
1122    }
1123
1124    /**
1125     * Return the Instruction object for the return instruction.
1126     */
1127
1128    public static Instruction make_return() {
1129        return new NoOperandsInstruction(op_return, 0);
1130    }
1131    
1132    /**
1133     * Return the Instruction object for the arraylength instruction.
1134     */
1135
1136    public static Instruction make_arraylength() {
1137        return new NoOperandsInstruction(op_arraylength, 0);
1138    }
1139
1140    /**
1141     * Return the Instruction object for the athrow instruction.
1142     */
1143
1144    public static Instruction make_athrow() {
1145        return new NoOperandsInstruction(op_athrow, 0);
1146    }
1147
1148    /**
1149     * Return the Instruction object for the monitorenter instruction.
1150     *
1151     */
1152
1153    public static Instruction make_monitorenter() {
1154        return new NoOperandsInstruction(op_monitorenter, -1);
1155    }
1156
1157    /**
1158     * Return the Instruction object for the monitorexit instruction.
1159     */
1160
1161    public static Instruction make_monitorexit() {
1162        return new NoOperandsInstruction(op_monitorexit, -1);
1163    }
1164
1165    /**
1166     * Return the Instruction object for the wide instruction.
1167     */
1168
1169    public static Instruction make_wide() {
1170        return new NoOperandsInstruction(op_wide, 0);
1171    }
1172
1173    /**
1174     * Return the Instruction object for the breakpoint instruction.
1175     */
1176
1177    public static Instruction make_breakpoint() {
1178        return new NoOperandsInstruction(op_breakpoint, 0);
1179    }
1180
1181    /**
1182     * Return the Instruction object for the invokevirtual_quick_w instruction.
1183     *
1184     * Apparently now undocumented. Presumably deprecated.
1185     */
1186
1187    public static Instruction make_invokevirtual_quick_w() {
1188        // fixme - I have no idea what the stack-depth change is here
1189        // should we even be using this class?
1190        return new NoOperandsInstruction(op_invokevirtual_quick_w, 0);
1191    }
1192
1193    /**
1194     * Return the Instruction object for the impdep1 instruction.
1195     */
1196
1197    public static Instruction make_impdep1() {
1198        return new NoOperandsInstruction(op_impdep1, 0);
1199    }
1200
1201    /**
1202     * Return the Instruction object for the impdep2 instruction.
1203     */
1204
1205    public static Instruction make_impdep2() {
1206        return new NoOperandsInstruction(op_impdep2, 0);
1207    }
1208
1209  public static Instruction make_checkcast(CodeClass clazz) {
1210    return new ClassInstruction(op_checkcast, clazz, 0);
1211  }
1212
1213  public static Instruction make_instanceof(CodeClass clazz) {
1214    return new ClassInstruction(op_instanceof, clazz, 0);
1215  }
1216    // new instruction added by hand - mrp
1217    
1218    public static Instruction make_new(CodeClass clazz) {
1219      return new ClassInstruction(op_new, clazz, 1);
1220    }
1221
1222    public static Instruction make_newarray(CodeClass clazz) 
1223        throws CodeException
1224    {
1225      if (clazz.isPrimitive()) {
1226        int type = -1;
1227        if (clazz == CodeUtils.TYPE_BOOLEAN) {
1228          type = 4;
1229        } else if (clazz == CodeUtils.TYPE_CHAR) {
1230          type = 5;
1231        } else if (clazz == CodeUtils.TYPE_FLOAT) {
1232          type = 6;
1233        } else if (clazz == CodeUtils.TYPE_DOUBLE) {
1234          type = 7;
1235        } else if (clazz == CodeUtils.TYPE_BYTE) {
1236          type = 8;
1237        } else if (clazz == CodeUtils.TYPE_SHORT) {
1238          type = 9;
1239        } else if (clazz == CodeUtils.TYPE_INT) {
1240          type = 10;
1241        } else if (clazz == CodeUtils.TYPE_LONG) {
1242          type = 11;
1243        } 
1244        if (type < 0) { 
1245          throw new CodeException("Invalid type " + clazz.getName());
1246        }
1247       
1248        return new ByteInstruction(op_newarray, (byte) type, 0);
1249      } else {
1250        return new ClassInstruction(op_anewarray, clazz, 0);
1251      }
1252    }
1253
1254    /**
1255     * A convenient one-stop method to get a return statement suitable for a
1256     * method.
1257     *
1258     * @param method  the CodeMethod to return from
1259     * @return a return Instruction that fits this method's return type
1260     */
1261    public static Instruction make_return(CodeMethod method) {
1262      return make_return(method.getReturnType());
1263    }
1264    
1265    /**
1266     * Creates the return Instruction suitable for a given class or type.
1267     *
1268     * @param clazz  the CodeClass representing the class or type to return
1269     * @return  the apropreate return instruction
1270     */
1271    public static Instruction make_return(CodeClass clazz) {
1272      if (false) {
1273      } else if(CodeUtils.TYPE_VOID.equals(clazz)) {
1274        return make_return();
1275      } else if(
1276        CodeUtils.TYPE_BYTE.equals(clazz) ||
1277        CodeUtils.TYPE_SHORT.equals(clazz) ||
1278        CodeUtils.TYPE_CHAR.equals(clazz) ||
1279        CodeUtils.TYPE_BOOLEAN.equals(clazz) ||
1280        CodeUtils.TYPE_INT.equals(clazz)
1281      ) {
1282        return make_ireturn();
1283      } else if(CodeUtils.TYPE_LONG.equals(clazz)) {
1284        return make_lreturn();
1285      } else if(CodeUtils.TYPE_FLOAT.equals(clazz)) {
1286        return make_freturn();
1287      } else if(CodeUtils.TYPE_DOUBLE.equals(clazz)) {
1288        return make_dreturn();
1289      }
1290
1291      return make_areturn();
1292    }
1293
1294    /**
1295     * Make an invoke opcode that is suited to the method.
1296     *
1297     * <p>Constructors and private methods are invoked by invokespecial.
1298     * Static methods are invoked by invokestatic. Methods referred to by
1299     * interface are invoked by invokeinterface, and methods referred to
1300     * by classes are invoked by invokeabstract.</p>
1301     *
1302     * @param cm  the CodeMethod to invoke
1303     * @return an invocation Instruction suited to the method
1304     */
1305    public static Instruction make_invoke(CodeMethod cm) {
1306      int modifiers = cm.getModifiers();
1307
1308      if( (CodeUtils.ACC_STATIC & modifiers) != 0 ) {
1309        return make_invokestatic(cm);
1310      } else if( (CodeUtils.ACC_INTERFACE) != 0 ) {
1311        return make_invokeinterface(cm);
1312      } else if( (CodeUtils.ACC_PRIVATE) != 0 ) {
1313        return make_invokespecial(cm);
1314      } else {
1315        return make_invokevirtual(cm);
1316      }
1317    }
1318    
1319    /**
1320     * Synchronize the processing of an entire block of code on a local
1321     * variable. The local variable must refer to a Java object. It is safe to
1322     * replace the value of the local variable within the block.
1323     *
1324     * @param lockVar  Label for the local variable to lock on
1325     * @param code the CodeGenerator that will make the body of the synchronized
1326     *   block
1327     * @throws CodeException if locVar holds a primative value
1328     */
1329    public static CodeGenerator make_synchronizedBlock(
1330      LocalVariable lockVar,
1331      CodeGenerator code
1332    ) throws CodeException {
1333      InstructionVector block = new InstructionVector();
1334      block.add(make_aload(lockVar));
1335      block.add(make_dup()); // defencive copy incase the local is re-assigned
1336      block.add(make_monitorenter());
1337      block.add(code);
1338      block.add(make_monitorexit());
1339      
1340      return block;
1341    }
1342    
1343    /**
1344     * Synchronize the processing of an entire block of code on the object on
1345     * the top of the stack.
1346     *
1347     * @param lockVar  Label for the local variable to lock on
1348     * @param code the CodeGenerator that will make the body of the synchronized
1349     *   block
1350     */
1351    public static CodeGenerator make_synchronizedBlock(CodeGenerator code) {
1352      InstructionVector block = new InstructionVector();
1353      block.add(make_dup());
1354      block.add(make_monitorenter());
1355      block.add(code);
1356      block.add(make_monitorexit());
1357      
1358      return block;
1359    }
1360    
1361    public static CodeGenerator make_markLabel(Label lab) {
1362      return new MarkLabel(lab);
1363    }
1364
1365    /**
1366     * Make an if Instruction for the opcode and label.
1367     *
1368     * <p>Obcodes for IF jump to the label if the condition is true, or execute
1369     * the next instruction ontherwise. In this case, op will be used to compare
1370     * the top of the stack and if the condition is true, will cause a jump to
1371     * the label. Otherwise, the next instruction in the stream will be used.
1372     * </p>
1373     *
1374     * @param op  if opcode
1375     * @param lab Label to jump to
1376     * @return an Instruction that will perform an if 
1377     * @throws IllegalArgumentException if the op code is not an if instruction
1378     */
1379    public static Instruction make_if(byte op, Label lab) {
1380      if(op >= op_ifeq && op <= op_ifle) {
1381        return new LabelInstruction(op, lab, -1);
1382      } else if(op >= op_if_icmpeq && op <= op_if_acmpne) {
1383        return new LabelInstruction(op, lab, -2);
1384      } else {
1385        throw new IllegalArgumentException("Opcode must be an if. " + op);
1386      }
1387    }
1388    
1389    public static ParametricCodeGenerator make_newraray(final ParametricType type) {
1390      return new ParametricCodeGenerator() {
1391        public ParametricType getType() { return type; }
1392        public int stackDepth() { return 0; }
1393        public int stackDelta() { return 0; }
1394        public void writeCode(CodeContext ctx) throws CodeException {
1395          CodeClass cc = ctx.resolveParametricType(type);
1396          make_newarray(cc).writeCode(ctx);
1397        }
1398      };
1399    }
1400    
1401    /**
1402     * Load an element of a parametric type to an array.
1403     *
1404     * <p>This is the parametric version of the make_&lt;x&gt;aload() factory
1405     * methods.</p>
1406     *
1407     * @param type  the ParametricType giving the element type of the array
1408     * @return a ParametricCodeGenerator that will load the correct type.
1409     */
1410    public static ParametricCodeGenerator make_array_load(final ParametricType type) {
1411      return new ParametricCodeGenerator() {
1412        public ParametricType getType() { return type; }
1413        public int stackDepth() { return 0; }
1414        public int stackDelta() { return -1; }
1415        public void writeCode(CodeContext ctx) throws CodeException {
1416          CodeClass cc = ctx.resolveParametricType(type);
1417          if(!cc.isPrimitive()) {
1418            ctx.writeByte(op_aaload);
1419          } else if(cc == CodeUtils.TYPE_INT) {
1420            ctx.writeByte(op_iaload);
1421          } else if(cc == CodeUtils.TYPE_LONG) {
1422            ctx.writeByte(op_daload);
1423          } else if(cc == CodeUtils.TYPE_FLOAT) {
1424            ctx.writeByte(op_faload);
1425          } else if(cc == CodeUtils.TYPE_DOUBLE) {
1426            ctx.writeByte(op_daload);
1427          } else if(cc == CodeUtils.TYPE_BYTE) {
1428            ctx.writeByte(op_baload);
1429          } else if(cc == CodeUtils.TYPE_CHAR) {
1430            ctx.writeByte(op_caload);
1431          } else if(cc == CodeUtils.TYPE_SHORT) {
1432            ctx.writeByte(op_saload);
1433          } else {
1434            throw new CodeException("Confused. Don't recognize type: " + cc);
1435          }
1436        }
1437      };
1438    }
1439
1440    /**
1441     * Store an element of a parametric type to an array.
1442     *
1443     * <p>This is the parametric version of the make_&lt;x&gt;astore() factory
1444     * methods.</p>
1445     *
1446     * @param type  the ParametricType giving the element type of the array
1447     * @return a ParametricCodeGenerator that will store the correct type.
1448     */
1449    public static ParametricCodeGenerator make_arrayStore(final ParametricType type) {
1450      return new ParametricCodeGenerator() {
1451        public ParametricType getType() { return type; }
1452        public int stackDepth() { return 0; }
1453        public int stackDelta() { return -3; }
1454        public void writeCode(CodeContext ctx) throws CodeException {
1455          CodeClass cc = ctx.resolveParametricType(type);
1456          if(!cc.isPrimitive()) {
1457            ctx.writeByte(op_aastore);
1458          } else if(cc == CodeUtils.TYPE_INT) {
1459            ctx.writeByte(op_iastore);
1460          } else if(cc == CodeUtils.TYPE_LONG) {
1461            ctx.writeByte(op_dastore);
1462          } else if(cc == CodeUtils.TYPE_FLOAT) {
1463            ctx.writeByte(op_fastore);
1464          } else if(cc == CodeUtils.TYPE_DOUBLE) {
1465            ctx.writeByte(op_dastore);
1466          } else if(cc == CodeUtils.TYPE_BYTE) {
1467            ctx.writeByte(op_bastore);
1468          } else if(cc == CodeUtils.TYPE_CHAR) {
1469            ctx.writeByte(op_castore);
1470          } else if(cc == CodeUtils.TYPE_SHORT) {
1471            ctx.writeByte(op_sastore);
1472          } else {
1473            throw new CodeException("Confused. Don't recognize type: " + cc);
1474          }
1475        }
1476      };
1477    }
1478    
1479    /**
1480     * Load an item of a parametric type from a local variable.
1481     *
1482     * <p>This is the parametric version of the make_&lt;x&gt;load() factory
1483     * methods.</p>
1484     *
1485     * @param type  the ParametricType giving the type to load
1486     * @param lv  the LocalVariable to load from
1487     * @return a ParametricCodeGenerator that will load the correct type.
1488     */
1489    public ParametricCodeGenerator make_load(
1490      final ParametricType type,
1491      final LocalVariable lv
1492    ) throws CodeException {
1493      return new ParametricCodeGenerator() {
1494        public ParametricType getType() { return type; }
1495        public int stackDepth() { return 1; }
1496        public int stackDelta() { return 1; }
1497        public void writeCode(CodeContext ctx) throws CodeException {
1498          CodeClass cc = ctx.resolveParametricType(type);
1499          Instruction ins;
1500          if(!cc.isPrimitive()) {
1501            ins = make_aload(lv);
1502          } else if(cc == CodeUtils.TYPE_INT) {
1503            ins = make_iload(lv);
1504          } else if(cc == CodeUtils.TYPE_LONG) {
1505            ins = make_lload(lv);
1506          } else if(cc == CodeUtils.TYPE_FLOAT) {
1507            ins = make_fload(lv);
1508          } else if(cc == CodeUtils.TYPE_DOUBLE) {
1509            ins = make_dload(lv);
1510          } else if(cc == CodeUtils.TYPE_BYTE) {
1511            ins = make_iload(lv);
1512          } else if(cc == CodeUtils.TYPE_CHAR) {
1513            ins = make_iload(lv);
1514          } else if(cc == CodeUtils.TYPE_SHORT) {
1515            ins = make_iload(lv);
1516          } else {
1517            throw new CodeException("Confused. Don't recognize type: " + cc);
1518          }
1519          
1520          ins.writeCode(ctx);
1521        }
1522      };
1523    }
1524    
1525    /**
1526     * Store an item of a parametric type to a local variable.
1527     *
1528     * <p>This is the parametric version of the make_&lt;x&gt;save() factory
1529     * methods.</p>
1530     *
1531     * @param type  the ParametricType giving the type to save
1532     * @param lv  the LocalVariable to load from
1533     * @return a ParametricCodeGenerator that will save the correct type.
1534     */
1535    public ParametricCodeGenerator make_save(
1536      final ParametricType type,
1537      final LocalVariable lv
1538    ) throws CodeException {
1539      return new ParametricCodeGenerator() {
1540        public ParametricType getType() { return type; }
1541        public int stackDepth() { return 0; }
1542        public int stackDelta() { return -1; }
1543        public void writeCode(CodeContext ctx) throws CodeException {
1544          CodeClass cc = ctx.resolveParametricType(type);
1545          Instruction ins;
1546          if(!cc.isPrimitive()) {
1547            ins = make_astore(lv);
1548          } else if(cc == CodeUtils.TYPE_INT) {
1549            ins = make_istore(lv);
1550          } else if(cc == CodeUtils.TYPE_LONG) {
1551            ins = make_lstore(lv);
1552          } else if(cc == CodeUtils.TYPE_FLOAT) {
1553            ins = make_fstore(lv);
1554          } else if(cc == CodeUtils.TYPE_DOUBLE) {
1555            ins = make_dstore(lv);
1556          } else if(cc == CodeUtils.TYPE_BYTE) {
1557            ins = make_istore(lv);
1558          } else if(cc == CodeUtils.TYPE_CHAR) {
1559            ins = make_istore(lv);
1560          } else if(cc == CodeUtils.TYPE_SHORT) {
1561            ins = make_istore(lv);
1562          } else {
1563            throw new CodeException("Confused. Don't recognize type: " + cc);
1564          }
1565          
1566          ins.writeCode(ctx);
1567        }
1568      };
1569    }
1570    
1571    /**
1572     * Make a return statement for the parametric type.
1573     *
1574     * @param type  the ParametricType to return
1575     */
1576    public ParametricCodeGenerator make_return(final ParametricType type) {
1577      return new ParametricCodeGenerator() {
1578        public ParametricType getType() { return type; }
1579        public int stackDepth() { return 0; }
1580        public int stackDelta() { return -1; }
1581        public void writeCode(CodeContext ctx) throws CodeException {
1582          CodeClass cc = ctx.resolveParametricType(type);
1583          if(!cc.isPrimitive()) {
1584            ctx.writeByte(op_areturn);
1585          } else if(cc == CodeUtils.TYPE_INT) {
1586            ctx.writeByte(op_ireturn);
1587          } else if(cc == CodeUtils.TYPE_LONG) {
1588            ctx.writeByte(op_lreturn);
1589          } else if(cc == CodeUtils.TYPE_FLOAT) {
1590            ctx.writeByte(op_freturn);
1591          } else if(cc == CodeUtils.TYPE_DOUBLE) {
1592            ctx.writeByte(op_dreturn);
1593          } else if(cc == CodeUtils.TYPE_BYTE) {
1594            ctx.writeByte(op_ireturn);
1595          } else if(cc == CodeUtils.TYPE_CHAR) {
1596            ctx.writeByte(op_ireturn);
1597          } else if(cc == CodeUtils.TYPE_SHORT) {
1598            ctx.writeByte(op_ireturn);
1599          } else {
1600            throw new CodeException("Confused. Don't recognize type: " + cc);
1601          }
1602        }
1603      };
1604    }
1605    
1606    public PParametricCodeGenerator make_cast(
1607      final ParametricType from,
1608      final ParametricType to
1609    ) throws CodeException {
1610      if(from.isObject()) {
1611        throw new CodeException("Can not cast from non-primative type: " + from);
1612      }
1613      
1614      if(to.isObject()) {
1615        throw new CodeException("Can not cast to non-primative type: " + to);
1616      }
1617      
1618      return new PParametricCodeGenerator() {
1619        public ParametricType getType1() { return from; }
1620        public ParametricType getType2() { return to; }
1621        public int stackDepth() { return 0; }
1622        public int stackDelta() { return 0; }
1623        public void writeCode(CodeContext ctx) throws CodeException {
1624          if(from == to) {
1625            return;
1626          }
1627          
1628          CodeClass fromc = ctx.resolveParametricType(from);
1629          CodeClass toc = ctx.resolveParametricType(to);
1630          
1631          if(!fromc.isPrimitive()) {
1632            throw new CodeException("Can't cast from non-primitive type: " + fromc);
1633          }
1634          
1635          if(!toc.isPrimitive()) {
1636            throw new CodeException("Can't cast to non-primitive type: " + toc);
1637          }
1638          
1639          if(fromc == CodeUtils.TYPE_DOUBLE) {
1640            if(toc == CodeUtils.TYPE_FLOAT) {
1641              ctx.writeByte(op_d2f);
1642            } else if(toc == CodeUtils.TYPE_LONG) {
1643              ctx.writeByte(op_d2l);
1644            } else {
1645              ctx.writeByte(op_d2i);
1646            }
1647          } else if(fromc == CodeUtils.TYPE_LONG) {
1648            if(toc == CodeUtils.TYPE_FLOAT) {
1649              ctx.writeByte(op_l2f);
1650            } else if(toc == CodeUtils.TYPE_DOUBLE) {
1651              ctx.writeByte(op_l2d);
1652            } else {
1653              ctx.writeByte(op_d2i);
1654            }
1655          } else { // something equivalent to integer
1656            if(toc == CodeUtils.TYPE_FLOAT) {
1657              ctx.writeByte(op_i2f);
1658            } else if(toc == CodeUtils.TYPE_DOUBLE) {
1659              ctx.writeByte(op_i2d);
1660            } else if(toc == CodeUtils.TYPE_LONG) {
1661              ctx.writeByte(op_i2l);
1662            } else if(toc == CodeUtils.TYPE_BYTE) {
1663              ctx.writeByte(op_i2b);
1664            } else if(toc == CodeUtils.TYPE_CHAR) {
1665              ctx.writeByte(op_i2c);
1666            } else if(toc == CodeUtils.TYPE_SHORT) {
1667              ctx.writeByte(op_i2s);
1668            }
1669          }
1670        }
1671      };
1672    }
1673    
1674    public ParametricCodeGenerator make_add(final ParametricType type)
1675    throws CodeException {
1676      if(type.isObject()) {
1677        throw new CodeException("Can't add non-primitive type: " + type);
1678      }
1679      
1680      return new ParametricCodeGenerator() {
1681        public ParametricType getType() { return type; }
1682        public int stackDelta() { return -1; }
1683        public int stackDepth() { return 0; }
1684        public void writeCode(CodeContext ctx) throws CodeException {
1685          CodeClass cc = ctx.resolveParametricType(type);
1686          
1687          if(!cc.isPrimitive()) {
1688            throw new CodeException(
1689              "We can only add primitive types: " +
1690              type + " : " + cc );
1691          }
1692          
1693          if(cc == CodeUtils.TYPE_DOUBLE) {
1694            ctx.writeByte(op_dadd);
1695          } else if(cc == CodeUtils.TYPE_LONG) {
1696            ctx.writeByte(op_ladd);
1697          } else if(cc == CodeUtils.TYPE_FLOAT) {
1698            ctx.writeByte(op_fadd);
1699          } else {
1700            ctx.writeByte(op_iadd);
1701          }
1702        }
1703      };
1704    }
1705    
1706    public ParametricCodeGenerator make_sub(final ParametricType type)
1707    throws CodeException {
1708      if(type.isObject()) {
1709        throw new CodeException("Can't sub non-primitive type: " + type);
1710      }
1711      
1712      return new ParametricCodeGenerator() {
1713        public ParametricType getType() { return type; }
1714        public int stackDelta() { return -1; }
1715        public int stackDepth() { return 0; }
1716        public void writeCode(CodeContext ctx) throws CodeException {
1717          CodeClass cc = ctx.resolveParametricType(type);
1718          
1719          if(!cc.isPrimitive()) {
1720            throw new CodeException(
1721              "We can only sub primitive types: " +
1722              type + " : " + cc );
1723          }
1724          
1725          if(cc == CodeUtils.TYPE_DOUBLE) {
1726            ctx.writeByte(op_dsub);
1727          } else if(cc == CodeUtils.TYPE_LONG) {
1728            ctx.writeByte(op_lsub);
1729          } else if(cc == CodeUtils.TYPE_FLOAT) {
1730            ctx.writeByte(op_fsub);
1731          } else {
1732            ctx.writeByte(op_isub);
1733          }
1734        }
1735      };
1736    }
1737
1738    
1739    public ParametricCodeGenerator make_mul(final ParametricType type)
1740    throws CodeException {
1741      if(type.isObject()) {
1742        throw new CodeException("Can't mul non-primitive type: " + type);
1743      }
1744      
1745      return new ParametricCodeGenerator() {
1746        public ParametricType getType() { return type; }
1747        public int stackDelta() { return -1; }
1748        public int stackDepth() { return 0; }
1749        public void writeCode(CodeContext ctx) throws CodeException {
1750          CodeClass cc = ctx.resolveParametricType(type);
1751          
1752          if(!cc.isPrimitive()) {
1753            throw new CodeException(
1754              "We can only mul primitive types: " +
1755              type + " : " + cc );
1756          }
1757          
1758          if(cc == CodeUtils.TYPE_DOUBLE) {
1759            ctx.writeByte(op_dmul);
1760          } else if(cc == CodeUtils.TYPE_LONG) {
1761            ctx.writeByte(op_lmul);
1762          } else if(cc == CodeUtils.TYPE_FLOAT) {
1763            ctx.writeByte(op_fmul);
1764          } else {
1765            ctx.writeByte(op_imul);
1766          }
1767        }
1768      };
1769    }
1770    
1771    
1772    public ParametricCodeGenerator make_div(final ParametricType type)
1773    throws CodeException {
1774      if(type.isObject()) {
1775        throw new CodeException("Can't div non-primitive type: " + type);
1776      }
1777      
1778      return new ParametricCodeGenerator() {
1779        public ParametricType getType() { return type; }
1780        public int stackDelta() { return -1; }
1781        public int stackDepth() { return 0; }
1782        public void writeCode(CodeContext ctx) throws CodeException {
1783          CodeClass cc = ctx.resolveParametricType(type);
1784          
1785          if(!cc.isPrimitive()) {
1786            throw new CodeException(
1787              "We can only div primitive types: " +
1788              type + " : " + cc );
1789          }
1790          
1791          if(cc == CodeUtils.TYPE_DOUBLE) {
1792            ctx.writeByte(op_ddiv);
1793          } else if(cc == CodeUtils.TYPE_LONG) {
1794            ctx.writeByte(op_ldiv);
1795          } else if(cc == CodeUtils.TYPE_FLOAT) {
1796            ctx.writeByte(op_fdiv);
1797          } else {
1798            ctx.writeByte(op_idiv);
1799          }
1800        }
1801      };
1802    }
1803    
1804    public ParametricCodeGenerator make_rem(final ParametricType type)
1805    throws CodeException {
1806      if(type.isObject()) {
1807        throw new CodeException("Can't rem non-primitive type: " + type);
1808      }
1809      
1810      return new ParametricCodeGenerator() {
1811        public ParametricType getType() { return type; }
1812        public int stackDelta() { return -1; }
1813        public int stackDepth() { return 0; }
1814        public void writeCode(CodeContext ctx) throws CodeException {
1815          CodeClass cc = ctx.resolveParametricType(type);
1816          
1817          if(!cc.isPrimitive()) {
1818            throw new CodeException(
1819              "We can only rem primitive types: " +
1820              type + " : " + cc );
1821          }
1822          
1823          if(cc == CodeUtils.TYPE_DOUBLE) {
1824            ctx.writeByte(op_drem);
1825          } else if(cc == CodeUtils.TYPE_LONG) {
1826            ctx.writeByte(op_lrem);
1827          } else if(cc == CodeUtils.TYPE_FLOAT) {
1828            ctx.writeByte(op_frem);
1829          } else {
1830            ctx.writeByte(op_irem);
1831          }
1832        }
1833      };
1834    }
1835    
1836    public ParametricCodeGenerator make_neg(final ParametricType type)
1837    throws CodeException {
1838      if(type.isObject()) {
1839        throw new CodeException("Can't add non-primitive type: " + type);
1840      }
1841      
1842      return new ParametricCodeGenerator() {
1843        public ParametricType getType() { return type; }
1844        public int stackDelta() { return 0; }
1845        public int stackDepth() { return 0; }
1846        public void writeCode(CodeContext ctx) throws CodeException {
1847          CodeClass cc = ctx.resolveParametricType(type);
1848          
1849          if(!cc.isPrimitive()) {
1850            throw new CodeException(
1851              "We can only add primitive types: " +
1852              type + " : " + cc );
1853          }
1854          
1855          if(cc == CodeUtils.TYPE_DOUBLE) {
1856            ctx.writeByte(op_dneg);
1857          } else if(cc == CodeUtils.TYPE_LONG) {
1858            ctx.writeByte(op_lneg);
1859          } else if(cc == CodeUtils.TYPE_FLOAT) {
1860            ctx.writeByte(op_fneg);
1861          } else {
1862            ctx.writeByte(op_ineg);
1863          }
1864        }
1865      };
1866    }
1867
1868    public ParametricCodeGenerator make_shiftLeft(final ParametricType type)
1869    throws CodeException {
1870      if(type.isObject()) {
1871        throw new CodeException("Can't shift non-primitive type: " + type);
1872      }
1873      return new ParametricCodeGenerator() {
1874        public ParametricType getType() { return type; }
1875        public int stackDelta() { return -1; }
1876        public int stackDepth() { return 0; }
1877        public void writeCode(CodeContext ctx) throws CodeException {
1878          CodeClass cc = ctx.resolveParametricType(type);
1879          
1880          if(!cc.isPrimitive()) {
1881            throw new CodeException("Can't shift non-primitive type: " + cc);
1882          }
1883          
1884          if(CodeUtils.isFloatType(cc)) {
1885            throw new CodeException("Can't shift floating point type: " + cc);
1886          }
1887          
1888          if(cc == CodeUtils.TYPE_LONG) {
1889            ctx.writeByte(op_lshl);
1890          } else  {
1891            ctx.writeByte(op_ishl);
1892          }
1893        }
1894      };
1895    }
1896    
1897    public ParametricCodeGenerator make_shiftRight(final ParametricType type)
1898    throws CodeException {
1899      if(type.isObject()) {
1900        throw new CodeException("Can't shift non-primitive type: " + type);
1901      }
1902      return new ParametricCodeGenerator() {
1903        public ParametricType getType() { return type; }
1904        public int stackDelta() { return -1; }
1905        public int stackDepth() { return 0; }
1906        public void writeCode(CodeContext ctx) throws CodeException {
1907          CodeClass cc = ctx.resolveParametricType(type);
1908          
1909          if(!cc.isPrimitive()) {
1910            throw new CodeException("Can't shift non-primitive type: " + cc);
1911          }
1912          
1913          if(CodeUtils.isFloatType(cc)) {
1914            throw new CodeException("Can't shift floating point type: " + cc);
1915          }
1916          
1917          if(cc == CodeUtils.TYPE_LONG) {
1918            ctx.writeByte(op_lshr);
1919          } else {
1920            ctx.writeByte(op_ishr);
1921          }
1922        }
1923      };
1924    }
1925    
1926    public ParametricCodeGenerator make_shiftRightLogical(final ParametricType type)
1927    throws CodeException {
1928      if(type.isObject()) {
1929        throw new CodeException("Can't shift non-primitive type: " + type);
1930      }
1931      return new ParametricCodeGenerator() {
1932        public ParametricType getType() { return type; }
1933        public int stackDelta() { return -1; }
1934        public int stackDepth() { return 0; }
1935        public void writeCode(CodeContext ctx) throws CodeException {
1936          CodeClass cc = ctx.resolveParametricType(type);
1937          
1938          if(!cc.isPrimitive()) {
1939            throw new CodeException("Can't shift non-primitive type: " + cc);
1940          }
1941          
1942          if(CodeUtils.isFloatType(cc)) {
1943            throw new CodeException("Can't shift floating point type: " + cc);
1944          }
1945          
1946          if(cc == CodeUtils.TYPE_LONG) {
1947            ctx.writeByte(op_lushr);
1948          } else {
1949            ctx.writeByte(op_iushr);
1950          }
1951        }
1952      };
1953    }
1954    
1955    public ParametricCodeGenerator make_and(final ParametricType type)
1956    throws CodeException {
1957      if(type.isObject()) {
1958        throw new CodeException("Can't and non-primitive type: " + type);
1959      }
1960      return new ParametricCodeGenerator() {
1961        public ParametricType getType() { return type; }
1962        public int stackDelta() { return -1; }
1963        public int stackDepth() { return 0; }
1964        public void writeCode(CodeContext ctx) throws CodeException {
1965          CodeClass cc = ctx.resolveParametricType(type);
1966          
1967          if(!cc.isPrimitive()) {
1968            throw new CodeException("Can't and non-primitive type: " + cc);
1969          }
1970          
1971          if(CodeUtils.isFloatType(cc)) {
1972            throw new CodeException("Can't and floating point type: " + cc);
1973          }
1974          
1975          
1976          if(cc == CodeUtils.TYPE_LONG) {
1977            ctx.writeByte(op_land);
1978          } else {
1979            ctx.writeByte(op_iand);
1980          }
1981        }
1982      };
1983    }
1984    
1985    public ParametricCodeGenerator make_or(final ParametricType type)
1986    throws CodeException {
1987      if(type.isObject()) {
1988        throw new CodeException("Can't and non-primitive type: " + type);
1989      }
1990      return new ParametricCodeGenerator() {
1991        public ParametricType getType() { return type; }
1992        public int stackDelta() { return -1; }
1993        public int stackDepth() { return 0; }
1994        public void writeCode(CodeContext ctx) throws CodeException {
1995          CodeClass cc = ctx.resolveParametricType(type);
1996          
1997          if(!cc.isPrimitive()) {
1998            throw new CodeException("Can't or non-primitive type: " + cc);
1999          }
2000          
2001          if(CodeUtils.isFloatType(cc)) {
2002            throw new CodeException("Can't or floating point type: " + cc);
2003          }
2004          
2005          
2006          if(cc == CodeUtils.TYPE_LONG) {
2007            ctx.writeByte(op_lor);
2008          } else {
2009            ctx.writeByte(op_ior);
2010          }
2011        }
2012      };
2013    }
2014    
2015    public ParametricCodeGenerator make_xor(final ParametricType type)
2016    throws CodeException {
2017      if(type.isObject()) {
2018        throw new CodeException("Can't and non-primitive type: " + type);
2019      }
2020      return new ParametricCodeGenerator() {
2021        public ParametricType getType() { return type; }
2022        public int stackDelta() { return -1; }
2023        public int stackDepth() { return 0; }
2024        public void writeCode(CodeContext ctx) throws CodeException {
2025          CodeClass cc = ctx.resolveParametricType(type);
2026          
2027          if(!cc.isPrimitive()) {
2028            throw new CodeException("Can't xor non-primitive type: " + cc);
2029          }
2030
2031          if(CodeUtils.isFloatType(cc)) {
2032            throw new CodeException("Can't xor floating point type: " + cc);
2033          }
2034          
2035          
2036          if(cc == CodeUtils.TYPE_LONG) {
2037            ctx.writeByte(op_lxor);
2038          } else  {
2039            ctx.writeByte(op_ixor);
2040          }
2041        }
2042      };
2043    }
2044    
2045    public ParametricCodeGenerator make_cmpg(final ParametricType type)
2046    throws CodeException {
2047      if(type.isObject()) {
2048        throw new CodeException("Can't cmpg non-primitive type: " + type);
2049      }
2050      
2051      return new ParametricCodeGenerator() {
2052        public ParametricType getType() { return type; }
2053        public int stackDelta() { return -1; }
2054        public int stackDepth() { return 0; }
2055        public void writeCode(CodeContext ctx) throws CodeException {
2056          CodeClass cc = ctx.resolveParametricType(type);
2057          
2058          if(!CodeUtils.isFloatType(cc)) {
2059            throw new CodeException("Can only cmpg floating point types: " + cc);
2060          }
2061          
2062          if(cc == CodeUtils.TYPE_DOUBLE) {
2063            ctx.writeByte(op_dcmpg);
2064          } else  {
2065            ctx.writeByte(op_fcmpg);
2066          }
2067        }
2068      };
2069    }
2070    
2071    public ParametricCodeGenerator make_cmpl(final ParametricType type)
2072    throws CodeException {
2073      if(type.isObject()) {
2074        throw new CodeException("Can't cmpl non-primitive type: " + type);
2075      }
2076      
2077      return new ParametricCodeGenerator() {
2078        public ParametricType getType() { return type; }
2079        public int stackDelta() { return -1; }
2080        public int stackDepth() { return 0; }
2081        public void writeCode(CodeContext ctx) throws CodeException {
2082          CodeClass cc = ctx.resolveParametricType(type);
2083          
2084          if(!CodeUtils.isFloatType(cc)) {
2085            throw new CodeException("Can only cmpl floating point types: " + cc);
2086          }
2087          
2088          if(cc == CodeUtils.TYPE_DOUBLE) {
2089            ctx.writeByte(op_dcmpl);
2090          } else  {
2091            ctx.writeByte(op_fcmpl);
2092          }
2093        }
2094      };
2095    }
2096    
2097    public ParametricCodeGenerator make_dup(final ParametricType type)
2098    throws CodeException {
2099      return new ParametricCodeGenerator() {
2100        public ParametricType getType() { return type; }
2101        public int stackDelta() { return 1; }
2102        public int stackDepth() { return 1; }
2103        public void writeCode(CodeContext ctx) throws CodeException {
2104          CodeClass cc = ctx.resolveParametricType(type);
2105          
2106          if(CodeUtils.wordsForType(cc) == 2) {
2107            ctx.writeByte(op_dup2);
2108          } else  {
2109            ctx.writeByte(op_dup);
2110          }
2111        }
2112      };
2113    }
2114    
2115    //
2116    // Java opcodes
2117    //
2118
2119    public final static byte op_nop = 0;
2120    public final static byte op_aconst_null = 1;
2121    public final static byte op_iconst_m1 = 2;
2122    public final static byte op_iconst_0 = 3;
2123    public final static byte op_iconst_1 = 4;
2124    public final static byte op_iconst_2 = 5;
2125    public final static byte op_iconst_3 = 6;
2126    public final static byte op_iconst_4 = 7;
2127    public final static byte op_iconst_5 = 8;
2128    public final static byte op_lconst_0 = 9;
2129    public final static byte op_lconst_1 = 10;
2130    public final static byte op_fconst_0 = 11;
2131    public final static byte op_fconst_1 = 12;
2132    public final static byte op_fconst_2 = 13;
2133    public final static byte op_dconst_0 = 14;
2134    public final static byte op_dconst_1 = 15;
2135    public final static byte op_bipush = 16;
2136    public final static byte op_sipush = 17;
2137    public final static byte op_ldc = 18;
2138    public final static byte op_ldc_w = 19;
2139    public final static byte op_ldc2_w = 20;
2140    public final static byte op_iload = 21;
2141    public final static byte op_lload = 22;
2142    public final static byte op_fload = 23;
2143    public final static byte op_dload = 24;
2144    public final static byte op_aload = 25;
2145    public final static byte op_iload_0 = 26;
2146    public final static byte op_iload_1 = 27;
2147    public final static byte op_iload_2 = 28;
2148    public final static byte op_iload_3 = 29;
2149    public final static byte op_lload_0 = 30;
2150    public final static byte op_lload_1 = 31;
2151    public final static byte op_lload_2 = 32;
2152    public final static byte op_lload_3 = 33;
2153    public final static byte op_fload_0 = 34;
2154    public final static byte op_fload_1 = 35;
2155    public final static byte op_fload_2 = 36;
2156    public final static byte op_fload_3 = 37;
2157    public final static byte op_dload_0 = 38;
2158    public final static byte op_dload_1 = 39;
2159    public final static byte op_dload_2 = 40;
2160    public final static byte op_dload_3 = 41;
2161    public final static byte op_aload_0 = 42;
2162    public final static byte op_aload_1 = 43;
2163    public final static byte op_aload_2 = 44;
2164    public final static byte op_aload_3 = 45;
2165    public final static byte op_iaload = 46;
2166    public final static byte op_laload = 47;
2167    public final static byte op_faload = 48;
2168    public final static byte op_daload = 49;
2169    public final static byte op_aaload = 50;
2170    public final static byte op_baload = 51;
2171    public final static byte op_caload = 52;
2172    public final static byte op_saload = 53;
2173    public final static byte op_istore = 54;
2174    public final static byte op_lstore = 55;
2175    public final static byte op_fstore = 56;
2176    public final static byte op_dstore = 57;
2177    public final static byte op_astore = 58;
2178    public final static byte op_istore_0 = 59;
2179    public final static byte op_istore_1 = 60;
2180    public final static byte op_istore_2 = 61;
2181    public final static byte op_istore_3 = 62;
2182    public final static byte op_lstore_0 = 63;
2183    public final static byte op_lstore_1 = 64;
2184    public final static byte op_lstore_2 = 65;
2185    public final static byte op_lstore_3 = 66;
2186    public final static byte op_fstore_0 = 67;
2187    public final static byte op_fstore_1 = 68;
2188    public final static byte op_fstore_2 = 69;
2189    public final static byte op_fstore_3 = 70;
2190    public final static byte op_dstore_0 = 71;
2191    public final static byte op_dstore_1 = 72;
2192    public final static byte op_dstore_2 = 73;
2193    public final static byte op_dstore_3 = 74;
2194    public final static byte op_astore_0 = 75;
2195    public final static byte op_astore_1 = 76;
2196    public final static byte op_astore_2 = 77;
2197    public final static byte op_astore_3 = 78;
2198    public final static byte op_iastore = 79;
2199    public final static byte op_lastore = 80;
2200    public final static byte op_fastore = 81;
2201    public final static byte op_dastore = 82;
2202    public final static byte op_aastore = 83;
2203    public final static byte op_bastore = 84;
2204    public final static byte op_castore = 85;
2205    public final static byte op_sastore = 86;
2206    public final static byte op_pop = 87;
2207    public final static byte op_pop2 = 88;
2208    public final static byte op_dup = 89;
2209    public final static byte op_dup_x1 = 90;
2210    public final static byte op_dup_x2 = 91;
2211    public final static byte op_dup2 = 92;
2212    public final static byte op_dup2_x1 = 93;
2213    public final static byte op_dup2_x2 = 94;
2214    public final static byte op_swap = 95;
2215    public final static byte op_iadd = 96;
2216    public final static byte op_ladd = 97;
2217    public final static byte op_fadd = 98;
2218    public final static byte op_dadd = 99;
2219    public final static byte op_isub = 100;
2220    public final static byte op_lsub = 101;
2221    public final static byte op_fsub = 102;
2222    public final static byte op_dsub = 103;
2223    public final static byte op_imul = 104;
2224    public final static byte op_lmul = 105;
2225    public final static byte op_fmul = 106;
2226    public final static byte op_dmul = 107;
2227    public final static byte op_idiv = 108;
2228    public final static byte op_ldiv = 109;
2229    public final static byte op_fdiv = 110;
2230    public final static byte op_ddiv = 111;
2231    public final static byte op_irem = 112;
2232    public final static byte op_lrem = 113;
2233    public final static byte op_frem = 114;
2234    public final static byte op_drem = 115;
2235    public final static byte op_ineg = 116;
2236    public final static byte op_lneg = 117;
2237    public final static byte op_fneg = 118;
2238    public final static byte op_dneg = 119;
2239    public final static byte op_ishl = 120;
2240    public final static byte op_lshl = 121;
2241    public final static byte op_ishr = 122;
2242    public final static byte op_lshr = 123;
2243    public final static byte op_iushr = 124;
2244    public final static byte op_lushr = 125;
2245    public final static byte op_iand = 126;
2246    public final static byte op_land = 127;
2247    public final static byte op_ior = (byte) 128;
2248    public final static byte op_lor = (byte) 129;
2249    public final static byte op_ixor = (byte) 130;
2250    public final static byte op_lxor = (byte) 131;
2251    public final static byte op_iinc = (byte) 132;
2252    public final static byte op_i2l = (byte) 133;
2253    public final static byte op_i2f = (byte) 134;
2254    public final static byte op_i2d = (byte) 135;
2255    public final static byte op_l2i = (byte) 136;
2256    public final static byte op_l2f = (byte) 137;
2257    public final static byte op_l2d = (byte) 138;
2258    public final static byte op_f2i = (byte) 139;
2259    public final static byte op_f2l = (byte) 140;
2260    public final static byte op_f2d = (byte) 141;
2261    public final static byte op_d2i = (byte) 142;
2262    public final static byte op_d2l = (byte) 143;
2263    public final static byte op_d2f = (byte) 144;
2264    public final static byte op_i2b = (byte) 145;
2265    public final static byte op_i2c = (byte) 146;
2266    public final static byte op_i2s = (byte) 147;
2267    public final static byte op_lcmp = (byte) 148;
2268    public final static byte op_fcmpl = (byte) 149;
2269    public final static byte op_fcmpg = (byte) 150;
2270    public final static byte op_dcmpl = (byte) 151;
2271    public final static byte op_dcmpg = (byte) 152;
2272    public final static byte op_ifeq = (byte) 153;
2273    public final static byte op_ifne = (byte) 154;
2274    public final static byte op_iflt = (byte) 155;
2275    public final static byte op_ifge = (byte) 156;
2276    public final static byte op_ifgt = (byte) 157;
2277    public final static byte op_ifle = (byte) 158;
2278    public final static byte op_if_icmpeq = (byte) 159;
2279    public final static byte op_if_icmpne = (byte) 160;
2280    public final static byte op_if_icmplt = (byte) 161;
2281    public final static byte op_if_icmpge = (byte) 162;
2282    public final static byte op_if_icmpgt = (byte) 163;
2283    public final static byte op_if_icmple = (byte) 164;
2284    public final static byte op_if_acmpeq = (byte) 165;
2285    public final static byte op_if_acmpne = (byte) 166;
2286    public final static byte op_goto = (byte) 167;
2287    public final static byte op_jsr = (byte) 168;
2288    public final static byte op_ret = (byte) 169;
2289    public final static byte op_tableswitch = (byte) 170;
2290    public final static byte op_lookupswitch = (byte) 171;
2291    public final static byte op_ireturn = (byte) 172;
2292    public final static byte op_lreturn = (byte) 173;
2293    public final static byte op_freturn = (byte) 174;
2294    public final static byte op_dreturn = (byte) 175;
2295    public final static byte op_areturn = (byte) 176;
2296    public final static byte op_return = (byte) 177;
2297    public final static byte op_getstatic = (byte) 178;
2298    public final static byte op_putstatic = (byte) 179;
2299    public final static byte op_getfield = (byte) 180;
2300    public final static byte op_putfield = (byte) 181;
2301    public final static byte op_invokevirtual = (byte) 182;
2302    public final static byte op_invokespecial = (byte) 183;
2303    public final static byte op_invokestatic = (byte) 184;
2304    public final static byte op_invokeinterface = (byte) 185;
2305    public final static byte op_new = (byte) 187;
2306    public final static byte op_newarray = (byte) 188;
2307    public final static byte op_anewarray = (byte) 189;
2308    public final static byte op_arraylength = (byte) 190;
2309    public final static byte op_athrow = (byte) 191;
2310    public final static byte op_checkcast = (byte) 192;
2311    public final static byte op_instanceof = (byte) 193;
2312    public final static byte op_monitorenter = (byte) 194;
2313    public final static byte op_monitorexit = (byte) 195;
2314    public final static byte op_wide = (byte) 196;
2315    public final static byte op_multianewarray = (byte) 197;
2316    public final static byte op_ifnull = (byte) 198;
2317    public final static byte op_ifnonnull = (byte) 199;
2318    public final static byte op_goto_w = (byte) 200;
2319    public final static byte op_jsr_w = (byte) 201;
2320    public final static byte op_breakpoint = (byte) 202;
2321    public final static byte op_ldc_quick = (byte) 203;
2322    public final static byte op_ldc_w_quick = (byte) 204;
2323    public final static byte op_ldc2_w_quick = (byte) 205;
2324    public final static byte op_getfield_quick = (byte) 206;
2325    public final static byte op_putfield_quick = (byte) 207;
2326    public final static byte op_getfield2_quick = (byte) 208;
2327    public final static byte op_putfield2_quick = (byte) 209;
2328    public final static byte op_getstatic_quick = (byte) 210;
2329    public final static byte op_putstatic_quick = (byte) 211;
2330    public final static byte op_getstatic2_quick = (byte) 212;
2331    public final static byte op_putstatic2_quick = (byte) 213;
2332    public final static byte op_invokevirtual_quick = (byte) 214;
2333    public final static byte op_invokenonvirtual_quick = (byte) 215;
2334    public final static byte op_invokesuper_quick = (byte) 216;
2335    public final static byte op_invokestatic_quick = (byte) 217;
2336    public final static byte op_invokeinterface_quick = (byte) 218;
2337    public final static byte op_invokevirtualobject_quick = (byte) 219;
2338    public final static byte op_new_quick = (byte) 221;
2339    public final static byte op_anewarray_quick = (byte) 222;
2340    public final static byte op_multianewarray_quick = (byte) 223;
2341    public final static byte op_checkcast_quick = (byte) 224;
2342    public final static byte op_instanceof_quick = (byte) 225;
2343    public final static byte op_invokevirtual_quick_w = (byte) 226;
2344    public final static byte op_getfield_quick_w = (byte) 227;
2345    public final static byte op_putfield_quick_w = (byte) 228;
2346    public final static byte op_impdep1 = (byte) 254;
2347    public final static byte op_impdep2 = (byte) 255;
2348}