1
2
3
4 package joeq.Compiler.BytecodeAnalysis;
5
6 import java.util.ArrayList;
7 import java.util.Collections;
8 import java.util.Enumeration;
9 import java.util.HashMap;
10 import java.util.Iterator;
11 import java.util.LinkedList;
12 import java.util.List;
13 import java.util.ListIterator;
14 import java.util.Map;
15 import java.util.NoSuchElementException;
16 import java.util.Set;
17 import java.io.ByteArrayOutputStream;
18 import java.io.DataOutputStream;
19 import java.io.IOException;
20 import java.io.Serializable;
21 import joeq.Class.PrimordialClassLoader;
22 import joeq.Class.jq_Array;
23 import joeq.Class.jq_Class;
24 import joeq.Class.jq_ClassFileConstants;
25 import joeq.Class.jq_ConstantPool;
26 import joeq.Class.jq_Field;
27 import joeq.Class.jq_InstanceField;
28 import joeq.Class.jq_InstanceMethod;
29 import joeq.Class.jq_LineNumberBC;
30 import joeq.Class.jq_Member;
31 import joeq.Class.jq_MemberReference;
32 import joeq.Class.jq_Method;
33 import joeq.Class.jq_NameAndDesc;
34 import joeq.Class.jq_Primitive;
35 import joeq.Class.jq_Reference;
36 import joeq.Class.jq_StaticField;
37 import joeq.Class.jq_TryCatchBC;
38 import joeq.Class.jq_Type;
39 import joeq.Runtime.Reflection;
40 import joeq.UTF.Utf8;
41 import jwutil.collections.LinearSet;
42 import jwutil.io.ByteSequence;
43 import jwutil.strings.Strings;
44 import jwutil.util.Assert;
45
46
47
48
49
50 public interface Bytecodes {
51
52 abstract class Instruction implements Cloneable, Serializable {
53 protected short length = 1;
54 protected short opcode = -1;
55
56 /***
57 * Empty constructor needed for the Class.newInstance() statement in
58 * Instruction.readInstruction(). Not to be used otherwise.
59 */
60 Instruction() {}
61
62 public Instruction(short opcode, short length) {
63 this.length = length;
64 this.opcode = opcode;
65 }
66
67 /***
68 * Dump instruction as byte code to stream out.
69 * @param out Output stream
70 */
71 public void dump(DataOutputStream out) throws IOException {
72 out.writeByte(opcode);
73 }
74
75 /***
76 * Long output format:
77 *
78 * <name of opcode> "["<opcode number>"]"
79 * "("<length of instruction>")"
80 *
81 * @param verbose long/short format switch
82 * @return mnemonic for instruction
83 */
84 public String toString(boolean verbose) {
85 if(verbose)
86 return jq_ClassFileConstants.OPCODE_NAMES[opcode] + "[" + opcode + "](" + length + ")";
87 else
88 return jq_ClassFileConstants.OPCODE_NAMES[opcode];
89 }
90
91 /***
92 * @return mnemonic for instruction in verbose format
93 */
94 public String toString() {
95 return toString(true);
96 }
97
98 /***
99 * Use with caution, since `BranchInstruction's have a `target' reference which
100 * is not copied correctly (only basic types are). This also applies for
101 * `Select' instructions with their multiple branch targets.
102 *
103 * @see joeq.Compiler.BytecodeAnalysis.Bytecodes.BranchInstruction
104 * @return (shallow) copy of an instruction
105 */
106 public Instruction copy() {
107 Instruction i = null;
108
109
110 if(InstructionConstants.INSTRUCTIONS[this.getOpcode()] != null)
111 i = this;
112 else {
113 try {
114 i = (Instruction)clone();
115 } catch(CloneNotSupportedException e) {
116 System.err.println(e);
117 }
118 }
119
120 return i;
121 }
122
123 /***
124 * Read needed data (e.g. index) from file.
125 *
126 * @param cp constant pool of class we are reading
127 * @param bytes byte sequence to read from
128 * @param wide "wide" instruction flag
129 */
130 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {}
131
132 /***
133 * Read an instruction from (byte code) input stream and return the
134 * appropiate object.
135 *
136 * @param cp constant pool of class we are reading from
137 * @param bytes sequence of bytes to read
138 * @return instruction object being read
139 */
140 public static final Instruction readInstruction(jq_ConstantPool cp, ByteSequence bytes) throws IOException {
141 boolean wide = false;
142 short opcode = (short)bytes.readUnsignedByte();
143 Instruction obj = null;
144
145 if(opcode == jq_ClassFileConstants.jbc_WIDE) {
146 wide = true;
147 opcode = (short)bytes.readUnsignedByte();
148 }
149
150 if(InstructionConstants.INSTRUCTIONS[opcode] != null)
151 return InstructionConstants.INSTRUCTIONS[opcode];
152
153
154
155
156 Class clazz;
157 try {
158 clazz = Class.forName(className(opcode));
159 }
160 catch (ClassNotFoundException cnfe){
161
162
163 throw new BytecodeException("Illegal opcode detected.");
164 }
165 try {
166 obj = (Instruction)clazz.newInstance();
167
168 if(wide && !((obj instanceof LocalVariableInstruction) || (obj instanceof IINC) ||
169 (obj instanceof RET)))
170 throw new Exception("Illegal opcode after wide: " + opcode);
171
172 obj.setOpcode(opcode);
173 obj.initFromFile(cp, bytes, wide);
174
175 } catch(Exception e) {
176 e.printStackTrace();
177 throw new BytecodeException("Error loading "+clazz+"="+obj+": "+e.toString());
178 }
179
180 return obj;
181 }
182
183 private static final String className(short opcode) {
184 String name = jq_ClassFileConstants.OPCODE_NAMES[opcode].toUpperCase();
185
186
187
188
189 try {
190 int len = name.length();
191 char ch1 = name.charAt(len - 2), ch2 = name.charAt(len - 1);
192
193 if((ch1 == '_') && (ch2 >= '0') && (ch2 <= '5'))
194 name = name.substring(0, len - 2);
195
196 if(name.equals("ICONST_M1"))
197 name = "ICONST";
198 } catch(StringIndexOutOfBoundsException e) { System.err.println(e); }
199
200 return "joeq.Compiler.BytecodeAnalysis.Bytecodes$" + name;
201 }
202
203 /***
204 * @return Number of words consumed from stack by this instruction
205 */
206 public int consumeStack() { return jq_ClassFileConstants.CONSUME_STACK[opcode]; }
207
208 /***
209 * @return Number of words produced onto stack by this instruction
210 */
211 public int produceStack() { return jq_ClassFileConstants.PRODUCE_STACK[opcode]; }
212
213 /***
214 * @return this instructions opcode
215 */
216 public short getOpcode() { return opcode; }
217
218 /***
219 * @return length (in bytes) of instruction
220 */
221 public int getLength() { return length; }
222
223 /***
224 * Needed in readInstruction.
225 */
226 private void setOpcode(short opcode) { this.opcode = opcode; }
227
228 /*** Some instructions may be reused, so don't do anything by default.
229 */
230 void dispose() { }
231
232 /***
233 * Call corresponding visitor method(s). The order is:
234 * Call visitor methods of implemented interfaces first, then
235 * call methods according to the class hierarchy in descending order,
236 * i.e., the most specific visitXXX() call comes last.
237 *
238 * @param v Visitor object
239 */
240 public abstract void accept(Visitor v);
241 }
242
243 class InstructionHandle implements Serializable {
244 /***
245 * Version ID for serialization.
246 */
247 private static final long serialVersionUID = 3904965256957670706L;
248
249 InstructionHandle next, prev;
250 Instruction instruction;
251 protected int i_position = -1;
252 private Set targeters;
253 private Map attributes;
254
255 public final InstructionHandle getNext() { return next; }
256 public final InstructionHandle getPrev() { return prev; }
257 public final Instruction getInstruction() { return instruction; }
258
259 /***
260 * Replace current instruction contained in this handle.
261 * Old instruction is disposed using Instruction.dispose().
262 */
263 public void setInstruction(Instruction i) {
264 if(i == null)
265 throw new BytecodeException("Assigning null to handle");
266
267
268
269 if ((!(this instanceof BranchHandle)) && (i instanceof BranchInstruction))
270 throw new BytecodeException("Assigning branch instruction " + i + " to plain handle");
271
272 if(instruction != null)
273 instruction.dispose();
274
275 instruction = i;
276 }
277
278 /***
279 * Temporarily swap the current instruction, without disturbing
280 * anything. Meant to be used by a debugger, implementing
281 * breakpoints. Current instruction is returned.
282 */
283 public Instruction swapInstruction(Instruction i) {
284 Instruction oldInstruction = instruction;
285 instruction = i;
286 return oldInstruction;
287 }
288
289
290 setInstruction(i);
291 }
292
293 private static InstructionHandle ih_list = null;
294
295 /*** Factory method.
296 */
297 static final InstructionHandle getInstructionHandle(Instruction i) {
298 if(ih_list == null)
299 return new InstructionHandle(i);
300 else {
301 InstructionHandle ih = ih_list;
302 ih_list = ih.next;
303
304 ih.setInstruction(i);
305
306 return ih;
307 }
308 }
309
310 /***
311 * Called by InstructionList.setPositions when setting the position for every
312 * instruction. In the presence of variable length instructions `setPositions()'
313 * performs multiple passes over the instruction list to calculate the
314 * correct (byte) positions and offsets by calling this function.
315 *
316 * @param offset additional offset caused by preceding (variable length) instructions
317 * @param max_offset the maximum offset that may be caused by these instructions
318 * @return additional offset caused by possible change of this instruction's length
319 */
320 protected int updatePosition(int offset, int max_offset) {
321 i_position += offset;
322 return 0;
323 }
324
325 /*** @return the position, i.e., the byte code offset of the contained
326 * instruction. This is accurate only after
327 * InstructionList.setPositions() has been called.
328 */
329 public int getPosition() { return i_position; }
330
331 /*** Set the position, i.e., the byte code offset of the contained
332 * instruction.
333 */
334 void setPosition(int pos) { i_position = pos; }
335
336 /*** Overridden in BranchHandle
337 */
338 protected void addHandle() {
339 next = ih_list;
340 ih_list = this;
341 }
342
343 /***
344 * Delete contents, i.e., remove user access and make handle reusable.
345 */
346 void dispose() {
347 next = prev = null;
348 instruction.dispose();
349 instruction = null;
350 i_position = -1;
351 attributes = null;
352 removeAllTargeters();
353 addHandle();
354 }
355
356 /*** Remove all targeters, if any.
357 */
358 public void removeAllTargeters() {
359 if(targeters != null)
360 targeters.clear();
361 }
362
363 /***
364 * Denote this handle isn't referenced anymore by t.
365 */
366 public void removeTargeter(InstructionTargeter t) {
367 targeters.remove(t);
368 }
369
370 /***
371 * Denote this handle is being referenced by t.
372 */
373 public void addTargeter(InstructionTargeter t) {
374 if(targeters == null)
375 targeters = new LinearSet();
376
377 targeters.add(t);
378 }
379
380 public boolean hasTargeters() {
381 return (targeters != null) && (targeters.size() > 0);
382 }
383
384 /***
385 * @return null, if there are no targeters
386 */
387 public Set
388 if(!hasTargeters())
389 return null;
390 return Collections.unmodifiableSet(targeters);
391 }
392
393 /*** @return a (verbose) string representation of the contained instruction.
394 */
395 public String toString(boolean verbose) {
396 return Strings.format(i_position, 4, false, ' ') + ": " + instruction.toString(verbose);
397 }
398
399 /*** @return a string representation of the contained instruction.
400 */
401 public String toString() {
402 return toString(true);
403 }
404
405 /*** Add an attribute to an instruction handle.
406 *
407 * @param key the key object to store/retrieve the attribute
408 * @param attr the attribute to associate with this handle
409 */
410 public void addAttribute(Object key, Object attr) {
411 if(attributes == null)
412 attributes = new HashMap(3);
413
414 attributes.put(key, attr);
415 }
416
417 /*** Delete an attribute of an instruction handle.
418 *
419 * @param key the key object to retrieve the attribute
420 */
421 public void removeAttribute(Object key) {
422 if(attributes != null)
423 attributes.remove(key);
424 }
425
426 /*** Get attribute of an instruction handle.
427 *
428 * @param key the key object to store/retrieve the attribute
429 */
430 public Object getAttribute(Object key) {
431 if(attributes != null)
432 return attributes.get(key);
433
434 return null;
435 }
436
437 /*** Convenience method, simply calls accept() on the contained instruction.
438 *
439 * @param v Visitor object
440 */
441 public void accept(Visitor v) {
442 instruction.accept(v);
443 }
444 }
445
446 final class BranchHandle extends InstructionHandle {
447 /***
448 * Version ID for serialization.
449 */
450 private static final long serialVersionUID = 3834870291158283317L;
451
452 private BranchInstruction bi;
453
454 private BranchHandle(BranchInstruction i) {
455 super(i);
456 bi = i;
457 }
458
459 /*** Factory methods.
460 */
461 private static BranchHandle bh_list = null;
462
463 static final BranchHandle getBranchHandle(BranchInstruction i) {
464 if(bh_list == null)
465 return new BranchHandle(i);
466 else {
467 BranchHandle bh = bh_list;
468 bh_list = (BranchHandle)bh.next;
469
470 bh.setInstruction(i);
471
472 return bh;
473 }
474 }
475
476 /*** Handle adds itself to the list of resuable handles.
477 */
478 protected void addHandle() {
479 next = bh_list;
480 bh_list = this;
481 }
482
483
484
485
486
487 public int getPosition() { return bi.position; }
488
489 void setPosition(int pos) {
490 i_position = bi.position = pos;
491 }
492
493 protected int updatePosition(int offset, int max_offset) {
494 int x = bi.updatePosition(offset, max_offset);
495 i_position = bi.position;
496 return x;
497 }
498
499 /***
500 * Pass new target to instruction.
501 */
502 public void setTarget(InstructionHandle ih) {
503 bi.setTarget(ih);
504 }
505
506 /***
507 * Update target of instruction.
508 */
509 public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
510 bi.updateTarget(old_ih, new_ih);
511 }
512
513 /***
514 * @return target of instruction.
515 */
516 public InstructionHandle getTarget() {
517 return bi.getTarget();
518 }
519
520 /***
521 * Set new contents. Old instruction is disposed and may not be used anymore.
522 */
523 public void setInstruction(Instruction i) {
524 super.setInstruction(i);
525
526 if(!(i instanceof BranchInstruction))
527 throw new BytecodeException("Assigning " + i + " to branch handle which is not a branch instruction");
528
529 bi = (BranchInstruction)i;
530 }
531 }
532
533 class InstructionList implements Serializable {
534 /***
535 * Version ID for serialization.
536 */
537 private static final long serialVersionUID = 3832624001687433272L;
538
539 private InstructionHandle start = null, end = null;
540 private int length = 0;
541 private int[] byte_positions;
542
543 /***
544 * Create (empty) instruction list.
545 */
546 public InstructionList() {}
547
548 /***
549 * Create instruction list containing one instruction.
550 * @param i initial instruction
551 */
552 public InstructionList(Instruction i) {
553 append(i);
554 }
555
556 /***
557 * Create instruction list containing one instruction.
558 * @param i initial instruction
559 */
560 public InstructionList(BranchInstruction i) {
561 append(i);
562 }
563
564 /***
565 * Initialize list with (nonnull) compound instruction. Consumes argument
566 * list, i.e., it becomes empty.
567 *
568 * @param c compound instruction (list)
569 */
570 public InstructionList(CompoundInstruction c) {
571 append(c.getInstructionList());
572 }
573
574 /***
575 * Test for empty list.
576 */
577 public boolean isEmpty() { return start == null; }
578
579 /***
580 * Find the target instruction (handle) that corresponds to the given target
581 * position (byte code offset).
582 *
583 * @param ihs array of instruction handles, i.e. il.getInstructionHandles()
584 * @param pos array of positions corresponding to ihs, i.e. il.getInstructionPositions()
585 * @param target target position to search for
586 * @return target position's instruction handle if available
587 */
588 public static InstructionHandle findHandle(List
589 int l=0, r = pos.length-1;
590
591
592
593 do {
594 int i = (l + r) / 2;
595 int j = pos[i];
596
597
598 while (j == -1 && i >= l && i > 0) {
599 j = pos[--i];
600 }
601 if (i < l) {
602 i = (l + r) / 2;
603 j = pos[i];
604 while (j == -1 && i <= r && i < pos.length) {
605 j = pos[++i];
606 }
607 if (i > r) return null;
608 }
609
610
611 if (j == target)
612 return (InstructionHandle)ihs.get(i);
613 else if (target < j)
614 r = i - 1;
615 else
616 l = i + 1;
617 } while (l <= r);
618
619 return null;
620 }
621
622 /***
623 * Get instruction handle for instruction at byte code position pos.
624 * This only works properly, if the list is freshly initialized from a byte array or
625 * setPositions() has been called before this method.
626 *
627 * @param pos byte code position to search for
628 * @return target position's instruction handle if available
629 */
630 public InstructionHandle findHandle(int pos) {
631 List
632 return findHandle(ihs, byte_positions, pos);
633 }
634
635 public InstructionList(jq_Method m) {
636 this(m.getDeclaringClass().getCP(), m.getBytecode());
637 }
638
639 /***
640 * Initialize instruction list from byte array.
641 *
642 * @param code byte array containing the instructions
643 */
644 public InstructionList(jq_ConstantPool cp, byte[] code) {
645 ByteSequence bytes = new ByteSequence(code);
646 ArrayList
647 int[] pos = new int[code.length];
648 int count = 0;
649
650
651
652
653 try {
654 while(bytes.available() > 0) {
655
656 int off = bytes.getIndex();
657 pos[count] = off;
658
659
660
661
662 Instruction i = Instruction.readInstruction(cp, bytes);
663 InstructionHandle ih;
664 if(i instanceof BranchInstruction)
665 ih = append((BranchInstruction)i);
666 else
667 ih = append(i);
668
669 ih.setPosition(off);
670 ihs.add(ih);
671
672
673 count++;
674 }
675 } catch(IOException e) { throw new BytecodeException(e.toString()); }
676
677 byte_positions = new int[count];
678 System.arraycopy(pos, 0, byte_positions, 0, count);
679
680
681
682
683 for(int i=0; i < count; i++) {
684 if(ihs.get(i) instanceof BranchHandle) {
685 BranchInstruction bi = (BranchInstruction)((BranchHandle)ihs.get(i)).instruction;
686 int target = bi.position + bi.getIndex();
687
688
689 InstructionHandle ih = findHandle(ihs, byte_positions, target);
690
691 if(ih == null)
692 throw new BytecodeException("Couldn't find target "+target+" for branch: " + bi);
693
694 bi.setTarget(ih);
695
696
697 if(bi instanceof Select) {
698 Select s = (Select)bi;
699 int[] indices = s.getIndices();
700
701 for(int j=0; j < indices.length; j++) {
702 target = bi.position + indices[j];
703 ih = findHandle(ihs, byte_positions, target);
704
705 if(ih == null)
706 throw new BytecodeException("Couldn't find target "+target+" for switch: " + bi);
707
708 s.setTarget(j, ih);
709 }
710 }
711 }
712 }
713 }
714
715 /***
716 * Append another list after instruction (handle) ih contained in this list.
717 * Consumes argument list, i.e., it becomes empty.
718 *
719 * @param ih where to append the instruction list
720 * @param il Instruction list to append to this one
721 * @return instruction handle pointing to the <B>first</B> appended instruction
722 */
723 public InstructionHandle append(InstructionHandle ih, InstructionList il) {
724 if(il == null)
725 throw new BytecodeException("Appending null InstructionList");
726
727 if(il.isEmpty())
728 return ih;
729
730 InstructionHandle next = ih.next, ret = il.start;
731
732 ih.next = il.start;
733 il.start.prev = ih;
734
735 il.end.next = next;
736
737 if(next != null)
738 next.prev = il.end;
739 else
740 end = il.end;
741
742 length += il.length;
743
744 il.clear();
745
746 return ret;
747 }
748
749 /***
750 * Append another list after instruction i contained in this list.
751 * Consumes argument list, i.e., it becomes empty.
752 *
753 * @param i where to append the instruction list
754 * @param il Instruction list to append to this one
755 * @return instruction handle pointing to the <B>first</B> appended instruction
756 */
757 public InstructionHandle append(Instruction i, InstructionList il) {
758 InstructionHandle ih;
759
760 if((ih = findInstruction2(i)) == null)
761 throw new BytecodeException("Instruction " + i + " is not contained in this list.");
762
763 return append(ih, il);
764 }
765
766 /***
767 * Append another list to this one.
768 * Consumes argument list, i.e., it becomes empty.
769 *
770 * @param il list to append to end of this list
771 * @return instruction handle of the <B>first</B> appended instruction
772 */
773 public InstructionHandle append(InstructionList il) {
774 if(il == null)
775 throw new BytecodeException("Appending null InstructionList");
776
777 if(il.isEmpty())
778 return null;
779
780 if(isEmpty()) {
781 start = il.start;
782 end = il.end;
783 length = il.length;
784
785 il.clear();
786
787 return start;
788 } else
789 return append(end, il);
790 }
791
792 /***
793 * Append an instruction to the end of this list.
794 *
795 * @param ih instruction to append
796 */
797 private void append(InstructionHandle ih) {
798 if(isEmpty()) {
799 start = end = ih;
800 ih.next = ih.prev = null;
801 }
802 else {
803 end.next = ih;
804 ih.prev = end;
805 ih.next = null;
806 end = ih;
807 }
808
809 length++;
810 }
811
812 /***
813 * Append an instruction to the end of this list.
814 *
815 * @param i instruction to append
816 * @return instruction handle of the appended instruction
817 */
818 public InstructionHandle append(Instruction i) {
819 InstructionHandle ih = InstructionHandle.getInstructionHandle(i);
820 append(ih);
821
822 return ih;
823 }
824
825 /***
826 * Append a branch instruction to the end of this list.
827 *
828 * @param i branch instruction to append
829 * @return branch instruction handle of the appended instruction
830 */
831 public BranchHandle append(BranchInstruction i) {
832 BranchHandle ih = BranchHandle.getBranchHandle(i);
833 append(ih);
834
835 return ih;
836 }
837
838 /***
839 * Append a single instruction j after another instruction i, which
840 * must be in this list of course!
841 *
842 * @param i Instruction in list
843 * @param j Instruction to append after i in list
844 * @return instruction handle of the first appended instruction
845 */
846 public InstructionHandle append(Instruction i, Instruction j) {
847 return append(i, new InstructionList(j));
848 }
849
850 /***
851 * Append a compound instruction, after instruction i.
852 *
853 * @param i Instruction in list
854 * @param c The composite instruction (containing an InstructionList)
855 * @return instruction handle of the first appended instruction
856 */
857 public InstructionHandle append(Instruction i, CompoundInstruction c) {
858 return append(i, c.getInstructionList());
859 }
860
861 /***
862 * Append a compound instruction.
863 *
864 * @param c The composite instruction (containing an InstructionList)
865 * @return instruction handle of the first appended instruction
866 */
867 public InstructionHandle append(CompoundInstruction c) {
868 return append(c.getInstructionList());
869 }
870
871 /***
872 * Append a compound instruction.
873 *
874 * @param ih where to append the instruction list
875 * @param c The composite instruction (containing an InstructionList)
876 * @return instruction handle of the first appended instruction
877 */
878 public InstructionHandle append(InstructionHandle ih, CompoundInstruction c) {
879 return append(ih, c.getInstructionList());
880 }
881
882 /***
883 * Append an instruction after instruction (handle) ih contained in this list.
884 *
885 * @param ih where to append the instruction list
886 * @param i Instruction to append
887 * @return instruction handle pointing to the <B>first</B> appended instruction
888 */
889 public InstructionHandle append(InstructionHandle ih, Instruction i) {
890 return append(ih, new InstructionList(i));
891 }
892
893 /***
894 * Append an instruction after instruction (handle) ih contained in this list.
895 *
896 * @param ih where to append the instruction list
897 * @param i Instruction to append
898 * @return instruction handle pointing to the <B>first</B> appended instruction
899 */
900 public BranchHandle append(InstructionHandle ih, BranchInstruction i) {
901 BranchHandle bh = BranchHandle.getBranchHandle(i);
902 InstructionList il = new InstructionList();
903 il.append(bh);
904
905 append(ih, il);
906
907 return bh;
908 }
909
910 /***
911 * Insert another list before Instruction handle ih contained in this list.
912 * Consumes argument list, i.e., it becomes empty.
913 *
914 * @param ih where to append the instruction list
915 * @param il instruction list to insert
916 * @return instruction handle of the first inserted instruction
917 */
918 public InstructionHandle insert(InstructionHandle ih, InstructionList il) {
919 if(il == null)
920 throw new BytecodeException("Inserting null InstructionList");
921
922 if(il.isEmpty())
923 return ih;
924
925 InstructionHandle prev = ih.prev, ret = il.start;
926
927 ih.prev = il.end;
928 il.end.next = ih;
929
930 il.start.prev = prev;
931
932 if(prev != null)
933 prev.next = il.start;
934 else
935 start = il.start;
936
937 length += il.length;
938
939 il.clear();
940
941 return ret;
942 }
943
944 /***
945 * Insert another list.
946 *
947 * @param il list to insert before start of this list
948 * @return instruction handle of the first inserted instruction
949 */
950 public InstructionHandle insert(InstructionList il) {
951 if(isEmpty()) {
952 append(il);
953 return start;
954 }
955 else
956 return insert(start, il);
957 }
958
959 /***
960 * Insert an instruction at start of this list.
961 *
962 * @param ih instruction to insert
963 */
964 private void insert(InstructionHandle ih) {
965 if(isEmpty()) {
966 start = end = ih;
967 ih.next = ih.prev = null;
968 } else {
969 start.prev = ih;
970 ih.next = start;
971 ih.prev = null;
972 start = ih;
973 }
974
975 length++;
976 }
977
978 /***
979 * Insert another list before Instruction i contained in this list.
980 * Consumes argument list, i.e., it becomes empty.
981 *
982 * @param i where to append the instruction list
983 * @param il Instruction list to insert
984 * @return instruction handle pointing to the first inserted instruction,
985 * i.e., il.getStart()
986 */
987 public InstructionHandle insert(Instruction i, InstructionList il) {
988 InstructionHandle ih;
989
990 if((ih = findInstruction1(i)) == null)
991 throw new BytecodeException("Instruction " + i + " is not contained in this list.");
992
993 return insert(ih, il);
994 }
995
996 /***
997 * Insert an instruction at start of this list.
998 *
999 * @param i instruction to insert
1000 * @return instruction handle of the inserted instruction
1001 */
1002 public InstructionHandle insert(Instruction i) {
1003 InstructionHandle ih = InstructionHandle.getInstructionHandle(i);
1004 insert(ih);
1005
1006 return ih;
1007 }
1008
1009 /***
1010 * Insert a branch instruction at start of this list.
1011 *
1012 * @param i branch instruction to insert
1013 * @return branch instruction handle of the appended instruction
1014 */
1015 public BranchHandle insert(BranchInstruction i) {
1016 BranchHandle ih = BranchHandle.getBranchHandle(i);
1017 insert(ih);
1018 return ih;
1019 }
1020
1021 /***
1022 * Insert a single instruction j before another instruction i, which
1023 * must be in this list of course!
1024 *
1025 * @param i Instruction in list
1026 * @param j Instruction to insert before i in list
1027 * @return instruction handle of the first inserted instruction
1028 */
1029 public InstructionHandle insert(Instruction i, Instruction j) {
1030 return insert(i, new InstructionList(j));
1031 }
1032
1033 /***
1034 * Insert a compound instruction before instruction i.
1035 *
1036 * @param i Instruction in list
1037 * @param c The composite instruction (containing an InstructionList)
1038 * @return instruction handle of the first inserted instruction
1039 */
1040 public InstructionHandle insert(Instruction i, CompoundInstruction c) {
1041 return insert(i, c.getInstructionList());
1042 }
1043
1044 /***
1045 * Insert a compound instruction.
1046 *
1047 * @param c The composite instruction (containing an InstructionList)
1048 * @return instruction handle of the first inserted instruction
1049 */
1050 public InstructionHandle insert(CompoundInstruction c) {
1051 return insert(c.getInstructionList());
1052 }
1053
1054 /***
1055 * Insert an instruction before instruction (handle) ih contained in this list.
1056 *
1057 * @param ih where to insert to the instruction list
1058 * @param i Instruction to insert
1059 * @return instruction handle of the first inserted instruction
1060 */
1061 public InstructionHandle insert(InstructionHandle ih, Instruction i) {
1062 return insert(ih, new InstructionList(i));
1063 }
1064
1065 /***
1066 * Insert a compound instruction.
1067 *
1068 * @param ih where to insert the instruction list
1069 * @param c The composite instruction (containing an InstructionList)
1070 * @return instruction handle of the first inserted instruction
1071 */
1072 public InstructionHandle insert(InstructionHandle ih, CompoundInstruction c) {
1073 return insert(ih, c.getInstructionList());
1074 }
1075
1076 /***
1077 * Insert an instruction before instruction (handle) ih contained in this list.
1078 *
1079 * @param ih where to insert to the instruction list
1080 * @param i Instruction to insert
1081 * @return instruction handle of the first inserted instruction
1082 */
1083 public BranchHandle insert(InstructionHandle ih, BranchInstruction i) {
1084 BranchHandle bh = BranchHandle.getBranchHandle(i);
1085 InstructionList il = new InstructionList();
1086 il.append(bh);
1087
1088 insert(ih, il);
1089
1090 return bh;
1091 }
1092
1093 /***
1094 * Take all instructions (handles) from "start" to "end" and append them after the
1095 * new location "target". Of course, "end" must be after "start" and target must
1096 * not be located withing this range. If you want to move something to the start of
1097 * the list use null as value for target.<br>
1098 * Any instruction targeters pointing to handles within the block, keep their targets.
1099 *
1100 * @param start of moved block
1101 * @param end of moved block
1102 * @param target of moved block
1103 */
1104 public void move(InstructionHandle start, InstructionHandle end, InstructionHandle target) {
1105
1106
1107 if((start == null) || (end == null))
1108 throw new BytecodeException("Invalid null handle: From " + start + " to " + end);
1109
1110 if((target == start) || (target == end))
1111 throw new BytecodeException("Invalid range: From " + start + " to " + end +
1112 " contains target " + target);
1113
1114 for(InstructionHandle ih = start; ih != end.next; ih = ih.next) {
1115 if(ih == null)
1116 throw new BytecodeException("Invalid range: From " + start + " to " + end);
1117 else if(ih == target)
1118 throw new BytecodeException("Invalid range: From " + start + " to " + end +
1119 " contains target " + target);
1120 }
1121
1122
1123
1124 InstructionHandle prev = start.prev, next = end.next;
1125
1126 if(prev != null)
1127 prev.next = next;
1128 else
1129 this.start = next;
1130
1131 if(next != null)
1132 next.prev = prev;
1133 else
1134 this.end = prev;
1135
1136 start.prev = end.next = null;
1137
1138
1139
1140 if(target == null) {
1141 end.next = this.start;
1142 this.start = start;
1143 } else {
1144 next = target.next;
1145
1146 target.next = start;
1147 start.prev = target;
1148 end.next = next;
1149
1150 if(next != null)
1151 next.prev = end;
1152 }
1153 }
1154
1155 /***
1156 * Move a single instruction (handle) to a new location.
1157 *
1158 * @param ih moved instruction
1159 * @param target new location of moved instruction
1160 */
1161 public void move(InstructionHandle ih, InstructionHandle target) {
1162 move(ih, ih, target);
1163 }
1164
1165 /***
1166 * Remove from instruction `prev' to instruction `next' both contained
1167 * in this list. Throws TargetLostException when one of the removed instruction handles
1168 * is still being targeted.
1169 *
1170 * @param prev where to start deleting (predecessor, exclusive)
1171 * @param next where to end deleting (successor, exclusive)
1172 */
1173 private void remove(InstructionHandle prev, InstructionHandle next) throws TargetLostException {
1174 InstructionHandle first, last;
1175
1176 if((prev == null) && (next == null)) {
1177 first = last = start;
1178 start = end = null;
1179 } else {
1180 if(prev == null) {
1181 first = start;
1182 start = next;
1183 } else {
1184 first = prev.next;
1185 prev.next = next;
1186 }
1187
1188 if(next == null) {
1189 last = end;
1190 end = prev;
1191 } else {
1192 last = next.prev;
1193 next.prev = prev;
1194 }
1195 }
1196
1197 first.prev = null;
1198 last.next = null;
1199
1200 List target_vec = new LinkedList();
1201
1202 for(InstructionHandle ih=first; ih != null; ih = ih.next)
1203 ih.getInstruction().dispose();
1204
1205 StringBuffer buf = new StringBuffer("{ ");
1206 for(InstructionHandle ih=first; ih != null; ih = next) {
1207 next = ih.next;
1208 length--;
1209
1210 if(ih.hasTargeters()) {
1211 target_vec.add(ih);
1212 buf.append(ih.toString(true) + " ");
1213 ih.next = ih.prev = null;
1214 } else
1215 ih.dispose();
1216 }
1217
1218 buf.append("}");
1219
1220 if(!target_vec.isEmpty()) {
1221 throw new TargetLostException(target_vec, buf.toString());
1222 }
1223 }
1224
1225 /***
1226 * Remove instruction from this list. The corresponding Instruction
1227 * handles must not be reused!
1228 *
1229 * @param ih instruction (handle) to remove
1230 */
1231 public void delete(InstructionHandle ih) throws TargetLostException {
1232 remove(ih.prev, ih.next);
1233 }
1234
1235 /***
1236 * Remove instruction from this list. The corresponding Instruction
1237 * handles must not be reused!
1238 *
1239 * @param i instruction to remove
1240 */
1241 public void delete(Instruction i) throws TargetLostException {
1242 InstructionHandle ih;
1243
1244 if((ih = findInstruction1(i)) == null)
1245 throw new BytecodeException("Instruction " + i +
1246 " is not contained in this list.");
1247 delete(ih);
1248 }
1249
1250 /***
1251 * Remove instructions from instruction `from' to instruction `to' contained
1252 * in this list. The user must ensure that `from' is an instruction before
1253 * `to', or risk havoc. The corresponding Instruction handles must not be reused!
1254 *
1255 * @param from where to start deleting (inclusive)
1256 * @param to where to end deleting (inclusive)
1257 */
1258 public void delete(InstructionHandle from, InstructionHandle to) throws TargetLostException {
1259 remove(from.prev, to.next);
1260 }
1261
1262 /***
1263 * Remove instructions from instruction `from' to instruction `to' contained
1264 * in this list. The user must ensure that `from' is an instruction before
1265 * `to', or risk havoc. The corresponding Instruction handles must not be reused!
1266 *
1267 * @param from where to start deleting (inclusive)
1268 * @param to where to end deleting (inclusive)
1269 */
1270 public void delete(Instruction from, Instruction to) throws TargetLostException {
1271 InstructionHandle from_ih, to_ih;
1272
1273 if((from_ih = findInstruction1(from)) == null)
1274 throw new BytecodeException("Instruction " + from +
1275 " is not contained in this list.");
1276
1277 if((to_ih = findInstruction2(to)) == null)
1278 throw new BytecodeException("Instruction " + to +
1279 " is not contained in this list.");
1280 delete(from_ih, to_ih);
1281 }
1282
1283 /***
1284 * Search for given Instruction reference, start at beginning of list.
1285 *
1286 * @param i instruction to search for
1287 * @return instruction found on success, null otherwise
1288 */
1289 private InstructionHandle findInstruction1(Instruction i) {
1290 for(InstructionHandle ih=start; ih != null; ih = ih.next)
1291 if(ih.instruction == i)
1292 return ih;
1293
1294 return null;
1295 }
1296
1297 /***
1298 * Search for given Instruction reference, start at end of list
1299 *
1300 * @param i instruction to search for
1301 * @return instruction found on success, null otherwise
1302 */
1303 private InstructionHandle findInstruction2(Instruction i) {
1304 for(InstructionHandle ih=end; ih != null; ih = ih.prev)
1305 if(ih.instruction == i)
1306 return ih;
1307
1308 return null;
1309 }
1310
1311 public boolean contains(InstructionHandle i) {
1312 if(i == null)
1313 return false;
1314
1315 for(InstructionHandle ih=start; ih != null; ih = ih.next)
1316 if(ih == i)
1317 return true;
1318
1319 return false;
1320 }
1321
1322 public boolean contains(Instruction i) {
1323 return findInstruction1(i) != null;
1324 }
1325
1326 public void setPositions() {
1327 setPositions(false);
1328 }
1329
1330 /***
1331 * Give all instructions their position number (offset in byte stream), i.e.,
1332 * make the list ready to be dumped.
1333 *
1334 * @param check Perform sanity checks, e.g. if all targeted instructions really belong
1335 * to this list
1336 */
1337 public void setPositions(boolean check) {
1338 int max_additional_bytes = 0, additional_bytes = 0;
1339 int index = 0, count = 0;
1340 int[] pos = new int[length];
1341
1342
1343
1344 if(check) {
1345 for(InstructionHandle ih=start; ih != null; ih = ih.next) {
1346 Instruction i = ih.instruction;
1347
1348 if(i instanceof BranchInstruction) {
1349 Instruction inst = ((BranchInstruction)i).getTarget().instruction;
1350 if(!contains(inst))
1351 throw new BytecodeException("Branch target of " +
1352 jq_ClassFileConstants.OPCODE_NAMES[i.opcode] + ":" +
1353 inst + " not in instruction list");
1354
1355 if(i instanceof Select) {
1356 List
1357
1358 for(Iterator j=targets.iterator(); j.hasNext(); ) {
1359 inst = (Instruction)j.next();
1360 if(!contains(inst))
1361 throw new BytecodeException("Branch target of " +
1362 jq_ClassFileConstants.OPCODE_NAMES[i.opcode] + ":" +
1363 inst + " not in instruction list");
1364 }
1365 }
1366
1367 if(!(ih instanceof BranchHandle))
1368 throw new BytecodeException("Branch instruction " +
1369 jq_ClassFileConstants.OPCODE_NAMES[i.opcode] + ":" +
1370 inst + " not contained in BranchHandle.");
1371
1372 }
1373 }
1374 }
1375
1376
1377
1378
1379 for(InstructionHandle ih=start; ih != null; ih = ih.next) {
1380 Instruction i = ih.instruction;
1381
1382 ih.setPosition(index);
1383 pos[count++] = index;
1384
1385
1386
1387
1388
1389
1390 switch(i.getOpcode()) {
1391 case jq_ClassFileConstants.jbc_JSR: case jq_ClassFileConstants.jbc_GOTO:
1392 max_additional_bytes += 2;
1393 break;
1394
1395 case jq_ClassFileConstants.jbc_TABLESWITCH: case jq_ClassFileConstants.jbc_LOOKUPSWITCH:
1396 max_additional_bytes += 3;
1397 break;
1398 }
1399
1400 index += i.getLength();
1401 }
1402
1403
1404
1405
1406
1407 for(InstructionHandle ih=start; ih != null; ih = ih.next)
1408 additional_bytes += ih.updatePosition(additional_bytes, max_additional_bytes);
1409
1410
1411
1412
1413 index=count=0;
1414 for(InstructionHandle ih=start; ih != null; ih = ih.next) {
1415 Instruction i = ih.instruction;
1416
1417 ih.setPosition(index);
1418 pos[count++] = index;
1419 index += i.getLength();
1420 }
1421
1422 byte_positions = new int[count];
1423 System.arraycopy(pos, 0, byte_positions, 0, count);
1424 }
1425
1426 /***
1427 * When everything is finished, use this method to convert the instruction
1428 * list into an array of bytes.
1429 *
1430 * @return the byte code ready to be dumped
1431 */
1432 public byte[] getByteCode() {
1433
1434 setPositions();
1435
1436 ByteArrayOutputStream b = new ByteArrayOutputStream();
1437 DataOutputStream out = new DataOutputStream(b);
1438
1439 try {
1440 for(InstructionHandle ih=start; ih != null; ih = ih.next) {
1441 Instruction i = ih.instruction;
1442 i.dump(out);
1443 }
1444 } catch(IOException e) {
1445 System.err.println(e);
1446 return null;
1447 }
1448
1449 return b.toByteArray();
1450 }
1451
1452 /***
1453 * @return an array of instructions without target information for branch instructions.
1454 */
1455 public List
1456 byte[] bc = getByteCode();
1457 ByteSequence bytes = new ByteSequence(bc);
1458 ArrayList instructions = new ArrayList(bc.length);
1459
1460 try {
1461 while(bytes.available() > 0) {
1462 instructions.add(Instruction.readInstruction(cp, bytes));
1463 }
1464 } catch(IOException e) { throw new BytecodeException(e.toString()); }
1465
1466 return instructions;
1467 }
1468
1469 public String toString() {
1470 return toString(true);
1471 }
1472
1473 /***
1474 * @param verbose toggle output format
1475 * @return String containing all instructions in this list.
1476 */
1477 public String toString(boolean verbose) {
1478 StringBuffer buf = new StringBuffer();
1479
1480 for(InstructionHandle ih=start; ih != null; ih = ih.next) {
1481 buf.append(ih.toString(verbose) + Strings.lineSep);
1482 }
1483
1484 return buf.toString();
1485 }
1486
1487 /***
1488 * @return Enumeration that lists all instructions (handles)
1489 */
1490 public Enumeration elements() {
1491 return new Enumeration() {
1492 private InstructionHandle ih = start;
1493
1494 public Object nextElement() {
1495 if (ih == null) throw new NoSuchElementException();
1496 InstructionHandle i = ih;
1497 ih = ih.next;
1498 return i;
1499 }
1500
1501 public boolean hasMoreElements() { return ih != null; }
1502 };
1503 }
1504
1505 /***
1506 * @return Enumeration that lists all instructions (handles)
1507 */
1508 public ListIterator iterator() {
1509 return new ListIterator() {
1510 private InstructionHandle lastReturned = start;
1511 private InstructionHandle next = start;
1512 private int nextIndex = 0;
1513
1514 public boolean hasNext() { return nextIndex != length; }
1515 public Object next() {
1516 if (nextIndex == length) throw new NoSuchElementException();
1517 lastReturned = next;
1518 next = next.next; ++nextIndex;
1519 return lastReturned;
1520 }
1521 public boolean hasPrevious() { return nextIndex != 0; }
1522 public Object previous() {
1523 if (nextIndex == 0) throw new NoSuchElementException();
1524 if (nextIndex == length) {
1525 next = end;
1526 } else {
1527 next = next.prev;
1528 }
1529 --nextIndex;
1530 return lastReturned = next;
1531 }
1532 public int nextIndex() { return nextIndex; }
1533 public int previousIndex() { return nextIndex-1; }
1534 public void remove() {
1535 if (lastReturned == null) throw new IllegalStateException("remove or add called before remove");
1536 if (next == lastReturned) next = lastReturned.next;
1537 else --nextIndex;
1538 try {
1539 delete(lastReturned);
1540 } catch (TargetLostException x) {
1541 throw new IllegalStateException("Target lost: "+x);
1542 }
1543 lastReturned = null;
1544 }
1545 public void set(Object o) {
1546 if (lastReturned == null) throw new IllegalStateException("remove or add called before set");
1547 InstructionHandle ih;
1548 if (o instanceof BranchInstruction) {
1549 ih = insert(lastReturned, (BranchInstruction)o);
1550 } else if (o instanceof Instruction) {
1551 ih = insert(lastReturned, (Instruction)o);
1552 } else {
1553 InstructionList il = new InstructionList();
1554 il.append((InstructionHandle)o);
1555 ih = insert(lastReturned, il);
1556 }
1557 if (lastReturned == next) next = ih;
1558 redirectBranches(lastReturned, ih);
1559
1560 try {
1561 delete(lastReturned);
1562 } catch (TargetLostException x) {
1563 throw new IllegalStateException("Target lost: "+x);
1564 }
1565 lastReturned = ih;
1566 }
1567 public void add(Object o) {
1568 if (lastReturned == null) throw new IllegalStateException("remove or add called before add");
1569 ++nextIndex;
1570 if (o instanceof BranchInstruction) {
1571 insert(next, (BranchInstruction)o);
1572 } else if (o instanceof Instruction) {
1573 insert(next, (Instruction)o);
1574 } else {
1575 InstructionList il = new InstructionList();
1576 il.append((InstructionHandle)o);
1577 insert(next, il);
1578 }
1579 lastReturned = null;
1580 }
1581
1582 };
1583 }
1584
1585 /***
1586 * @return array containing all instructions (handles)
1587 */
1588 public List
1589 ArrayList
1590 if (byte_positions.length != length)
1591 byte_positions = new int[length];
1592 InstructionHandle ih = start;
1593
1594 for(int i=0; i < length; i++) {
1595 ihs.add(ih);
1596 byte_positions[i] = ih.getPosition();
1597 ih = ih.next;
1598 }
1599
1600 return ihs;
1601 }
1602
1603 /***
1604 * Get positions (offsets) of all instructions in the list. This relies on that
1605 * the list has been freshly created from an byte code array, or that setPositions()
1606 * has been called. Otherwise this may be inaccurate.
1607 *
1608 * @return array containing all instruction's offset in byte code
1609 */
1610 public int[] getInstructionPositions() { return byte_positions; }
1611
1612 /***
1613 * @return complete, i.e., deep copy of this list
1614 */
1615 public InstructionList copy() {
1616 HashMap map = new HashMap();
1617 InstructionList il = new InstructionList();
1618
1619
1620
1621
1622
1623 for(InstructionHandle ih=start; ih != null; ih = ih.next) {
1624 Instruction i = ih.instruction;
1625 Instruction c = i.copy();
1626
1627 if(c instanceof BranchInstruction)
1628 map.put(ih, il.append((BranchInstruction)c));
1629 else
1630 map.put(ih, il.append(c));
1631 }
1632
1633
1634
1635 InstructionHandle ih=start;
1636 InstructionHandle ch=il.start;
1637
1638 while(ih != null) {
1639 Instruction i = ih.instruction;
1640 Instruction c = ch.instruction;
1641
1642 if(i instanceof BranchInstruction) {
1643 BranchInstruction bi = (BranchInstruction)i;
1644 BranchInstruction bc = (BranchInstruction)c;
1645 InstructionHandle itarget = bi.getTarget();
1646
1647
1648 bc.setTarget((InstructionHandle)map.get(itarget));
1649
1650 if(bi instanceof Select) {
1651 Select si = (Select)bi;
1652 Select sc = (Select)bc;
1653 List
1654
1655 int k; Iterator j;
1656 for(k=0, j=itargets.iterator(); j.hasNext(); ++k) {
1657 sc.setTarget(k, (InstructionHandle)map.get(j.next()));
1658 }
1659 }
1660 }
1661
1662 ih = ih.next;
1663 ch = ch.next;
1664 }
1665
1666 return il;
1667 }
1668
1669 private void clear() {
1670 start = end = null;
1671 length = 0;
1672 }
1673
1674 /***
1675 * Delete contents of list. Provides better memory utilization,
1676 * because the system then may reuse the instruction handles. This
1677 * method is typically called right after
1678 * <href="MethodGen.html#getMethod()">MethodGen.getMethod()</a>.
1679 */
1680 public void dispose() {
1681
1682 for(InstructionHandle ih=end; ih != null; ih = ih.prev)
1683
1684
1685
1686 ih.dispose();
1687
1688 clear();
1689 }
1690
1691 /***
1692 * @return start of list
1693 */
1694 public InstructionHandle getStart() { return start; }
1695
1696 /***
1697 * @return end of list
1698 */
1699 public InstructionHandle getEnd() { return end; }
1700
1701 /***
1702 * @return length of list (Number of instructions, not bytes)
1703 */
1704 public int getLength() { return length; }
1705
1706 /***
1707 * @return length of list (Number of instructions, not bytes)
1708 */
1709 public int size() { return length; }
1710
1711 /***
1712 * Redirect all references from old_target to new_target, i.e., update targets
1713 * of branch instructions.
1714 *
1715 * @param old_target the old target instruction handle
1716 * @param new_target the new target instruction handle
1717 */
1718 public void redirectBranches(InstructionHandle old_target, InstructionHandle new_target) {
1719 for(InstructionHandle ih = start; ih != null; ih = ih.next) {
1720 Instruction i = ih.getInstruction();
1721
1722 if(i instanceof BranchInstruction) {
1723 BranchInstruction b = (BranchInstruction)i;
1724 InstructionHandle target = b.getTarget();
1725
1726 if(target == old_target)
1727 b.setTarget(new_target);
1728
1729 if(b instanceof Select) {
1730 List
1731 Select sb = (Select)b;
1732
1733 int k; Iterator j;
1734 for(k=0, j=targets.iterator(); j.hasNext(); ++k)
1735 if(j.next() == old_target)
1736 sb.setTarget(k, new_target);
1737 }
1738 }
1739 }
1740 }
1741
1742 /***
1743 * Redirect all references of local variables from old_target to new_target.
1744 *
1745 * @param lg array of local variables
1746 * @param old_target the old target instruction handle
1747 * @param new_target the new target instruction handle
1748 */
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764 /***
1765 * Redirect all references of exception handlers from old_target to new_target.
1766 *
1767 * @param exceptions array of exception handlers
1768 * @param old_target the old target instruction handle
1769 * @param new_target the new target instruction handle
1770 */
1771 public void redirectExceptionHandlers(CodeException[] exceptions, InstructionHandle old_target, InstructionHandle new_target) {
1772 for(int i=0; i < exceptions.length; i++) {
1773 if(exceptions[i].getStartPC() == old_target)
1774 exceptions[i].setStartPC(new_target);
1775
1776 if(exceptions[i].getEndPC() == old_target)
1777 exceptions[i].setEndPC(new_target);
1778
1779 if(exceptions[i].getHandlerPC() == old_target)
1780 exceptions[i].setHandlerPC(new_target);
1781 }
1782 }
1783
1784 private List observers;
1785
1786 /*** Add observer for this object.
1787 */
1788 public void addObserver(InstructionListObserver o) {
1789 if(observers == null)
1790 observers = new LinkedList();
1791
1792 observers.add(o);
1793 }
1794
1795 /*** Remove observer for this object.
1796 */
1797 public void removeObserver(InstructionListObserver o) {
1798 if(observers != null)
1799 observers.remove(o);
1800 }
1801
1802 /*** Call notify() method on all observers. This method is not called
1803 * automatically whenever the state has changed, but has to be
1804 * called by the user after he has finished editing the object.
1805 */
1806 public void update() {
1807 if(observers != null)
1808 for(Iterator e = observers.iterator(); e.hasNext(); )
1809 ((InstructionListObserver)e.next()).notify(this);
1810 }
1811
1812 /*** Convenience method, simply calls accept() on the contained instructions.
1813 *
1814 * @param v Visitor object
1815 */
1816 public void accept(Visitor v) {
1817 for (InstructionHandle p = start; p != null; p = p.next) {
1818 p.accept(v);
1819 }
1820 }
1821
1822 }
1823
1824 final class TargetLostException extends Exception {
1825 /***
1826 * Version ID for serialization.
1827 */
1828 private static final long serialVersionUID = 3258132461824063281L;
1829
1830 private List
1831
1832 TargetLostException(List
1833 super(mesg);
1834 targets = t;
1835 }
1836
1837 /***
1838 * @return list of instructions still being targeted.
1839 */
1840 public List
1841 }
1842
1843 interface InstructionListObserver {
1844 void notify(InstructionList list);
1845 }
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855 class ARRAYLENGTH extends Instruction implements ExceptionThrower, StackProducer {
1856 /***
1857 * Version ID for serialization.
1858 */
1859 private static final long serialVersionUID = 3977863973062521397L;
1860
1861 /***
1862 * Get length of array
1863 */
1864 public ARRAYLENGTH() {
1865 super(jq_ClassFileConstants.jbc_ARRAYLENGTH, (short)1);
1866 }
1867
1868 /***
1869 * @return exceptions this instruction may cause
1870 */
1871 public Set
1872
1873 return null;
1874 }
1875
1876 /***
1877 * Call corresponding visitor method(s). The order is:
1878 * Call visitor methods of implemented interfaces first, then
1879 * call methods according to the class hierarchy in descending order,
1880 * i.e., the most specific visitXXX() call comes last.
1881 *
1882 * @param v Visitor object
1883 */
1884 public void accept(Visitor v) {
1885 v.visitExceptionThrower(this);
1886 v.visitStackProducer(this);
1887 v.visitARRAYLENGTH(this);
1888 }
1889 }
1890
1891 class AALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
1892 /***
1893 * Version ID for serialization.
1894 */
1895 private static final long serialVersionUID = 3256723991774572857L;
1896
1897 /***
1898 * Load reference from array
1899 */
1900 public AALOAD() {
1901 super(jq_ClassFileConstants.jbc_AALOAD);
1902 }
1903
1904 /***
1905 * Call corresponding visitor method(s). The order is:
1906 * Call visitor methods of implemented interfaces first, then
1907 * call methods according to the class hierarchy in descending order,
1908 * i.e., the most specific visitXXX() call comes last.
1909 *
1910 * @param v Visitor object
1911 */
1912 public void accept(Visitor v) {
1913 v.visitStackProducer(this);
1914 v.visitExceptionThrower(this);
1915 v.visitTypedInstruction(this);
1916 v.visitArrayInstruction(this);
1917 v.visitAALOAD(this);
1918 }
1919
1920 }
1921
1922 class AASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
1923 /***
1924 * Version ID for serialization.
1925 */
1926 private static final long serialVersionUID = 4123103961466286131L;
1927
1928 /***
1929 * Store into reference array
1930 */
1931 public AASTORE() {
1932 super(jq_ClassFileConstants.jbc_AASTORE);
1933 }
1934
1935 /***
1936 * Call corresponding visitor method(s). The order is:
1937 * Call visitor methods of implemented interfaces first, then
1938 * call methods according to the class hierarchy in descending order,
1939 * i.e., the most specific visitXXX() call comes last.
1940 *
1941 * @param v Visitor object
1942 */
1943 public void accept(Visitor v) {
1944 v.visitStackConsumer(this);
1945 v.visitExceptionThrower(this);
1946 v.visitTypedInstruction(this);
1947 v.visitArrayInstruction(this);
1948 v.visitAASTORE(this);
1949 }
1950 }
1951
1952 class ACONST_NULL extends Instruction implements StackProducer, PushInstruction, TypedInstruction {
1953 /***
1954 * Version ID for serialization.
1955 */
1956 private static final long serialVersionUID = 3258688827559458096L;
1957
1958 /***
1959 * Push null reference
1960 */
1961 public ACONST_NULL() {
1962 super(jq_ClassFileConstants.jbc_ACONST_NULL, (short)1);
1963 }
1964
1965 /*** @return jq_NullType.NULL
1966 */
1967 public jq_Type getType() {
1968 return jq_Reference.jq_NullType.NULL_TYPE;
1969 }
1970
1971 /***
1972 * Call corresponding visitor method(s). The order is:
1973 * Call visitor methods of implemented interfaces first, then
1974 * call methods according to the class hierarchy in descending order,
1975 * i.e., the most specific visitXXX() call comes last.
1976 *
1977 * @param v Visitor object
1978 */
1979 public void accept(Visitor v) {
1980 v.visitStackProducer(this);
1981 v.visitPushInstruction(this);
1982 v.visitTypedInstruction(this);
1983 v.visitACONST_NULL(this);
1984 }
1985 }
1986
1987 class ALOAD extends LoadInstruction implements StackProducer, PushInstruction, TypedInstruction {
1988 /***
1989 * Version ID for serialization.
1990 */
1991 private static final long serialVersionUID = 3617853079836242227L;
1992
1993 /***
1994 * Empty constructor needed for the Class.newInstance() statement in
1995 * Instruction.readInstruction(). Not to be used otherwise.
1996 */
1997 ALOAD() {
1998 super(jq_ClassFileConstants.jbc_ALOAD, jq_ClassFileConstants.jbc_ALOAD_0);
1999 }
2000
2001 /*** Load reference from local variable
2002 * @param n index of local variable
2003 */
2004 public ALOAD(int n) {
2005 super(jq_ClassFileConstants.jbc_ALOAD, jq_ClassFileConstants.jbc_ALOAD_0, n);
2006 }
2007
2008
2009
2010
2011
2012
2013
2014 /***
2015 * Call corresponding visitor method(s). The order is:
2016 * Call visitor methods of implemented interfaces first, then
2017 * call methods according to the class hierarchy in descending order,
2018 * i.e., the most specific visitXXX() call comes last.
2019 *
2020 * @param v Visitor object
2021 */
2022 public void accept(Visitor v) {
2023 super.accept(v);
2024 v.visitALOAD(this);
2025 }
2026 }
2027
2028 class ANEWARRAY extends CPInstruction implements
2029 /***
2030 * Version ID for serialization.
2031 */
2032 private static final long serialVersionUID = 3616730495593756729L;
2033
2034 /***
2035 * Empty constructor needed for the Class.newInstance() statement in
2036 * Instruction.readInstruction(). Not to be used otherwise.
2037 */
2038 ANEWARRAY() {}
2039
2040 public ANEWARRAY(jq_Array a) {
2041 super(jq_ClassFileConstants.jbc_ANEWARRAY, a);
2042 }
2043
2044 public Set
2045
2046
2047
2048
2049
2050
2051
2052
2053 return null;
2054 }
2055
2056 /***
2057 * Call corresponding visitor method(s). The order is:
2058 * Call visitor methods of implemented interfaces first, then
2059 * call methods according to the class hierarchy in descending order,
2060 * i.e., the most specific visitXXX() call comes last.
2061 *
2062 * @param v Visitor object
2063 */
2064 public void accept(Visitor v) {
2065
2066 v.visitAllocationInstruction(this);
2067 v.visitExceptionThrower(this);
2068 v.visitStackProducer(this);
2069 v.visitTypedInstruction(this);
2070 v.visitCPInstruction(this);
2071 v.visitANEWARRAY(this);
2072 }
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085 }
2086
2087 class ARETURN extends ReturnInstruction implements TypedInstruction, StackConsumer {
2088 /***
2089 * Version ID for serialization.
2090 */
2091 private static final long serialVersionUID = 4050204120013355318L;
2092
2093 /***
2094 * Return reference from method
2095 */
2096 public ARETURN() {
2097 super(jq_ClassFileConstants.jbc_ARETURN);
2098 }
2099
2100 /***
2101 * Call corresponding visitor method(s). The order is:
2102 * Call visitor methods of implemented interfaces first, then
2103 * call methods according to the class hierarchy in descending order,
2104 * i.e., the most specific visitXXX() call comes last.
2105 *
2106 * @param v Visitor object
2107 */
2108 public void accept(Visitor v) {
2109
2110 v.visitTypedInstruction(this);
2111 v.visitStackConsumer(this);
2112 v.visitReturnInstruction(this);
2113 v.visitARETURN(this);
2114 }
2115 }
2116
2117 class ASTORE extends StoreInstruction {
2118 /***
2119 * Version ID for serialization.
2120 */
2121 private static final long serialVersionUID = 3906086762995594038L;
2122
2123 /***
2124 * Empty constructor needed for the Class.newInstance() statement in
2125 * Instruction.readInstruction(). Not to be used otherwise.
2126 */
2127 ASTORE() {
2128 super(jq_ClassFileConstants.jbc_ASTORE, jq_ClassFileConstants.jbc_ASTORE_0);
2129 }
2130
2131 /*** Store reference into local variable
2132 * @param n index of local variable
2133 */
2134 public ASTORE(int n) {
2135 super(jq_ClassFileConstants.jbc_ASTORE, jq_ClassFileConstants.jbc_ASTORE_0, n);
2136 }
2137
2138 /***
2139 * Call corresponding visitor method(s). The order is:
2140 * Call visitor methods of implemented interfaces first, then
2141 * call methods according to the class hierarchy in descending order,
2142 * i.e., the most specific visitXXX() call comes last.
2143 *
2144 * @param v Visitor object
2145 */
2146 public void accept(Visitor v) {
2147 super.accept(v);
2148 v.visitASTORE(this);
2149 }
2150 }
2151
2152 class ATHROW extends Instruction implements UnconditionalBranch, ExceptionThrower {
2153 /***
2154 * Version ID for serialization.
2155 */
2156 private static final long serialVersionUID = 3906926768488265008L;
2157
2158 /***
2159 * Throw exception
2160 */
2161 public ATHROW() {
2162 super(jq_ClassFileConstants.jbc_ATHROW, (short)1);
2163 }
2164
2165 /*** @return exceptions this instruction may cause
2166 */
2167 public Set
2168
2169 return null;
2170 }
2171
2172 /***
2173 * Call corresponding visitor method(s). The order is:
2174 * Call visitor methods of implemented interfaces first, then
2175 * call methods according to the class hierarchy in descending order,
2176 * i.e., the most specific visitXXX() call comes last.
2177 *
2178 * @param v Visitor object
2179 */
2180 public void accept(Visitor v) {
2181 v.visitUnconditionalBranch(this);
2182 v.visitExceptionThrower(this);
2183 v.visitATHROW(this);
2184 }
2185 }
2186
2187 class BALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
2188 /***
2189 * Version ID for serialization.
2190 */
2191 private static final long serialVersionUID = 3835149541292194102L;
2192
2193 /***
2194 * Load byte or boolean from array
2195 */
2196 public BALOAD() {
2197 super(jq_ClassFileConstants.jbc_BALOAD);
2198 }
2199
2200 /***
2201 * Call corresponding visitor method(s). The order is:
2202 * Call visitor methods of implemented interfaces first, then
2203 * call methods according to the class hierarchy in descending order,
2204 * i.e., the most specific visitXXX() call comes last.
2205 *
2206 * @param v Visitor object
2207 */
2208 public void accept(Visitor v) {
2209 v.visitStackProducer(this);
2210 v.visitExceptionThrower(this);
2211 v.visitTypedInstruction(this);
2212 v.visitArrayInstruction(this);
2213 v.visitBALOAD(this);
2214 }
2215 }
2216
2217 class BASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
2218 /***
2219 * Version ID for serialization.
2220 */
2221 private static final long serialVersionUID = 3690192157323311159L;
2222
2223 /***
2224 * Store byte or boolean into array
2225 */
2226 public BASTORE() {
2227 super(jq_ClassFileConstants.jbc_BASTORE);
2228 }
2229
2230 /***
2231 * Call corresponding visitor method(s). The order is:
2232 * Call visitor methods of implemented interfaces first, then
2233 * call methods according to the class hierarchy in descending order,
2234 * i.e., the most specific visitXXX() call comes last.
2235 *
2236 * @param v Visitor object
2237 */
2238 public void accept(Visitor v) {
2239 v.visitStackConsumer(this);
2240 v.visitExceptionThrower(this);
2241 v.visitTypedInstruction(this);
2242 v.visitArrayInstruction(this);
2243 v.visitBASTORE(this);
2244 }
2245 }
2246
2247 class BIPUSH extends Instruction implements PushInstruction, StackProducer, TypedInstruction, ConstantPushInstruction {
2248 /***
2249 * Version ID for serialization.
2250 */
2251 private static final long serialVersionUID = 3256999947701598520L;
2252
2253 private byte b;
2254
2255 /***
2256 * Empty constructor needed for the Class.newInstance() statement in
2257 * Instruction.readInstruction(). Not to be used otherwise.
2258 */
2259 BIPUSH() {}
2260
2261 /*** Push byte on stack
2262 */
2263 public BIPUSH(byte b) {
2264 super(jq_ClassFileConstants.jbc_BIPUSH, (short)2);
2265 this.b = b;
2266 }
2267
2268 /***
2269 * Dump instruction as byte code to stream out.
2270 */
2271 public void dump(DataOutputStream out) throws IOException {
2272 super.dump(out);
2273 out.writeByte(b);
2274 }
2275
2276 /***
2277 * @return mnemonic for instruction
2278 */
2279 public String toString(boolean verbose) {
2280 return super.toString(verbose) + " " + b;
2281 }
2282
2283 /***
2284 * Read needed data (e.g. index) from file.
2285 */
2286 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
2287 length = 2;
2288 b = bytes.readByte();
2289 }
2290
2291 public Number getValue() { return new Integer(b); }
2292
2293 /*** @return jq_Primitive.BYTE
2294 */
2295 public jq_Type getType() {
2296 return jq_Primitive.BYTE;
2297 }
2298
2299 /***
2300 * Call corresponding visitor method(s). The order is:
2301 * Call visitor methods of implemented interfaces first, then
2302 * call methods according to the class hierarchy in descending order,
2303 * i.e., the most specific visitXXX() call comes last.
2304 *
2305 * @param v Visitor object
2306 */
2307 public void accept(Visitor v) {
2308 v.visitPushInstruction(this);
2309 v.visitStackProducer(this);
2310 v.visitTypedInstruction(this);
2311 v.visitConstantPushInstruction(this);
2312 v.visitBIPUSH(this);
2313 }
2314 }
2315
2316 class BREAKPOINT extends Instruction {
2317 /***
2318 * Version ID for serialization.
2319 */
2320 private static final long serialVersionUID = 3544676178515406900L;
2321
2322 public BREAKPOINT() {
2323 super(jq_ClassFileConstants.jbc_BREAKPOINT, (short)1);
2324 }
2325
2326 /***
2327 * Call corresponding visitor method(s). The order is:
2328 * Call visitor methods of implemented interfaces first, then
2329 * call methods according to the class hierarchy in descending order,
2330 * i.e., the most specific visitXXX() call comes last.
2331 *
2332 * @param v Visitor object
2333 */
2334 public void accept(Visitor v) {
2335 v.visitBREAKPOINT(this);
2336 }
2337 }
2338
2339 class CALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
2340 /***
2341 * Version ID for serialization.
2342 */
2343 private static final long serialVersionUID = 3258134643684161592L;
2344
2345 /***
2346 * Load char from array
2347 */
2348 public CALOAD() {
2349 super(jq_ClassFileConstants.jbc_CALOAD);
2350 }
2351
2352 /***
2353 * Call corresponding visitor method(s). The order is:
2354 * Call visitor methods of implemented interfaces first, then
2355 * call methods according to the class hierarchy in descending order,
2356 * i.e., the most specific visitXXX() call comes last.
2357 *
2358 * @param v Visitor object
2359 */
2360 public void accept(Visitor v) {
2361 v.visitStackProducer(this);
2362 v.visitExceptionThrower(this);
2363 v.visitTypedInstruction(this);
2364 v.visitArrayInstruction(this);
2365 v.visitCALOAD(this);
2366 }
2367 }
2368
2369 class CASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
2370 /***
2371 * Version ID for serialization.
2372 */
2373 private static final long serialVersionUID = 3979272425999776057L;
2374
2375 /***
2376 * Store char into array
2377 */
2378 public CASTORE() {
2379 super(jq_ClassFileConstants.jbc_CASTORE);
2380 }
2381
2382 /***
2383 * Call corresponding visitor method(s). The order is:
2384 * Call visitor methods of implemented interfaces first, then
2385 * call methods according to the class hierarchy in descending order,
2386 * i.e., the most specific visitXXX() call comes last.
2387 *
2388 * @param v Visitor object
2389 */
2390 public void accept(Visitor v) {
2391 v.visitStackConsumer(this);
2392 v.visitExceptionThrower(this);
2393 v.visitTypedInstruction(this);
2394 v.visitArrayInstruction(this);
2395 v.visitCASTORE(this);
2396 }
2397 }
2398
2399 class CHECKCAST extends CPInstruction implements LoadClass, ExceptionThrower, StackProducer, StackConsumer, TypedInstruction {
2400 /***
2401 * Version ID for serialization.
2402 */
2403 private static final long serialVersionUID = 3834306250300471602L;
2404
2405 /***
2406 * Empty constructor needed for the Class.newInstance() statement in
2407 * Instruction.readInstruction(). Not to be used otherwise.
2408 */
2409 CHECKCAST() {}
2410
2411 /*** Check whether object is of given type
2412 * @param f type to check
2413 */
2414 public CHECKCAST(jq_Type f) {
2415 super(jq_ClassFileConstants.jbc_CHECKCAST, f);
2416 }
2417
2418 /*** @return exceptions this instruction may cause
2419 */
2420 public Set
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430 return null;
2431 }
2432
2433 public jq_Class getLoadClassType() {
2434 jq_Type t = getType();
2435
2436 if(t instanceof jq_Array)
2437 t = ((jq_Array) t).getInnermostElementType();
2438
2439 return (t instanceof jq_Class) ? (jq_Class) t : null;
2440 }
2441
2442 /***
2443 * Call corresponding visitor method(s). The order is:
2444 * Call visitor methods of implemented interfaces first, then
2445 * call methods according to the class hierarchy in descending order,
2446 * i.e., the most specific visitXXX() call comes last.
2447 *
2448 * @param v Visitor object
2449 */
2450 public void accept(Visitor v) {
2451 v.visitLoadClass(this);
2452 v.visitExceptionThrower(this);
2453 v.visitStackProducer(this);
2454 v.visitStackConsumer(this);
2455 v.visitTypedInstruction(this);
2456 v.visitCPInstruction(this);
2457 v.visitCHECKCAST(this);
2458 }
2459 }
2460
2461 class D2F extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
2462 /***
2463 * Version ID for serialization.
2464 */
2465 private static final long serialVersionUID = 3545521707369838132L;
2466
2467 /***
2468 * Convert double to float
2469 */
2470 public D2F() {
2471 super(jq_ClassFileConstants.jbc_D2F);
2472 }
2473
2474 /***
2475 * Call corresponding visitor method(s). The order is:
2476 * Call visitor methods of implemented interfaces first, then
2477 * call methods according to the class hierarchy in descending order,
2478 * i.e., the most specific visitXXX() call comes last.
2479 *
2480 * @param v Visitor object
2481 */
2482 public void accept(Visitor v) {
2483 v.visitTypedInstruction(this);
2484 v.visitStackProducer(this);
2485 v.visitStackConsumer(this);
2486 v.visitConversionInstruction(this);
2487 v.visitD2F(this);
2488 }
2489 }
2490
2491 class D2I extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
2492 /***
2493 * Version ID for serialization.
2494 */
2495 private static final long serialVersionUID = 3257282517928064057L;
2496
2497 /***
2498 * Convert double to int
2499 */
2500 public D2I() {
2501 super(jq_ClassFileConstants.jbc_D2I);
2502 }
2503
2504 /***
2505 * Call corresponding visitor method(s). The order is:
2506 * Call visitor methods of implemented interfaces first, then
2507 * call methods according to the class hierarchy in descending order,
2508 * i.e., the most specific visitXXX() call comes last.
2509 *
2510 * @param v Visitor object
2511 */
2512 public void accept(Visitor v) {
2513 v.visitTypedInstruction(this);
2514 v.visitStackProducer(this);
2515 v.visitStackConsumer(this);
2516 v.visitConversionInstruction(this);
2517 v.visitD2I(this);
2518 }
2519 }
2520
2521 class D2L extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
2522 /***
2523 * Version ID for serialization.
2524 */
2525 private static final long serialVersionUID = 3688508792102858802L;
2526
2527 /***
2528 * Convert double to long
2529 */
2530 public D2L() {
2531 super(jq_ClassFileConstants.jbc_D2L);
2532 }
2533
2534 /***
2535 * Call corresponding visitor method(s). The order is:
2536 * Call visitor methods of implemented interfaces first, then
2537 * call methods according to the class hierarchy in descending order,
2538 * i.e., the most specific visitXXX() call comes last.
2539 *
2540 * @param v Visitor object
2541 */
2542 public void accept(Visitor v) {
2543 v.visitTypedInstruction(this);
2544 v.visitStackProducer(this);
2545 v.visitStackConsumer(this);
2546 v.visitConversionInstruction(this);
2547 v.visitD2L(this);
2548 }
2549 }
2550
2551 class DADD extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
2552 /***
2553 * Version ID for serialization.
2554 */
2555 private static final long serialVersionUID = 3979270244139218744L;
2556
2557 /***
2558 * Add doubles
2559 */
2560 public DADD() {
2561 super(jq_ClassFileConstants.jbc_DADD);
2562 }
2563
2564 /***
2565 * Call corresponding visitor method(s). The order is:
2566 * Call visitor methods of implemented interfaces first, then
2567 * call methods according to the class hierarchy in descending order,
2568 * i.e., the most specific visitXXX() call comes last.
2569 *
2570 * @param v Visitor object
2571 */
2572 public void accept(Visitor v) {
2573 v.visitTypedInstruction(this);
2574 v.visitStackProducer(this);
2575 v.visitStackConsumer(this);
2576 v.visitArithmeticInstruction(this);
2577 v.visitDADD(this);
2578 }
2579 }
2580
2581 class DALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
2582 /***
2583 * Version ID for serialization.
2584 */
2585 private static final long serialVersionUID = 3761124950999709239L;
2586
2587 /***
2588 * Load double from array
2589 */
2590 public DALOAD() {
2591 super(jq_ClassFileConstants.jbc_DALOAD);
2592 }
2593
2594 /***
2595 * Call corresponding visitor method(s). The order is:
2596 * Call visitor methods of implemented interfaces first, then
2597 * call methods according to the class hierarchy in descending order,
2598 * i.e., the most specific visitXXX() call comes last.
2599 *
2600 * @param v Visitor object
2601 */
2602 public void accept(Visitor v) {
2603 v.visitStackProducer(this);
2604 v.visitExceptionThrower(this);
2605 v.visitTypedInstruction(this);
2606 v.visitArrayInstruction(this);
2607 v.visitDALOAD(this);
2608 }
2609 }
2610
2611 class DASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
2612 /***
2613 * Version ID for serialization.
2614 */
2615 private static final long serialVersionUID = 3618977897344414514L;
2616
2617 /***
2618 * Store double into array
2619 */
2620 public DASTORE() {
2621 super(jq_ClassFileConstants.jbc_DASTORE);
2622 }
2623
2624 /***
2625 * Call corresponding visitor method(s). The order is:
2626 * Call visitor methods of implemented interfaces first, then
2627 * call methods according to the class hierarchy in descending order,
2628 * i.e., the most specific visitXXX() call comes last.
2629 *
2630 * @param v Visitor object
2631 */
2632 public void accept(Visitor v) {
2633 v.visitStackConsumer(this);
2634 v.visitExceptionThrower(this);
2635 v.visitTypedInstruction(this);
2636 v.visitArrayInstruction(this);
2637 v.visitDASTORE(this);
2638 }
2639 }
2640
2641 class DCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
2642
2643 /***
2644 * Version ID for serialization.
2645 */
2646 private static final long serialVersionUID = 3257848775023013941L;
2647
2648 public DCMPG() {
2649 super(jq_ClassFileConstants.jbc_DCMPG, (short)1);
2650 }
2651
2652 /*** @return jq_Primitive.DOUBLE
2653 */
2654 public jq_Type getType() {
2655 return jq_Primitive.DOUBLE;
2656 }
2657
2658 /***
2659 * Call corresponding visitor method(s). The order is:
2660 * Call visitor methods of implemented interfaces first, then
2661 * call methods according to the class hierarchy in descending order,
2662 * i.e., the most specific visitXXX() call comes last.
2663 *
2664 * @param v Visitor object
2665 */
2666 public void accept(Visitor v) {
2667 v.visitTypedInstruction(this);
2668 v.visitStackProducer(this);
2669 v.visitStackConsumer(this);
2670 v.visitDCMPG(this);
2671 }
2672 }
2673
2674 class DCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
2675
2676 /***
2677 * Version ID for serialization.
2678 */
2679 private static final long serialVersionUID = 3258135760375984179L;
2680
2681 public DCMPL() {
2682 super(jq_ClassFileConstants.jbc_DCMPL, (short)1);
2683 }
2684
2685 /*** @return jq_Primitive.DOUBLE
2686 */
2687 public jq_Type getType() {
2688 return jq_Primitive.DOUBLE;
2689 }
2690
2691 /***
2692 * Call corresponding visitor method(s). The order is:
2693 * Call visitor methods of implemented interfaces first, then
2694 * call methods according to the class hierarchy in descending order,
2695 * i.e., the most specific visitXXX() call comes last.
2696 *
2697 * @param v Visitor object
2698 */
2699 public void accept(Visitor v) {
2700 v.visitTypedInstruction(this);
2701 v.visitStackProducer(this);
2702 v.visitStackConsumer(this);
2703 v.visitDCMPL(this);
2704 }
2705 }
2706
2707 class DCONST extends Instruction implements PushInstruction, StackProducer, TypedInstruction, ConstantPushInstruction {
2708 /***
2709 * Version ID for serialization.
2710 */
2711 private static final long serialVersionUID = 3905242312396387385L;
2712 private double value;
2713
2714 /***
2715 * Empty constructor needed for the Class.newInstance() statement in
2716 * Instruction.readInstruction(). Not to be used otherwise.
2717 */
2718 DCONST() {}
2719
2720 public DCONST(double f) {
2721 super(jq_ClassFileConstants.jbc_DCONST_0, (short)1);
2722
2723 if(f == 0.0)
2724 opcode = jq_ClassFileConstants.jbc_DCONST_0;
2725 else if(f == 1.0)
2726 opcode = jq_ClassFileConstants.jbc_DCONST_1;
2727 else
2728 throw new BytecodeException("DCONST can be used only for 0.0 and 1.0: " + f);
2729
2730 value = f;
2731 }
2732
2733 public Number getValue() { return new Double(value); }
2734
2735 /*** @return jq_Primitive.DOUBLE
2736 */
2737 public jq_Type getType() {
2738 return jq_Primitive.DOUBLE;
2739 }
2740
2741 /***
2742 * Call corresponding visitor method(s). The order is:
2743 * Call visitor methods of implemented interfaces first, then
2744 * call methods according to the class hierarchy in descending order,
2745 * i.e., the most specific visitXXX() call comes last.
2746 *
2747 * @param v Visitor object
2748 */
2749 public void accept(Visitor v) {
2750 v.visitPushInstruction(this);
2751 v.visitStackProducer(this);
2752 v.visitTypedInstruction(this);
2753 v.visitConstantPushInstruction(this);
2754 v.visitDCONST(this);
2755 }
2756 }
2757
2758 class DDIV extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
2759 /***
2760 * Version ID for serialization.
2761 */
2762 private static final long serialVersionUID = 3618699703773377592L;
2763
2764 /***
2765 * Divide doubles
2766 */
2767 public DDIV() {
2768 super(jq_ClassFileConstants.jbc_DDIV);
2769 }
2770
2771 /***
2772 * Call corresponding visitor method(s). The order is:
2773 * Call visitor methods of implemented interfaces first, then
2774 * call methods according to the class hierarchy in descending order,
2775 * i.e., the most specific visitXXX() call comes last.
2776 *
2777 * @param v Visitor object
2778 */
2779 public void accept(Visitor v) {
2780 v.visitTypedInstruction(this);
2781 v.visitStackProducer(this);
2782 v.visitStackConsumer(this);
2783 v.visitArithmeticInstruction(this);
2784 v.visitDDIV(this);
2785 }
2786 }
2787
2788 class DLOAD extends LoadInstruction {
2789 /***
2790 * Version ID for serialization.
2791 */
2792 private static final long serialVersionUID = 3544673992393895987L;
2793
2794 /***
2795 * Empty constructor needed for the Class.newInstance() statement in
2796 * Instruction.readInstruction(). Not to be used otherwise.
2797 */
2798 DLOAD() {
2799 super(jq_ClassFileConstants.jbc_DLOAD, jq_ClassFileConstants.jbc_DLOAD_0);
2800 }
2801
2802 /*** Load double from local variable
2803 * @param n index of local variable
2804 */
2805 public DLOAD(int n) {
2806 super(jq_ClassFileConstants.jbc_DLOAD, jq_ClassFileConstants.jbc_DLOAD_0, n);
2807 }
2808
2809 /***
2810 * Call corresponding visitor method(s). The order is:
2811 * Call visitor methods of implemented interfaces first, then
2812 * call methods according to the class hierarchy in descending order,
2813 * i.e., the most specific visitXXX() call comes last.
2814 *
2815 * @param v Visitor object
2816 */
2817 public void accept(Visitor v) {
2818 super.accept(v);
2819 v.visitDLOAD(this);
2820 }
2821 }
2822
2823 class DMUL extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
2824 /***
2825 * Version ID for serialization.
2826 */
2827 private static final long serialVersionUID = 3689915058885047096L;
2828
2829 /***
2830 * Multiply doubles
2831 */
2832 public DMUL() {
2833 super(jq_ClassFileConstants.jbc_DMUL);
2834 }
2835
2836 /***
2837 * Call corresponding visitor method(s). The order is:
2838 * Call visitor methods of implemented interfaces first, then
2839 * call methods according to the class hierarchy in descending order,
2840 * i.e., the most specific visitXXX() call comes last.
2841 *
2842 * @param v Visitor object
2843 */
2844 public void accept(Visitor v) {
2845 v.visitTypedInstruction(this);
2846 v.visitStackProducer(this);
2847 v.visitStackConsumer(this);
2848 v.visitArithmeticInstruction(this);
2849 v.visitDMUL(this);
2850 }
2851 }
2852
2853 class DNEG extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
2854 /***
2855 * Version ID for serialization.
2856 */
2857 private static final long serialVersionUID = 3256719585154447409L;
2858
2859 public DNEG() {
2860 super(jq_ClassFileConstants.jbc_DNEG);
2861 }
2862
2863 /***
2864 * Call corresponding visitor method(s). The order is:
2865 * Call visitor methods of implemented interfaces first, then
2866 * call methods according to the class hierarchy in descending order,
2867 * i.e., the most specific visitXXX() call comes last.
2868 *
2869 * @param v Visitor object
2870 */
2871 public void accept(Visitor v) {
2872 v.visitTypedInstruction(this);
2873 v.visitStackProducer(this);
2874 v.visitStackConsumer(this);
2875 v.visitArithmeticInstruction(this);
2876 v.visitDNEG(this);
2877 }
2878 }
2879
2880 class DREM extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
2881 /***
2882 * Version ID for serialization.
2883 */
2884 private static final long serialVersionUID = 3257562893443873076L;
2885
2886 /***
2887 * Remainder of doubles
2888 */
2889 public DREM() {
2890 super(jq_ClassFileConstants.jbc_DREM);
2891 }
2892
2893 /***
2894 * Call corresponding visitor method(s). The order is:
2895 * Call visitor methods of implemented interfaces first, then
2896 * call methods according to the class hierarchy in descending order,
2897 * i.e., the most specific visitXXX() call comes last.
2898 *
2899 * @param v Visitor object
2900 */
2901 public void accept(Visitor v) {
2902 v.visitTypedInstruction(this);
2903 v.visitStackProducer(this);
2904 v.visitStackConsumer(this);
2905 v.visitArithmeticInstruction(this);
2906 v.visitDREM(this);
2907 }
2908 }
2909
2910 class DRETURN extends ReturnInstruction implements TypedInstruction, StackConsumer {
2911 /***
2912 * Version ID for serialization.
2913 */
2914 private static final long serialVersionUID = 3618696392235758390L;
2915
2916 /***
2917 * Return double from method
2918 */
2919 public DRETURN() {
2920 super(jq_ClassFileConstants.jbc_DRETURN);
2921 }
2922
2923 /***
2924 * Call corresponding visitor method(s). The order is:
2925 * Call visitor methods of implemented interfaces first, then
2926 * call methods according to the class hierarchy in descending order,
2927 * i.e., the most specific visitXXX() call comes last.
2928 *
2929 * @param v Visitor object
2930 */
2931 public void accept(Visitor v) {
2932
2933 v.visitTypedInstruction(this);
2934 v.visitStackConsumer(this);
2935 v.visitReturnInstruction(this);
2936 v.visitDRETURN(this);
2937 }
2938 }
2939
2940 class DSTORE extends StoreInstruction {
2941 /***
2942 * Version ID for serialization.
2943 */
2944 private static final long serialVersionUID = 3616446787167335478L;
2945
2946 /***
2947 * Empty constructor needed for the Class.newInstance() statement in
2948 * Instruction.readInstruction(). Not to be used otherwise.
2949 */
2950 DSTORE() {
2951 super(jq_ClassFileConstants.jbc_DSTORE, jq_ClassFileConstants.jbc_DSTORE_0);
2952 }
2953
2954 /*** Store double into local variable
2955 * @param n index of local variable
2956 */
2957 public DSTORE(int n) {
2958 super(jq_ClassFileConstants.jbc_DSTORE, jq_ClassFileConstants.jbc_DSTORE_0, n);
2959 }
2960
2961 /***
2962 * Call corresponding visitor method(s). The order is:
2963 * Call visitor methods of implemented interfaces first, then
2964 * call methods according to the class hierarchy in descending order,
2965 * i.e., the most specific visitXXX() call comes last.
2966 *
2967 * @param v Visitor object
2968 */
2969 public void accept(Visitor v) {
2970 super.accept(v);
2971 v.visitDSTORE(this);
2972 }
2973 }
2974
2975 class DSUB extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
2976 /***
2977 * Version ID for serialization
2978 */
2979 private static final long serialVersionUID = 3978420312960547126L;
2980
2981 /***
2982 * Substract doubles
2983 */
2984 public DSUB() {
2985 super(jq_ClassFileConstants.jbc_DSUB);
2986 }
2987
2988 /***
2989 * Call corresponding visitor method(s). The order is:
2990 * Call visitor methods of implemented interfaces first, then
2991 * call methods according to the class hierarchy in descending order,
2992 * i.e., the most specific visitXXX() call comes last.
2993 *
2994 * @param v Visitor object
2995 */
2996 public void accept(Visitor v) {
2997 v.visitTypedInstruction(this);
2998 v.visitStackProducer(this);
2999 v.visitStackConsumer(this);
3000 v.visitArithmeticInstruction(this);
3001 v.visitDSUB(this);
3002 }
3003 }
3004
3005 class DUP2 extends StackInstruction implements StackProducer, PushInstruction {
3006 /***
3007 * Version ID for serialization.
3008 */
3009 private static final long serialVersionUID = 3257849900220757556L;
3010
3011 public DUP2() {
3012 super(jq_ClassFileConstants.jbc_DUP2);
3013 }
3014
3015 /***
3016 * Call corresponding visitor method(s). The order is:
3017 * Call visitor methods of implemented interfaces first, then
3018 * call methods according to the class hierarchy in descending order,
3019 * i.e., the most specific visitXXX() call comes last.
3020 *
3021 * @param v Visitor object
3022 */
3023 public void accept(Visitor v) {
3024 v.visitStackProducer(this);
3025 v.visitPushInstruction(this);
3026 v.visitStackInstruction(this);
3027 v.visitDUP2(this);
3028 }
3029 }
3030
3031 class DUP2_X1 extends StackInstruction {
3032 /***
3033 * Version ID for serialization.
3034 */
3035 private static final long serialVersionUID = 3256442525387534902L;
3036
3037 public DUP2_X1() {
3038 super(jq_ClassFileConstants.jbc_DUP2_X1);
3039 }
3040
3041 /***
3042 * Call corresponding visitor method(s). The order is:
3043 * Call visitor methods of implemented interfaces first, then
3044 * call methods according to the class hierarchy in descending order,
3045 * i.e., the most specific visitXXX() call comes last.
3046 *
3047 * @param v Visitor object
3048 */
3049 public void accept(Visitor v) {
3050 v.visitStackInstruction(this);
3051 v.visitDUP2_X1(this);
3052 }
3053 }
3054
3055 class DUP2_X2 extends StackInstruction {
3056 /***
3057 * Version ID for serialization.
3058 */
3059 private static final long serialVersionUID = 3691038772737225011L;
3060
3061 public DUP2_X2() {
3062 super(jq_ClassFileConstants.jbc_DUP2_X2);
3063 }
3064
3065 /***
3066 * Call corresponding visitor method(s). The order is:
3067 * Call visitor methods of implemented interfaces first, then
3068 * call methods according to the class hierarchy in descending order,
3069 * i.e., the most specific visitXXX() call comes last.
3070 *
3071 * @param v Visitor object
3072 */
3073 public void accept(Visitor v) {
3074 v.visitStackInstruction(this);
3075 v.visitDUP2_X2(this);
3076 }
3077 }
3078
3079 class DUP extends StackInstruction implements StackProducer, PushInstruction {
3080 /***
3081 * Version ID for serialization.
3082 */
3083 private static final long serialVersionUID = 3257571698076234552L;
3084
3085 public DUP() {
3086 super(jq_ClassFileConstants.jbc_DUP);
3087 }
3088
3089 /***
3090 * Call corresponding visitor method(s). The order is:
3091 * Call visitor methods of implemented interfaces first, then
3092 * call methods according to the class hierarchy in descending order,
3093 * i.e., the most specific visitXXX() call comes last.
3094 *
3095 * @param v Visitor object
3096 */
3097 public void accept(Visitor v) {
3098 v.visitStackProducer(this);
3099 v.visitPushInstruction(this);
3100 v.visitStackInstruction(this);
3101 v.visitDUP(this);
3102 }
3103 }
3104
3105 class DUP_X1 extends StackInstruction {
3106 /***
3107 * Version ID for serialization.
3108 */
3109 private static final long serialVersionUID = 3258135760375986488L;
3110
3111 public DUP_X1() {
3112 super(jq_ClassFileConstants.jbc_DUP_X1);
3113 }
3114
3115 /***
3116 * Call corresponding visitor method(s). The order is:
3117 * Call visitor methods of implemented interfaces first, then
3118 * call methods according to the class hierarchy in descending order,
3119 * i.e., the most specific visitXXX() call comes last.
3120 *
3121 * @param v Visitor object
3122 */
3123 public void accept(Visitor v) {
3124 v.visitStackInstruction(this);
3125 v.visitDUP_X1(this);
3126 }
3127 }
3128
3129 class DUP_X2 extends StackInstruction {
3130 /***
3131 * Version ID for serialization.
3132 */
3133 private static final long serialVersionUID = 3256720693155868723L;
3134
3135 public DUP_X2() {
3136 super(jq_ClassFileConstants.jbc_DUP_X2);
3137 }
3138
3139 /***
3140 * Call corresponding visitor method(s). The order is:
3141 * Call visitor methods of implemented interfaces first, then
3142 * call methods according to the class hierarchy in descending order,
3143 * i.e., the most specific visitXXX() call comes last.
3144 *
3145 * @param v Visitor object
3146 */
3147 public void accept(Visitor v) {
3148 v.visitStackInstruction(this);
3149 v.visitDUP_X2(this);
3150 }
3151 }
3152
3153 class F2D extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
3154 /***
3155 * Version ID for serialization.
3156 */
3157 private static final long serialVersionUID = 3257853198772484147L;
3158
3159 /***
3160 * Convert float to double
3161 */
3162 public F2D() {
3163 super(jq_ClassFileConstants.jbc_F2D);
3164 }
3165
3166 /***
3167 * Call corresponding visitor method(s). The order is:
3168 * Call visitor methods of implemented interfaces first, then
3169 * call methods according to the class hierarchy in descending order,
3170 * i.e., the most specific visitXXX() call comes last.
3171 *
3172 * @param v Visitor object
3173 */
3174 public void accept(Visitor v) {
3175 v.visitTypedInstruction(this);
3176 v.visitStackProducer(this);
3177 v.visitStackConsumer(this);
3178 v.visitConversionInstruction(this);
3179 v.visitF2D(this);
3180 }
3181 }
3182
3183 class F2I extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
3184 /***
3185 * Version ID for serialization.
3186 */
3187 private static final long serialVersionUID = 3832617404583917363L;
3188
3189 /***
3190 * Convert float to int
3191 */
3192 public F2I() {
3193 super(jq_ClassFileConstants.jbc_F2I);
3194 }
3195
3196 /***
3197 * Call corresponding visitor method(s). The order is:
3198 * Call visitor methods of implemented interfaces first, then
3199 * call methods according to the class hierarchy in descending order,
3200 * i.e., the most specific visitXXX() call comes last.
3201 *
3202 * @param v Visitor object
3203 */
3204 public void accept(Visitor v) {
3205 v.visitTypedInstruction(this);
3206 v.visitStackProducer(this);
3207 v.visitStackConsumer(this);
3208 v.visitConversionInstruction(this);
3209 v.visitF2I(this);
3210 }
3211 }
3212
3213 class F2L extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
3214 /***
3215 * Version ID for serialization.
3216 */
3217 private static final long serialVersionUID = 3256445793790406707L;
3218
3219 /***
3220 * Convert float to long
3221 */
3222 public F2L() {
3223 super(jq_ClassFileConstants.jbc_F2L);
3224 }
3225
3226 /***
3227 * Call corresponding visitor method(s). The order is:
3228 * Call visitor methods of implemented interfaces first, then
3229 * call methods according to the class hierarchy in descending order,
3230 * i.e., the most specific visitXXX() call comes last.
3231 *
3232 * @param v Visitor object
3233 */
3234 public void accept(Visitor v) {
3235 v.visitTypedInstruction(this);
3236 v.visitStackProducer(this);
3237 v.visitStackConsumer(this);
3238 v.visitConversionInstruction(this);
3239 v.visitF2L(this);
3240 }
3241 }
3242
3243 class FADD extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
3244 /***
3245 * Version ID for serialization.
3246 */
3247 private static final long serialVersionUID = 3256438110195104052L;
3248
3249 /***
3250 * Add floats
3251 */
3252 public FADD() {
3253 super(jq_ClassFileConstants.jbc_FADD);
3254 }
3255
3256 /***
3257 * Call corresponding visitor method(s). The order is:
3258 * Call visitor methods of implemented interfaces first, then
3259 * call methods according to the class hierarchy in descending order,
3260 * i.e., the most specific visitXXX() call comes last.
3261 *
3262 * @param v Visitor object
3263 */
3264 public void accept(Visitor v) {
3265 v.visitTypedInstruction(this);
3266 v.visitStackProducer(this);
3267 v.visitStackConsumer(this);
3268 v.visitArithmeticInstruction(this);
3269 v.visitFADD(this);
3270 }
3271 }
3272
3273 class FALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
3274 /***
3275 * Version ID for serialization.
3276 */
3277 private static final long serialVersionUID = 3688789167651958840L;
3278
3279 /***
3280 * Load float from array
3281 */
3282 public FALOAD() {
3283 super(jq_ClassFileConstants.jbc_FALOAD);
3284 }
3285
3286 /***
3287 * Call corresponding visitor method(s). The order is:
3288 * Call visitor methods of implemented interfaces first, then
3289 * call methods according to the class hierarchy in descending order,
3290 * i.e., the most specific visitXXX() call comes last.
3291 *
3292 * @param v Visitor object
3293 */
3294 public void accept(Visitor v) {
3295 v.visitStackProducer(this);
3296 v.visitExceptionThrower(this);
3297 v.visitTypedInstruction(this);
3298 v.visitArrayInstruction(this);
3299 v.visitFALOAD(this);
3300 }
3301 }
3302
3303 class FASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
3304 /***
3305 * Version ID for serialization.
3306 */
3307 private static final long serialVersionUID = 3833747672556188983L;
3308
3309 /***
3310 * Store float into array
3311 */
3312 public FASTORE() {
3313 super(jq_ClassFileConstants.jbc_FASTORE);
3314 }
3315
3316 /***
3317 * Call corresponding visitor method(s). The order is:
3318 * Call visitor methods of implemented interfaces first, then
3319 * call methods according to the class hierarchy in descending order,
3320 * i.e., the most specific visitXXX() call comes last.
3321 *
3322 * @param v Visitor object
3323 */
3324 public void accept(Visitor v) {
3325 v.visitStackConsumer(this);
3326 v.visitExceptionThrower(this);
3327 v.visitTypedInstruction(this);
3328 v.visitArrayInstruction(this);
3329 v.visitFASTORE(this);
3330 }
3331 }
3332
3333 class FCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
3334 /***
3335 * Version ID for serialization.
3336 */
3337 private static final long serialVersionUID = 3618699716641043510L;
3338
3339 public FCMPG() {
3340 super(jq_ClassFileConstants.jbc_FCMPG, (short)1);
3341 }
3342
3343 /*** @return jq_Primitive.FLOAT
3344 */
3345 public jq_Type getType() {
3346 return jq_Primitive.FLOAT;
3347 }
3348
3349 /***
3350 * Call corresponding visitor method(s). The order is:
3351 * Call visitor methods of implemented interfaces first, then
3352 * call methods according to the class hierarchy in descending order,
3353 * i.e., the most specific visitXXX() call comes last.
3354 *
3355 * @param v Visitor object
3356 */
3357 public void accept(Visitor v) {
3358 v.visitTypedInstruction(this);
3359 v.visitStackProducer(this);
3360 v.visitStackConsumer(this);
3361 v.visitFCMPG(this);
3362 }
3363 }
3364
3365 class FCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
3366 /***
3367 * Version ID for serialization.
3368 */
3369 private static final long serialVersionUID = 3761688983301795896L;
3370
3371 public FCMPL() {
3372 super(jq_ClassFileConstants.jbc_FCMPL, (short)1);
3373 }
3374
3375 /*** @return jq_Primitive.FLOAT
3376 */
3377 public jq_Type getType() {
3378 return jq_Primitive.FLOAT;
3379 }
3380
3381 /***
3382 * Call corresponding visitor method(s). The order is:
3383 * Call visitor methods of implemented interfaces first, then
3384 * call methods according to the class hierarchy in descending order,
3385 * i.e., the most specific visitXXX() call comes last.
3386 *
3387 * @param v Visitor object
3388 */
3389 public void accept(Visitor v) {
3390 v.visitTypedInstruction(this);
3391 v.visitStackProducer(this);
3392 v.visitStackConsumer(this);
3393 v.visitFCMPL(this);
3394 }
3395 }
3396
3397 class FCONST extends Instruction implements PushInstruction, StackProducer, TypedInstruction, ConstantPushInstruction {
3398 /***
3399 * Version ID for serialization.
3400 */
3401 private static final long serialVersionUID = 3258411750780383544L;
3402
3403 private float value;
3404
3405 /***
3406 * Empty constructor needed for the Class.newInstance() statement in
3407 * Instruction.readInstruction(). Not to be used otherwise.
3408 */
3409 FCONST() {}
3410
3411 public FCONST(float f) {
3412 super(jq_ClassFileConstants.jbc_FCONST_0, (short)1);
3413
3414 if(f == 0.0)
3415 opcode = jq_ClassFileConstants.jbc_FCONST_0;
3416 else if(f == 1.0)
3417 opcode = jq_ClassFileConstants.jbc_FCONST_1;
3418 else if(f == 2.0)
3419 opcode = jq_ClassFileConstants.jbc_FCONST_2;
3420 else
3421 throw new BytecodeException("FCONST can be used only for 0.0, 1.0 and 2.0: " + f);
3422
3423 value = f;
3424 }
3425
3426 public Number getValue() { return new Float(value); }
3427
3428 /*** @return jq_Primitive.FLOAT
3429 */
3430 public jq_Type getType() {
3431 return jq_Primitive.FLOAT;
3432 }
3433
3434 /***
3435 * Call corresponding visitor method(s). The order is:
3436 * Call visitor methods of implemented interfaces first, then
3437 * call methods according to the class hierarchy in descending order,
3438 * i.e., the most specific visitXXX() call comes last.
3439 *
3440 * @param v Visitor object
3441 */
3442 public void accept(Visitor v) {
3443 v.visitPushInstruction(this);
3444 v.visitStackProducer(this);
3445 v.visitTypedInstruction(this);
3446 v.visitConstantPushInstruction(this);
3447 v.visitFCONST(this);
3448 }
3449 }
3450
3451 class FDIV extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
3452 /***
3453 * Version ID for serialization.
3454 */
3455 private static final long serialVersionUID = 3617295618767272240L;
3456
3457 /***
3458 * Divide floats
3459 */
3460 public FDIV() {
3461 super(jq_ClassFileConstants.jbc_FDIV);
3462 }
3463
3464 /***
3465 * Call corresponding visitor method(s). The order is:
3466 * Call visitor methods of implemented interfaces first, then
3467 * call methods according to the class hierarchy in descending order,
3468 * i.e., the most specific visitXXX() call comes last.
3469 *
3470 * @param v Visitor object
3471 */
3472 public void accept(Visitor v) {
3473 v.visitTypedInstruction(this);
3474 v.visitStackProducer(this);
3475 v.visitStackConsumer(this);
3476 v.visitArithmeticInstruction(this);
3477 v.visitFDIV(this);
3478 }
3479 }
3480
3481 class FLOAD extends LoadInstruction {
3482 /***
3483 * Version ID for serialization.
3484 */
3485 private static final long serialVersionUID = 3256440317707497522L;
3486
3487 /***
3488 * Empty constructor needed for the Class.newInstance() statement in
3489 * Instruction.readInstruction(). Not to be used otherwise.
3490 */
3491 FLOAD() {
3492 super(jq_ClassFileConstants.jbc_FLOAD, jq_ClassFileConstants.jbc_FLOAD_0);
3493 }
3494
3495 /***
3496 * Load float from local variable
3497 * @param n index of local variable
3498 */
3499 public FLOAD(int n) {
3500 super(jq_ClassFileConstants.jbc_FLOAD, jq_ClassFileConstants.jbc_FLOAD_0, n);
3501 }
3502
3503 /***
3504 * Call corresponding visitor method(s). The order is:
3505 * Call visitor methods of implemented interfaces first, then
3506 * call methods according to the class hierarchy in descending order,
3507 * i.e., the most specific visitXXX() call comes last.
3508 *
3509 * @param v Visitor object
3510 */
3511 public void accept(Visitor v) {
3512 super.accept(v);
3513 v.visitFLOAD(this);
3514 }
3515 }
3516
3517 class FMUL extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
3518 /***
3519 * Version ID for serialization.
3520 */
3521 private static final long serialVersionUID = 3256727298848797488L;
3522
3523 /***
3524 * Multiply floats
3525 */
3526 public FMUL() {
3527 super(jq_ClassFileConstants.jbc_FMUL);
3528 }
3529
3530 /***
3531 * Call corresponding visitor method(s). The order is:
3532 * Call visitor methods of implemented interfaces first, then
3533 * call methods according to the class hierarchy in descending order,
3534 * i.e., the most specific visitXXX() call comes last.
3535 *
3536 * @param v Visitor object
3537 */
3538 public void accept(Visitor v) {
3539 v.visitTypedInstruction(this);
3540 v.visitStackProducer(this);
3541 v.visitStackConsumer(this);
3542 v.visitArithmeticInstruction(this);
3543 v.visitFMUL(this);
3544 }
3545 }
3546
3547 class FNEG extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
3548 /***
3549 * Version ID for serialization.
3550 */
3551 private static final long serialVersionUID = 3544387015597831478L;
3552
3553 public FNEG() {
3554 super(jq_ClassFileConstants.jbc_FNEG);
3555 }
3556
3557 /***
3558 * Call corresponding visitor method(s). The order is:
3559 * Call visitor methods of implemented interfaces first, then
3560 * call methods according to the class hierarchy in descending order,
3561 * i.e., the most specific visitXXX() call comes last.
3562 *
3563 * @param v Visitor object
3564 */
3565 public void accept(Visitor v) {
3566 v.visitTypedInstruction(this);
3567 v.visitStackProducer(this);
3568 v.visitStackConsumer(this);
3569 v.visitArithmeticInstruction(this);
3570 v.visitFNEG(this);
3571 }
3572 }
3573
3574 class FREM extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
3575 /***
3576 * Version ID for serialization.
3577 */
3578 private static final long serialVersionUID = 3257850986897749561L;
3579
3580 /***
3581 * Remainder of floats
3582 */
3583 public FREM() {
3584 super(jq_ClassFileConstants.jbc_FREM);
3585 }
3586
3587 /***
3588 * Call corresponding visitor method(s). The order is:
3589 * Call visitor methods of implemented interfaces first, then
3590 * call methods according to the class hierarchy in descending order,
3591 * i.e., the most specific visitXXX() call comes last.
3592 *
3593 * @param v Visitor object
3594 */
3595 public void accept(Visitor v) {
3596 v.visitTypedInstruction(this);
3597 v.visitStackProducer(this);
3598 v.visitStackConsumer(this);
3599 v.visitArithmeticInstruction(this);
3600 v.visitFREM(this);
3601 }
3602 }
3603
3604 class FRETURN extends ReturnInstruction implements TypedInstruction, StackConsumer {
3605 /***
3606 * Version ID for serialization.
3607 */
3608 private static final long serialVersionUID = 3257286933171484213L;
3609
3610 /***
3611 * Return float from method
3612 */
3613 public FRETURN() {
3614 super(jq_ClassFileConstants.jbc_FRETURN);
3615 }
3616
3617 /***
3618 * Call corresponding visitor method(s). The order is:
3619 * Call visitor methods of implemented interfaces first, then
3620 * call methods according to the class hierarchy in descending order,
3621 * i.e., the most specific visitXXX() call comes last.
3622 *
3623 * @param v Visitor object
3624 */
3625 public void accept(Visitor v) {
3626
3627 v.visitTypedInstruction(this);
3628 v.visitStackConsumer(this);
3629 v.visitReturnInstruction(this);
3630 v.visitFRETURN(this);
3631 }
3632 }
3633
3634 class FSTORE extends StoreInstruction {
3635 /***
3636 * Version ID for serialization.
3637 */
3638 private static final long serialVersionUID = 3833748763461432884L;
3639
3640 /***
3641 * Empty constructor needed for the Class.newInstance() statement in
3642 * Instruction.readInstruction(). Not to be used otherwise.
3643 */
3644 FSTORE() {
3645 super(jq_ClassFileConstants.jbc_FSTORE, jq_ClassFileConstants.jbc_FSTORE_0);
3646 }
3647
3648 /*** Store float into local variable
3649 * @param n index of local variable
3650 */
3651 public FSTORE(int n) {
3652 super(jq_ClassFileConstants.jbc_FSTORE, jq_ClassFileConstants.jbc_FSTORE_0, n);
3653 }
3654
3655 /***
3656 * Call corresponding visitor method(s). The order is:
3657 * Call visitor methods of implemented interfaces first, then
3658 * call methods according to the class hierarchy in descending order,
3659 * i.e., the most specific visitXXX() call comes last.
3660 *
3661 * @param v Visitor object
3662 */
3663 public void accept(Visitor v) {
3664 super.accept(v);
3665 v.visitFSTORE(this);
3666 }
3667 }
3668
3669 class FSUB extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
3670 /***
3671 * Version ID for serialization.
3672 */
3673 private static final long serialVersionUID = 3256725069727019317L;
3674
3675 /*** Substract floats
3676 */
3677 public FSUB() {
3678 super(jq_ClassFileConstants.jbc_FSUB);
3679 }
3680
3681 /***
3682 * Call corresponding visitor method(s). The order is:
3683 * Call visitor methods of implemented interfaces first, then
3684 * call methods according to the class hierarchy in descending order,
3685 * i.e., the most specific visitXXX() call comes last.
3686 *
3687 * @param v Visitor object
3688 */
3689 public void accept(Visitor v) {
3690 v.visitTypedInstruction(this);
3691 v.visitStackProducer(this);
3692 v.visitStackConsumer(this);
3693 v.visitArithmeticInstruction(this);
3694 v.visitFSUB(this);
3695 }
3696 }
3697
3698 class GETFIELD extends FieldInstruction implements ExceptionThrower, StackConsumer, StackProducer, TypedInstruction, LoadClass {
3699 /***
3700 * Version ID for serialization.
3701 */
3702 private static final long serialVersionUID = 3256442503862761017L;
3703
3704 /***
3705 * Empty constructor needed for the Class.newInstance() statement in
3706 * Instruction.readInstruction(). Not to be used otherwise.
3707 */
3708 GETFIELD() {}
3709
3710 public GETFIELD(jq_InstanceField f) {
3711 super(jq_ClassFileConstants.jbc_GETFIELD, f);
3712 }
3713
3714 public int produceStack() { return getFieldSize(); }
3715
3716 /***
3717 * Read needed data (i.e., index) from file.
3718 * @param bytes input stream
3719 * @param wide wide prefix?
3720 */
3721 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
3722 o = cp.getAsInstanceField((char)bytes.readUnsignedShort());
3723 length = 3;
3724 }
3725
3726 public Set
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739 return null;
3740 }
3741
3742 /***
3743 * Call corresponding visitor method(s). The order is:
3744 * Call visitor methods of implemented interfaces first, then
3745 * call methods according to the class hierarchy in descending order,
3746 * i.e., the most specific visitXXX() call comes last.
3747 *
3748 * @param v Visitor object
3749 */
3750 public void accept(Visitor v) {
3751 v.visitExceptionThrower(this);
3752 v.visitStackConsumer(this);
3753 v.visitStackProducer(this);
3754 v.visitTypedInstruction(this);
3755 v.visitLoadClass(this);
3756 v.visitCPInstruction(this);
3757 v.visitFieldOrMethod(this);
3758 v.visitFieldInstruction(this);
3759 v.visitGETFIELD(this);
3760 }
3761 }
3762
3763 class GETSTATIC extends FieldInstruction implements ExceptionThrower, StackProducer, PushInstruction, TypedInstruction, LoadClass {
3764 /***
3765 * Version ID for serialization.
3766 */
3767 private static final long serialVersionUID = 3258128076763510581L;
3768
3769 /***
3770 * Empty constructor needed for the Class.newInstance() statement in
3771 * Instruction.readInstruction(). Not to be used otherwise.
3772 */
3773 GETSTATIC() {}
3774
3775 public GETSTATIC(jq_StaticField f) {
3776 super(jq_ClassFileConstants.jbc_GETSTATIC, f);
3777 }
3778
3779 public int produceStack() { return getFieldSize(); }
3780
3781 /***
3782 * Read needed data (i.e., index) from file.
3783 * @param bytes input stream
3784 * @param wide wide prefix?
3785 */
3786 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
3787 o = cp.getAsStaticField((char)bytes.readUnsignedShort());
3788 length = 3;
3789 }
3790
3791 public Set
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802 return null;
3803 }
3804
3805 /***
3806 * Call corresponding visitor method(s). The order is:
3807 * Call visitor methods of implemented interfaces first, then
3808 * call methods according to the class hierarchy in descending order,
3809 * i.e., the most specific visitXXX() call comes last.
3810 *
3811 * @param v Visitor object
3812 */
3813 public void accept(Visitor v) {
3814 v.visitExceptionThrower(this);
3815 v.visitStackProducer(this);
3816 v.visitPushInstruction(this);
3817 v.visitTypedInstruction(this);
3818 v.visitLoadClass(this);
3819 v.visitCPInstruction(this);
3820 v.visitFieldOrMethod(this);
3821 v.visitFieldInstruction(this);
3822 v.visitGETSTATIC(this);
3823 }
3824 }
3825
3826 class GOTO extends GotoInstruction implements VariableLengthInstruction, UnconditionalBranch {
3827 /***
3828 * Version ID for serialization.
3829 */
3830 private static final long serialVersionUID = 3256440322019242036L;
3831
3832 /***
3833 * Empty constructor needed for the Class.newInstance() statement in
3834 * Instruction.readInstruction(). Not to be used otherwise.
3835 */
3836 GOTO() {}
3837
3838 public GOTO(InstructionHandle target) {
3839 super(jq_ClassFileConstants.jbc_GOTO, target);
3840 }
3841
3842 /***
3843 * Dump instruction as byte code to stream out.
3844 * @param out Output stream
3845 */
3846 public void dump(DataOutputStream out) throws IOException {
3847 index = getTargetOffset();
3848 if(opcode == jq_ClassFileConstants.jbc_GOTO)
3849 super.dump(out);
3850 else {
3851 index = getTargetOffset();
3852 out.writeByte(opcode);
3853 out.writeInt(index);
3854 }
3855 }
3856
3857 /*** Called in pass 2 of InstructionList.setPositions() in order to update
3858 * the branch target, that may shift due to variable length instructions.
3859 */
3860 protected int updatePosition(int offset, int max_offset) {
3861 int i = getTargetOffset();
3862
3863 position += offset;
3864
3865 if(Math.abs(i) >= (32767 - max_offset)) {
3866 opcode = jq_ClassFileConstants.jbc_GOTO_W;
3867 length = 5;
3868 return 2;
3869 }
3870
3871 return 0;
3872 }
3873
3874 /***
3875 * Call corresponding visitor method(s). The order is:
3876 * Call visitor methods of implemented interfaces first, then
3877 * call methods according to the class hierarchy in descending order,
3878 * i.e., the most specific visitXXX() call comes last.
3879 *
3880 * @param v Visitor object
3881 */
3882 public void accept(Visitor v) {
3883 v.visitVariableLengthInstruction(this);
3884 v.visitUnconditionalBranch(this);
3885 v.visitBranchInstruction(this);
3886 v.visitGotoInstruction(this);
3887 v.visitGOTO(this);
3888 }
3889 }
3890
3891 class GOTO_W extends GotoInstruction implements UnconditionalBranch {
3892 /***
3893 * Version ID for serialization.
3894 */
3895 private static final long serialVersionUID = 3689912864307884082L;
3896
3897 /***
3898 * Empty constructor needed for the Class.newInstance() statement in
3899 * Instruction.readInstruction(). Not to be used otherwise.
3900 */
3901 GOTO_W() {}
3902
3903 public GOTO_W(InstructionHandle target) {
3904 super(jq_ClassFileConstants.jbc_GOTO_W, target);
3905 length = 5;
3906 }
3907
3908 /***
3909 * Dump instruction as byte code to stream out.
3910 * @param out Output stream
3911 */
3912 public void dump(DataOutputStream out) throws IOException {
3913 index = getTargetOffset();
3914 out.writeByte(opcode);
3915 out.writeInt(index);
3916 }
3917
3918 /***
3919 * Read needed data (e.g. index) from file.
3920 */
3921 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
3922 index = bytes.readInt();
3923 length = 5;
3924 }
3925
3926 /***
3927 * Call corresponding visitor method(s). The order is:
3928 * Call visitor methods of implemented interfaces first, then
3929 * call methods according to the class hierarchy in descending order,
3930 * i.e., the most specific visitXXX() call comes last.
3931 *
3932 * @param v Visitor object
3933 */
3934 public void accept(Visitor v) {
3935 v.visitUnconditionalBranch(this);
3936 v.visitBranchInstruction(this);
3937 v.visitGotoInstruction(this);
3938 v.visitGOTO_W(this);
3939 }
3940 }
3941
3942 class I2B extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
3943 /***
3944 * Version ID for serialization.
3945 */
3946 private static final long serialVersionUID = 3257572788930885170L;
3947
3948 /***
3949 * Convert int to byte
3950 */
3951 public I2B() {
3952 super(jq_ClassFileConstants.jbc_I2B);
3953 }
3954
3955 /***
3956 * Call corresponding visitor method(s). The order is:
3957 * Call visitor methods of implemented interfaces first, then
3958 * call methods according to the class hierarchy in descending order,
3959 * i.e., the most specific visitXXX() call comes last.
3960 *
3961 * @param v Visitor object
3962 */
3963 public void accept(Visitor v) {
3964 v.visitTypedInstruction(this);
3965 v.visitStackProducer(this);
3966 v.visitStackConsumer(this);
3967 v.visitConversionInstruction(this);
3968 v.visitI2B(this);
3969 }
3970 }
3971
3972 class I2C extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
3973 /***
3974 * Version ID for serialization.
3975 */
3976 private static final long serialVersionUID = 3257009838977331257L;
3977
3978 /***
3979 * Convert int to char
3980 */
3981 public I2C() {
3982 super(jq_ClassFileConstants.jbc_I2C);
3983 }
3984
3985 /***
3986 * Call corresponding visitor method(s). The order is:
3987 * Call visitor methods of implemented interfaces first, then
3988 * call methods according to the class hierarchy in descending order,
3989 * i.e., the most specific visitXXX() call comes last.
3990 *
3991 * @param v Visitor object
3992 */
3993 public void accept(Visitor v) {
3994 v.visitTypedInstruction(this);
3995 v.visitStackProducer(this);
3996 v.visitStackConsumer(this);
3997 v.visitConversionInstruction(this);
3998 v.visitI2C(this);
3999 }
4000 }
4001
4002 class I2D extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
4003 /***
4004 * Version ID for serialization.
4005 */
4006 private static final long serialVersionUID = 3258409538788340793L;
4007
4008 /***
4009 * Convert int to double
4010 */
4011 public I2D() {
4012 super(jq_ClassFileConstants.jbc_I2D);
4013 }
4014
4015 /***
4016 * Call corresponding visitor method(s). The order is:
4017 * Call visitor methods of implemented interfaces first, then
4018 * call methods according to the class hierarchy in descending order,
4019 * i.e., the most specific visitXXX() call comes last.
4020 *
4021 * @param v Visitor object
4022 */
4023 public void accept(Visitor v) {
4024 v.visitTypedInstruction(this);
4025 v.visitStackProducer(this);
4026 v.visitStackConsumer(this);
4027 v.visitConversionInstruction(this);
4028 v.visitI2D(this);
4029 }
4030 }
4031
4032 class I2F extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
4033 /***
4034 * Version ID for serialization.
4035 */
4036 private static final long serialVersionUID = 3256720667536732721L;
4037
4038 /***
4039 * Convert int to float
4040 */
4041 public I2F() {
4042 super(jq_ClassFileConstants.jbc_I2F);
4043 }
4044
4045 /***
4046 * Call corresponding visitor method(s). The order is:
4047 * Call visitor methods of implemented interfaces first, then
4048 * call methods according to the class hierarchy in descending order,
4049 * i.e., the most specific visitXXX() call comes last.
4050 *
4051 * @param v Visitor object
4052 */
4053 public void accept(Visitor v) {
4054 v.visitTypedInstruction(this);
4055 v.visitStackProducer(this);
4056 v.visitStackConsumer(this);
4057 v.visitConversionInstruction(this);
4058 v.visitI2F(this);
4059 }
4060 }
4061
4062 class I2L extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
4063 /***
4064 * Version ID for serialization.
4065 */
4066 private static final long serialVersionUID = 3688789184748009521L;
4067
4068 /***
4069 * Convert int to long
4070 */
4071 public I2L() {
4072 super(jq_ClassFileConstants.jbc_I2L);
4073 }
4074
4075 /***
4076 * Call corresponding visitor method(s). The order is:
4077 * Call visitor methods of implemented interfaces first, then
4078 * call methods according to the class hierarchy in descending order,
4079 * i.e., the most specific visitXXX() call comes last.
4080 *
4081 * @param v Visitor object
4082 */
4083 public void accept(Visitor v) {
4084 v.visitTypedInstruction(this);
4085 v.visitStackProducer(this);
4086 v.visitStackConsumer(this);
4087 v.visitConversionInstruction(this);
4088 v.visitI2L(this);
4089 }
4090 }
4091
4092 class I2S extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
4093 /***
4094 * Version ID for serialization.
4095 */
4096 private static final long serialVersionUID = 3617573790998017588L;
4097
4098 public I2S() {
4099 super(jq_ClassFileConstants.jbc_I2S);
4100 }
4101
4102 /***
4103 * Call corresponding visitor method(s). The order is:
4104 * Call visitor methods of implemented interfaces first, then
4105 * call methods according to the class hierarchy in descending order,
4106 * i.e., the most specific visitXXX() call comes last.
4107 *
4108 * @param v Visitor object
4109 */
4110 public void accept(Visitor v) {
4111 v.visitTypedInstruction(this);
4112 v.visitStackProducer(this);
4113 v.visitStackConsumer(this);
4114 v.visitConversionInstruction(this);
4115 v.visitI2S(this);
4116 }
4117 }
4118
4119 class IADD extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
4120 /***
4121 * Version ID for serialization.
4122 */
4123 private static final long serialVersionUID = 4049919380911567408L;
4124
4125 /*** Add ints
4126 */
4127 public IADD() {
4128 super(jq_ClassFileConstants.jbc_IADD);
4129 }
4130
4131 /***
4132 * Call corresponding visitor method(s). The order is:
4133 * Call visitor methods of implemented interfaces first, then
4134 * call methods according to the class hierarchy in descending order,
4135 * i.e., the most specific visitXXX() call comes last.
4136 *
4137 * @param v Visitor object
4138 */
4139 public void accept(Visitor v) {
4140 v.visitTypedInstruction(this);
4141 v.visitStackProducer(this);
4142 v.visitStackConsumer(this);
4143 v.visitArithmeticInstruction(this);
4144 v.visitIADD(this);
4145 }
4146 }
4147
4148 class IALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
4149 /***
4150 * Version ID for serialization.
4151 */
4152 private static final long serialVersionUID = 3977866184903242032L;
4153
4154 /***
4155 * Load int from array
4156 */
4157 public IALOAD() {
4158 super(jq_ClassFileConstants.jbc_IALOAD);
4159 }
4160
4161 /***
4162 * Call corresponding visitor method(s). The order is:
4163 * Call visitor methods of implemented interfaces first, then
4164 * call methods according to the class hierarchy in descending order,
4165 * i.e., the most specific visitXXX() call comes last.
4166 *
4167 * @param v Visitor object
4168 */
4169 public void accept(Visitor v) {
4170 v.visitStackProducer(this);
4171 v.visitExceptionThrower(this);
4172 v.visitTypedInstruction(this);
4173 v.visitArrayInstruction(this);
4174 v.visitIALOAD(this);
4175 }
4176 }
4177
4178 class IAND extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
4179 /***
4180 * Version ID for serialization.
4181 */
4182 private static final long serialVersionUID = 3762250838071850548L;
4183
4184 public IAND() {
4185 super(jq_ClassFileConstants.jbc_IAND);
4186 }
4187
4188 /***
4189 * Call corresponding visitor method(s). The order is:
4190 * Call visitor methods of implemented interfaces first, then
4191 * call methods according to the class hierarchy in descending order,
4192 * i.e., the most specific visitXXX() call comes last.
4193 *
4194 * @param v Visitor object
4195 */
4196 public void accept(Visitor v) {
4197 v.visitTypedInstruction(this);
4198 v.visitStackProducer(this);
4199 v.visitStackConsumer(this);
4200 v.visitArithmeticInstruction(this);
4201 v.visitIAND(this);
4202 }
4203 }
4204
4205 class IASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
4206 /***
4207 * Version ID for serialization.
4208 */
4209 private static final long serialVersionUID = 4049070549395256631L;
4210
4211 /***
4212 * Store into int array
4213 */
4214 public IASTORE() {
4215 super(jq_ClassFileConstants.jbc_IASTORE);
4216 }
4217
4218 /***
4219 * Call corresponding visitor method(s). The order is:
4220 * Call visitor methods of implemented interfaces first, then
4221 * call methods according to the class hierarchy in descending order,
4222 * i.e., the most specific visitXXX() call comes last.
4223 *
4224 * @param v Visitor object
4225 */
4226 public void accept(Visitor v) {
4227 v.visitStackConsumer(this);
4228 v.visitExceptionThrower(this);
4229 v.visitTypedInstruction(this);
4230 v.visitArrayInstruction(this);
4231 v.visitIASTORE(this);
4232 }
4233 }
4234
4235 class ICONST extends Instruction implements PushInstruction, StackProducer, TypedInstruction, ConstantPushInstruction {
4236 /***
4237 * Version ID for serialization.
4238 */
4239 private static final long serialVersionUID = 3760844566994892595L;
4240
4241 private int value;
4242
4243 /***
4244 * Empty constructor needed for the Class.newInstance() statement in
4245 * Instruction.readInstruction(). Not to be used otherwise.
4246 */
4247 ICONST() {}
4248
4249 public ICONST(int i) {
4250 super(jq_ClassFileConstants.jbc_ICONST_0, (short)1);
4251
4252 if((i >= -1) && (i <= 5))
4253 opcode = (short)(jq_ClassFileConstants.jbc_ICONST_0 + i);
4254 else
4255 throw new BytecodeException("ICONST can be used only for value between -1 and 5: " +
4256 i);
4257 value = i;
4258 }
4259
4260 public Number getValue() { return new Integer(value); }
4261
4262 /*** @return jq_Primitive.INT
4263 */
4264 public jq_Type getType() {
4265 return jq_Primitive.INT;
4266 }
4267
4268 /***
4269 * Call corresponding visitor method(s). The order is:
4270 * Call visitor methods of implemented interfaces first, then
4271 * call methods according to the class hierarchy in descending order,
4272 * i.e., the most specific visitXXX() call comes last.
4273 *
4274 * @param v Visitor object
4275 */
4276 public void accept(Visitor v) {
4277 v.visitPushInstruction(this);
4278 v.visitStackProducer(this);
4279 v.visitTypedInstruction(this);
4280 v.visitConstantPushInstruction(this);
4281 v.visitICONST(this);
4282 }
4283 }
4284
4285 class IDIV extends ArithmeticInstruction implements ExceptionThrower, TypedInstruction, StackProducer, StackConsumer {
4286 /***
4287 * Version ID for serialization.
4288 */
4289 private static final long serialVersionUID = 3258411746401007415L;
4290
4291 /***
4292 * Divide ints
4293 */
4294 public IDIV() {
4295 super(jq_ClassFileConstants.jbc_IDIV);
4296 }
4297
4298 /*** @return exceptions this instruction may cause
4299 */
4300 public Set
4301
4302 return null;
4303 }
4304
4305 /***
4306 * Call corresponding visitor method(s). The order is:
4307 * Call visitor methods of implemented interfaces first, then
4308 * call methods according to the class hierarchy in descending order,
4309 * i.e., the most specific visitXXX() call comes last.
4310 *
4311 * @param v Visitor object
4312 */
4313 public void accept(Visitor v) {
4314 v.visitExceptionThrower(this);
4315 v.visitTypedInstruction(this);
4316 v.visitStackProducer(this);
4317 v.visitStackConsumer(this);
4318 v.visitArithmeticInstruction(this);
4319 v.visitIDIV(this);
4320 }
4321 }
4322
4323 class IF_ACMPEQ extends IfInstruction implements StackConsumer {
4324 /***
4325 * Version ID for serialization.
4326 */
4327 private static final long serialVersionUID = 3257281431267718709L;
4328
4329 /***
4330 * Empty constructor needed for the Class.newInstance() statement in
4331 * Instruction.readInstruction(). Not to be used otherwise.
4332 */
4333 IF_ACMPEQ() {}
4334
4335 public IF_ACMPEQ(InstructionHandle target) {
4336 super(jq_ClassFileConstants.jbc_IF_ACMPEQ, target);
4337 }
4338
4339 /***
4340 * @return negation of instruction
4341 */
4342 public IfInstruction negate() {
4343 return new IF_ACMPNE(target);
4344 }
4345
4346 /***
4347 * Call corresponding visitor method(s). The order is:
4348 * Call visitor methods of implemented interfaces first, then
4349 * call methods according to the class hierarchy in descending order,
4350 * i.e., the most specific visitXXX() call comes last.
4351 *
4352 * @param v Visitor object
4353 */
4354 public void accept(Visitor v) {
4355 v.visitStackConsumer(this);
4356 v.visitBranchInstruction(this);
4357 v.visitIfInstruction(this);
4358 v.visitIF_ACMPEQ(this);
4359 }
4360 }
4361
4362 class IF_ACMPNE extends IfInstruction implements StackConsumer {
4363 /***
4364 * Version ID for serialization.
4365 */
4366 private static final long serialVersionUID = 3256718502722222130L;
4367
4368 /***
4369 * Empty constructor needed for the Class.newInstance() statement in
4370 * Instruction.readInstruction(). Not to be used otherwise.
4371 */
4372 IF_ACMPNE() {}
4373
4374 public IF_ACMPNE(InstructionHandle target) {
4375 super(jq_ClassFileConstants.jbc_IF_ACMPNE, target);
4376 }
4377
4378 /***
4379 * @return negation of instruction
4380 */
4381 public IfInstruction negate() {
4382 return new IF_ACMPEQ(target);
4383 }
4384
4385 /***
4386 * Call corresponding visitor method(s). The order is:
4387 * Call visitor methods of implemented interfaces first, then
4388 * call methods according to the class hierarchy in descending order,
4389 * i.e., the most specific visitXXX() call comes last.
4390 *
4391 * @param v Visitor object
4392 */
4393 public void accept(Visitor v) {
4394 v.visitStackConsumer(this);
4395 v.visitBranchInstruction(this);
4396 v.visitIfInstruction(this);
4397 v.visitIF_ACMPNE(this);
4398 }
4399 }
4400
4401 class IFEQ extends IfInstruction implements StackConsumer {
4402 /***
4403 * Version ID for serialization.
4404 */
4405 private static final long serialVersionUID = 3906090070137058610L;
4406
4407 /***
4408 * Empty constructor needed for the Class.newInstance() statement in
4409 * Instruction.readInstruction(). Not to be used otherwise.
4410 */
4411 IFEQ() {}
4412
4413 public IFEQ(InstructionHandle target) {
4414 super(jq_ClassFileConstants.jbc_IFEQ, target);
4415 }
4416
4417 /***
4418 * @return negation of instruction, e.g. IFEQ.negate() == IFNE
4419 */
4420 public IfInstruction negate() {
4421 return new IFNE(target);
4422 }
4423
4424 /***
4425 * Call corresponding visitor method(s). The order is:
4426 * Call visitor methods of implemented interfaces first, then
4427 * call methods according to the class hierarchy in descending order,
4428 * i.e., the most specific visitXXX() call comes last.
4429 *
4430 * @param v Visitor object
4431 */
4432 public void accept(Visitor v) {
4433 v.visitStackConsumer(this);
4434 v.visitBranchInstruction(this);
4435 v.visitIfInstruction(this);
4436 v.visitIFEQ(this);
4437 }
4438 }
4439
4440 class IFGE extends IfInstruction implements StackConsumer {
4441 /***
4442 * Version ID for serialization.
4443 */
4444 private static final long serialVersionUID = 3258407335536703282L;
4445
4446 /***
4447 * Empty constructor needed for the Class.newInstance() statement in
4448 * Instruction.readInstruction(). Not to be used otherwise.
4449 */
4450 IFGE() {}
4451
4452 public IFGE(InstructionHandle target) {
4453 super(jq_ClassFileConstants.jbc_IFGE, target);
4454 }
4455
4456 /***
4457 * @return negation of instruction
4458 */
4459 public IfInstruction negate() {
4460 return new IFLT(target);
4461 }
4462
4463 /***
4464 * Call corresponding visitor method(s). The order is:
4465 * Call visitor methods of implemented interfaces first, then
4466 * call methods according to the class hierarchy in descending order,
4467 * i.e., the most specific visitXXX() call comes last.
4468 *
4469 * @param v Visitor object
4470 */
4471 public void accept(Visitor v) {
4472 v.visitStackConsumer(this);
4473 v.visitBranchInstruction(this);
4474 v.visitIfInstruction(this);
4475 v.visitIFGE(this);
4476 }
4477 }
4478
4479 class IFGT extends IfInstruction implements StackConsumer {
4480 /***
4481 * Version ID for serialization.
4482 */
4483 private static final long serialVersionUID = 3545520624970642740L;
4484
4485 /***
4486 * Empty constructor needed for the Class.newInstance() statement in
4487 * Instruction.readInstruction(). Not to be used otherwise.
4488 */
4489 IFGT() {}
4490
4491 public IFGT(InstructionHandle target) {
4492 super(jq_ClassFileConstants.jbc_IFGT, target);
4493 }
4494
4495 /***
4496 * @return negation of instruction
4497 */
4498 public IfInstruction negate() {
4499 return new IFLE(target);
4500 }
4501
4502 /***
4503 * Call corresponding visitor method(s). The order is:
4504 * Call visitor methods of implemented interfaces first, then
4505 * call methods according to the class hierarchy in descending order,
4506 * i.e., the most specific visitXXX() call comes last.
4507 *
4508 * @param v Visitor object
4509 */
4510 public void accept(Visitor v) {
4511 v.visitStackConsumer(this);
4512 v.visitBranchInstruction(this);
4513 v.visitIfInstruction(this);
4514 v.visitIFGT(this);
4515 }
4516 }
4517
4518 class IF_ICMPEQ extends IfInstruction implements StackConsumer {
4519 /***
4520 * Version ID for serialization.
4521 */
4522 private static final long serialVersionUID = 3257007652906349880L;
4523
4524 /***
4525 * Empty constructor needed for the Class.newInstance() statement in
4526 * Instruction.readInstruction(). Not to be used otherwise.
4527 */
4528 IF_ICMPEQ() {}
4529
4530 public IF_ICMPEQ(InstructionHandle target) {
4531 super(jq_ClassFileConstants.jbc_IF_ICMPEQ, target);
4532 }
4533
4534 /***
4535 * @return negation of instruction
4536 */
4537 public IfInstruction negate() {
4538 return new IF_ICMPNE(target);
4539 }
4540
4541 /***
4542 * Call corresponding visitor method(s). The order is:
4543 * Call visitor methods of implemented interfaces first, then
4544 * call methods according to the class hierarchy in descending order,
4545 * i.e., the most specific visitXXX() call comes last.
4546 *
4547 * @param v Visitor object
4548 */
4549 public void accept(Visitor v) {
4550 v.visitStackConsumer(this);
4551 v.visitBranchInstruction(this);
4552 v.visitIfInstruction(this);
4553 v.visitIF_ICMPEQ(this);
4554 }
4555 }
4556
4557 class IF_ICMPGE extends IfInstruction implements StackConsumer {
4558 /***
4559 * Version ID for serialization.
4560 */
4561 private static final long serialVersionUID = 3834586591372325176L;
4562
4563 /***
4564 * Empty constructor needed for the Class.newInstance() statement in
4565 * Instruction.readInstruction(). Not to be used otherwise.
4566 */
4567 IF_ICMPGE() {}
4568
4569 public IF_ICMPGE(InstructionHandle target) {
4570 super(jq_ClassFileConstants.jbc_IF_ICMPGE, target);
4571 }
4572
4573 /***
4574 * @return negation of instruction
4575 */
4576 public IfInstruction negate() {
4577 return new IF_ICMPLT(target);
4578 }
4579
4580 /***
4581 * Call corresponding visitor method(s). The order is:
4582 * Call visitor methods of implemented interfaces first, then
4583 * call methods according to the class hierarchy in descending order,
4584 * i.e., the most specific visitXXX() call comes last.
4585 *
4586 * @param v Visitor object
4587 */
4588 public void accept(Visitor v) {
4589 v.visitStackConsumer(this);
4590 v.visitBranchInstruction(this);
4591 v.visitIfInstruction(this);
4592 v.visitIF_ICMPGE(this);
4593 }
4594 }
4595
4596 class IF_ICMPGT extends IfInstruction implements StackConsumer {
4597 /***
4598 * Version ID for serialization.
4599 */
4600 private static final long serialVersionUID = 4051322353537726518L;
4601
4602 /***
4603 * Empty constructor needed for the Class.newInstance() statement in
4604 * Instruction.readInstruction(). Not to be used otherwise.
4605 */
4606 IF_ICMPGT() {}
4607
4608 public IF_ICMPGT(InstructionHandle target) {
4609 super(jq_ClassFileConstants.jbc_IF_ICMPGT, target);
4610 }
4611
4612 /***
4613 * @return negation of instruction
4614 */
4615 public IfInstruction negate() {
4616 return new IF_ICMPLE(target);
4617 }
4618
4619 /***
4620 * Call corresponding visitor method(s). The order is:
4621 * Call visitor methods of implemented interfaces first, then
4622 * call methods according to the class hierarchy in descending order,
4623 * i.e., the most specific visitXXX() call comes last.
4624 *
4625 * @param v Visitor object
4626 */
4627 public void accept(Visitor v) {
4628 v.visitStackConsumer(this);
4629 v.visitBranchInstruction(this);
4630 v.visitIfInstruction(this);
4631 v.visitIF_ICMPGT(this);
4632 }
4633 }
4634
4635 class IF_ICMPLE extends IfInstruction implements StackConsumer {
4636 /***
4637 * Version ID for serialization.
4638 */
4639 private static final long serialVersionUID = 3257854268169008433L;
4640
4641 /***
4642 * Empty constructor needed for the Class.newInstance() statement in
4643 * Instruction.readInstruction(). Not to be used otherwise.
4644 */
4645 IF_ICMPLE() {}
4646
4647 public IF_ICMPLE(InstructionHandle target) {
4648 super(jq_ClassFileConstants.jbc_IF_ICMPLE, target);
4649 }
4650
4651 /***
4652 * @return negation of instruction
4653 */
4654 public IfInstruction negate() {
4655 return new IF_ICMPGT(target);
4656 }
4657
4658 /***
4659 * Call corresponding visitor method(s). The order is:
4660 * Call visitor methods of implemented interfaces first, then
4661 * call methods according to the class hierarchy in descending order,
4662 * i.e., the most specific visitXXX() call comes last.
4663 *
4664 * @param v Visitor object
4665 */
4666 public void accept(Visitor v) {
4667 v.visitStackConsumer(this);
4668 v.visitBranchInstruction(this);
4669 v.visitIfInstruction(this);
4670 v.visitIF_ICMPLE(this);
4671 }
4672 }
4673
4674 class IF_ICMPLT extends IfInstruction implements StackConsumer {
4675 /***
4676 * Version ID for serialization.
4677 */
4678 private static final long serialVersionUID = 3256718481348309561L;
4679
4680 /***
4681 * Empty constructor needed for the Class.newInstance() statement in
4682 * Instruction.readInstruction(). Not to be used otherwise.
4683 */
4684 IF_ICMPLT() {}
4685
4686 public IF_ICMPLT(InstructionHandle target) {
4687 super(jq_ClassFileConstants.jbc_IF_ICMPLT, target);
4688 }
4689
4690 /***
4691 * @return negation of instruction
4692 */
4693 public IfInstruction negate() {
4694 return new IF_ICMPGE(target);
4695 }
4696
4697 /***
4698 * Call corresponding visitor method(s). The order is:
4699 * Call visitor methods of implemented interfaces first, then
4700 * call methods according to the class hierarchy in descending order,
4701 * i.e., the most specific visitXXX() call comes last.
4702 *
4703 * @param v Visitor object
4704 */
4705 public void accept(Visitor v) {
4706 v.visitStackConsumer(this);
4707 v.visitBranchInstruction(this);
4708 v.visitIfInstruction(this);
4709 v.visitIF_ICMPLT(this);
4710 }
4711 }
4712
4713 class IF_ICMPNE extends IfInstruction implements StackConsumer {
4714 /***
4715 * Version ID for serialization.
4716 */
4717 private static final long serialVersionUID = 3258131340904641584L;
4718
4719 /***
4720 * Empty constructor needed for the Class.newInstance() statement in
4721 * Instruction.readInstruction(). Not to be used otherwise.
4722 */
4723 IF_ICMPNE() {}
4724
4725 public IF_ICMPNE(InstructionHandle target) {
4726 super(jq_ClassFileConstants.jbc_IF_ICMPNE, target);
4727 }
4728
4729 /***
4730 * @return negation of instruction
4731 */
4732 public IfInstruction negate() {
4733 return new IF_ICMPEQ(target);
4734 }
4735
4736 /***
4737 * Call corresponding visitor method(s). The order is:
4738 * Call visitor methods of implemented interfaces first, then
4739 * call methods according to the class hierarchy in descending order,
4740 * i.e., the most specific visitXXX() call comes last.
4741 *
4742 * @param v Visitor object
4743 */
4744 public void accept(Visitor v) {
4745 v.visitStackConsumer(this);
4746 v.visitBranchInstruction(this);
4747 v.visitIfInstruction(this);
4748 v.visitIF_ICMPNE(this);
4749 }
4750 }
4751
4752 class IFLE extends IfInstruction implements StackConsumer {
4753 /***
4754 * Version ID for serialization.
4755 */
4756 private static final long serialVersionUID = 3545230323870021686L;
4757
4758 /***
4759 * Empty constructor needed for the Class.newInstance() statement in
4760 * Instruction.readInstruction(). Not to be used otherwise.
4761 */
4762 IFLE() {}
4763
4764 public IFLE(InstructionHandle target) {
4765 super(jq_ClassFileConstants.jbc_IFLE, target);
4766 }
4767
4768 /***
4769 * @return negation of instruction
4770 */
4771 public IfInstruction negate() {
4772 return new IFGT(target);
4773 }
4774
4775 /***
4776 * Call corresponding visitor method(s). The order is:
4777 * Call visitor methods of implemented interfaces first, then
4778 * call methods according to the class hierarchy in descending order,
4779 * i.e., the most specific visitXXX() call comes last.
4780 *
4781 * @param v Visitor object
4782 */
4783 public void accept(Visitor v) {
4784 v.visitStackConsumer(this);
4785 v.visitBranchInstruction(this);
4786 v.visitIfInstruction(this);
4787 v.visitIFLE(this);
4788 }
4789 }
4790
4791 class IFLT extends IfInstruction implements StackConsumer {
4792 /***
4793 * Version ID for serialization.
4794 */
4795 private static final long serialVersionUID = 3689345542060913718L;
4796
4797 /***
4798 * Empty constructor needed for the Class.newInstance() statement in
4799 * Instruction.readInstruction(). Not to be used otherwise.
4800 */
4801 IFLT() {}
4802
4803 public IFLT(InstructionHandle target) {
4804 super(jq_ClassFileConstants.jbc_IFLT, target);
4805 }
4806
4807 /***
4808 * @return negation of instruction
4809 */
4810 public IfInstruction negate() {
4811 return new IFGE(target);
4812 }
4813
4814 /***
4815 * Call corresponding visitor method(s). The order is:
4816 * Call visitor methods of implemented interfaces first, then
4817 * call methods according to the class hierarchy in descending order,
4818 * i.e., the most specific visitXXX() call comes last.
4819 *
4820 * @param v Visitor object
4821 */
4822 public void accept(Visitor v) {
4823 v.visitStackConsumer(this);
4824 v.visitBranchInstruction(this);
4825 v.visitIfInstruction(this);
4826 v.visitIFLT(this);
4827 }
4828 }
4829
4830 class IFNE extends IfInstruction implements StackConsumer {
4831 /***
4832 * Version ID for serialization.
4833 */
4834 private static final long serialVersionUID = 3977582476510311735L;
4835
4836 /***
4837 * Empty constructor needed for the Class.newInstance() statement in
4838 * Instruction.readInstruction(). Not to be used otherwise.
4839 */
4840 IFNE() {}
4841
4842 public IFNE(InstructionHandle target) {
4843 super(jq_ClassFileConstants.jbc_IFNE, target);
4844 }
4845
4846 /***
4847 * @return negation of instruction
4848 */
4849 public IfInstruction negate() {
4850 return new IFEQ(target);
4851 }
4852
4853 /***
4854 * Call corresponding visitor method(s). The order is:
4855 * Call visitor methods of implemented interfaces first, then
4856 * call methods according to the class hierarchy in descending order,
4857 * i.e., the most specific visitXXX() call comes last.
4858 *
4859 * @param v Visitor object
4860 */
4861 public void accept(Visitor v) {
4862 v.visitStackConsumer(this);
4863 v.visitBranchInstruction(this);
4864 v.visitIfInstruction(this);
4865 v.visitIFNE(this);
4866 }
4867 }
4868
4869 class IFNONNULL extends IfInstruction implements StackConsumer {
4870 /***
4871 * Version ID for serialization.
4872 */
4873 private static final long serialVersionUID = 3257853194460608562L;
4874
4875 /***
4876 * Empty constructor needed for the Class.newInstance() statement in
4877 * Instruction.readInstruction(). Not to be used otherwise.
4878 */
4879 IFNONNULL() {}
4880
4881 public IFNONNULL(InstructionHandle target) {
4882 super(jq_ClassFileConstants.jbc_IFNONNULL, target);
4883 }
4884
4885 /***
4886 * @return negation of instruction
4887 */
4888 public IfInstruction negate() {
4889 return new IFNULL(target);
4890 }
4891
4892 /***
4893 * Call corresponding visitor method(s). The order is:
4894 * Call visitor methods of implemented interfaces first, then
4895 * call methods according to the class hierarchy in descending order,
4896 * i.e., the most specific visitXXX() call comes last.
4897 *
4898 * @param v Visitor object
4899 */
4900 public void accept(Visitor v) {
4901 v.visitStackConsumer(this);
4902 v.visitBranchInstruction(this);
4903 v.visitIfInstruction(this);
4904 v.visitIFNONNULL(this);
4905 }
4906 }
4907
4908 class IFNULL extends IfInstruction implements StackConsumer {
4909 /***
4910 * Version ID for serialization.
4911 */
4912 private static final long serialVersionUID = 3977298824035382320L;
4913
4914 /***
4915 * Empty constructor needed for the Class.newInstance() statement in
4916 * Instruction.readInstruction(). Not to be used otherwise.
4917 */
4918 IFNULL() {}
4919
4920 public IFNULL(InstructionHandle target) {
4921 super(jq_ClassFileConstants.jbc_IFNULL, target);
4922 }
4923
4924 /***
4925 * @return negation of instruction
4926 */
4927 public IfInstruction negate() {
4928 return new IFNONNULL(target);
4929 }
4930
4931 /***
4932 * Call corresponding visitor method(s). The order is:
4933 * Call visitor methods of implemented interfaces first, then
4934 * call methods according to the class hierarchy in descending order,
4935 * i.e., the most specific visitXXX() call comes last.
4936 *
4937 * @param v Visitor object
4938 */
4939 public void accept(Visitor v) {
4940 v.visitStackConsumer(this);
4941 v.visitBranchInstruction(this);
4942 v.visitIfInstruction(this);
4943 v.visitIFNULL(this);
4944 }
4945 }
4946
4947 class IINC extends LocalVariableInstruction {
4948 /***
4949 * Version ID for serialization.
4950 */
4951 private static final long serialVersionUID = 3256441395794751798L;
4952
4953 private boolean wide;
4954 private int c;
4955
4956 /***
4957 * Empty constructor needed for the Class.newInstance() statement in
4958 * Instruction.readInstruction(). Not to be used otherwise.
4959 */
4960 IINC() {}
4961
4962 public IINC(int n, int c) {
4963 super();
4964
4965 this.opcode = jq_ClassFileConstants.jbc_IINC;
4966 this.length = (short)3;
4967
4968 setIndex(n);
4969 setIncrement(c);
4970 }
4971
4972 /***
4973 * Dump instruction as byte code to stream out.
4974 * @param out Output stream
4975 */
4976 public void dump(DataOutputStream out) throws IOException {
4977 if(wide)
4978 out.writeByte(jq_ClassFileConstants.jbc_WIDE);
4979
4980 out.writeByte(opcode);
4981
4982 if(wide) {
4983 out.writeShort(n);
4984 out.writeShort(c);
4985 } else {
4986 out.writeByte(n);
4987 out.writeByte(c);
4988 }
4989 }
4990
4991 private final void setWide() {
4992 wide = (n > Short.MAX_VALUE) ||
4993 (Math.abs(c) > Byte.MAX_VALUE);
4994 if (wide)
4995 length = 6;
4996 else
4997 length = 3;
4998 }
4999
5000 /***
5001 * Read needed data (e.g. index) from file.
5002 */
5003 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
5004 this.wide = wide;
5005
5006 if(wide) {
5007 length = 6;
5008 n = bytes.readUnsignedShort();
5009 c = bytes.readShort();
5010 } else {
5011 length = 3;
5012 n = bytes.readUnsignedByte();
5013 c = bytes.readByte();
5014 }
5015 }
5016
5017 /***
5018 * @return mnemonic for instruction
5019 */
5020 public String toString(boolean verbose) {
5021 return super.toString(verbose) + " " + c;
5022 }
5023
5024 /***
5025 * Set index of local variable.
5026 */
5027 public final void setIndex(int n) {
5028 if(n < 0)
5029 throw new BytecodeException("Negative index value: " + n);
5030
5031 this.n = n;
5032 setWide();
5033 }
5034
5035 /***
5036 * @return increment factor
5037 */
5038 public final int getIncrement() { return c; }
5039
5040 /***
5041 * Set increment factor.
5042 */
5043 public final void setIncrement(int c) {
5044 this.c = c;
5045 setWide();
5046 }
5047
5048 /*** @return jq_Primitive.INT
5049 */
5050
5051
5052
5053
5054
5055
5056 /***
5057 * Call corresponding visitor method(s). The order is:
5058 * Call visitor methods of implemented interfaces first, then
5059 * call methods according to the class hierarchy in descending order,
5060 * i.e., the most specific visitXXX() call comes last.
5061 *
5062 * @param v Visitor object
5063 */
5064 public void accept(Visitor v) {
5065 v.visitLocalVariableInstruction(this);
5066 v.visitIINC(this);
5067 }
5068 }
5069
5070 class ILOAD extends LoadInstruction {
5071 /***
5072 * Version ID for serialization.
5073 */
5074 private static final long serialVersionUID = 3257570607070983990L;
5075
5076 /***
5077 * Empty constructor needed for the Class.newInstance() statement in
5078 * Instruction.readInstruction(). Not to be used otherwise.
5079 */
5080 ILOAD() {
5081 super(jq_ClassFileConstants.jbc_ILOAD, jq_ClassFileConstants.jbc_ILOAD_0);
5082 }
5083
5084 /*** Load int from local variable
5085 * @param n index of local variable
5086 */
5087 public ILOAD(int n) {
5088 super(jq_ClassFileConstants.jbc_ILOAD, jq_ClassFileConstants.jbc_ILOAD_0, n);
5089 }
5090
5091 /***
5092 * Call corresponding visitor method(s). The order is:
5093 * Call visitor methods of implemented interfaces first, then
5094 * call methods according to the class hierarchy in descending order,
5095 * i.e., the most specific visitXXX() call comes last.
5096 *
5097 * @param v Visitor object
5098 */
5099 public void accept(Visitor v) {
5100 super.accept(v);
5101 v.visitILOAD(this);
5102 }
5103 }
5104
5105 class IMUL extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5106 /***
5107 * Version ID for serialization.
5108 */
5109 private static final long serialVersionUID = 4049078241681617461L;
5110
5111 /***
5112 * Multiply ints
5113 */
5114 public IMUL() {
5115 super(jq_ClassFileConstants.jbc_IMUL);
5116 }
5117
5118 /***
5119 * Call corresponding visitor method(s). The order is:
5120 * Call visitor methods of implemented interfaces first, then
5121 * call methods according to the class hierarchy in descending order,
5122 * i.e., the most specific visitXXX() call comes last.
5123 *
5124 * @param v Visitor object
5125 */
5126 public void accept(Visitor v) {
5127 v.visitTypedInstruction(this);
5128 v.visitStackProducer(this);
5129 v.visitStackConsumer(this);
5130 v.visitArithmeticInstruction(this);
5131 v.visitIMUL(this);
5132 }
5133 }
5134
5135 class INEG extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5136 /***
5137 * Version ID for serialization.
5138 */
5139 private static final long serialVersionUID = 3258409530181301552L;
5140
5141 public INEG() {
5142 super(jq_ClassFileConstants.jbc_INEG);
5143 }
5144
5145 /***
5146 * Call corresponding visitor method(s). The order is:
5147 * Call visitor methods of implemented interfaces first, then
5148 * call methods according to the class hierarchy in descending order,
5149 * i.e., the most specific visitXXX() call comes last.
5150 *
5151 * @param v Visitor object
5152 */
5153 public void accept(Visitor v) {
5154 v.visitTypedInstruction(this);
5155 v.visitStackProducer(this);
5156 v.visitStackConsumer(this);
5157 v.visitArithmeticInstruction(this);
5158 v.visitINEG(this);
5159 }
5160 }
5161
5162 class INSTANCEOF extends CPInstruction implements LoadClass, ExceptionThrower, StackProducer, StackConsumer, TypedInstruction {
5163 /***
5164 * Version ID for serialization.
5165 */
5166 private static final long serialVersionUID = 4121976949213574449L;
5167
5168 /***
5169 * Empty constructor needed for the Class.newInstance() statement in
5170 * Instruction.readInstruction(). Not to be used otherwise.
5171 */
5172 INSTANCEOF() {}
5173
5174 public INSTANCEOF(jq_Type f) {
5175 super(jq_ClassFileConstants.jbc_INSTANCEOF, f);
5176 }
5177
5178 public Set
5179
5180
5181
5182 return null;
5183 }
5184
5185 public jq_Class getLoadClassType() {
5186 jq_Type t = getType();
5187
5188 if(t instanceof jq_Array)
5189 t = ((jq_Array) t).getInnermostElementType();
5190
5191 return (t instanceof jq_Class)? (jq_Class) t : null;
5192 }
5193
5194 /***
5195 * Call corresponding visitor method(s). The order is:
5196 * Call visitor methods of implemented interfaces first, then
5197 * call methods according to the class hierarchy in descending order,
5198 * i.e., the most specific visitXXX() call comes last.
5199 *
5200 * @param v Visitor object
5201 */
5202 public void accept(Visitor v) {
5203 v.visitLoadClass(this);
5204 v.visitExceptionThrower(this);
5205 v.visitStackProducer(this);
5206 v.visitStackConsumer(this);
5207 v.visitTypedInstruction(this);
5208 v.visitCPInstruction(this);
5209 v.visitINSTANCEOF(this);
5210 }
5211 }
5212
5213 final class INVOKEINTERFACE extends InvokeInstruction implements ExceptionThrower, TypedInstruction, StackConsumer, StackProducer, LoadClass {
5214 /***
5215 * Version ID for serialization.
5216 */
5217 private static final long serialVersionUID = 4049633499382493239L;
5218
5219 private int nargs;
5220
5221 /***
5222 * Empty constructor needed for the Class.newInstance() statement in
5223 * Instruction.readInstruction(). Not to be used otherwise.
5224 */
5225 INVOKEINTERFACE() {}
5226
5227 public INVOKEINTERFACE(jq_Method f, int nargs) {
5228 super(jq_ClassFileConstants.jbc_INVOKEINTERFACE, f);
5229 length = 5;
5230
5231 if(nargs < 1)
5232 throw new BytecodeException("Number of arguments must be > 0 " + nargs);
5233
5234 this.nargs = nargs;
5235 }
5236
5237 /***
5238 * Dump instruction as byte code to stream out.
5239 * @param out Output stream
5240 */
5241 public void dump(DataOutputStream out) throws IOException {
5242 out.writeByte(opcode);
5243 out.writeShort(index);
5244 out.writeByte(nargs);
5245 out.writeByte(0);
5246 }
5247
5248 /***
5249 * The Java Virtual Machine Specification, First Edition was a little
5250 * bit unprecise about the naming. In the Java Virtual Machine Specification,
5251 * Second Edition, the value returned here is called "count".
5252 *
5253 * @deprecated Use getCount().
5254 */
5255 public int getNoArguments() { return nargs; }
5256
5257 /***
5258 * The <B>count</B> argument according to the Java Language Specification,
5259 * Second Edition.
5260 */
5261 public int getCount() { return nargs; }
5262
5263 /***
5264 * Read needed data (i.e., index) from file.
5265 * @param bytes input stream
5266 * @param wide wide prefix?
5267 */
5268 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
5269 o = cp.getAsInstanceMethod((char)bytes.readUnsignedShort());
5270 length = 5;
5271 nargs = bytes.readUnsignedByte();
5272 bytes.readByte();
5273 }
5274
5275 /***
5276 * @return mnemonic for instruction with symbolic references resolved
5277 */
5278 public String toString() {
5279 return super.toString() + " " + nargs;
5280 }
5281
5282 public int consumeStack() {
5283 return nargs;
5284 }
5285
5286 public Set
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300 return null;
5301 }
5302
5303 /***
5304 * Call corresponding visitor method(s). The order is:
5305 * Call visitor methods of implemented interfaces first, then
5306 * call methods according to the class hierarchy in descending order,
5307 * i.e., the most specific visitXXX() call comes last.
5308 *
5309 * @param v Visitor object
5310 */
5311 public void accept(Visitor v) {
5312 v.visitExceptionThrower(this);
5313 v.visitTypedInstruction(this);
5314 v.visitStackConsumer(this);
5315 v.visitStackProducer(this);
5316 v.visitLoadClass(this);
5317 v.visitCPInstruction(this);
5318 v.visitFieldOrMethod(this);
5319 v.visitInvokeInstruction(this);
5320 v.visitINVOKEINTERFACE(this);
5321 }
5322 }
5323
5324 class INVOKESPECIAL extends InvokeInstruction implements ExceptionThrower, TypedInstruction, StackConsumer, StackProducer, LoadClass {
5325 /***
5326 * Version ID for serialization.
5327 */
5328 private static final long serialVersionUID = 3617011949079310389L;
5329
5330 /***
5331 * Empty constructor needed for the Class.newInstance() statement in
5332 * Instruction.readInstruction(). Not to be used otherwise.
5333 */
5334 INVOKESPECIAL() {}
5335
5336 public INVOKESPECIAL(jq_Method f) {
5337 super(jq_ClassFileConstants.jbc_INVOKESPECIAL, f);
5338 }
5339
5340 /***
5341 * Read needed data (i.e., index) from file.
5342 * @param bytes input stream
5343 * @param wide wide prefix?
5344 */
5345 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
5346 o = cp.getAsInstanceMethod((char)bytes.readUnsignedShort());
5347 length = 3;
5348 }
5349
5350 public Set
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364 return null;
5365 }
5366
5367 /***
5368 * Call corresponding visitor method(s). The order is:
5369 * Call visitor methods of implemented interfaces first, then
5370 * call methods according to the class hierarchy in descending order,
5371 * i.e., the most specific visitXXX() call comes last.
5372 *
5373 * @param v Visitor object
5374 */
5375 public void accept(Visitor v) {
5376 v.visitExceptionThrower(this);
5377 v.visitTypedInstruction(this);
5378 v.visitStackConsumer(this);
5379 v.visitStackProducer(this);
5380 v.visitLoadClass(this);
5381 v.visitCPInstruction(this);
5382 v.visitFieldOrMethod(this);
5383 v.visitInvokeInstruction(this);
5384 v.visitINVOKESPECIAL(this);
5385 }
5386 }
5387
5388 class INVOKESTATIC extends InvokeInstruction implements ExceptionThrower, TypedInstruction, StackConsumer, StackProducer, LoadClass {
5389 /***
5390 * Version ID for serialization.
5391 */
5392 private static final long serialVersionUID = 3258689918497927219L;
5393
5394 /***
5395 * Empty constructor needed for the Class.newInstance() statement in
5396 * Instruction.readInstruction(). Not to be used otherwise.
5397 */
5398 INVOKESTATIC() {}
5399
5400 public INVOKESTATIC(jq_Method f) {
5401 super(jq_ClassFileConstants.jbc_INVOKESTATIC, f);
5402 }
5403
5404 /***
5405 * Read needed data (i.e., index) from file.
5406 * @param bytes input stream
5407 * @param wide wide prefix?
5408 */
5409 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
5410 o = cp.getAsStaticMethod((char)bytes.readUnsignedShort());
5411 length = 3;
5412 }
5413
5414 public Set
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426 return null;
5427 }
5428
5429 /***
5430 * Call corresponding visitor method(s). The order is:
5431 * Call visitor methods of implemented interfaces first, then
5432 * call methods according to the class hierarchy in descending order,
5433 * i.e., the most specific visitXXX() call comes last.
5434 *
5435 * @param v Visitor object
5436 */
5437 public void accept(Visitor v) {
5438 v.visitExceptionThrower(this);
5439 v.visitTypedInstruction(this);
5440 v.visitStackConsumer(this);
5441 v.visitStackProducer(this);
5442 v.visitLoadClass(this);
5443 v.visitCPInstruction(this);
5444 v.visitFieldOrMethod(this);
5445 v.visitInvokeInstruction(this);
5446 v.visitINVOKESTATIC(this);
5447 }
5448 }
5449
5450 class INVOKEVIRTUAL extends InvokeInstruction implements ExceptionThrower, TypedInstruction, StackConsumer, StackProducer, LoadClass {
5451 /***
5452 * Version ID for serialization.
5453 */
5454 private static final long serialVersionUID = 3761971579332080945L;
5455
5456 /***
5457 * Empty constructor needed for the Class.newInstance() statement in
5458 * Instruction.readInstruction(). Not to be used otherwise.
5459 */
5460 INVOKEVIRTUAL() {}
5461
5462 public INVOKEVIRTUAL(jq_Method f) {
5463 super(jq_ClassFileConstants.jbc_INVOKEVIRTUAL, f);
5464 }
5465
5466 /***
5467 * Read needed data (i.e., index) from file.
5468 * @param bytes input stream
5469 * @param wide wide prefix?
5470 */
5471 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
5472 o = cp.getAsInstanceMethod((char)bytes.readUnsignedShort());
5473 length = 3;
5474 }
5475
5476 public Set
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490 return null;
5491 }
5492
5493 /***
5494 * Call corresponding visitor method(s). The order is:
5495 * Call visitor methods of implemented interfaces first, then
5496 * call methods according to the class hierarchy in descending order,
5497 * i.e., the most specific visitXXX() call comes last.
5498 *
5499 * @param v Visitor object
5500 */
5501 public void accept(Visitor v) {
5502 v.visitExceptionThrower(this);
5503 v.visitTypedInstruction(this);
5504 v.visitStackConsumer(this);
5505 v.visitStackProducer(this);
5506 v.visitLoadClass(this);
5507 v.visitCPInstruction(this);
5508 v.visitFieldOrMethod(this);
5509 v.visitInvokeInstruction(this);
5510 v.visitINVOKEVIRTUAL(this);
5511 }
5512 }
5513
5514 class IOR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5515 /***
5516 * Version ID for serialization.
5517 */
5518 private static final long serialVersionUID = 3256441387170805305L;
5519
5520 public IOR() {
5521 super(jq_ClassFileConstants.jbc_IOR);
5522 }
5523
5524 /***
5525 * Call corresponding visitor method(s). The order is:
5526 * Call visitor methods of implemented interfaces first, then
5527 * call methods according to the class hierarchy in descending order,
5528 * i.e., the most specific visitXXX() call comes last.
5529 *
5530 * @param v Visitor object
5531 */
5532 public void accept(Visitor v) {
5533 v.visitTypedInstruction(this);
5534 v.visitStackProducer(this);
5535 v.visitStackConsumer(this);
5536 v.visitArithmeticInstruction(this);
5537 v.visitIOR(this);
5538 }
5539 }
5540
5541 class IREM extends ArithmeticInstruction implements ExceptionThrower, TypedInstruction, StackProducer, StackConsumer {
5542 /***
5543 * Version ID for serialization.
5544 */
5545 private static final long serialVersionUID = 3256446919122303286L;
5546
5547 /***
5548 * Remainder of ints
5549 */
5550 public IREM() {
5551 super(jq_ClassFileConstants.jbc_IREM);
5552 }
5553
5554 /*** @return exceptions this instruction may cause
5555 */
5556 public Set
5557
5558
5559
5560 return null;
5561 }
5562
5563 /***
5564 * Call corresponding visitor method(s). The order is:
5565 * Call visitor methods of implemented interfaces first, then
5566 * call methods according to the class hierarchy in descending order,
5567 * i.e., the most specific visitXXX() call comes last.
5568 *
5569 * @param v Visitor object
5570 */
5571 public void accept(Visitor v) {
5572 v.visitExceptionThrower(this);
5573 v.visitTypedInstruction(this);
5574 v.visitStackProducer(this);
5575 v.visitStackConsumer(this);
5576 v.visitArithmeticInstruction(this);
5577 v.visitIREM(this);
5578 }
5579 }
5580
5581 class IRETURN extends ReturnInstruction implements TypedInstruction, StackConsumer {
5582 /***
5583 * Version ID for serialization.
5584 */
5585 private static final long serialVersionUID = 3256723974544044343L;
5586
5587 /***
5588 * Return int from method
5589 */
5590 public IRETURN() {
5591 super(jq_ClassFileConstants.jbc_IRETURN);
5592 }
5593
5594 /***
5595 * Call corresponding visitor method(s). The order is:
5596 * Call visitor methods of implemented interfaces first, then
5597 * call methods according to the class hierarchy in descending order,
5598 * i.e., the most specific visitXXX() call comes last.
5599 *
5600 * @param v Visitor object
5601 */
5602 public void accept(Visitor v) {
5603 v.visitTypedInstruction(this);
5604 v.visitStackConsumer(this);
5605 v.visitReturnInstruction(this);
5606 v.visitIRETURN(this);
5607 }
5608 }
5609
5610 class ISHL extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5611 /***
5612 * Version ID for serialization.
5613 */
5614 private static final long serialVersionUID = 3257562919129396537L;
5615
5616 public ISHL() {
5617 super(jq_ClassFileConstants.jbc_ISHL);
5618 }
5619
5620 /***
5621 * Call corresponding visitor method(s). The order is:
5622 * Call visitor methods of implemented interfaces first, then
5623 * call methods according to the class hierarchy in descending order,
5624 * i.e., the most specific visitXXX() call comes last.
5625 *
5626 * @param v Visitor object
5627 */
5628 public void accept(Visitor v) {
5629 v.visitTypedInstruction(this);
5630 v.visitStackProducer(this);
5631 v.visitStackConsumer(this);
5632 v.visitArithmeticInstruction(this);
5633 v.visitISHL(this);
5634 }
5635 }
5636
5637 class ISHR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5638 /***
5639 * Version ID for serialization.
5640 */
5641 private static final long serialVersionUID = 3258408426374902576L;
5642
5643 public ISHR() {
5644 super(jq_ClassFileConstants.jbc_ISHR);
5645 }
5646
5647 /***
5648 * Call corresponding visitor method(s). The order is:
5649 * Call visitor methods of implemented interfaces first, then
5650 * call methods according to the class hierarchy in descending order,
5651 * i.e., the most specific visitXXX() call comes last.
5652 *
5653 * @param v Visitor object
5654 */
5655 public void accept(Visitor v) {
5656 v.visitTypedInstruction(this);
5657 v.visitStackProducer(this);
5658 v.visitStackConsumer(this);
5659 v.visitArithmeticInstruction(this);
5660 v.visitISHR(this);
5661 }
5662 }
5663
5664 class ISTORE extends StoreInstruction {
5665 /***
5666 * Version ID for serialization.
5667 */
5668 private static final long serialVersionUID = 3258410651234612016L;
5669
5670 /***
5671 * Empty constructor needed for the Class.newInstance() statement in
5672 * Instruction.readInstruction(). Not to be used otherwise.
5673 */
5674 ISTORE() {
5675 super(jq_ClassFileConstants.jbc_ISTORE, jq_ClassFileConstants.jbc_ISTORE_0);
5676 }
5677
5678 /*** Store int into local variable
5679 * @param n index of local variable
5680 */
5681 public ISTORE(int n) {
5682 super(jq_ClassFileConstants.jbc_ISTORE, jq_ClassFileConstants.jbc_ISTORE_0, n);
5683 }
5684
5685 /***
5686 * Call corresponding visitor method(s). The order is:
5687 * Call visitor methods of implemented interfaces first, then
5688 * call methods according to the class hierarchy in descending order,
5689 * i.e., the most specific visitXXX() call comes last.
5690 *
5691 * @param v Visitor object
5692 */
5693 public void accept(Visitor v) {
5694 super.accept(v);
5695 v.visitISTORE(this);
5696 }
5697 }
5698
5699 class ISUB extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5700 /***
5701 * Version ID for serialization.
5702 */
5703 private static final long serialVersionUID = 3256440309167632692L;
5704
5705 /***
5706 * Substract ints
5707 */
5708 public ISUB() {
5709 super(jq_ClassFileConstants.jbc_ISUB);
5710 }
5711
5712 /***
5713 * Call corresponding visitor method(s). The order is:
5714 * Call visitor methods of implemented interfaces first, then
5715 * call methods according to the class hierarchy in descending order,
5716 * i.e., the most specific visitXXX() call comes last.
5717 *
5718 * @param v Visitor object
5719 */
5720 public void accept(Visitor v) {
5721 v.visitTypedInstruction(this);
5722 v.visitStackProducer(this);
5723 v.visitStackConsumer(this);
5724 v.visitArithmeticInstruction(this);
5725 v.visitISUB(this);
5726 }
5727 }
5728
5729 class IUSHR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5730 /***
5731 * Version ID for serialization.
5732 */
5733 private static final long serialVersionUID = 3546923584611301680L;
5734
5735 public IUSHR() {
5736 super(jq_ClassFileConstants.jbc_IUSHR);
5737 }
5738
5739 /***
5740 * Call corresponding visitor method(s). The order is:
5741 * Call visitor methods of implemented interfaces first, then
5742 * call methods according to the class hierarchy in descending order,
5743 * i.e., the most specific visitXXX() call comes last.
5744 *
5745 * @param v Visitor object
5746 */
5747 public void accept(Visitor v) {
5748 v.visitTypedInstruction(this);
5749 v.visitStackProducer(this);
5750 v.visitStackConsumer(this);
5751 v.visitArithmeticInstruction(this);
5752 v.visitIUSHR(this);
5753 }
5754 }
5755
5756 class IXOR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5757 /***
5758 * Version ID for serialization.
5759 */
5760 private static final long serialVersionUID = 4121136935214724919L;
5761
5762 public IXOR() {
5763 super(jq_ClassFileConstants.jbc_IXOR);
5764 }
5765
5766 /***
5767 * Call corresponding visitor method(s). The order is:
5768 * Call visitor methods of implemented interfaces first, then
5769 * call methods according to the class hierarchy in descending order,
5770 * i.e., the most specific visitXXX() call comes last.
5771 *
5772 * @param v Visitor object
5773 */
5774 public void accept(Visitor v) {
5775 v.visitTypedInstruction(this);
5776 v.visitStackProducer(this);
5777 v.visitStackConsumer(this);
5778 v.visitArithmeticInstruction(this);
5779 v.visitIXOR(this);
5780 }
5781 }
5782
5783 class JSR extends JsrInstruction implements StackProducer, VariableLengthInstruction {
5784 /***
5785 * Version ID for serialization.
5786 */
5787 private static final long serialVersionUID = 4048789048665518649L;
5788
5789 /***
5790 * Empty constructor needed for the Class.newInstance() statement in
5791 * Instruction.readInstruction(). Not to be used otherwise.
5792 */
5793 JSR() {}
5794
5795 public JSR(InstructionHandle target) {
5796 super(jq_ClassFileConstants.jbc_JSR, target);
5797 }
5798
5799 /***
5800 * Dump instruction as byte code to stream out.
5801 * @param out Output stream
5802 */
5803 public void dump(DataOutputStream out) throws IOException {
5804 index = getTargetOffset();
5805 if(opcode == jq_ClassFileConstants.jbc_JSR)
5806 super.dump(out);
5807 else {
5808 index = getTargetOffset();
5809 out.writeByte(opcode);
5810 out.writeInt(index);
5811 }
5812 }
5813
5814 protected int updatePosition(int offset, int max_offset) {
5815 int i = getTargetOffset();
5816
5817 position += offset;
5818
5819 if(Math.abs(i) >= (32767 - max_offset)) {
5820 opcode = jq_ClassFileConstants.jbc_JSR_W;
5821 length = 5;
5822 return 2;
5823 }
5824
5825 return 0;
5826 }
5827
5828 /***
5829 * Call corresponding visitor method(s). The order is:
5830 * Call visitor methods of implemented interfaces first, then
5831 * call methods according to the class hierarchy in descending order,
5832 * i.e., the most specific visitXXX() call comes last.
5833 *
5834 * @param v Visitor object
5835 */
5836 public void accept(Visitor v) {
5837 v.visitStackProducer(this);
5838 v.visitVariableLengthInstruction(this);
5839 v.visitBranchInstruction(this);
5840 v.visitJsrInstruction(this);
5841 v.visitJSR(this);
5842 }
5843 }
5844
5845 class JSR_W extends JsrInstruction implements StackProducer {
5846 /***
5847 * Version ID for serialization.
5848 */
5849 private static final long serialVersionUID = 4050486720355185968L;
5850
5851 /***
5852 * Empty constructor needed for the Class.newInstance() statement in
5853 * Instruction.readInstruction(). Not to be used otherwise.
5854 */
5855 JSR_W() {}
5856
5857 public JSR_W(InstructionHandle target) {
5858 super(jq_ClassFileConstants.jbc_JSR_W, target);
5859 length = 5;
5860 }
5861
5862 /***
5863 * Dump instruction as byte code to stream out.
5864 * @param out Output stream
5865 */
5866 public void dump(DataOutputStream out) throws IOException {
5867 index = getTargetOffset();
5868 out.writeByte(opcode);
5869 out.writeInt(index);
5870 }
5871
5872 /***
5873 * Read needed data (e.g. index) from file.
5874 */
5875 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
5876 index = bytes.readInt();
5877 length = 5;
5878 }
5879
5880 /***
5881 * Call corresponding visitor method(s). The order is:
5882 * Call visitor methods of implemented interfaces first, then
5883 * call methods according to the class hierarchy in descending order,
5884 * i.e., the most specific visitXXX() call comes last.
5885 *
5886 * @param v Visitor object
5887 */
5888 public void accept(Visitor v) {
5889 v.visitStackProducer(this);
5890 v.visitBranchInstruction(this);
5891 v.visitJsrInstruction(this);
5892 v.visitJSR_W(this);
5893 }
5894 }
5895
5896 class L2D extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
5897 /***
5898 * Version ID for serialization.
5899 */
5900 private static final long serialVersionUID = 3257291331100227385L;
5901
5902 public L2D() {
5903 super(jq_ClassFileConstants.jbc_L2D);
5904 }
5905
5906 /***
5907 * Call corresponding visitor method(s). The order is:
5908 * Call visitor methods of implemented interfaces first, then
5909 * call methods according to the class hierarchy in descending order,
5910 * i.e., the most specific visitXXX() call comes last.
5911 *
5912 * @param v Visitor object
5913 */
5914 public void accept(Visitor v) {
5915 v.visitTypedInstruction(this);
5916 v.visitStackProducer(this);
5917 v.visitStackConsumer(this);
5918 v.visitConversionInstruction(this);
5919 v.visitL2D(this);
5920 }
5921 }
5922
5923 class L2F extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
5924 /***
5925 * Version ID for serialization.
5926 */
5927 private static final long serialVersionUID = 3834028043743409968L;
5928
5929 public L2F() {
5930 super(jq_ClassFileConstants.jbc_L2F);
5931 }
5932
5933 /***
5934 * Call corresponding visitor method(s). The order is:
5935 * Call visitor methods of implemented interfaces first, then
5936 * call methods according to the class hierarchy in descending order,
5937 * i.e., the most specific visitXXX() call comes last.
5938 *
5939 * @param v Visitor object
5940 */
5941 public void accept(Visitor v) {
5942 v.visitTypedInstruction(this);
5943 v.visitStackProducer(this);
5944 v.visitStackConsumer(this);
5945 v.visitConversionInstruction(this);
5946 v.visitL2F(this);
5947 }
5948 }
5949
5950 class L2I extends ConversionInstruction implements TypedInstruction, StackProducer, StackConsumer {
5951 /***
5952 * Version ID for serialization.
5953 */
5954 private static final long serialVersionUID = 3257283613178344503L;
5955
5956 public L2I() {
5957 super(jq_ClassFileConstants.jbc_L2I);
5958 }
5959
5960 /***
5961 * Call corresponding visitor method(s). The order is:
5962 * Call visitor methods of implemented interfaces first, then
5963 * call methods according to the class hierarchy in descending order,
5964 * i.e., the most specific visitXXX() call comes last.
5965 *
5966 * @param v Visitor object
5967 */
5968 public void accept(Visitor v) {
5969 v.visitTypedInstruction(this);
5970 v.visitStackProducer(this);
5971 v.visitStackConsumer(this);
5972 v.visitConversionInstruction(this);
5973 v.visitL2I(this);
5974 }
5975 }
5976
5977 class LADD extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
5978 /***
5979 * Version ID for serialization.
5980 */
5981 private static final long serialVersionUID = 3257003241907434544L;
5982
5983 public LADD() {
5984 super(jq_ClassFileConstants.jbc_LADD);
5985 }
5986
5987 /***
5988 * Call corresponding visitor method(s). The order is:
5989 * Call visitor methods of implemented interfaces first, then
5990 * call methods according to the class hierarchy in descending order,
5991 * i.e., the most specific visitXXX() call comes last.
5992 *
5993 * @param v Visitor object
5994 */
5995 public void accept(Visitor v) {
5996 v.visitTypedInstruction(this);
5997 v.visitStackProducer(this);
5998 v.visitStackConsumer(this);
5999 v.visitArithmeticInstruction(this);
6000 v.visitLADD(this);
6001 }
6002 }
6003
6004 class LALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
6005 /***
6006 * Version ID for serialization.
6007 */
6008 private static final long serialVersionUID = 3977016232367109688L;
6009
6010 /***
6011 * Load long from array
6012 */
6013 public LALOAD() {
6014 super(jq_ClassFileConstants.jbc_LALOAD);
6015 }
6016
6017 /***
6018 * Call corresponding visitor method(s). The order is:
6019 * Call visitor methods of implemented interfaces first, then
6020 * call methods according to the class hierarchy in descending order,
6021 * i.e., the most specific visitXXX() call comes last.
6022 *
6023 * @param v Visitor object
6024 */
6025 public void accept(Visitor v) {
6026 v.visitStackProducer(this);
6027 v.visitExceptionThrower(this);
6028 v.visitTypedInstruction(this);
6029 v.visitArrayInstruction(this);
6030 v.visitLALOAD(this);
6031 }
6032 }
6033
6034 class LAND extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6035 /***
6036 * Version ID for serialization.
6037 */
6038 private static final long serialVersionUID = 3257007670069639480L;
6039
6040 public LAND() {
6041 super(jq_ClassFileConstants.jbc_LAND);
6042 }
6043
6044 /***
6045 * Call corresponding visitor method(s). The order is:
6046 * Call visitor methods of implemented interfaces first, then
6047 * call methods according to the class hierarchy in descending order,
6048 * i.e., the most specific visitXXX() call comes last.
6049 *
6050 * @param v Visitor object
6051 */
6052 public void accept(Visitor v) {
6053 v.visitTypedInstruction(this);
6054 v.visitStackProducer(this);
6055 v.visitStackConsumer(this);
6056 v.visitArithmeticInstruction(this);
6057 v.visitLAND(this);
6058 }
6059 }
6060
6061 class LASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
6062 /***
6063 * Version ID for serialization.
6064 */
6065 private static final long serialVersionUID = 3258417235319403575L;
6066
6067 /***
6068 * Store long into array
6069 */
6070 public LASTORE() {
6071 super(jq_ClassFileConstants.jbc_LASTORE);
6072 }
6073
6074 /***
6075 * Call corresponding visitor method(s). The order is:
6076 * Call visitor methods of implemented interfaces first, then
6077 * call methods according to the class hierarchy in descending order,
6078 * i.e., the most specific visitXXX() call comes last.
6079 *
6080 * @param v Visitor object
6081 */
6082 public void accept(Visitor v) {
6083 v.visitStackConsumer(this);
6084 v.visitExceptionThrower(this);
6085 v.visitTypedInstruction(this);
6086 v.visitArrayInstruction(this);
6087 v.visitLASTORE(this);
6088 }
6089 }
6090
6091 class LCMP extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
6092 /***
6093 * Version ID for serialization.
6094 */
6095 private static final long serialVersionUID = 3544389218915923254L;
6096
6097 public LCMP() {
6098 super(jq_ClassFileConstants.jbc_LCMP, (short)1);
6099 }
6100
6101 /*** @return jq_Primitive.LONG
6102 */
6103 public jq_Type getType() {
6104 return jq_Primitive.LONG;
6105 }
6106
6107 /***
6108 * Call corresponding visitor method(s). The order is:
6109 * Call visitor methods of implemented interfaces first, then
6110 * call methods according to the class hierarchy in descending order,
6111 * i.e., the most specific visitXXX() call comes last.
6112 *
6113 * @param v Visitor object
6114 */
6115 public void accept(Visitor v) {
6116 v.visitTypedInstruction(this);
6117 v.visitStackProducer(this);
6118 v.visitStackConsumer(this);
6119 v.visitLCMP(this);
6120 }
6121 }
6122
6123 class LCONST extends Instruction implements PushInstruction, StackProducer, TypedInstruction, ConstantPushInstruction {
6124 /***
6125 * Version ID for serialization.
6126 */
6127 private static final long serialVersionUID = 4050760472946882360L;
6128
6129 private long value;
6130
6131 /***
6132 * Empty constructor needed for the Class.newInstance() statement in
6133 * Instruction.readInstruction(). Not to be used otherwise.
6134 */
6135 LCONST() {}
6136
6137 public LCONST(long l) {
6138 super(jq_ClassFileConstants.jbc_LCONST_0, (short)1);
6139
6140 if(l == 0)
6141 opcode = jq_ClassFileConstants.jbc_LCONST_0;
6142 else if(l == 1)
6143 opcode = jq_ClassFileConstants.jbc_LCONST_1;
6144 else
6145 throw new BytecodeException("LCONST can be used only for 0 and 1: " + l);
6146
6147 value = l;
6148 }
6149
6150 public Number getValue() { return new Long(value); }
6151
6152 /*** @return jq_Primitive.LONG
6153 */
6154 public jq_Type getType() {
6155 return jq_Primitive.LONG;
6156 }
6157
6158 /***
6159 * Call corresponding visitor method(s). The order is:
6160 * Call visitor methods of implemented interfaces first, then
6161 * call methods according to the class hierarchy in descending order,
6162 * i.e., the most specific visitXXX() call comes last.
6163 *
6164 * @param v Visitor object
6165 */
6166 public void accept(Visitor v) {
6167 v.visitPushInstruction(this);
6168 v.visitStackProducer(this);
6169 v.visitTypedInstruction(this);
6170 v.visitConstantPushInstruction(this);
6171 v.visitLCONST(this);
6172 }
6173 }
6174
6175 class LDC2_W extends CPInstruction implements StackProducer, PushInstruction, TypedInstruction {
6176 /***
6177 * Version ID for serialization.
6178 */
6179 private static final long serialVersionUID = 3618978966757980470L;
6180
6181 /***
6182 * Empty constructor needed for the Class.newInstance() statement in
6183 * Instruction.readInstruction(). Not to be used otherwise.
6184 */
6185 LDC2_W() {}
6186
6187 public LDC2_W(Object o) {
6188 super(jq_ClassFileConstants.jbc_LDC2_W, o);
6189 }
6190
6191 public jq_Type getType() {
6192 if (o instanceof Long) return jq_Primitive.LONG;
6193 if (o instanceof Double) return jq_Primitive.DOUBLE;
6194 throw new RuntimeException("Unknown constant type " + o.getClass());
6195 }
6196
6197 public Number getValue() {
6198 return (Number)getObject();
6199 }
6200
6201 /***
6202 * Call corresponding visitor method(s). The order is:
6203 * Call visitor methods of implemented interfaces first, then
6204 * call methods according to the class hierarchy in descending order,
6205 * i.e., the most specific visitXXX() call comes last.
6206 *
6207 * @param v Visitor object
6208 */
6209 public void accept(Visitor v) {
6210 v.visitStackProducer(this);
6211 v.visitPushInstruction(this);
6212 v.visitTypedInstruction(this);
6213 v.visitCPInstruction(this);
6214 v.visitLDC2_W(this);
6215 }
6216 }
6217
6218 class LDC extends CPInstruction implements PushInstruction, ExceptionThrower, TypedInstruction {
6219 /***
6220 * Version ID for serialization.
6221 */
6222 private static final long serialVersionUID = 3832907645656183091L;
6223
6224 /***
6225 * Empty constructor needed for the Class.newInstance() statement in
6226 * Instruction.readInstruction(). Not to be used otherwise.
6227 */
6228 LDC() {}
6229
6230 public LDC(Object o) {
6231 super(jq_ClassFileConstants.jbc_LDC_W, o);
6232 setSize();
6233 }
6234
6235
6236 protected final void setSize() {
6237 if(index <= Byte.MAX_VALUE) {
6238 opcode = jq_ClassFileConstants.jbc_LDC;
6239 length = 2;
6240 } else {
6241 opcode = jq_ClassFileConstants.jbc_LDC_W;
6242 length = 3;
6243 }
6244 }
6245
6246 /***
6247 * Dump instruction as byte code to stream out.
6248 * @param out Output stream
6249 */
6250 public void dump(DataOutputStream out) throws IOException {
6251 out.writeByte(opcode);
6252
6253 if(length == 2)
6254 out.writeByte(index);
6255 else
6256 out.writeShort(index);
6257 }
6258
6259 /***
6260 * Set the index to constant pool and adjust size.
6261 */
6262 public final void setIndex(jq_ConstantPool.ConstantPoolRebuilder cpr) {
6263 super.setIndex(cpr);
6264 setSize();
6265 }
6266
6267 /***
6268 * Read needed data (e.g. index) from file.
6269 */
6270 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
6271 char c = (char) bytes.readUnsignedByte();
6272 o = cp.get(c);
6273 if (cp.getTag(c) == (char) jq_ClassFileConstants.CONSTANT_ResolvedClass)
6274 o = Reflection.getJDKType((jq_Type) o);
6275 else
6276 o = cp.get(c);
6277 length = 2;
6278 }
6279
6280 public Object getValue() {
6281 return getObject();
6282 }
6283
6284 public jq_Type getType() {
6285 if (o instanceof String) return PrimordialClassLoader.getJavaLangString();
6286 if (o instanceof Float) return jq_Primitive.FLOAT;
6287 if (o instanceof Integer) return jq_Primitive.INT;
6288 throw new RuntimeException("Unknown or invalid constant type "+o.getClass()+" at "+index);
6289 }
6290
6291 public Set
6292
6293
6294
6295 return null;
6296 }
6297
6298 /***
6299 * Call corresponding visitor method(s). The order is:
6300 * Call visitor methods of implemented interfaces first, then
6301 * call methods according to the class hierarchy in descending order,
6302 * i.e., the most specific visitXXX() call comes last.
6303 *
6304 * @param v Visitor object
6305 */
6306 public void accept(Visitor v) {
6307 v.visitStackProducer(this);
6308 v.visitPushInstruction(this);
6309 v.visitExceptionThrower(this);
6310 v.visitTypedInstruction(this);
6311 v.visitCPInstruction(this);
6312 v.visitLDC(this);
6313 }
6314 }
6315
6316 class LDC_W extends LDC {
6317 /***
6318 * Version ID for serialization.
6319 */
6320 private static final long serialVersionUID = 3904680492002260018L;
6321
6322 /***
6323 * Empty constructor needed for the Class.newInstance() statement in
6324 * Instruction.readInstruction(). Not to be used otherwise.
6325 */
6326 LDC_W() {}
6327
6328 public LDC_W(Object o) {
6329 super(o);
6330 }
6331
6332 /***
6333 * Read needed data (i.e., index) from file.
6334 */
6335 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
6336 char c = (char) bytes.readUnsignedShort();
6337 o = cp.get(c);
6338 if (cp.getTag(c) == (char) jq_ClassFileConstants.CONSTANT_ResolvedClass)
6339 o = Reflection.getJDKType((jq_Type) o);
6340 else
6341 o = cp.get(c);
6342 length = 3;
6343 }
6344 }
6345
6346 class LDIV extends ArithmeticInstruction implements ExceptionThrower, TypedInstruction, StackProducer, StackConsumer {
6347 /***
6348 * Version ID for serialization.
6349 */
6350 private static final long serialVersionUID = 3257572793276512304L;
6351
6352 public LDIV() {
6353 super(jq_ClassFileConstants.jbc_LDIV);
6354 }
6355
6356 public Set
6357
6358
6359
6360 return null;
6361 }
6362
6363 /***
6364 * Call corresponding visitor method(s). The order is:
6365 * Call visitor methods of implemented interfaces first, then
6366 * call methods according to the class hierarchy in descending order,
6367 * i.e., the most specific visitXXX() call comes last.
6368 *
6369 * @param v Visitor object
6370 */
6371 public void accept(Visitor v) {
6372 v.visitExceptionThrower(this);
6373 v.visitTypedInstruction(this);
6374 v.visitStackProducer(this);
6375 v.visitStackConsumer(this);
6376 v.visitArithmeticInstruction(this);
6377 v.visitLDIV(this);
6378 }
6379 }
6380
6381 class LLOAD extends LoadInstruction {
6382 /***
6383 * Version ID for serialization.
6384 */
6385 private static final long serialVersionUID = 3978425823470499637L;
6386
6387 /***
6388 * Empty constructor needed for the Class.newInstance() statement in
6389 * Instruction.readInstruction(). Not to be used otherwise.
6390 */
6391 LLOAD() {
6392 super(jq_ClassFileConstants.jbc_LLOAD, jq_ClassFileConstants.jbc_LLOAD_0);
6393 }
6394
6395 public LLOAD(int n) {
6396 super(jq_ClassFileConstants.jbc_LLOAD, jq_ClassFileConstants.jbc_LLOAD_0, n);
6397 }
6398
6399 /***
6400 * Call corresponding visitor method(s). The order is:
6401 * Call visitor methods of implemented interfaces first, then
6402 * call methods according to the class hierarchy in descending order,
6403 * i.e., the most specific visitXXX() call comes last.
6404 *
6405 * @param v Visitor object
6406 */
6407 public void accept(Visitor v) {
6408 super.accept(v);
6409 v.visitLLOAD(this);
6410 }
6411 }
6412
6413 class LMUL extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6414 /***
6415 * Version ID for serialization.
6416 */
6417 private static final long serialVersionUID = 3688785869033125680L;
6418
6419 public LMUL() {
6420 super(jq_ClassFileConstants.jbc_LMUL);
6421 }
6422
6423 /***
6424 * Call corresponding visitor method(s). The order is:
6425 * Call visitor methods of implemented interfaces first, then
6426 * call methods according to the class hierarchy in descending order,
6427 * i.e., the most specific visitXXX() call comes last.
6428 *
6429 * @param v Visitor object
6430 */
6431 public void accept(Visitor v) {
6432 v.visitTypedInstruction(this);
6433 v.visitStackProducer(this);
6434 v.visitStackConsumer(this);
6435 v.visitArithmeticInstruction(this);
6436 v.visitLMUL(this);
6437 }
6438 }
6439
6440 class LNEG extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6441 /***
6442 * Version ID for serialization.
6443 */
6444 private static final long serialVersionUID = 3256725078350770736L;
6445
6446 public LNEG() {
6447 super(jq_ClassFileConstants.jbc_LNEG);
6448 }
6449
6450 /***
6451 * Call corresponding visitor method(s). The order is:
6452 * Call visitor methods of implemented interfaces first, then
6453 * call methods according to the class hierarchy in descending order,
6454 * i.e., the most specific visitXXX() call comes last.
6455 *
6456 * @param v Visitor object
6457 */
6458 public void accept(Visitor v) {
6459 v.visitTypedInstruction(this);
6460 v.visitStackProducer(this);
6461 v.visitStackConsumer(this);
6462 v.visitArithmeticInstruction(this);
6463 v.visitLNEG(this);
6464 }
6465 }
6466
6467 class LOOKUPSWITCH extends Select {
6468 /***
6469 * Version ID for serialization.
6470 */
6471 private static final long serialVersionUID = 3979268049427836981L;
6472
6473 /***
6474 * Empty constructor needed for the Class.newInstance() statement in
6475 * Instruction.readInstruction(). Not to be used otherwise.
6476 */
6477 LOOKUPSWITCH() {}
6478
6479 public LOOKUPSWITCH(int[] match, ArrayList
6480 super(jq_ClassFileConstants.jbc_LOOKUPSWITCH, match, targets, target);
6481
6482 length = (short)(9 + match_length * 8);
6483
6484 fixed_length = length;
6485 }
6486
6487 /***
6488 * Dump instruction as byte code to stream out.
6489 * @param out Output stream
6490 */
6491 public void dump(DataOutputStream out) throws IOException {
6492 super.dump(out);
6493 out.writeInt(match_length);
6494
6495 for(int i=0; i < match_length; i++) {
6496 out.writeInt(match[i]);
6497 out.writeInt(indices[i] = getTargetOffset((InstructionHandle)targets.get(i)));
6498 }
6499 }
6500
6501 /***
6502 * Read needed data (e.g. index) from file.
6503 */
6504 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
6505 super.initFromFile(cp, bytes, wide);
6506
6507 match_length = bytes.readInt();
6508 fixed_length = (short)(9 + match_length * 8);
6509 length = (short)(fixed_length + padding);
6510
6511 match = new int[match_length];
6512 indices = new int[match_length];
6513 targets = new ArrayList
6514
6515 for(int i=0; i < match_length; i++) {
6516 match[i] = bytes.readInt();
6517 indices[i] = bytes.readInt();
6518 targets.add(null);
6519 }
6520 }
6521
6522 /***
6523 * Call corresponding visitor method(s). The order is:
6524 * Call visitor methods of implemented interfaces first, then
6525 * call methods according to the class hierarchy in descending order,
6526 * i.e., the most specific visitXXX() call comes last.
6527 *
6528 * @param v Visitor object
6529 */
6530 public void accept(Visitor v) {
6531 v.visitVariableLengthInstruction(this);
6532 v.visitStackProducer(this);
6533 v.visitBranchInstruction(this);
6534 v.visitSelect(this);
6535 v.visitLOOKUPSWITCH(this);
6536 }
6537 }
6538
6539 class LOR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6540 /***
6541 * Version ID for serialization.
6542 */
6543 private static final long serialVersionUID = 3257854272497726513L;
6544
6545 public LOR() {
6546 super(jq_ClassFileConstants.jbc_LOR);
6547 }
6548
6549 /***
6550 * Call corresponding visitor method(s). The order is:
6551 * Call visitor methods of implemented interfaces first, then
6552 * call methods according to the class hierarchy in descending order,
6553 * i.e., the most specific visitXXX() call comes last.
6554 *
6555 * @param v Visitor object
6556 */
6557 public void accept(Visitor v) {
6558 v.visitTypedInstruction(this);
6559 v.visitStackProducer(this);
6560 v.visitStackConsumer(this);
6561 v.visitArithmeticInstruction(this);
6562 v.visitLOR(this);
6563 }
6564 }
6565
6566 class LREM extends ArithmeticInstruction implements ExceptionThrower, TypedInstruction, StackProducer, StackConsumer {
6567 /***
6568 * Version ID for serialization.
6569 */
6570 private static final long serialVersionUID = 3256723987479148082L;
6571
6572 public LREM() {
6573 super(jq_ClassFileConstants.jbc_LREM);
6574 }
6575
6576 public Set
6577
6578
6579
6580 return null;
6581 }
6582
6583 /***
6584 * Call corresponding visitor method(s). The order is:
6585 * Call visitor methods of implemented interfaces first, then
6586 * call methods according to the class hierarchy in descending order,
6587 * i.e., the most specific visitXXX() call comes last.
6588 *
6589 * @param v Visitor object
6590 */
6591 public void accept(Visitor v) {
6592 v.visitExceptionThrower(this);
6593 v.visitTypedInstruction(this);
6594 v.visitStackProducer(this);
6595 v.visitStackConsumer(this);
6596 v.visitArithmeticInstruction(this);
6597 v.visitLREM(this);
6598 }
6599 }
6600
6601 class LRETURN extends ReturnInstruction implements TypedInstruction, StackConsumer {
6602 /***
6603 * Version ID for serialization.
6604 */
6605 private static final long serialVersionUID = 3760561988110923576L;
6606
6607 public LRETURN() {
6608 super(jq_ClassFileConstants.jbc_LRETURN);
6609 }
6610
6611 /***
6612 * Call corresponding visitor method(s). The order is:
6613 * Call visitor methods of implemented interfaces first, then
6614 * call methods according to the class hierarchy in descending order,
6615 * i.e., the most specific visitXXX() call comes last.
6616 *
6617 * @param v Visitor object
6618 */
6619 public void accept(Visitor v) {
6620
6621 v.visitTypedInstruction(this);
6622 v.visitStackConsumer(this);
6623 v.visitReturnInstruction(this);
6624 v.visitLRETURN(this);
6625 }
6626 }
6627
6628 class LSHL extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6629 /***
6630 * Version ID for serialization.
6631 */
6632 private static final long serialVersionUID = 3256439201133310514L;
6633
6634 public LSHL() {
6635 super(jq_ClassFileConstants.jbc_LSHL);
6636 }
6637
6638 /***
6639 * Call corresponding visitor method(s). The order is:
6640 * Call visitor methods of implemented interfaces first, then
6641 * call methods according to the class hierarchy in descending order,
6642 * i.e., the most specific visitXXX() call comes last.
6643 *
6644 * @param v Visitor object
6645 */
6646 public void accept(Visitor v) {
6647 v.visitTypedInstruction(this);
6648 v.visitStackProducer(this);
6649 v.visitStackConsumer(this);
6650 v.visitArithmeticInstruction(this);
6651 v.visitLSHL(this);
6652 }
6653 }
6654
6655 class LSHR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6656 /***
6657 * Version ID for serialization.
6658 */
6659 private static final long serialVersionUID = 3258412824370688816L;
6660
6661 public LSHR() {
6662 super(jq_ClassFileConstants.jbc_LSHR);
6663 }
6664
6665 /***
6666 * Call corresponding visitor method(s). The order is:
6667 * Call visitor methods of implemented interfaces first, then
6668 * call methods according to the class hierarchy in descending order,
6669 * i.e., the most specific visitXXX() call comes last.
6670 *
6671 * @param v Visitor object
6672 */
6673 public void accept(Visitor v) {
6674 v.visitTypedInstruction(this);
6675 v.visitStackProducer(this);
6676 v.visitStackConsumer(this);
6677 v.visitArithmeticInstruction(this);
6678 v.visitLSHR(this);
6679 }
6680 }
6681
6682 class LSTORE extends StoreInstruction {
6683 /***
6684 * Version ID for serialization.
6685 */
6686 private static final long serialVersionUID = 3257566204763058230L;
6687
6688 /***
6689 * Empty constructor needed for the Class.newInstance() statement in
6690 * Instruction.readInstruction(). Not to be used otherwise.
6691 */
6692 LSTORE() {
6693 super(jq_ClassFileConstants.jbc_LSTORE, jq_ClassFileConstants.jbc_LSTORE_0);
6694 }
6695
6696 public LSTORE(int n) {
6697 super(jq_ClassFileConstants.jbc_LSTORE, jq_ClassFileConstants.jbc_LSTORE_0, n);
6698 }
6699
6700 /***
6701 * Call corresponding visitor method(s). The order is:
6702 * Call visitor methods of implemented interfaces first, then
6703 * call methods according to the class hierarchy in descending order,
6704 * i.e., the most specific visitXXX() call comes last.
6705 *
6706 * @param v Visitor object
6707 */
6708 public void accept(Visitor v) {
6709 super.accept(v);
6710 v.visitLSTORE(this);
6711 }
6712 }
6713
6714 class LSUB extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6715 /***
6716 * Version ID for serialization.
6717 */
6718 private static final long serialVersionUID = 3834874680631636793L;
6719
6720 public LSUB() {
6721 super(jq_ClassFileConstants.jbc_LSUB);
6722 }
6723
6724 /***
6725 * Call corresponding visitor method(s). The order is:
6726 * Call visitor methods of implemented interfaces first, then
6727 * call methods according to the class hierarchy in descending order,
6728 * i.e., the most specific visitXXX() call comes last.
6729 *
6730 * @param v Visitor object
6731 */
6732 public void accept(Visitor v) {
6733 v.visitTypedInstruction(this);
6734 v.visitStackProducer(this);
6735 v.visitStackConsumer(this);
6736 v.visitArithmeticInstruction(this);
6737 v.visitLSUB(this);
6738 }
6739 }
6740
6741 class LUSHR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6742 /***
6743 * Version ID for serialization.
6744 */
6745 private static final long serialVersionUID = 3258126938496316217L;
6746
6747 public LUSHR() {
6748 super(jq_ClassFileConstants.jbc_LUSHR);
6749 }
6750
6751 /***
6752 * Call corresponding visitor method(s). The order is:
6753 * Call visitor methods of implemented interfaces first, then
6754 * call methods according to the class hierarchy in descending order,
6755 * i.e., the most specific visitXXX() call comes last.
6756 *
6757 * @param v Visitor object
6758 */
6759 public void accept(Visitor v) {
6760 v.visitTypedInstruction(this);
6761 v.visitStackProducer(this);
6762 v.visitStackConsumer(this);
6763 v.visitArithmeticInstruction(this);
6764 v.visitLUSHR(this);
6765 }
6766 }
6767
6768 class LXOR extends ArithmeticInstruction implements TypedInstruction, StackProducer, StackConsumer {
6769 /***
6770 * Version ID for serialization.
6771 */
6772 private static final long serialVersionUID = 3257565126675870519L;
6773
6774 public LXOR() {
6775 super(jq_ClassFileConstants.jbc_LXOR);
6776 }
6777
6778 /***
6779 * Call corresponding visitor method(s). The order is:
6780 * Call visitor methods of implemented interfaces first, then
6781 * call methods according to the class hierarchy in descending order,
6782 * i.e., the most specific visitXXX() call comes last.
6783 *
6784 * @param v Visitor object
6785 */
6786 public void accept(Visitor v) {
6787 v.visitTypedInstruction(this);
6788 v.visitStackProducer(this);
6789 v.visitStackConsumer(this);
6790 v.visitArithmeticInstruction(this);
6791 v.visitLXOR(this);
6792 }
6793 }
6794
6795 class MONITORENTER extends Instruction implements ExceptionThrower, StackConsumer {
6796 /***
6797 * Version ID for serialization.
6798 */
6799 private static final long serialVersionUID = 3761131530872960054L;
6800
6801 public MONITORENTER() {
6802 super(jq_ClassFileConstants.jbc_MONITORENTER, (short)1);
6803 }
6804
6805 public Set
6806
6807
6808
6809 return null;
6810 }
6811
6812 /***
6813 * Call corresponding visitor method(s). The order is:
6814 * Call visitor methods of implemented interfaces first, then
6815 * call methods according to the class hierarchy in descending order,
6816 * i.e., the most specific visitXXX() call comes last.
6817 *
6818 * @param v Visitor object
6819 */
6820 public void accept(Visitor v) {
6821 v.visitExceptionThrower(this);
6822 v.visitStackConsumer(this);
6823 v.visitMONITORENTER(this);
6824 }
6825 }
6826
6827 class MONITOREXIT extends Instruction implements ExceptionThrower, StackConsumer {
6828 /***
6829 * Version ID for serialization.
6830 */
6831 private static final long serialVersionUID = 3689071746502244658L;
6832
6833 public MONITOREXIT() {
6834 super(jq_ClassFileConstants.jbc_MONITOREXIT, (short)1);
6835 }
6836
6837 public Set
6838
6839
6840
6841 return null;
6842 }
6843
6844 /***
6845 * Call corresponding visitor method(s). The order is:
6846 * Call visitor methods of implemented interfaces first, then
6847 * call methods according to the class hierarchy in descending order,
6848 * i.e., the most specific visitXXX() call comes last.
6849 *
6850 * @param v Visitor object
6851 */
6852 public void accept(Visitor v) {
6853 v.visitExceptionThrower(this);
6854 v.visitStackConsumer(this);
6855 v.visitMONITOREXIT(this);
6856 }
6857 }
6858
6859 class MULTIANEWARRAY extends CPInstruction implements AllocationInstruction, ExceptionThrower, TypedInstruction {
6860 /***
6861 * Version ID for serialization.
6862 */
6863 private static final long serialVersionUID = 4051049674586665785L;
6864
6865 private short dimensions;
6866
6867 /***
6868 * Empty constructor needed for the Class.newInstance() statement in
6869 * Instruction.readInstruction(). Not to be used otherwise.
6870 */
6871 MULTIANEWARRAY() {}
6872
6873 public MULTIANEWARRAY(jq_Type array, short dimensions) {
6874 super(jq_ClassFileConstants.jbc_MULTIANEWARRAY, array);
6875
6876 if(dimensions < 1)
6877 throw new BytecodeException("Invalid dimensions value: " + dimensions);
6878
6879 this.dimensions = dimensions;
6880 length = 4;
6881 }
6882
6883 /***
6884 * Dump instruction as byte code to stream out.
6885 * @param out Output stream
6886 */
6887 public void dump(DataOutputStream out) throws IOException {
6888 out.writeByte(opcode);
6889 out.writeShort(index);
6890 out.writeByte(dimensions);
6891 }
6892
6893 /***
6894 * Read needed data (i.e., no. dimension) from file.
6895 */
6896 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException
6897 {
6898 super.initFromFile(cp, bytes, wide);
6899 dimensions = bytes.readByte();
6900 length = 4;
6901 }
6902
6903 /***
6904 * @return number of dimensions to be created
6905 */
6906 public final short getDimensions() { return dimensions; }
6907
6908 /***
6909 * @return mnemonic for instruction
6910 */
6911 public String toString(boolean verbose) {
6912 return super.toString(verbose) + " " + index + " " + dimensions;
6913 }
6914
6915 /***
6916 * @return mnemonic for instruction with symbolic references resolved
6917 */
6918 public String toString() {
6919 return super.toString() + " " + dimensions;
6920 }
6921
6922 /***
6923 * Also works for instructions whose stack effect depends on the
6924 * constant pool entry they reference.
6925 * @return Number of words consumed from stack by this instruction
6926 */
6927 public int consumeStack() { return dimensions; }
6928
6929 public Set
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941 return null;
6942 }
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956 /***
6957 * Call corresponding visitor method(s). The order is:
6958 * Call visitor methods of implemented interfaces first, then
6959 * call methods according to the class hierarchy in descending order,
6960 * i.e., the most specific visitXXX() call comes last.
6961 *
6962 * @param v Visitor object
6963 */
6964 public void accept(Visitor v) {
6965 v.visitAllocationInstruction(this);
6966 v.visitExceptionThrower(this);
6967 v.visitTypedInstruction(this);
6968 v.visitCPInstruction(this);
6969 v.visitMULTIANEWARRAY(this);
6970 }
6971 }
6972
6973 class NEWARRAY extends Instruction implements AllocationInstruction, ExceptionThrower, StackProducer {
6974 /***
6975 * Version ID for serialization.
6976 */
6977 private static final long serialVersionUID = 3258126964265988406L;
6978
6979
6980 private transient jq_Array type;
6981
6982 /***
6983 * Empty constructor needed for the Class.newInstance() statement in
6984 * Instruction.readInstruction(). Not to be used otherwise.
6985 */
6986 NEWARRAY() {}
6987
6988 public NEWARRAY(byte type) {
6989 super(jq_ClassFileConstants.jbc_NEWARRAY, (short)2);
6990 this.type = jq_Array.getPrimitiveArrayType(type);
6991 }
6992
6993 public NEWARRAY(jq_Array type) {
6994 super(jq_ClassFileConstants.jbc_NEWARRAY, (short)2);
6995 Assert._assert(type.getElementType().isPrimitiveType());
6996 this.type = type;
6997 }
6998
6999 /***
7000 * Dump instruction as byte code to stream out.
7001 * @param out Output stream
7002 */
7003 public void dump(DataOutputStream out) throws IOException {
7004 out.writeByte(opcode);
7005 out.writeByte(jq_Array.getTypecode(type));
7006 }
7007
7008 /***
7009 * @return numeric code for basic element type
7010 */
7011 public final byte getTypecode() { return jq_Array.getTypecode(type); }
7012
7013 /***
7014 * @return type of constructed array
7015 */
7016 public final jq_Type getType() {
7017 return type;
7018 }
7019
7020 /***
7021 * @return mnemonic for instruction
7022 */
7023 public String toString(boolean verbose) {
7024 return super.toString(verbose) + " " + type;
7025 }
7026 /***
7027 * Read needed data (e.g. index) from file.
7028 */
7029 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException
7030 {
7031 type = jq_Array.getPrimitiveArrayType(bytes.readByte());
7032 length = 2;
7033 }
7034
7035 public Set
7036
7037
7038
7039 return null;
7040 }
7041
7042 /***
7043 * Call corresponding visitor method(s). The order is:
7044 * Call visitor methods of implemented interfaces first, then
7045 * call methods according to the class hierarchy in descending order,
7046 * i.e., the most specific visitXXX() call comes last.
7047 *
7048 * @param v Visitor object
7049 */
7050 public void accept(Visitor v) {
7051 v.visitAllocationInstruction(this);
7052 v.visitExceptionThrower(this);
7053 v.visitStackProducer(this);
7054 v.visitNEWARRAY(this);
7055 }
7056 }
7057
7058 class NEW extends CPInstruction implements LoadClass, AllocationInstruction, ExceptionThrower, StackProducer, TypedInstruction {
7059 /***
7060 * Version ID for serialization.
7061 */
7062 private static final long serialVersionUID = 3258694316594573877L;
7063
7064 /***
7065 * Empty constructor needed for the Class.newInstance() statement in
7066 * Instruction.readInstruction(). Not to be used otherwise.
7067 */
7068 NEW() {}
7069
7070 public NEW(jq_Type f) {
7071 super(jq_ClassFileConstants.jbc_NEW, f);
7072 }
7073
7074 public Set
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086 return null;
7087 }
7088
7089 public jq_Class getLoadClassType() {
7090 return (jq_Class)getObject();
7091 }
7092
7093 /***
7094 * Call corresponding visitor method(s). The order is:
7095 * Call visitor methods of implemented interfaces first, then
7096 * call methods according to the class hierarchy in descending order,
7097 * i.e., the most specific visitXXX() call comes last.
7098 *
7099 * @param v Visitor object
7100 */
7101 public void accept(Visitor v) {
7102 v.visitLoadClass(this);
7103 v.visitAllocationInstruction(this);
7104 v.visitExceptionThrower(this);
7105 v.visitStackProducer(this);
7106 v.visitTypedInstruction(this);
7107 v.visitCPInstruction(this);
7108 v.visitNEW(this);
7109 }
7110 }
7111
7112 class NOP extends Instruction {
7113 /***
7114 * Version ID for serialization.
7115 */
7116 private static final long serialVersionUID = 3257567299962875957L;
7117
7118 public NOP() {
7119 super(jq_ClassFileConstants.jbc_NOP, (short)1);
7120 }
7121
7122 /***
7123 * Call corresponding visitor method(s). The order is:
7124 * Call visitor methods of implemented interfaces first, then
7125 * call methods according to the class hierarchy in descending order,
7126 * i.e., the most specific visitXXX() call comes last.
7127 *
7128 * @param v Visitor object
7129 */
7130 public void accept(Visitor v) {
7131 v.visitNOP(this);
7132 }
7133 }
7134
7135 class POP2 extends StackInstruction implements PopInstruction {
7136 /***
7137 * Version ID for serialization.
7138 */
7139 private static final long serialVersionUID = 3546360617595123251L;
7140
7141 public POP2() {
7142 super(jq_ClassFileConstants.jbc_POP2);
7143 }
7144
7145 /***
7146 * Call corresponding visitor method(s). The order is:
7147 * Call visitor methods of implemented interfaces first, then
7148 * call methods according to the class hierarchy in descending order,
7149 * i.e., the most specific visitXXX() call comes last.
7150 *
7151 * @param v Visitor object
7152 */
7153 public void accept(Visitor v) {
7154 v.visitStackConsumer(this);
7155 v.visitPopInstruction(this);
7156 v.visitStackInstruction(this);
7157 v.visitPOP2(this);
7158 }
7159 }
7160
7161 class POP extends StackInstruction implements PopInstruction {
7162 /***
7163 * Version ID for serialization.
7164 */
7165 private static final long serialVersionUID = 3257002172494461239L;
7166
7167 public POP() {
7168 super(jq_ClassFileConstants.jbc_POP);
7169 }
7170
7171 /***
7172 * Call corresponding visitor method(s). The order is:
7173 * Call visitor methods of implemented interfaces first, then
7174 * call methods according to the class hierarchy in descending order,
7175 * i.e., the most specific visitXXX() call comes last.
7176 *
7177 * @param v Visitor object
7178 */
7179 public void accept(Visitor v) {
7180 v.visitStackConsumer(this);
7181 v.visitPopInstruction(this);
7182 v.visitStackInstruction(this);
7183 v.visitPOP(this);
7184 }
7185 }
7186
7187 final class PUSH implements CompoundInstruction, VariableLengthInstruction {
7188 private Instruction instruction;
7189
7190 /***
7191 * This constructor also applies for values of type short, char, byte
7192 *
7193 * @param value to be pushed
7194 */
7195 public PUSH(int value) {
7196 if((value >= -1) && (value <= 5))
7197 instruction = InstructionConstants.INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_0 + value];
7198 else if((value >= -128) && (value <= 127))
7199 instruction = new BIPUSH((byte)value);
7200 else if((value >= -32768) && (value <= 32767))
7201 instruction = new SIPUSH((short)value);
7202 else {
7203 Integer i = new Integer(value);
7204
7205 instruction = new LDC(i);
7206 }
7207 }
7208
7209 /***
7210 * @param value to be pushed
7211 */
7212 public PUSH(boolean value) {
7213 instruction = InstructionConstants.INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_0 + (value? 1 : 0)];
7214 }
7215
7216 /***
7217 * @param value to be pushed
7218 */
7219 public PUSH(float value) {
7220 if(value == 0.0)
7221 instruction = InstructionConstants.FCONST_0;
7222 else if(value == 1.0)
7223 instruction = InstructionConstants.FCONST_1;
7224 else if(value == 2.0)
7225 instruction = InstructionConstants.FCONST_2;
7226 else {
7227 Float i = new Float(value);
7228
7229 instruction = new LDC(i);
7230 }
7231 }
7232
7233 /***
7234 * @param value to be pushed
7235 */
7236 public PUSH(long value) {
7237 if(value == 0)
7238 instruction = InstructionConstants.LCONST_0;
7239 else if(value == 1)
7240 instruction = InstructionConstants.LCONST_1;
7241 else {
7242 Long i = new Long(value);
7243
7244 instruction = new LDC2_W(i);
7245 }
7246 }
7247
7248 /***
7249 * @param value to be pushed
7250 */
7251 public PUSH(double value) {
7252 if(value == 0.0)
7253 instruction = InstructionConstants.DCONST_0;
7254 else if(value == 1.0)
7255 instruction = InstructionConstants.DCONST_1;
7256 else {
7257 Double i = new Double(value);
7258
7259 instruction = new LDC2_W(i);
7260 }
7261 }
7262
7263 /***
7264 * @param value to be pushed
7265 */
7266 public PUSH(jq_ConstantPool.ConstantPoolRebuilder cpr, String value) {
7267 if(value == null)
7268 instruction = InstructionConstants.ACONST_NULL;
7269 else {
7270 cpr.addString(value);
7271 instruction = new LDC(value);
7272 }
7273 }
7274
7275 /***
7276 * @param value to be pushed
7277 */
7278 public PUSH(Number value) {
7279 if((value instanceof Integer) || (value instanceof Short) || (value instanceof Byte))
7280 instruction = new PUSH(value.intValue()).instruction;
7281 else if(value instanceof Double)
7282 instruction = new PUSH(value.doubleValue()).instruction;
7283 else if(value instanceof Float)
7284 instruction = new PUSH(value.floatValue()).instruction;
7285 else if(value instanceof Long)
7286 instruction = new PUSH(value.longValue()).instruction;
7287 else
7288 throw new BytecodeException("What's this: " + value);
7289 }
7290
7291 /***
7292 * @param value to be pushed
7293 */
7294 public PUSH(Character value) {
7295 this((int)value.charValue());
7296 }
7297
7298 /***
7299 * @param value to be pushed
7300 */
7301 public PUSH(Boolean value) {
7302 this(value.booleanValue());
7303 }
7304
7305 public final InstructionList getInstructionList() {
7306 return new InstructionList(instruction);
7307 }
7308
7309 public final Instruction getInstruction() {
7310 return instruction;
7311 }
7312
7313 /***
7314 * @return mnemonic for instruction
7315 */
7316 public String toString() {
7317 return instruction.toString() + " (PUSH)";
7318 }
7319 }
7320
7321 class PUTFIELD extends FieldInstruction implements ExceptionThrower, TypedInstruction, LoadClass {
7322 /***
7323 * Version ID for serialization.
7324 */
7325 private static final long serialVersionUID = 3257571719517777968L;
7326
7327 /***
7328 * Empty constructor needed for the Class.newInstance() statement in
7329 * Instruction.readInstruction(). Not to be used otherwise.
7330 */
7331 PUTFIELD() {}
7332
7333 public PUTFIELD(jq_InstanceField f) {
7334 super(jq_ClassFileConstants.jbc_PUTFIELD, f);
7335 }
7336
7337 public int consumeStack() { return getFieldSize() + 1; }
7338
7339 /***
7340 * Read needed data (i.e., index) from file.
7341 * @param bytes input stream
7342 * @param wide wide prefix?
7343 */
7344 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
7345 o = cp.getAsInstanceField((char)bytes.readUnsignedShort());
7346 length = 3;
7347 }
7348
7349 public Set
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363 return null;
7364 }
7365
7366 /***
7367 * Call corresponding visitor method(s). The order is:
7368 * Call visitor methods of implemented interfaces first, then
7369 * call methods according to the class hierarchy in descending order,
7370 * i.e., the most specific visitXXX() call comes last.
7371 *
7372 * @param v Visitor object
7373 */
7374 public void accept(Visitor v) {
7375 v.visitExceptionThrower(this);
7376 v.visitTypedInstruction(this);
7377 v.visitLoadClass(this);
7378 v.visitCPInstruction(this);
7379 v.visitFieldOrMethod(this);
7380 v.visitFieldInstruction(this);
7381 v.visitPUTFIELD(this);
7382 }
7383 }
7384
7385 class PUTSTATIC extends FieldInstruction implements ExceptionThrower, StackConsumer, PopInstruction, TypedInstruction, LoadClass {
7386 /***
7387 * Version ID for serialization.
7388 */
7389 private static final long serialVersionUID = 3833745473583462711L;
7390
7391 /***
7392 * Empty constructor needed for the Class.newInstance() statement in
7393 * Instruction.readInstruction(). Not to be used otherwise.
7394 */
7395 PUTSTATIC() {}
7396
7397 public PUTSTATIC(jq_StaticField f) {
7398 super(jq_ClassFileConstants.jbc_PUTSTATIC, f);
7399 }
7400
7401 public int consumeStack() { return getFieldSize(); }
7402
7403 /***
7404 * Read needed data (i.e., index) from file.
7405 * @param bytes input stream
7406 * @param wide wide prefix?
7407 */
7408 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
7409 o = cp.getAsStaticField((char)bytes.readUnsignedShort());
7410 length = 3;
7411 }
7412
7413 public Set
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424 return null;
7425 }
7426
7427 /***
7428 * Call corresponding visitor method(s). The order is:
7429 * Call visitor methods of implemented interfaces first, then
7430 * call methods according to the class hierarchy in descending order,
7431 * i.e., the most specific visitXXX() call comes last.
7432 *
7433 * @param v Visitor object
7434 */
7435 public void accept(Visitor v) {
7436 v.visitExceptionThrower(this);
7437 v.visitStackConsumer(this);
7438 v.visitPopInstruction(this);
7439 v.visitTypedInstruction(this);
7440 v.visitLoadClass(this);
7441 v.visitCPInstruction(this);
7442 v.visitFieldOrMethod(this);
7443 v.visitFieldInstruction(this);
7444 v.visitPUTSTATIC(this);
7445 }
7446 }
7447
7448 class RET extends Instruction implements IndexedInstruction, TypedInstruction {
7449 /***
7450 * Version ID for serialization.
7451 */
7452 private static final long serialVersionUID = 3905525986396092729L;
7453
7454 private boolean wide;
7455 private int index;
7456
7457 /***
7458 * Empty constructor needed for the Class.newInstance() statement in
7459 * Instruction.readInstruction(). Not to be used otherwise.
7460 */
7461 RET() {}
7462
7463 public RET(int index) {
7464 super(jq_ClassFileConstants.jbc_RET, (short)2);
7465 setIndex(index);
7466 }
7467
7468 /***
7469 * Dump instruction as byte code to stream out.
7470 * @param out Output stream
7471 */
7472 public void dump(DataOutputStream out) throws IOException {
7473 if(wide)
7474 out.writeByte(jq_ClassFileConstants.jbc_WIDE);
7475
7476 out.writeByte(opcode);
7477
7478 if(wide)
7479 out.writeShort(index);
7480 else
7481 out.writeByte(index);
7482 }
7483
7484 private final void setWide() {
7485 wide = index > Byte.MAX_VALUE;
7486 if (wide)
7487 length = 4;
7488 else
7489 length = 2;
7490 }
7491
7492 /***
7493 * Read needed data (e.g. index) from file.
7494 */
7495 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
7496 this.wide = wide;
7497
7498 if(wide) {
7499 index = bytes.readUnsignedShort();
7500 length = 4;
7501 } else {
7502 index = bytes.readUnsignedByte();
7503 length = 2;
7504 }
7505 }
7506
7507 /***
7508 * @return index of local variable containg the return address
7509 */
7510 public final int getIndex() { return index; }
7511
7512 /***
7513 * Set index of local variable containg the return address
7514 */
7515 public final void setIndex(int n) {
7516 if(n < 0)
7517 throw new BytecodeException("Negative index value: " + n);
7518
7519 index = n;
7520 setWide();
7521 }
7522
7523 /***
7524 * @return mnemonic for instruction
7525 */
7526 public String toString(boolean verbose) {
7527 return super.toString(verbose) + " " + index;
7528 }
7529
7530 /*** @return return address type
7531 */
7532 public jq_Type getType() {
7533 return jq_ReturnAddressType.NO_TARGET;
7534 }
7535
7536 /***
7537 * Call corresponding visitor method(s). The order is:
7538 * Call visitor methods of implemented interfaces first, then
7539 * call methods according to the class hierarchy in descending order,
7540 * i.e., the most specific visitXXX() call comes last.
7541 *
7542 * @param v Visitor object
7543 */
7544 public void accept(Visitor v) {
7545 v.visitTypedInstruction(this);
7546 v.visitRET(this);
7547 }
7548 }
7549
7550 class RETURN extends ReturnInstruction implements TypedInstruction, StackConsumer {
7551 /***
7552 * Version ID for serialization.
7553 */
7554 private static final long serialVersionUID = 3904958664166290739L;
7555
7556 public RETURN() {
7557 super(jq_ClassFileConstants.jbc_RETURN);
7558 }
7559
7560 /***
7561 * Call corresponding visitor method(s). The order is:
7562 * Call visitor methods of implemented interfaces first, then
7563 * call methods according to the class hierarchy in descending order,
7564 * i.e., the most specific visitXXX() call comes last.
7565 *
7566 * @param v Visitor object
7567 */
7568 public void accept(Visitor v) {
7569 v.visitTypedInstruction(this);
7570 v.visitStackConsumer(this);
7571 v.visitReturnInstruction(this);
7572 v.visitRETURN(this);
7573 }
7574 }
7575
7576 class SALOAD extends ArrayInstruction implements StackProducer, ExceptionThrower, TypedInstruction {
7577 /***
7578 * Version ID for serialization.
7579 */
7580 private static final long serialVersionUID = 3905518285402616886L;
7581
7582 public SALOAD() {
7583 super(jq_ClassFileConstants.jbc_SALOAD);
7584 }
7585
7586 /***
7587 * Call corresponding visitor method(s). The order is:
7588 * Call visitor methods of implemented interfaces first, then
7589 * call methods according to the class hierarchy in descending order,
7590 * i.e., the most specific visitXXX() call comes last.
7591 *
7592 * @param v Visitor object
7593 */
7594 public void accept(Visitor v) {
7595 v.visitStackProducer(this);
7596 v.visitExceptionThrower(this);
7597 v.visitTypedInstruction(this);
7598 v.visitArrayInstruction(this);
7599 v.visitSALOAD(this);
7600 }
7601 }
7602
7603 class SASTORE extends ArrayInstruction implements StackConsumer, ExceptionThrower, TypedInstruction {
7604 /***
7605 * Version ID for serialization.
7606 */
7607 private static final long serialVersionUID = 3257284716884538421L;
7608
7609 public SASTORE() {
7610 super(jq_ClassFileConstants.jbc_SASTORE);
7611 }
7612
7613 /***
7614 * Call corresponding visitor method(s). The order is:
7615 * Call visitor methods of implemented interfaces first, then
7616 * call methods according to the class hierarchy in descending order,
7617 * i.e., the most specific visitXXX() call comes last.
7618 *
7619 * @param v Visitor object
7620 */
7621 public void accept(Visitor v) {
7622 v.visitStackConsumer(this);
7623 v.visitExceptionThrower(this);
7624 v.visitTypedInstruction(this);
7625 v.visitArrayInstruction(this);
7626 v.visitSASTORE(this);
7627 }
7628 }
7629
7630 class SIPUSH extends Instruction implements PushInstruction, StackProducer, TypedInstruction, ConstantPushInstruction {
7631 /***
7632 * Version ID for serialization.
7633 */
7634 private static final long serialVersionUID = 3978422512050845237L;
7635
7636 private short b;
7637
7638 /***
7639 * Empty constructor needed for the Class.newInstance() statement in
7640 * Instruction.readInstruction(). Not to be used otherwise.
7641 */
7642 SIPUSH() {}
7643
7644 public SIPUSH(short b) {
7645 super(jq_ClassFileConstants.jbc_SIPUSH, (short)3);
7646 this.b = b;
7647 }
7648
7649 /***
7650 * Dump instruction as short code to stream out.
7651 */
7652 public void dump(DataOutputStream out) throws IOException {
7653 super.dump(out);
7654 out.writeShort(b);
7655 }
7656
7657 /***
7658 * @return mnemonic for instruction
7659 */
7660 public String toString(boolean verbose) {
7661 return super.toString(verbose) + " " + b;
7662 }
7663
7664 /***
7665 * Read needed data (e.g. index) from file.
7666 */
7667 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException
7668 {
7669 length = 3;
7670 b = bytes.readShort();
7671 }
7672
7673 public Number getValue() { return new Integer(b); }
7674
7675 /*** @return jq_Primitive.SHORT
7676 */
7677 public jq_Type getType() {
7678 return jq_Primitive.SHORT;
7679 }
7680
7681 /***
7682 * Call corresponding visitor method(s). The order is:
7683 * Call visitor methods of implemented interfaces first, then
7684 * call methods according to the class hierarchy in descending order,
7685 * i.e., the most specific visitXXX() call comes last.
7686 *
7687 * @param v Visitor object
7688 */
7689 public void accept(Visitor v) {
7690 v.visitPushInstruction(this);
7691 v.visitStackProducer(this);
7692 v.visitTypedInstruction(this);
7693 v.visitConstantPushInstruction(this);
7694 v.visitSIPUSH(this);
7695 }
7696 }
7697
7698 class SWAP extends StackInstruction implements StackConsumer, StackProducer {
7699 /***
7700 * Version ID for serialization.
7701 */
7702 private static final long serialVersionUID = 3257008743760803633L;
7703
7704 public SWAP() {
7705 super(jq_ClassFileConstants.jbc_SWAP);
7706 }
7707
7708 /***
7709 * Call corresponding visitor method(s). The order is:
7710 * Call visitor methods of implemented interfaces first, then
7711 * call methods according to the class hierarchy in descending order,
7712 * i.e., the most specific visitXXX() call comes last.
7713 *
7714 * @param v Visitor object
7715 */
7716 public void accept(Visitor v) {
7717 v.visitStackConsumer(this);
7718 v.visitStackProducer(this);
7719 v.visitStackInstruction(this);
7720 v.visitSWAP(this);
7721 }
7722 }
7723
7724 final class SWITCH implements CompoundInstruction {
7725 private int[] match;
7726 private ArrayList
7727 private Select instruction;
7728 private int match_length;
7729
7730 /***
7731 * Template for switch() constructs. If the match array can be
7732 * sorted in ascending order with gaps no larger than max_gap
7733 * between the numbers, a TABLESWITCH instruction is generated, and
7734 * a LOOKUPSWITCH otherwise. The former may be more efficient, but
7735 * needs more space.
7736 *
7737 * Note, that the key array always will be sorted, though we leave
7738 * the original arrays unaltered.
7739 *
7740 * @param match array of match values (case 2: ... case 7: ..., etc.)
7741 * @param targets the instructions to be branched to for each case
7742 * @param target the default target
7743 * @param max_gap maximum gap that may between case branches
7744 */
7745 public SWITCH(int[] match, ArrayList
7746 this.match = (int[])match.clone();
7747 this.targets = (ArrayList
7748
7749 if((match_length = match.length) < 2)
7750 instruction = new TABLESWITCH(match, targets, target);
7751 else {
7752 sort(0, match_length - 1);
7753
7754 if(matchIsOrdered(max_gap)) {
7755 fillup(max_gap, target);
7756
7757 instruction = new TABLESWITCH(this.match, this.targets, target);
7758 }
7759 else
7760 instruction = new LOOKUPSWITCH(this.match, this.targets, target);
7761 }
7762 }
7763
7764 public SWITCH(int[] match, ArrayList
7765 this(match, targets, target, 1);
7766 }
7767
7768 private final void fillup(int max_gap, InstructionHandle target) {
7769 int max_size = match_length + match_length * max_gap;
7770 int[] m_vec = new int[max_size];
7771 ArrayList
7772 int count = 1;
7773
7774 m_vec[0] = match[0];
7775 t_vec.add(targets.get(0));
7776
7777 for(int i=1; i < match_length; i++) {
7778 int prev = match[i-1];
7779 int gap = match[i] - prev;
7780
7781 for(int j=1; j < gap; j++) {
7782 m_vec[count] = prev + j;
7783 t_vec.add(target);
7784 count++;
7785 }
7786
7787 m_vec[count] = match[i];
7788 t_vec.add(targets.get(i));
7789 count++;
7790 }
7791
7792 match = new int[count];
7793 System.arraycopy(m_vec, 0, match, 0, count);
7794
7795 targets = t_vec;
7796 t_vec.trimToSize();
7797 }
7798
7799 /***
7800 * Sort match and targets array with QuickSort.
7801 */
7802 private final void sort(int l, int r) {
7803 int i = l, j = r;
7804 int h, m = match[(l + r) / 2];
7805 Object h2;
7806
7807 do {
7808 while(match[i] < m) i++;
7809 while(m < match[j]) j--;
7810
7811 if(i <= j) {
7812 h=match[i]; match[i]=match[j]; match[j]=h;
7813 h2=targets.get(i); targets.set(i, targets.get(j)); targets.set(j, h2);
7814 i++; j--;
7815 }
7816 } while(i <= j);
7817
7818 if(l < j) sort(l, j);
7819 if(i < r) sort(i, r);
7820 }
7821
7822 /***
7823 * @return match is sorted in ascending order with no gap bigger than max_gap?
7824 */
7825 private final boolean matchIsOrdered(int max_gap) {
7826 for(int i=1; i < match_length; i++)
7827 if(match[i] - match[i-1] > max_gap)
7828 return false;
7829
7830 return true;
7831 }
7832
7833 public final InstructionList getInstructionList() {
7834 return new InstructionList(instruction);
7835 }
7836
7837 public final Instruction getInstruction() {
7838 return instruction;
7839 }
7840 }
7841
7842 class TABLESWITCH extends Select implements VariableLengthInstruction, StackProducer {
7843 /***
7844 * Version ID for serialization.
7845 */
7846 private static final long serialVersionUID = 3257286937416250672L;
7847
7848 /***
7849 * Empty constructor needed for the Class.newInstance() statement in
7850 * Instruction.readInstruction(). Not to be used otherwise.
7851 */
7852 TABLESWITCH() {}
7853
7854 /***
7855 * @param match sorted array of match values, match[0] must be low value,
7856 * match[match_length - 1] high value
7857 * @param targets where to branch for matched values
7858 * @param target default branch
7859 */
7860 public TABLESWITCH(int[] match, ArrayList
7861 super(jq_ClassFileConstants.jbc_TABLESWITCH, match, targets, target);
7862
7863 length = (short)(13 + match_length * 4);
7864
7865 fixed_length = length;
7866 }
7867
7868 /***
7869 * Dump instruction as byte code to stream out.
7870 * @param out Output stream
7871 */
7872 public void dump(DataOutputStream out) throws IOException {
7873 super.dump(out);
7874
7875 int low = (match_length > 0)? match[0] : 0;
7876 out.writeInt(low);
7877
7878 int high = (match_length > 0)? match[match_length - 1] : 0;
7879 out.writeInt(high);
7880
7881 for(int i=0; i < match_length; i++)
7882 out.writeInt(indices[i] = getTargetOffset((InstructionHandle)targets.get(i)));
7883 }
7884
7885 /***
7886 * Read needed data (e.g. index) from file.
7887 */
7888 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException
7889 {
7890 super.initFromFile(cp, bytes, wide);
7891
7892 int low = bytes.readInt();
7893 int high = bytes.readInt();
7894
7895 match_length = high - low + 1;
7896 fixed_length = (short)(13 + match_length * 4);
7897 length = (short)(fixed_length + padding);
7898
7899 match = new int[match_length];
7900 indices = new int[match_length];
7901 targets = new ArrayList
7902
7903 for(int i=low; i <= high; i++)
7904 match[i - low] = i;
7905
7906 for(int i=0; i < match_length; i++) {
7907 indices[i] = bytes.readInt();
7908 targets.add(null);
7909 }
7910 }
7911
7912 /***
7913 * Call corresponding visitor method(s). The order is:
7914 * Call visitor methods of implemented interfaces first, then
7915 * call methods according to the class hierarchy in descending order,
7916 * i.e., the most specific visitXXX() call comes last.
7917 *
7918 * @param v Visitor object
7919 */
7920 public void accept(Visitor v) {
7921 v.visitVariableLengthInstruction(this);
7922 v.visitStackProducer(this);
7923 v.visitBranchInstruction(this);
7924 v.visitSelect(this);
7925 v.visitTABLESWITCH(this);
7926 }
7927 }
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969 interface AllocationInstruction {}
7970
7971 abstract class ArithmeticInstruction extends Instruction
7972 implements TypedInstruction, StackProducer, StackConsumer {
7973 /***
7974 * Empty constructor needed for the Class.newInstance() statement in
7975 * Instruction.readInstruction(). Not to be used otherwise.
7976 */
7977 ArithmeticInstruction() {}
7978
7979 /***
7980 * @param opcode of instruction
7981 */
7982 protected ArithmeticInstruction(short opcode) {
7983 super(opcode, (short)1);
7984 }
7985
7986 /*** @return type associated with the instruction
7987 */
7988 public jq_Type getType() {
7989 switch(opcode) {
7990 case jq_ClassFileConstants.jbc_DADD: case jq_ClassFileConstants.jbc_DDIV: case jq_ClassFileConstants.jbc_DMUL:
7991 case jq_ClassFileConstants.jbc_DNEG: case jq_ClassFileConstants.jbc_DREM: case jq_ClassFileConstants.jbc_DSUB:
7992 return jq_Primitive.DOUBLE;
7993
7994 case jq_ClassFileConstants.jbc_FADD: case jq_ClassFileConstants.jbc_FDIV: case jq_ClassFileConstants.jbc_FMUL:
7995 case jq_ClassFileConstants.jbc_FNEG: case jq_ClassFileConstants.jbc_FREM: case jq_ClassFileConstants.jbc_FSUB:
7996 return jq_Primitive.FLOAT;
7997
7998 case jq_ClassFileConstants.jbc_IADD: case jq_ClassFileConstants.jbc_IAND: case jq_ClassFileConstants.jbc_IDIV:
7999 case jq_ClassFileConstants.jbc_IMUL: case jq_ClassFileConstants.jbc_INEG: case jq_ClassFileConstants.jbc_IOR: case jq_ClassFileConstants.jbc_IREM:
8000 case jq_ClassFileConstants.jbc_ISHL: case jq_ClassFileConstants.jbc_ISHR: case jq_ClassFileConstants.jbc_ISUB:
8001 case jq_ClassFileConstants.jbc_IUSHR: case jq_ClassFileConstants.jbc_IXOR:
8002 return jq_Primitive.INT;
8003
8004 case jq_ClassFileConstants.jbc_LADD: case jq_ClassFileConstants.jbc_LAND: case jq_ClassFileConstants.jbc_LDIV:
8005 case jq_ClassFileConstants.jbc_LMUL: case jq_ClassFileConstants.jbc_LNEG: case jq_ClassFileConstants.jbc_LOR: case jq_ClassFileConstants.jbc_LREM:
8006 case jq_ClassFileConstants.jbc_LSHL: case jq_ClassFileConstants.jbc_LSHR: case jq_ClassFileConstants.jbc_LSUB:
8007 case jq_ClassFileConstants.jbc_LUSHR: case jq_ClassFileConstants.jbc_LXOR:
8008 return jq_Primitive.LONG;
8009
8010 default:
8011 throw new BytecodeException("Unknown type " + opcode);
8012 }
8013 }
8014 }
8015
8016 abstract class ArrayInstruction extends Instruction implements ExceptionThrower, TypedInstruction {
8017 /***
8018 * Empty constructor needed for the Class.newInstance() statement in
8019 * Instruction.readInstruction(). Not to be used otherwise.
8020 */
8021 ArrayInstruction() {}
8022
8023 /***
8024 * @param opcode of instruction
8025 */
8026 protected ArrayInstruction(short opcode) {
8027 super(opcode, (short)1);
8028 }
8029
8030 public Set
8031
8032
8033
8034 return null;
8035 }
8036
8037 /*** @return type associated with the instruction
8038 */
8039 public jq_Type getType() {
8040 switch(opcode) {
8041 case jq_ClassFileConstants.jbc_IALOAD: case jq_ClassFileConstants.jbc_IASTORE:
8042 return jq_Primitive.INT;
8043 case jq_ClassFileConstants.jbc_CALOAD: case jq_ClassFileConstants.jbc_CASTORE:
8044 return jq_Primitive.CHAR;
8045 case jq_ClassFileConstants.jbc_BALOAD: case jq_ClassFileConstants.jbc_BASTORE:
8046 return jq_Primitive.BYTE;
8047 case jq_ClassFileConstants.jbc_SALOAD: case jq_ClassFileConstants.jbc_SASTORE:
8048 return jq_Primitive.SHORT;
8049 case jq_ClassFileConstants.jbc_LALOAD: case jq_ClassFileConstants.jbc_LASTORE:
8050 return jq_Primitive.LONG;
8051 case jq_ClassFileConstants.jbc_DALOAD: case jq_ClassFileConstants.jbc_DASTORE:
8052 return jq_Primitive.DOUBLE;
8053 case jq_ClassFileConstants.jbc_FALOAD: case jq_ClassFileConstants.jbc_FASTORE:
8054 return jq_Primitive.FLOAT;
8055 case jq_ClassFileConstants.jbc_AALOAD: case jq_ClassFileConstants.jbc_AASTORE:
8056 return PrimordialClassLoader.getJavaLangObject();
8057
8058 default: throw new BytecodeException("Oops: unknown case in switch" + opcode);
8059 }
8060 }
8061 }
8062
8063 abstract class BranchInstruction extends Instruction implements InstructionTargeter {
8064 protected int index;
8065 protected InstructionHandle target;
8066 protected int position;
8067
8068 /***
8069 * Empty constructor needed for the Class.newInstance() statement in
8070 * Instruction.readInstruction(). Not to be used otherwise.
8071 */
8072 BranchInstruction() {}
8073
8074 /*** Common super constructor.
8075 * @param opcode instruction opcode
8076 * @param target instruction to branch to
8077 */
8078 protected BranchInstruction(short opcode, InstructionHandle target) {
8079 super(opcode, (short)3);
8080 setTarget(target);
8081 }
8082
8083 /***
8084 * Dump instruction as byte code to stream out.
8085 * @param out Output stream
8086 */
8087 public void dump(DataOutputStream out) throws IOException {
8088 out.writeByte(opcode);
8089
8090 index = getTargetOffset();
8091
8092 if(Math.abs(index) >= 32767)
8093 throw new BytecodeException("Branch target offset too large for short");
8094
8095 out.writeShort(index);
8096 }
8097
8098 /***
8099 * @param target branch target
8100 * @return the offset to `target' relative to this instruction
8101 */
8102 protected int getTargetOffset(InstructionHandle target) {
8103 if(target == null)
8104 throw new BytecodeException("Target of " + super.toString(true) +
8105 " is invalid null handle");
8106
8107 int t = target.getPosition();
8108
8109 if(t < 0)
8110 throw new BytecodeException("Invalid branch target position offset for " +
8111 super.toString(true) + ":" + t + ":" + target);
8112
8113 return t - position;
8114 }
8115
8116 /***
8117 * @return the offset to this instruction's target
8118 */
8119 protected int getTargetOffset() { return getTargetOffset(target); }
8120
8121 /***
8122 * Called by InstructionList.setPositions when setting the position for every
8123 * instruction. In the presence of variable length instructions `setPositions'
8124 * performs multiple passes over the instruction list to calculate the
8125 * correct (byte) positions and offsets by calling this function.
8126 *
8127 * @param offset additional offset caused by preceding (variable length) instructions
8128 * @param max_offset the maximum offset that may be caused by these instructions
8129 * @return additional offset caused by possible change of this instruction's length
8130 */
8131 protected int updatePosition(int offset, int max_offset) {
8132 position += offset;
8133 return 0;
8134 }
8135
8136 /***
8137 * Long output format:
8138 *
8139 * <position in byte code>
8140 * <name of opcode> "["<opcode number>"]"
8141 * "("<length of instruction>")"
8142 * "<"<target instruction>">" "@"<branch target offset>
8143 *
8144 * @param verbose long/short format switch
8145 * @return mnemonic for instruction
8146 */
8147 public String toString(boolean verbose) {
8148 String s = super.toString(verbose);
8149 String t = "null";
8150
8151 if(verbose) {
8152 if(target != null) {
8153 if(target.getInstruction() == this)
8154 t = "<points to itself>";
8155 else if(target.getInstruction() == null)
8156 t = "<null instruction!!!?>";
8157 else
8158 t = target.getInstruction().toString(false);
8159 }
8160 } else {
8161 if(target != null) {
8162 index = getTargetOffset();
8163 t = "" + (index + position);
8164 }
8165 }
8166
8167 return s + " -> " + t;
8168 }
8169
8170 /***
8171 * Read needed data (e.g. index) from file. Conversion to a InstructionHandle
8172 * is done in InstructionList(byte[]).
8173 *
8174 * @param bytes input stream
8175 * @param wide wide prefix?
8176 * @see joeq.Compiler.BytecodeAnalysis.Bytecodes.InstructionList
8177 */
8178 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
8179 length = 3;
8180 index = bytes.readShort();
8181 }
8182
8183 /***
8184 * @return target offset in byte code
8185 */
8186 public final int getIndex() { return index; }
8187
8188 /***
8189 * @return target of branch instruction
8190 */
8191 public InstructionHandle getTarget() { return target; }
8192
8193 /***
8194 * Set branch target
8195 * @param target branch target
8196 */
8197 public void setTarget(InstructionHandle target) {
8198 notifyTarget(this.target, target, this);
8199 this.target = target;
8200 }
8201
8202 /***
8203 * Used by BranchInstruction, LocalVariable, CodeException
8204 */
8205 static final void notifyTarget(InstructionHandle old_ih, InstructionHandle new_ih, InstructionTargeter t) {
8206 if(old_ih != null)
8207 old_ih.removeTargeter(t);
8208 if(new_ih != null)
8209 new_ih.addTargeter(t);
8210 }
8211
8212 /***
8213 * @param old_ih old target
8214 * @param new_ih new target
8215 */
8216 public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
8217 if(target == old_ih)
8218 setTarget(new_ih);
8219 else
8220 throw new BytecodeException("Not targeting " + old_ih + ", but " + target);
8221 }
8222
8223 /***
8224 * @return true, if ih is target of this instruction
8225 */
8226 public boolean containsTarget(InstructionHandle ih) {
8227 return (target == ih);
8228 }
8229
8230 /***
8231 * Inform target that it's not targeted anymore.
8232 */
8233 void dispose() {
8234 setTarget(null);
8235 index=-1;
8236 position=-1;
8237 }
8238 }
8239
8240 interface CompoundInstruction {
8241 InstructionList getInstructionList();
8242 }
8243
8244 interface ConstantPushInstruction extends PushInstruction, TypedInstruction {
8245 Number getValue();
8246 }
8247
8248 abstract class ConversionInstruction extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
8249 /***
8250 * Empty constructor needed for the Class.newInstance() statement in
8251 * Instruction.readInstruction(). Not to be used otherwise.
8252 */
8253 ConversionInstruction() {}
8254
8255 /***
8256 * @param opcode opcode of instruction
8257 */
8258 protected ConversionInstruction(short opcode) {
8259 super(opcode, (short)1);
8260 }
8261
8262 /*** @return type associated with the instruction
8263 */
8264 public jq_Type getType() {
8265 switch(opcode) {
8266 case jq_ClassFileConstants.jbc_D2I: case jq_ClassFileConstants.jbc_F2I: case jq_ClassFileConstants.jbc_L2I:
8267 return jq_Primitive.INT;
8268 case jq_ClassFileConstants.jbc_D2F: case jq_ClassFileConstants.jbc_I2F: case jq_ClassFileConstants.jbc_L2F:
8269 return jq_Primitive.FLOAT;
8270 case jq_ClassFileConstants.jbc_D2L: case jq_ClassFileConstants.jbc_F2L: case jq_ClassFileConstants.jbc_I2L:
8271 return jq_Primitive.LONG;
8272 case jq_ClassFileConstants.jbc_F2D: case jq_ClassFileConstants.jbc_I2D: case jq_ClassFileConstants.jbc_L2D:
8273 return jq_Primitive.DOUBLE;
8274 case jq_ClassFileConstants.jbc_I2B:
8275 return jq_Primitive.BYTE;
8276 case jq_ClassFileConstants.jbc_I2C:
8277 return jq_Primitive.CHAR;
8278 case jq_ClassFileConstants.jbc_I2S:
8279 return jq_Primitive.SHORT;
8280
8281 default:
8282 throw new BytecodeException("Unknown type " + opcode);
8283 }
8284 }
8285 }
8286
8287 abstract class CPInstruction extends Instruction implements TypedInstruction {
8288 protected Object o;
8289 protected char index;
8290
8291 /***
8292 * Empty constructor needed for the Class.newInstance() statement in
8293 * Instruction.readInstruction(). Not to be used otherwise.
8294 */
8295 CPInstruction() {}
8296
8297 /***
8298 * @param opcode instruction opcode
8299 * @param o referred to in constant pool
8300 */
8301 protected CPInstruction(short opcode, Object o) {
8302 super(opcode, (short)3);
8303 this.o = o;
8304 Assert._assert(o != null);
8305 }
8306
8307 /***
8308 * Dump instruction as byte code to stream out.
8309 * @param out Output stream
8310 */
8311 public void dump(DataOutputStream out) throws IOException {
8312 Assert._assert(index != 0);
8313 out.writeByte(opcode);
8314 out.writeChar(index);
8315 }
8316
8317 /***
8318 * Long output format:
8319 *
8320 * <name of opcode> "["<opcode number>"]"
8321 * "("<length of instruction>")" "<"< constant pool index>">"
8322 *
8323 * @param verbose long/short format switch
8324 * @return mnemonic for instruction
8325 */
8326 public String toString(boolean verbose) {
8327 return super.toString(verbose) + " " + (int)index;
8328 }
8329
8330 /***
8331 * @return mnemonic for instruction with symbolic references resolved
8332 */
8333 public String toString() {
8334 return jq_ClassFileConstants.OPCODE_NAMES[opcode] + " " + getObject();
8335 }
8336
8337 /***
8338 * Read needed data (i.e., index) from file.
8339 * @param bytes input stream
8340 * @param wide wide prefix?
8341 */
8342 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
8343 o = cp.get((char)bytes.readUnsignedShort());
8344 Assert._assert(!(o instanceof jq_MemberReference));
8345 length = 3;
8346 }
8347
8348 /***
8349 * @return index in constant pool referred by this instruction.
8350 */
8351 public final int getIndex() { return index; }
8352
8353 /***
8354 * Set the index to constant pool.
8355 * @param cpr constant pool rebuilder
8356 */
8357 public void setIndex(jq_ConstantPool.ConstantPoolRebuilder cpr) {
8358 this.index = cpr.get(o);
8359
8360 if(index == 0)
8361 throw new BytecodeException("Zero constant pool index");
8362 }
8363
8364 public Object getObject() {
8365 return o;
8366 }
8367
8368 public void setObject(Object o) {
8369 this.o = o;
8370 }
8371
8372 /*** @return type related with this instruction.
8373 */
8374 public jq_Type getType() {
8375 return (jq_Type)getObject();
8376 }
8377
8378 }
8379
8380 interface ExceptionThrower {
8381 Set
8382 }
8383
8384 abstract class FieldInstruction extends FieldOrMethod implements TypedInstruction {
8385 /***
8386 * Empty constructor needed for the Class.newInstance() statement in
8387 * Instruction.readInstruction(). Not to be used otherwise.
8388 */
8389 FieldInstruction() {}
8390
8391 /***
8392 * @param opcode instruction opcode
8393 * @param f field
8394 */
8395 protected FieldInstruction(short opcode, jq_Field f) {
8396 super(opcode, f);
8397 }
8398
8399 /***
8400 * @return mnemonic for instruction with symbolic references resolved
8401 */
8402 public String toString() {
8403 return jq_ClassFileConstants.OPCODE_NAMES[opcode] + " " + getField();
8404 }
8405
8406 public jq_Field getField() { return (jq_Field)getObject(); }
8407
8408 /*** @return size of field (1 or 2)
8409 */
8410 protected int getFieldSize() {
8411 return getField().getWidth() >> 2;
8412 }
8413
8414 /*** @return return type of referenced field
8415 */
8416 public jq_Type getType() {
8417 return getFieldType();
8418 }
8419
8420 /*** @return type of field
8421 */
8422 public jq_Type getFieldType() {
8423 return getField().getType();
8424 }
8425
8426 /*** @return name of referenced field.
8427 */
8428 public String getFieldName() {
8429 return getName();
8430 }
8431 }
8432
8433 abstract class FieldOrMethod extends CPInstruction implements LoadClass {
8434 /***
8435 * Empty constructor needed for the Class.newInstance() statement in
8436 * Instruction.readInstruction(). Not to be used otherwise.
8437 */
8438 FieldOrMethod() {}
8439
8440 /***
8441 * @param opcode instruction opcode
8442 * @param f field or method
8443 */
8444 protected FieldOrMethod(short opcode, jq_Member f) {
8445 super(opcode, f);
8446 }
8447
8448 /*** @return signature of referenced method/field.
8449 */
8450 public String getSignature() {
8451 jq_Member member = (jq_Member)getObject();
8452 return member.getDesc().toString();
8453 }
8454
8455 /*** @return name of referenced method/field.
8456 */
8457 public String getName() {
8458 jq_Member member = (jq_Member)getObject();
8459 return member.getName().toString();
8460 }
8461
8462 /*** @return name of the referenced class/interface
8463 */
8464 public String getClassName() {
8465 jq_Member member = (jq_Member)getObject();
8466 return member.getDeclaringClass().getName().toString();
8467 }
8468
8469 /*** @return type of the referenced class/interface
8470 */
8471 public jq_Class getClassType() {
8472 jq_Member member = (jq_Member)getObject();
8473 return member.getDeclaringClass();
8474 }
8475
8476 /*** @return type of the referenced class/interface
8477 */
8478 public jq_Class getLoadClassType() {
8479 return getClassType();
8480 }
8481
8482 protected abstract void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException;
8483 }
8484
8485 abstract class GotoInstruction extends BranchInstruction implements UnconditionalBranch
8486 {
8487 GotoInstruction(short opcode, InstructionHandle target) {
8488 super(opcode, target);
8489 }
8490
8491 /***
8492 * Empty constructor needed for the Class.newInstance() statement in
8493 * Instruction.readInstruction(). Not to be used otherwise.
8494 */
8495 GotoInstruction() {}
8496 }
8497
8498 abstract class IfInstruction extends BranchInstruction implements StackConsumer {
8499 /***
8500 * Empty constructor needed for the Class.newInstance() statement in
8501 * Instruction.readInstruction(). Not to be used otherwise.
8502 */
8503 IfInstruction() {}
8504
8505 /***
8506 * @param opcode opcode of this instruction
8507 * @param target target instruction to branch to
8508 */
8509 protected IfInstruction(short opcode, InstructionHandle target) {
8510 super(opcode, target);
8511 }
8512
8513 /***
8514 * @return negation of instruction, e.g. IFEQ.negate() == IFNE
8515 */
8516 public abstract IfInstruction negate();
8517 }
8518
8519 interface IndexedInstruction {
8520 int getIndex();
8521 void setIndex(int index);
8522 }
8523
8524 interface InstructionTargeter {
8525 boolean containsTarget(InstructionHandle ih);
8526 void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih);
8527 }
8528
8529 abstract class InvokeInstruction extends FieldOrMethod implements ExceptionThrower, TypedInstruction, StackConsumer, StackProducer {
8530 /***
8531 * Empty constructor needed for the Class.newInstance() statement in
8532 * Instruction.readInstruction(). Not to be used otherwise.
8533 */
8534 InvokeInstruction() {}
8535
8536 /***
8537 * @param opcode instruction opcode
8538 * @param f method
8539 */
8540 protected InvokeInstruction(short opcode, jq_Method f) {
8541 super(opcode, f);
8542 }
8543
8544 /***
8545 * @return mnemonic for instruction with symbolic references resolved
8546 */
8547 public String toString() {
8548 return jq_ClassFileConstants.OPCODE_NAMES[opcode] + " " + getMethod();
8549 }
8550
8551 public jq_Method getMethod() { return (jq_Method)getObject(); }
8552
8553 /***
8554 * Also works for instructions whose stack effect depends on the
8555 * constant pool entry they reference.
8556 * @return Number of words consumed from stack by this instruction
8557 */
8558 public int consumeStack() {
8559 return getMethod().getParamWords();
8560 }
8561
8562 /***
8563 * Also works for instructions whose stack effect depends on the
8564 * constant pool entry they reference.
8565 * @return Number of words produced onto stack by this instruction
8566 */
8567 public int produceStack() {
8568 return getMethod().getReturnWords();
8569 }
8570
8571 /*** @return return type of referenced method.
8572 */
8573 public jq_Type getType() {
8574 return getMethod().getReturnType();
8575 }
8576
8577 /*** @return name of referenced method.
8578 */
8579 public String getMethodName() {
8580 return getName();
8581 }
8582
8583 /*** @return return type of referenced method.
8584 */
8585 public jq_Type getReturnType() {
8586 return getMethod().getReturnType();
8587 }
8588
8589 /*** @return argument types of referenced method.
8590 */
8591 public jq_Type[] getArgumentTypes() {
8592 return getMethod().getParamTypes();
8593 }
8594 }
8595
8596 abstract class JsrInstruction extends BranchInstruction implements UnconditionalBranch, TypedInstruction, StackProducer {
8597 JsrInstruction(short opcode, InstructionHandle target) {
8598 super(opcode, target);
8599 }
8600
8601 /***
8602 * Empty constructor needed for the Class.newInstance() statement in
8603 * Instruction.readInstruction(). Not to be used otherwise.
8604 */
8605 JsrInstruction(){}
8606
8607 /*** @return return address type
8608 */
8609 public jq_Type getType() {
8610 return new jq_ReturnAddressType(physicalSuccessor());
8611 }
8612
8613 /***
8614 * Returns an InstructionHandle to the physical successor
8615 * of this JsrInstruction. <B>For this method to work,
8616 * this JsrInstruction object must not be shared between
8617 * multiple InstructionHandle objects!</B>
8618 * Formally, there must not be InstructionHandle objects
8619 * i, j where i != j and i.getInstruction() == this ==
8620 * j.getInstruction().
8621 * @return an InstructionHandle to the "next" instruction that
8622 * will be executed when RETurned from a subroutine.
8623 */
8624 public InstructionHandle physicalSuccessor(){
8625 InstructionHandle ih = this.target;
8626
8627
8628 while(ih.getPrev() != null)
8629 ih = ih.getPrev();
8630
8631
8632 while(ih.getInstruction() != this)
8633 ih = ih.getNext();
8634
8635 InstructionHandle toThis = ih;
8636
8637 while(ih != null){
8638 ih = ih.getNext();
8639 if ((ih != null) && (ih.getInstruction() == this))
8640 throw new RuntimeException("physicalSuccessor() called on a shared JsrInstruction.");
8641 }
8642
8643
8644 return toThis.getNext();
8645 }
8646 }
8647
8648 interface LoadClass {
8649 /***
8650 * Returns the jq_Class of the referenced class or interface
8651 * that may be loaded and resolved.
8652 * @return object type that may be loaded or null if a primitive is
8653 * referenced
8654 */
8655 jq_Class getLoadClassType();
8656
8657 /***
8658 * Returns the type associated with this instruction.
8659 * LoadClass instances are always typed, but this type
8660 * does not always refer to the type of the class or interface
8661 * that it possibly forces to load. For example, GETFIELD would
8662 * return the type of the field and not the type of the class
8663 * where the field is defined.
8664 * If no class is forced to be loaded, <B>null</B> is returned.
8665 * An example for this is an ANEWARRAY instruction that creates
8666 * an int[][].
8667 * @see #getLoadClassType()
8668 */
8669 jq_Type getType();
8670 }
8671
8672 abstract class LoadInstruction extends LocalVariableInstruction implements PushInstruction {
8673 /***
8674 * Empty constructor needed for the Class.newInstance() statement in
8675 * Instruction.readInstruction(). Not to be used otherwise.
8676 * tag and length are defined in readInstruction and initFromFile, respectively.
8677 */
8678 LoadInstruction(short canon_tag, short c_tag) {
8679 super(canon_tag, c_tag);
8680 }
8681
8682 /***
8683 * @param opcode Instruction opcode
8684 * @param c_tag Instruction number for compact version, ALOAD_0, e.g.
8685 * @param n local variable index (unsigned short)
8686 */
8687 protected LoadInstruction(short opcode, short c_tag, int n) {
8688 super(opcode, c_tag, n);
8689 }
8690
8691 /***
8692 * Call corresponding visitor method(s). The order is:
8693 * Call visitor methods of implemented interfaces first, then
8694 * call methods according to the class hierarchy in descending order,
8695 * i.e., the most specific visitXXX() call comes last.
8696 *
8697 * @param v Visitor object
8698 */
8699 public void accept(Visitor v) {
8700 v.visitStackProducer(this);
8701 v.visitPushInstruction(this);
8702 v.visitTypedInstruction(this);
8703 v.visitLocalVariableInstruction(this);
8704 v.visitLoadInstruction(this);
8705 }
8706 }
8707
8708 abstract class LocalVariableInstruction extends Instruction implements TypedInstruction, IndexedInstruction {
8709 protected int n = -1;
8710 private short c_tag = -1;
8711 private short canon_tag = -1;
8712
8713 private final boolean wide() { return n > Byte.MAX_VALUE; }
8714
8715 /***
8716 * Empty constructor needed for the Class.newInstance() statement in
8717 * Instruction.readInstruction(). Not to be used otherwise.
8718 * tag and length are defined in readInstruction and initFromFile, respectively.
8719 */
8720 LocalVariableInstruction(short canon_tag, short c_tag) {
8721 super();
8722 this.canon_tag = canon_tag;
8723 this.c_tag = c_tag;
8724 }
8725
8726 /***
8727 * Empty constructor needed for the Class.newInstance() statement in
8728 * Instruction.readInstruction(). Also used by IINC()!
8729 */
8730 LocalVariableInstruction() {}
8731
8732 /***
8733 * @param opcode Instruction opcode
8734 * @param c_tag Instruction number for compact version, ALOAD_0, e.g.
8735 * @param n local variable index (unsigned short)
8736 */
8737 protected LocalVariableInstruction(short opcode, short c_tag, int n) {
8738 super(opcode, (short)2);
8739
8740 this.c_tag = c_tag;
8741 canon_tag = opcode;
8742
8743 setIndex(n);
8744 }
8745
8746 /***
8747 * Dump instruction as byte code to stream out.
8748 * @param out Output stream
8749 */
8750 public void dump(DataOutputStream out) throws IOException {
8751 if(wide())
8752 out.writeByte(jq_ClassFileConstants.jbc_WIDE);
8753
8754 out.writeByte(opcode);
8755
8756 if(length > 1) {
8757 if(wide())
8758 out.writeShort(n);
8759 else
8760 out.writeByte(n);
8761 }
8762 }
8763
8764 /***
8765 * Long output format:
8766 *
8767 * <name of opcode> "["<opcode number>"]"
8768 * "("<length of instruction>")" "<"< local variable index>">"
8769 *
8770 * @param verbose long/short format switch
8771 * @return mnemonic for instruction
8772 */
8773 public String toString(boolean verbose) {
8774 if(((opcode >= jq_ClassFileConstants.jbc_ILOAD_0) && (opcode <= jq_ClassFileConstants.jbc_ALOAD_3)) || ((opcode >= jq_ClassFileConstants.jbc_ISTORE_0) && (opcode <= jq_ClassFileConstants.jbc_ASTORE_3)))
8775 return super.toString(verbose);
8776 else
8777 return super.toString(verbose) + " " + n;
8778 }
8779
8780 /***
8781 * Read needed data (e.g. index) from file.
8782 * PRE: (ILOAD <= tag <= ALOAD_3) || (ISTORE <= tag <= ASTORE_3)
8783 */
8784 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
8785 if(wide) {
8786 n = bytes.readUnsignedShort();
8787 length = 4;
8788 } else if(((opcode >= jq_ClassFileConstants.jbc_ILOAD) &&
8789 (opcode <= jq_ClassFileConstants.jbc_ALOAD)) ||
8790 ((opcode >= jq_ClassFileConstants.jbc_ISTORE) &&
8791 (opcode <= jq_ClassFileConstants.jbc_ASTORE))) {
8792 n = bytes.readUnsignedByte();
8793 length = 2;
8794 } else if(opcode <= jq_ClassFileConstants.jbc_ALOAD_3) {
8795 n = (opcode - jq_ClassFileConstants.jbc_ILOAD_0) % 4;
8796 length = 1;
8797 } else {
8798 n = (opcode - jq_ClassFileConstants.jbc_ISTORE_0) % 4;
8799 length = 1;
8800 }
8801 }
8802
8803 /***
8804 * @return local variable index referred by this instruction.
8805 */
8806 public final int getIndex() { return n; }
8807
8808 /***
8809 * Set the local variable index
8810 */
8811 public void setIndex(int n) {
8812 if((n < 0) || (n > Short.MAX_VALUE))
8813 throw new BytecodeException("Illegal value: " + n);
8814
8815 this.n = n;
8816
8817 if(n >= 0 && n <= 3) {
8818 opcode = (short)(c_tag + n);
8819 length = 1;
8820 } else {
8821 opcode = canon_tag;
8822
8823 if(wide())
8824 length = 4;
8825 else
8826 length = 2;
8827 }
8828 }
8829
8830 /*** @return canonical tag for instruction, e.g., ALOAD for ALOAD_0
8831 */
8832 public short getCanonicalTag() {
8833 return canon_tag;
8834 }
8835
8836 /***
8837 * Returns the type associated with the instruction -
8838 * in case of ALOAD or ASTORE Type.OBJECT is returned.
8839 * This is just a bit incorrect, because ALOAD and ASTORE
8840 * may work on every ReferenceType (including Type.NULL) and
8841 * ASTORE may even work on a ReturnaddressType .
8842 * @return type associated with the instruction
8843 */
8844 public final jq_Type getType() {
8845 switch(canon_tag) {
8846 case jq_ClassFileConstants.jbc_ILOAD: case jq_ClassFileConstants.jbc_ISTORE:
8847 return jq_Primitive.INT;
8848 case jq_ClassFileConstants.jbc_LLOAD: case jq_ClassFileConstants.jbc_LSTORE:
8849 return jq_Primitive.LONG;
8850 case jq_ClassFileConstants.jbc_DLOAD: case jq_ClassFileConstants.jbc_DSTORE:
8851 return jq_Primitive.DOUBLE;
8852 case jq_ClassFileConstants.jbc_FLOAD: case jq_ClassFileConstants.jbc_FSTORE:
8853 return jq_Primitive.FLOAT;
8854 case jq_ClassFileConstants.jbc_ALOAD: case jq_ClassFileConstants.jbc_ASTORE:
8855 return PrimordialClassLoader.getJavaLangObject();
8856
8857 default: throw new BytecodeException("Oops: unknown case in switch" + canon_tag);
8858 }
8859 }
8860 }
8861
8862 interface PopInstruction extends StackConsumer {}
8863
8864 interface PushInstruction extends StackProducer {}
8865
8866 abstract class ReturnInstruction extends Instruction implements ExceptionThrower, TypedInstruction, StackConsumer {
8867 /***
8868 * Empty constructor needed for the Class.newInstance() statement in
8869 * Instruction.readInstruction(). Not to be used otherwise.
8870 */
8871 ReturnInstruction() {}
8872
8873 /***
8874 * @param opcode of instruction
8875 */
8876 protected ReturnInstruction(short opcode) {
8877 super(opcode, (short)1);
8878 }
8879
8880 public jq_Type getType() {
8881 switch(opcode) {
8882 case jq_ClassFileConstants.jbc_IRETURN: return jq_Primitive.INT;
8883 case jq_ClassFileConstants.jbc_LRETURN: return jq_Primitive.LONG;
8884 case jq_ClassFileConstants.jbc_FRETURN: return jq_Primitive.FLOAT;
8885 case jq_ClassFileConstants.jbc_DRETURN: return jq_Primitive.DOUBLE;
8886 case jq_ClassFileConstants.jbc_ARETURN: return PrimordialClassLoader.getJavaLangObject();
8887 case jq_ClassFileConstants.jbc_RETURN: return jq_Primitive.VOID;
8888
8889 default:
8890 throw new BytecodeException("Unknown type " + opcode);
8891 }
8892 }
8893
8894 public Set
8895
8896 return null;
8897 }
8898
8899 }
8900
8901 abstract class Select extends BranchInstruction implements VariableLengthInstruction, StackProducer {
8902 protected int[] match;
8903 protected int[] indices;
8904 protected ArrayList
8905 protected int fixed_length;
8906 protected int match_length;
8907 protected int padding = 0;
8908
8909 /***
8910 * Empty constructor needed for the Class.newInstance() statement in
8911 * Instruction.readInstruction(). Not to be used otherwise.
8912 */
8913 Select() {}
8914
8915 /***
8916 * (Match, target) pairs for switch.
8917 * `Match' and `targets' must have the same length of course.
8918 *
8919 * @param match array of matching values
8920 * @param targets instruction targets
8921 * @param target default instruction target
8922 */
8923 Select(short opcode, int[] match, ArrayList
8924 super(opcode, target);
8925
8926 this.targets = targets;
8927 for(Iterator i=targets.iterator(); i.hasNext();)
8928 notifyTarget(null, (InstructionHandle)i.next(), this);
8929
8930 this.match = match;
8931
8932 if((match_length = match.length) != targets.size())
8933 throw new BytecodeException("Match and target array have not the same length");
8934
8935 indices = new int[match_length];
8936 }
8937
8938 /***
8939 * Since this is a variable length instruction, it may shift the following
8940 * instructions which then need to update their position.
8941 *
8942 * Called by InstructionList.setPositions when setting the position for every
8943 * instruction. In the presence of variable length instructions `setPositions'
8944 * performs multiple passes over the instruction list to calculate the
8945 * correct (byte) positions and offsets by calling this function.
8946 *
8947 * @param offset additional offset caused by preceding (variable length) instructions
8948 * @param max_offset the maximum offset that may be caused by these instructions
8949 * @return additional offset caused by possible change of this instruction's length
8950 */
8951 protected int updatePosition(int offset, int max_offset) {
8952 position += offset;
8953
8954 short old_length = length;
8955
8956
8957
8958 padding = (4 - ((position + 1) % 4)) % 4;
8959 length = (short)(fixed_length + padding);
8960
8961 return length - old_length;
8962 }
8963
8964 /***
8965 * Dump instruction as byte code to stream out.
8966 * @param out Output stream
8967 */
8968 public void dump(DataOutputStream out) throws IOException {
8969 out.writeByte(opcode);
8970
8971 for(int i=0; i < padding; i++)
8972 out.writeByte(0);
8973
8974 index = getTargetOffset();
8975 out.writeInt(index);
8976 }
8977
8978 /***
8979 * Read needed data (e.g. index) from file.
8980 */
8981 protected void initFromFile(jq_ConstantPool cp, ByteSequence bytes, boolean wide) throws IOException {
8982 padding = (4 - (bytes.getIndex() % 4)) % 4;
8983
8984 for(int i=0; i < padding; i++) {
8985 byte b;
8986 if((b=bytes.readByte()) != 0)
8987 throw new BytecodeException("Padding byte != 0: " + b);
8988 }
8989
8990
8991 index = bytes.readInt();
8992 }
8993
8994 /***
8995 * @return mnemonic for instruction
8996 */
8997 public String toString(boolean verbose) {
8998 StringBuffer buf = new StringBuffer(super.toString(verbose));
8999
9000 if(verbose) {
9001 for(int i=0; i < match_length; i++) {
9002 String s = "null";
9003
9004 if(targets.get(i) != null)
9005 s = ((InstructionHandle)targets.get(i)).getInstruction().toString();
9006
9007 buf.append("(" + match[i] + ", " + s + " = {" + indices[i] + "})");
9008 }
9009 }
9010 else
9011 buf.append(" ...");
9012
9013 return buf.toString();
9014 }
9015
9016 /***
9017 * Set branch target for `i'th case
9018 */
9019 public void setTarget(int i, InstructionHandle target) {
9020 notifyTarget((InstructionHandle)targets.get(i), target, this);
9021 targets.set(i, target);
9022 }
9023
9024 /***
9025 * @param old_ih old target
9026 * @param new_ih new target
9027 */
9028 public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
9029 boolean targeted = false;
9030
9031 if(target == old_ih) {
9032 targeted = true;
9033 setTarget(new_ih);
9034 }
9035
9036 for(int i=0; i<targets.size(); ++i) {
9037 if (targets.get(i) == old_ih) {
9038 targeted = true;
9039 setTarget(i, new_ih);
9040 }
9041 }
9042
9043 if(!targeted)
9044 throw new BytecodeException("Not targeting " + old_ih);
9045 }
9046
9047 /***
9048 * @return true, if ih is target of this instruction
9049 */
9050 public boolean containsTarget(InstructionHandle ih) {
9051 if(target == ih)
9052 return true;
9053
9054 for(int i=0; i < targets.size(); i++)
9055 if(targets.get(i) == ih)
9056 return true;
9057
9058 return false;
9059 }
9060
9061 /***
9062 * Inform targets that they're not targeted anymore.
9063 */
9064 void dispose() {
9065 super.dispose();
9066
9067 for(int i=0; i < targets.size(); i++)
9068 ((InstructionHandle)targets.get(i)).removeTargeter(this);
9069 }
9070
9071 /***
9072 * @return array of match indices
9073 */
9074 public int[] getMatchs() { return match; }
9075
9076 /***
9077 * @return array of match target offsets
9078 */
9079 public int[] getIndices() { return indices; }
9080
9081 /***
9082 * @return array of match targets
9083 */
9084 public List
9085 }
9086
9087 interface StackConsumer {
9088 /*** @return how many words are consumed from stack
9089 */
9090 int consumeStack();
9091 }
9092
9093 abstract class StackInstruction extends Instruction {
9094 /***
9095 * Empty constructor needed for the Class.newInstance() statement in
9096 * Instruction.readInstruction(). Not to be used otherwise.
9097 */
9098 StackInstruction() {}
9099
9100 /***
9101 * @param opcode instruction opcode
9102 */
9103 protected StackInstruction(short opcode) {
9104 super(opcode, (short)1);
9105 }
9106
9107 }
9108
9109 interface StackProducer {
9110 /*** @return how many words are produced on stack
9111 */
9112 int produceStack();
9113 }
9114
9115 abstract class StoreInstruction extends LocalVariableInstruction implements PopInstruction
9116 {
9117 /***
9118 * Empty constructor needed for the Class.newInstance() statement in
9119 * Instruction.readInstruction(). Not to be used otherwise.
9120 * tag and length are defined in readInstruction and initFromFile, respectively.
9121 */
9122 StoreInstruction(short canon_tag, short c_tag) {
9123 super(canon_tag, c_tag);
9124 }
9125
9126 /***
9127 * @param opcode Instruction opcode
9128 * @param c_tag Instruction number for compact version, ASTORE_0, e.g.
9129 * @param n local variable index (unsigned short)
9130 */
9131 protected StoreInstruction(short opcode, short c_tag, int n) {
9132 super(opcode, c_tag, n);
9133 }
9134
9135 /***
9136 * Call corresponding visitor method(s). The order is:
9137 * Call visitor methods of implemented interfaces first, then
9138 * call methods according to the class hierarchy in descending order,
9139 * i.e., the most specific visitXXX() call comes last.
9140 *
9141 * @param v Visitor object
9142 */
9143 public void accept(Visitor v) {
9144 v.visitStackConsumer(this);
9145 v.visitPopInstruction(this);
9146 v.visitStoreInstruction(this);
9147 v.visitTypedInstruction(this);
9148 v.visitLocalVariableInstruction(this);
9149 v.visitStoreInstruction(this);
9150 }
9151 }
9152
9153 interface TypedInstruction {
9154 jq_Type getType();
9155 }
9156
9157 interface UnconditionalBranch {}
9158
9159 interface VariableLengthInstruction {}
9160
9161
9162
9163 class BytecodeException extends RuntimeException {
9164 /***
9165 * Version ID for serialization.
9166 */
9167 private static final long serialVersionUID = 3689634696422175796L;
9168 public BytecodeException() { super(); }
9169 public BytecodeException(String s) { super(s); }
9170 }
9171
9172
9173 class jq_ReturnAddressType extends jq_Reference {
9174 public static final jq_ReturnAddressType NO_TARGET = new jq_ReturnAddressType();
9175 private InstructionHandle returnTarget;
9176 private jq_ReturnAddressType() { super(Utf8.get("L&ReturnAddress;"), PrimordialClassLoader.loader); }
9177 private jq_ReturnAddressType(InstructionHandle returnTarget) {
9178 super(Utf8.get("L&ReturnAddress;"), PrimordialClassLoader.loader);
9179 this.returnTarget = returnTarget;
9180 }
9181 public boolean isAddressType() { return false; }
9182 public String getJDKName() { return desc.toString(); }
9183 public String getJDKDesc() { return getJDKName(); }
9184 public jq_Class[] getInterfaces() { Assert.UNREACHABLE(); return null; }
9185 public jq_Class getInterface(Utf8 desc) { Assert.UNREACHABLE(); return null; }
9186 public boolean implementsInterface(jq_Class k) { Assert.UNREACHABLE(); return false; }
9187 public jq_InstanceMethod getVirtualMethod(jq_NameAndDesc nd) { Assert.UNREACHABLE(); return null; }
9188 public String getName() { Assert.UNREACHABLE(); return null; }
9189 public String shortName() { Assert.UNREACHABLE(); return null; }
9190 public boolean isClassType() { Assert.UNREACHABLE(); return false; }
9191 public boolean isArrayType() { Assert.UNREACHABLE(); return false; }
9192 public boolean isFinal() { Assert.UNREACHABLE(); return false; }
9193 public jq_Reference getDirectPrimarySupertype() { Assert.UNREACHABLE(); return null; }
9194 public int getDepth() { Assert.UNREACHABLE(); return 0; }
9195 public void load() { Assert.UNREACHABLE(); }
9196 public void verify() { Assert.UNREACHABLE(); }
9197 public void prepare() { Assert.UNREACHABLE(); }
9198 public void sf_initialize() { Assert.UNREACHABLE(); }
9199 public void compile() { Assert.UNREACHABLE(); }
9200 public void cls_initialize() { Assert.UNREACHABLE(); }
9201 public String toString() { return "ReturnAddress (target="+returnTarget+")"; }
9202 public boolean equals(Object rat) {
9203 if (!(rat instanceof jq_ReturnAddressType)) return false;
9204 return ((jq_ReturnAddressType)rat).returnTarget.equals(this.returnTarget);
9205 }
9206 public int hashCode() {
9207 return returnTarget.hashCode();
9208 }
9209 }
9210
9211 class CodeException {
9212 private InstructionHandle start, end, handler;
9213 private jq_Class type;
9214
9215 public CodeException(InstructionList il, byte[] b, jq_TryCatchBC tc) {
9216 this.start = il.findHandle(tc.getStartPC());
9217 if (tc.getEndPC() == b.length) {
9218 this.end = il.getEnd();
9219 } else {
9220 this.end = il.findHandle(tc.getEndPC());
9221 this.end = this.end.getPrev();
9222 }
9223 this.handler = il.findHandle(tc.getHandlerPC());
9224 this.type = tc.getExceptionType();
9225 }
9226 public CodeException(InstructionHandle start, InstructionHandle end, jq_Class type, InstructionHandle handler) {
9227 this.start = start;
9228 this.end = end;
9229 this.type = type;
9230 this.handler = handler;
9231 }
9232
9233 public InstructionHandle getStartPC() { return start; }
9234 public void setStartPC(InstructionHandle i) { this.start = i; }
9235 public InstructionHandle getEndPC() { return end; }
9236 public void setEndPC(InstructionHandle i) { this.end = i; }
9237 public InstructionHandle getHandlerPC() { return handler; }
9238 public void setHandlerPC(InstructionHandle i) { this.handler = i; }
9239
9240 public jq_TryCatchBC finish() {
9241 Assert._assert(this.start.getPosition() >= 0);
9242 Assert._assert(this.end.getPosition()+this.end.getInstruction().getLength() > 0);
9243 Assert._assert(this.handler.getPosition() >= 0);
9244 return new jq_TryCatchBC((char)this.start.getPosition(),
9245 (char)(this.end.getPosition()+this.end.getInstruction().getLength()),
9246 (char)this.handler.getPosition(),
9247 this.type);
9248 }
9249 }
9250
9251 class LineNumber {
9252 private InstructionHandle start;
9253 private char num;
9254
9255 public LineNumber(InstructionList il, jq_LineNumberBC tc) {
9256 this.start = il.findHandle(tc.getStartPC());
9257 if (this.start == null) {
9258 System.out.println("Cannot find index "+(int)tc.getStartPC()+" in "+il);
9259 }
9260 this.num = tc.getLineNum();
9261 }
9262
9263 public InstructionHandle getStartPC() { return start; }
9264 public void setStartPC(InstructionHandle i) { this.start = i; }
9265
9266 public jq_LineNumberBC finish() {
9267 char c;
9268 if (this.start == null) c = 0;
9269 else c = (char)this.start.getPosition();
9270 return new jq_LineNumberBC(c, this.num);
9271 }
9272 }
9273
9274 interface InstructionConstants {
9275 /*** Predefined instruction objects
9276 */
9277 Instruction NOP = new NOP();
9278 Instruction ACONST_NULL = new ACONST_NULL();
9279 Instruction ICONST_M1 = new ICONST(-1);
9280 Instruction ICONST_0 = new ICONST(0);
9281 Instruction ICONST_1 = new ICONST(1);
9282 Instruction ICONST_2 = new ICONST(2);
9283 Instruction ICONST_3 = new ICONST(3);
9284 Instruction ICONST_4 = new ICONST(4);
9285 Instruction ICONST_5 = new ICONST(5);
9286 Instruction LCONST_0 = new LCONST(0);
9287 Instruction LCONST_1 = new LCONST(1);
9288 Instruction FCONST_0 = new FCONST(0);
9289 Instruction FCONST_1 = new FCONST(1);
9290 Instruction FCONST_2 = new FCONST(2);
9291 Instruction DCONST_0 = new DCONST(0);
9292 Instruction DCONST_1 = new DCONST(1);
9293 ArrayInstruction IALOAD = new IALOAD();
9294 ArrayInstruction LALOAD = new LALOAD();
9295 ArrayInstruction FALOAD = new FALOAD();
9296 ArrayInstruction DALOAD = new DALOAD();
9297 ArrayInstruction AALOAD = new AALOAD();
9298 ArrayInstruction BALOAD = new BALOAD();
9299 ArrayInstruction CALOAD = new CALOAD();
9300 ArrayInstruction SALOAD = new SALOAD();
9301 ArrayInstruction IASTORE = new IASTORE();
9302 ArrayInstruction LASTORE = new LASTORE();
9303 ArrayInstruction FASTORE = new FASTORE();
9304 ArrayInstruction DASTORE = new DASTORE();
9305 ArrayInstruction AASTORE = new AASTORE();
9306 ArrayInstruction BASTORE = new BASTORE();
9307 ArrayInstruction CASTORE = new CASTORE();
9308 ArrayInstruction SASTORE = new SASTORE();
9309 StackInstruction POP = new POP();
9310 StackInstruction POP2 = new POP2();
9311 StackInstruction DUP = new DUP();
9312 StackInstruction DUP_X1 = new DUP_X1();
9313 StackInstruction DUP_X2 = new DUP_X2();
9314 StackInstruction DUP2 = new DUP2();
9315 StackInstruction DUP2_X1 = new DUP2_X1();
9316 StackInstruction DUP2_X2 = new DUP2_X2();
9317 StackInstruction SWAP = new SWAP();
9318 ArithmeticInstruction IADD = new IADD();
9319 ArithmeticInstruction LADD = new LADD();
9320 ArithmeticInstruction FADD = new FADD();
9321 ArithmeticInstruction DADD = new DADD();
9322 ArithmeticInstruction ISUB = new ISUB();
9323 ArithmeticInstruction LSUB = new LSUB();
9324 ArithmeticInstruction FSUB = new FSUB();
9325 ArithmeticInstruction DSUB = new DSUB();
9326 ArithmeticInstruction IMUL = new IMUL();
9327 ArithmeticInstruction LMUL = new LMUL();
9328 ArithmeticInstruction FMUL = new FMUL();
9329 ArithmeticInstruction DMUL = new DMUL();
9330 ArithmeticInstruction IDIV = new IDIV();
9331 ArithmeticInstruction LDIV = new LDIV();
9332 ArithmeticInstruction FDIV = new FDIV();
9333 ArithmeticInstruction DDIV = new DDIV();
9334 ArithmeticInstruction IREM = new IREM();
9335 ArithmeticInstruction LREM = new LREM();
9336 ArithmeticInstruction FREM = new FREM();
9337 ArithmeticInstruction DREM = new DREM();
9338 ArithmeticInstruction INEG = new INEG();
9339 ArithmeticInstruction LNEG = new LNEG();
9340 ArithmeticInstruction FNEG = new FNEG();
9341 ArithmeticInstruction DNEG = new DNEG();
9342 ArithmeticInstruction ISHL = new ISHL();
9343 ArithmeticInstruction LSHL = new LSHL();
9344 ArithmeticInstruction ISHR = new ISHR();
9345 ArithmeticInstruction LSHR = new LSHR();
9346 ArithmeticInstruction IUSHR = new IUSHR();
9347 ArithmeticInstruction LUSHR = new LUSHR();
9348 ArithmeticInstruction IAND = new IAND();
9349 ArithmeticInstruction LAND = new LAND();
9350 ArithmeticInstruction IOR = new IOR();
9351 ArithmeticInstruction LOR = new LOR();
9352 ArithmeticInstruction IXOR = new IXOR();
9353 ArithmeticInstruction LXOR = new LXOR();
9354 ConversionInstruction I2L = new I2L();
9355 ConversionInstruction I2F = new I2F();
9356 ConversionInstruction I2D = new I2D();
9357 ConversionInstruction L2I = new L2I();
9358 ConversionInstruction L2F = new L2F();
9359 ConversionInstruction L2D = new L2D();
9360 ConversionInstruction F2I = new F2I();
9361 ConversionInstruction F2L = new F2L();
9362 ConversionInstruction F2D = new F2D();
9363 ConversionInstruction D2I = new D2I();
9364 ConversionInstruction D2L = new D2L();
9365 ConversionInstruction D2F = new D2F();
9366 ConversionInstruction I2B = new I2B();
9367 ConversionInstruction I2C = new I2C();
9368 ConversionInstruction I2S = new I2S();
9369 Instruction LCMP = new LCMP();
9370 Instruction FCMPL = new FCMPL();
9371 Instruction FCMPG = new FCMPG();
9372 Instruction DCMPL = new DCMPL();
9373 Instruction DCMPG = new DCMPG();
9374 ReturnInstruction IRETURN = new IRETURN();
9375 ReturnInstruction LRETURN = new LRETURN();
9376 ReturnInstruction FRETURN = new FRETURN();
9377 ReturnInstruction DRETURN = new DRETURN();
9378 ReturnInstruction ARETURN = new ARETURN();
9379 ReturnInstruction RETURN = new RETURN();
9380 Instruction ARRAYLENGTH = new ARRAYLENGTH();
9381 Instruction ATHROW = new ATHROW();
9382 Instruction MONITORENTER = new MONITORENTER();
9383 Instruction MONITOREXIT = new MONITOREXIT();
9384
9385 /*** You can use these constants in multiple places safely, if you can guarantee
9386 * that you will never alter their internal values, e.g. call setIndex().
9387 */
9388 LocalVariableInstruction THIS = new ALOAD(0);
9389 LocalVariableInstruction ALOAD_0 = THIS;
9390 LocalVariableInstruction ALOAD_1 = new ALOAD(1);
9391 LocalVariableInstruction ALOAD_2 = new ALOAD(2);
9392 LocalVariableInstruction ILOAD_0 = new ILOAD(0);
9393 LocalVariableInstruction ILOAD_1 = new ILOAD(1);
9394 LocalVariableInstruction ILOAD_2 = new ILOAD(2);
9395 LocalVariableInstruction ASTORE_0 = new ASTORE(0);
9396 LocalVariableInstruction ASTORE_1 = new ASTORE(1);
9397 LocalVariableInstruction ASTORE_2 = new ASTORE(2);
9398 LocalVariableInstruction ISTORE_0 = new ISTORE(0);
9399 LocalVariableInstruction ISTORE_1 = new ISTORE(1);
9400 LocalVariableInstruction ISTORE_2 = new ISTORE(2);
9401
9402 /*** Get object via its opcode, for immutable instructions like
9403 * branch instructions entries are set to null.
9404 */
9405 Instruction[] INSTRUCTIONS = new Instruction[256];
9406
9407 /*** Interfaces may have no static initializers, so we simulate this
9408 * with an inner class.
9409 */
9410 Clinit bla = new Clinit();
9411
9412 class Clinit {
9413 Clinit() {
9414 INSTRUCTIONS[jq_ClassFileConstants.jbc_NOP] = NOP;
9415 INSTRUCTIONS[jq_ClassFileConstants.jbc_ACONST_NULL] = ACONST_NULL;
9416 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_M1] = ICONST_M1;
9417 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_0] = ICONST_0;
9418 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_1] = ICONST_1;
9419 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_2] = ICONST_2;
9420 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_3] = ICONST_3;
9421 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_4] = ICONST_4;
9422 INSTRUCTIONS[jq_ClassFileConstants.jbc_ICONST_5] = ICONST_5;
9423 INSTRUCTIONS[jq_ClassFileConstants.jbc_LCONST_0] = LCONST_0;
9424 INSTRUCTIONS[jq_ClassFileConstants.jbc_LCONST_1] = LCONST_1;
9425 INSTRUCTIONS[jq_ClassFileConstants.jbc_FCONST_0] = FCONST_0;
9426 INSTRUCTIONS[jq_ClassFileConstants.jbc_FCONST_1] = FCONST_1;
9427 INSTRUCTIONS[jq_ClassFileConstants.jbc_FCONST_2] = FCONST_2;
9428 INSTRUCTIONS[jq_ClassFileConstants.jbc_DCONST_0] = DCONST_0;
9429 INSTRUCTIONS[jq_ClassFileConstants.jbc_DCONST_1] = DCONST_1;
9430 INSTRUCTIONS[jq_ClassFileConstants.jbc_IALOAD] = IALOAD;
9431 INSTRUCTIONS[jq_ClassFileConstants.jbc_LALOAD] = LALOAD;
9432 INSTRUCTIONS[jq_ClassFileConstants.jbc_FALOAD] = FALOAD;
9433 INSTRUCTIONS[jq_ClassFileConstants.jbc_DALOAD] = DALOAD;
9434 INSTRUCTIONS[jq_ClassFileConstants.jbc_AALOAD] = AALOAD;
9435 INSTRUCTIONS[jq_ClassFileConstants.jbc_BALOAD] = BALOAD;
9436 INSTRUCTIONS[jq_ClassFileConstants.jbc_CALOAD] = CALOAD;
9437 INSTRUCTIONS[jq_ClassFileConstants.jbc_SALOAD] = SALOAD;
9438 INSTRUCTIONS[jq_ClassFileConstants.jbc_IASTORE] = IASTORE;
9439 INSTRUCTIONS[jq_ClassFileConstants.jbc_LASTORE] = LASTORE;
9440 INSTRUCTIONS[jq_ClassFileConstants.jbc_FASTORE] = FASTORE;
9441 INSTRUCTIONS[jq_ClassFileConstants.jbc_DASTORE] = DASTORE;
9442 INSTRUCTIONS[jq_ClassFileConstants.jbc_AASTORE] = AASTORE;
9443 INSTRUCTIONS[jq_ClassFileConstants.jbc_BASTORE] = BASTORE;
9444 INSTRUCTIONS[jq_ClassFileConstants.jbc_CASTORE] = CASTORE;
9445 INSTRUCTIONS[jq_ClassFileConstants.jbc_SASTORE] = SASTORE;
9446 INSTRUCTIONS[jq_ClassFileConstants.jbc_POP] = POP;
9447 INSTRUCTIONS[jq_ClassFileConstants.jbc_POP2] = POP2;
9448 INSTRUCTIONS[jq_ClassFileConstants.jbc_DUP] = DUP;
9449 INSTRUCTIONS[jq_ClassFileConstants.jbc_DUP_X1] = DUP_X1;
9450 INSTRUCTIONS[jq_ClassFileConstants.jbc_DUP_X2] = DUP_X2;
9451 INSTRUCTIONS[jq_ClassFileConstants.jbc_DUP2] = DUP2;
9452 INSTRUCTIONS[jq_ClassFileConstants.jbc_DUP2_X1] = DUP2_X1;
9453 INSTRUCTIONS[jq_ClassFileConstants.jbc_DUP2_X2] = DUP2_X2;
9454 INSTRUCTIONS[jq_ClassFileConstants.jbc_SWAP] = SWAP;
9455 INSTRUCTIONS[jq_ClassFileConstants.jbc_IADD] = IADD;
9456 INSTRUCTIONS[jq_ClassFileConstants.jbc_LADD] = LADD;
9457 INSTRUCTIONS[jq_ClassFileConstants.jbc_FADD] = FADD;
9458 INSTRUCTIONS[jq_ClassFileConstants.jbc_DADD] = DADD;
9459 INSTRUCTIONS[jq_ClassFileConstants.jbc_ISUB] = ISUB;
9460 INSTRUCTIONS[jq_ClassFileConstants.jbc_LSUB] = LSUB;
9461 INSTRUCTIONS[jq_ClassFileConstants.jbc_FSUB] = FSUB;
9462 INSTRUCTIONS[jq_ClassFileConstants.jbc_DSUB] = DSUB;
9463 INSTRUCTIONS[jq_ClassFileConstants.jbc_IMUL] = IMUL;
9464 INSTRUCTIONS[jq_ClassFileConstants.jbc_LMUL] = LMUL;
9465 INSTRUCTIONS[jq_ClassFileConstants.jbc_FMUL] = FMUL;
9466 INSTRUCTIONS[jq_ClassFileConstants.jbc_DMUL] = DMUL;
9467 INSTRUCTIONS[jq_ClassFileConstants.jbc_IDIV] = IDIV;
9468 INSTRUCTIONS[jq_ClassFileConstants.jbc_LDIV] = LDIV;
9469 INSTRUCTIONS[jq_ClassFileConstants.jbc_FDIV] = FDIV;
9470 INSTRUCTIONS[jq_ClassFileConstants.jbc_DDIV] = DDIV;
9471 INSTRUCTIONS[jq_ClassFileConstants.jbc_IREM] = IREM;
9472 INSTRUCTIONS[jq_ClassFileConstants.jbc_LREM] = LREM;
9473 INSTRUCTIONS[jq_ClassFileConstants.jbc_FREM] = FREM;
9474 INSTRUCTIONS[jq_ClassFileConstants.jbc_DREM] = DREM;
9475 INSTRUCTIONS[jq_ClassFileConstants.jbc_INEG] = INEG;
9476 INSTRUCTIONS[jq_ClassFileConstants.jbc_LNEG] = LNEG;
9477 INSTRUCTIONS[jq_ClassFileConstants.jbc_FNEG] = FNEG;
9478 INSTRUCTIONS[jq_ClassFileConstants.jbc_DNEG] = DNEG;
9479 INSTRUCTIONS[jq_ClassFileConstants.jbc_ISHL] = ISHL;
9480 INSTRUCTIONS[jq_ClassFileConstants.jbc_LSHL] = LSHL;
9481 INSTRUCTIONS[jq_ClassFileConstants.jbc_ISHR] = ISHR;
9482 INSTRUCTIONS[jq_ClassFileConstants.jbc_LSHR] = LSHR;
9483 INSTRUCTIONS[jq_ClassFileConstants.jbc_IUSHR] = IUSHR;
9484 INSTRUCTIONS[jq_ClassFileConstants.jbc_LUSHR] = LUSHR;
9485 INSTRUCTIONS[jq_ClassFileConstants.jbc_IAND] = IAND;
9486 INSTRUCTIONS[jq_ClassFileConstants.jbc_LAND] = LAND;
9487 INSTRUCTIONS[jq_ClassFileConstants.jbc_IOR] = IOR;
9488 INSTRUCTIONS[jq_ClassFileConstants.jbc_LOR] = LOR;
9489 INSTRUCTIONS[jq_ClassFileConstants.jbc_IXOR] = IXOR;
9490 INSTRUCTIONS[jq_ClassFileConstants.jbc_LXOR] = LXOR;
9491 INSTRUCTIONS[jq_ClassFileConstants.jbc_I2L] = I2L;
9492 INSTRUCTIONS[jq_ClassFileConstants.jbc_I2F] = I2F;
9493 INSTRUCTIONS[jq_ClassFileConstants.jbc_I2D] = I2D;
9494 INSTRUCTIONS[jq_ClassFileConstants.jbc_L2I] = L2I;
9495 INSTRUCTIONS[jq_ClassFileConstants.jbc_L2F] = L2F;
9496 INSTRUCTIONS[jq_ClassFileConstants.jbc_L2D] = L2D;
9497 INSTRUCTIONS[jq_ClassFileConstants.jbc_F2I] = F2I;
9498 INSTRUCTIONS[jq_ClassFileConstants.jbc_F2L] = F2L;
9499 INSTRUCTIONS[jq_ClassFileConstants.jbc_F2D] = F2D;
9500 INSTRUCTIONS[jq_ClassFileConstants.jbc_D2I] = D2I;
9501 INSTRUCTIONS[jq_ClassFileConstants.jbc_D2L] = D2L;
9502 INSTRUCTIONS[jq_ClassFileConstants.jbc_D2F] = D2F;
9503 INSTRUCTIONS[jq_ClassFileConstants.jbc_I2B] = I2B;
9504 INSTRUCTIONS[jq_ClassFileConstants.jbc_I2C] = I2C;
9505 INSTRUCTIONS[jq_ClassFileConstants.jbc_I2S] = I2S;
9506 INSTRUCTIONS[jq_ClassFileConstants.jbc_LCMP] = LCMP;
9507 INSTRUCTIONS[jq_ClassFileConstants.jbc_FCMPL] = FCMPL;
9508 INSTRUCTIONS[jq_ClassFileConstants.jbc_FCMPG] = FCMPG;
9509 INSTRUCTIONS[jq_ClassFileConstants.jbc_DCMPL] = DCMPL;
9510 INSTRUCTIONS[jq_ClassFileConstants.jbc_DCMPG] = DCMPG;
9511 INSTRUCTIONS[jq_ClassFileConstants.jbc_IRETURN] = IRETURN;
9512 INSTRUCTIONS[jq_ClassFileConstants.jbc_LRETURN] = LRETURN;
9513 INSTRUCTIONS[jq_ClassFileConstants.jbc_FRETURN] = FRETURN;
9514 INSTRUCTIONS[jq_ClassFileConstants.jbc_DRETURN] = DRETURN;
9515 INSTRUCTIONS[jq_ClassFileConstants.jbc_ARETURN] = ARETURN;
9516 INSTRUCTIONS[jq_ClassFileConstants.jbc_RETURN] = RETURN;
9517 INSTRUCTIONS[jq_ClassFileConstants.jbc_ARRAYLENGTH] = ARRAYLENGTH;
9518 INSTRUCTIONS[jq_ClassFileConstants.jbc_ATHROW] = ATHROW;
9519 INSTRUCTIONS[jq_ClassFileConstants.jbc_MONITORENTER] = MONITORENTER;
9520 INSTRUCTIONS[jq_ClassFileConstants.jbc_MONITOREXIT] = MONITOREXIT;
9521 }
9522 }
9523 }
9524
9525 interface Visitor {
9526 void visitStackInstruction(StackInstruction obj);
9527 void visitLocalVariableInstruction(LocalVariableInstruction obj);
9528 void visitBranchInstruction(BranchInstruction obj);
9529 void visitLoadClass(LoadClass obj);
9530 void visitFieldInstruction(FieldInstruction obj);
9531 void visitIfInstruction(IfInstruction obj);
9532 void visitConversionInstruction(ConversionInstruction obj);
9533 void visitPopInstruction(PopInstruction obj);
9534 void visitStoreInstruction(StoreInstruction obj);
9535 void visitTypedInstruction(TypedInstruction obj);
9536 void visitSelect(Select obj);
9537 void visitJsrInstruction(JsrInstruction obj);
9538 void visitGotoInstruction(GotoInstruction obj);
9539 void visitUnconditionalBranch(UnconditionalBranch obj);
9540 void visitPushInstruction(PushInstruction obj);
9541 void visitArithmeticInstruction(ArithmeticInstruction obj);
9542 void visitCPInstruction(CPInstruction obj);
9543 void visitInvokeInstruction(InvokeInstruction obj);
9544 void visitArrayInstruction(ArrayInstruction obj);
9545 void visitAllocationInstruction(AllocationInstruction obj);
9546 void visitReturnInstruction(ReturnInstruction obj);
9547 void visitFieldOrMethod(FieldOrMethod obj);
9548 void visitConstantPushInstruction(ConstantPushInstruction obj);
9549 void visitExceptionThrower(ExceptionThrower obj);
9550 void visitLoadInstruction(LoadInstruction obj);
9551 void visitVariableLengthInstruction(VariableLengthInstruction obj);
9552 void visitStackProducer(StackProducer obj);
9553 void visitStackConsumer(StackConsumer obj);
9554 void visitACONST_NULL(ACONST_NULL obj);
9555 void visitGETSTATIC(GETSTATIC obj);
9556 void visitIF_ICMPLT(IF_ICMPLT obj);
9557 void visitMONITOREXIT(MONITOREXIT obj);
9558 void visitIFLT(IFLT obj);
9559 void visitLSTORE(LSTORE obj);
9560 void visitPOP2(POP2 obj);
9561 void visitBASTORE(BASTORE obj);
9562 void visitISTORE(ISTORE obj);
9563 void visitCHECKCAST(CHECKCAST obj);
9564 void visitFCMPG(FCMPG obj);
9565 void visitI2F(I2F obj);
9566 void visitATHROW(ATHROW obj);
9567 void visitDCMPL(DCMPL obj);
9568 void visitARRAYLENGTH(ARRAYLENGTH obj);
9569 void visitDUP(DUP obj);
9570 void visitINVOKESTATIC(INVOKESTATIC obj);
9571 void visitLCONST(LCONST obj);
9572 void visitDREM(DREM obj);
9573 void visitIFGE(IFGE obj);
9574 void visitCALOAD(CALOAD obj);
9575 void visitLASTORE(LASTORE obj);
9576 void visitI2D(I2D obj);
9577 void visitDADD(DADD obj);
9578 void visitINVOKESPECIAL(INVOKESPECIAL obj);
9579 void visitIAND(IAND obj);
9580 void visitPUTFIELD(PUTFIELD obj);
9581 void visitILOAD(ILOAD obj);
9582 void visitDLOAD(DLOAD obj);
9583 void visitDCONST(DCONST obj);
9584 void visitNEW(NEW obj);
9585 void visitIFNULL(IFNULL obj);
9586 void visitLSUB(LSUB obj);
9587 void visitL2I(L2I obj);
9588 void visitISHR(ISHR obj);
9589 void visitTABLESWITCH(TABLESWITCH obj);
9590 void visitIINC(IINC obj);
9591 void visitDRETURN(DRETURN obj);
9592 void visitFSTORE(FSTORE obj);
9593 void visitDASTORE(DASTORE obj);
9594 void visitIALOAD(IALOAD obj);
9595 void visitDDIV(DDIV obj);
9596 void visitIF_ICMPGE(IF_ICMPGE obj);
9597 void visitLAND(LAND obj);
9598 void visitIDIV(IDIV obj);
9599 void visitLOR(LOR obj);
9600 void visitCASTORE(CASTORE obj);
9601 void visitFREM(FREM obj);
9602 void visitLDC(LDC obj);
9603 void visitBIPUSH(BIPUSH obj);
9604 void visitDSTORE(DSTORE obj);
9605 void visitF2L(F2L obj);
9606 void visitFMUL(FMUL obj);
9607 void visitLLOAD(LLOAD obj);
9608 void visitJSR(JSR obj);
9609 void visitFSUB(FSUB obj);
9610 void visitSASTORE(SASTORE obj);
9611 void visitALOAD(ALOAD obj);
9612 void visitDUP2_X2(DUP2_X2 obj);
9613 void visitRETURN(RETURN obj);
9614 void visitDALOAD(DALOAD obj);
9615 void visitSIPUSH(SIPUSH obj);
9616 void visitDSUB(DSUB obj);
9617 void visitL2F(L2F obj);
9618 void visitIF_ICMPGT(IF_ICMPGT obj);
9619 void visitF2D(F2D obj);
9620 void visitI2L(I2L obj);
9621 void visitIF_ACMPNE(IF_ACMPNE obj);
9622 void visitPOP(POP obj);
9623 void visitI2S(I2S obj);
9624 void visitIFEQ(IFEQ obj);
9625 void visitSWAP(SWAP obj);
9626 void visitIOR(IOR obj);
9627 void visitIREM(IREM obj);
9628 void visitIASTORE(IASTORE obj);
9629 void visitNEWARRAY(NEWARRAY obj);
9630 void visitINVOKEINTERFACE(INVOKEINTERFACE obj);
9631 void visitINEG(INEG obj);
9632 void visitLCMP(LCMP obj);
9633 void visitJSR_W(JSR_W obj);
9634 void visitMULTIANEWARRAY(MULTIANEWARRAY obj);
9635 void visitDUP_X2(DUP_X2 obj);
9636 void visitSALOAD(SALOAD obj);
9637 void visitIFNONNULL(IFNONNULL obj);
9638 void visitDMUL(DMUL obj);
9639 void visitIFNE(IFNE obj);
9640 void visitIF_ICMPLE(IF_ICMPLE obj);
9641 void visitLDC2_W(LDC2_W obj);
9642 void visitGETFIELD(GETFIELD obj);
9643 void visitLADD(LADD obj);
9644 void visitNOP(NOP obj);
9645 void visitFALOAD(FALOAD obj);
9646 void visitINSTANCEOF(INSTANCEOF obj);
9647 void visitIFLE(IFLE obj);
9648 void visitLXOR(LXOR obj);
9649 void visitLRETURN(LRETURN obj);
9650 void visitFCONST(FCONST obj);
9651 void visitIUSHR(IUSHR obj);
9652 void visitBALOAD(BALOAD obj);
9653 void visitDUP2(DUP2 obj);
9654 void visitIF_ACMPEQ(IF_ACMPEQ obj);
9655 void visitMONITORENTER(MONITORENTER obj);
9656 void visitLSHL(LSHL obj);
9657 void visitDCMPG(DCMPG obj);
9658 void visitD2L(D2L obj);
9659 void visitL2D(L2D obj);
9660 void visitRET(RET obj);
9661 void visitIFGT(IFGT obj);
9662 void visitIXOR(IXOR obj);
9663 void visitINVOKEVIRTUAL(INVOKEVIRTUAL obj);
9664 void visitFASTORE(FASTORE obj);
9665 void visitIRETURN(IRETURN obj);
9666 void visitIF_ICMPNE(IF_ICMPNE obj);
9667 void visitFLOAD(FLOAD obj);
9668 void visitLDIV(LDIV obj);
9669 void visitPUTSTATIC(PUTSTATIC obj);
9670 void visitAALOAD(AALOAD obj);
9671 void visitD2I(D2I obj);
9672 void visitIF_ICMPEQ(IF_ICMPEQ obj);
9673 void visitAASTORE(AASTORE obj);
9674 void visitARETURN(ARETURN obj);
9675 void visitDUP2_X1(DUP2_X1 obj);
9676 void visitFNEG(FNEG obj);
9677 void visitGOTO_W(GOTO_W obj);
9678 void visitD2F(D2F obj);
9679 void visitGOTO(GOTO obj);
9680 void visitISUB(ISUB obj);
9681 void visitF2I(F2I obj);
9682 void visitDNEG(DNEG obj);
9683 void visitICONST(ICONST obj);
9684 void visitFDIV(FDIV obj);
9685 void visitI2B(I2B obj);
9686 void visitLNEG(LNEG obj);
9687 void visitLREM(LREM obj);
9688 void visitIMUL(IMUL obj);
9689 void visitIADD(IADD obj);
9690 void visitLSHR(LSHR obj);
9691 void visitLOOKUPSWITCH(LOOKUPSWITCH obj);
9692 void visitDUP_X1(DUP_X1 obj);
9693 void visitFCMPL(FCMPL obj);
9694 void visitI2C(I2C obj);
9695 void visitLMUL(LMUL obj);
9696 void visitLUSHR(LUSHR obj);
9697 void visitISHL(ISHL obj);
9698 void visitLALOAD(LALOAD obj);
9699 void visitASTORE(ASTORE obj);
9700 void visitANEWARRAY(ANEWARRAY obj);
9701 void visitFRETURN(FRETURN obj);
9702 void visitFADD(FADD obj);
9703 void visitBREAKPOINT(BREAKPOINT obj);
9704 }
9705
9706 abstract class EmptyVisitor implements Visitor {
9707 public void visitStackInstruction(StackInstruction obj) { }
9708 public void visitLocalVariableInstruction(LocalVariableInstruction obj) { }
9709 public void visitBranchInstruction(BranchInstruction obj) { }
9710 public void visitLoadClass(LoadClass obj) { }
9711 public void visitFieldInstruction(FieldInstruction obj) { }
9712 public void visitIfInstruction(IfInstruction obj) { }
9713 public void visitConversionInstruction(ConversionInstruction obj) { }
9714 public void visitPopInstruction(PopInstruction obj) { }
9715 public void visitJsrInstruction(JsrInstruction obj) { }
9716 public void visitGotoInstruction(GotoInstruction obj) { }
9717 public void visitStoreInstruction(StoreInstruction obj) { }
9718 public void visitTypedInstruction(TypedInstruction obj) { }
9719 public void visitSelect(Select obj) { }
9720 public void visitUnconditionalBranch(UnconditionalBranch obj) { }
9721 public void visitPushInstruction(PushInstruction obj) { }
9722 public void visitArithmeticInstruction(ArithmeticInstruction obj) { }
9723 public void visitCPInstruction(CPInstruction obj) { }
9724 public void visitInvokeInstruction(InvokeInstruction obj) { }
9725 public void visitArrayInstruction(ArrayInstruction obj) { }
9726 public void visitAllocationInstruction(AllocationInstruction obj) { }
9727 public void visitReturnInstruction(ReturnInstruction obj) { }
9728 public void visitFieldOrMethod(FieldOrMethod obj) { }
9729 public void visitConstantPushInstruction(ConstantPushInstruction obj) { }
9730 public void visitExceptionThrower(ExceptionThrower obj) { }
9731 public void visitLoadInstruction(LoadInstruction obj) { }
9732 public void visitVariableLengthInstruction(VariableLengthInstruction obj) { }
9733 public void visitStackProducer(StackProducer obj) { }
9734 public void visitStackConsumer(StackConsumer obj) { }
9735 public void visitACONST_NULL(ACONST_NULL obj) { }
9736 public void visitGETSTATIC(GETSTATIC obj) { }
9737 public void visitIF_ICMPLT(IF_ICMPLT obj) { }
9738 public void visitMONITOREXIT(MONITOREXIT obj) { }
9739 public void visitIFLT(IFLT obj) { }
9740 public void visitLSTORE(LSTORE obj) { }
9741 public void visitPOP2(POP2 obj) { }
9742 public void visitBASTORE(BASTORE obj) { }
9743 public void visitISTORE(ISTORE obj) { }
9744 public void visitCHECKCAST(CHECKCAST obj) { }
9745 public void visitFCMPG(FCMPG obj) { }
9746 public void visitI2F(I2F obj) { }
9747 public void visitATHROW(ATHROW obj) { }
9748 public void visitDCMPL(DCMPL obj) { }
9749 public void visitARRAYLENGTH(ARRAYLENGTH obj) { }
9750 public void visitDUP(DUP obj) { }
9751 public void visitINVOKESTATIC(INVOKESTATIC obj) { }
9752 public void visitLCONST(LCONST obj) { }
9753 public void visitDREM(DREM obj) { }
9754 public void visitIFGE(IFGE obj) { }
9755 public void visitCALOAD(CALOAD obj) { }
9756 public void visitLASTORE(LASTORE obj) { }
9757 public void visitI2D(I2D obj) { }
9758 public void visitDADD(DADD obj) { }
9759 public void visitINVOKESPECIAL(INVOKESPECIAL obj) { }
9760 public void visitIAND(IAND obj) { }
9761 public void visitPUTFIELD(PUTFIELD obj) { }
9762 public void visitILOAD(ILOAD obj) { }
9763 public void visitDLOAD(DLOAD obj) { }
9764 public void visitDCONST(DCONST obj) { }
9765 public void visitNEW(NEW obj) { }
9766 public void visitIFNULL(IFNULL obj) { }
9767 public void visitLSUB(LSUB obj) { }
9768 public void visitL2I(L2I obj) { }
9769 public void visitISHR(ISHR obj) { }
9770 public void visitTABLESWITCH(TABLESWITCH obj) { }
9771 public void visitIINC(IINC obj) { }
9772 public void visitDRETURN(DRETURN obj) { }
9773 public void visitFSTORE(FSTORE obj) { }
9774 public void visitDASTORE(DASTORE obj) { }
9775 public void visitIALOAD(IALOAD obj) { }
9776 public void visitDDIV(DDIV obj) { }
9777 public void visitIF_ICMPGE(IF_ICMPGE obj) { }
9778 public void visitLAND(LAND obj) { }
9779 public void visitIDIV(IDIV obj) { }
9780 public void visitLOR(LOR obj) { }
9781 public void visitCASTORE(CASTORE obj) { }
9782 public void visitFREM(FREM obj) { }
9783 public void visitLDC(LDC obj) { }
9784 public void visitBIPUSH(BIPUSH obj) { }
9785 public void visitDSTORE(DSTORE obj) { }
9786 public void visitF2L(F2L obj) { }
9787 public void visitFMUL(FMUL obj) { }
9788 public void visitLLOAD(LLOAD obj) { }
9789 public void visitJSR(JSR obj) { }
9790 public void visitFSUB(FSUB obj) { }
9791 public void visitSASTORE(SASTORE obj) { }
9792 public void visitALOAD(ALOAD obj) { }
9793 public void visitDUP2_X2(DUP2_X2 obj) { }
9794 public void visitRETURN(RETURN obj) { }
9795 public void visitDALOAD(DALOAD obj) { }
9796 public void visitSIPUSH(SIPUSH obj) { }
9797 public void visitDSUB(DSUB obj) { }
9798 public void visitL2F(L2F obj) { }
9799 public void visitIF_ICMPGT(IF_ICMPGT obj) { }
9800 public void visitF2D(F2D obj) { }
9801 public void visitI2L(I2L obj) { }
9802 public void visitIF_ACMPNE(IF_ACMPNE obj) { }
9803 public void visitPOP(POP obj) { }
9804 public void visitI2S(I2S obj) { }
9805 public void visitIFEQ(IFEQ obj) { }
9806 public void visitSWAP(SWAP obj) { }
9807 public void visitIOR(IOR obj) { }
9808 public void visitIREM(IREM obj) { }
9809 public void visitIASTORE(IASTORE obj) { }
9810 public void visitNEWARRAY(NEWARRAY obj) { }
9811 public void visitINVOKEINTERFACE(INVOKEINTERFACE obj) { }
9812 public void visitINEG(INEG obj) { }
9813 public void visitLCMP(LCMP obj) { }
9814 public void visitJSR_W(JSR_W obj) { }
9815 public void visitMULTIANEWARRAY(MULTIANEWARRAY obj) { }
9816 public void visitDUP_X2(DUP_X2 obj) { }
9817 public void visitSALOAD(SALOAD obj) { }
9818 public void visitIFNONNULL(IFNONNULL obj) { }
9819 public void visitDMUL(DMUL obj) { }
9820 public void visitIFNE(IFNE obj) { }
9821 public void visitIF_ICMPLE(IF_ICMPLE obj) { }
9822 public void visitLDC2_W(LDC2_W obj) { }
9823 public void visitGETFIELD(GETFIELD obj) { }
9824 public void visitLADD(LADD obj) { }
9825 public void visitNOP(NOP obj) { }
9826 public void visitFALOAD(FALOAD obj) { }
9827 public void visitINSTANCEOF(INSTANCEOF obj) { }
9828 public void visitIFLE(IFLE obj) { }
9829 public void visitLXOR(LXOR obj) { }
9830 public void visitLRETURN(LRETURN obj) { }
9831 public void visitFCONST(FCONST obj) { }
9832 public void visitIUSHR(IUSHR obj) { }
9833 public void visitBALOAD(BALOAD obj) { }
9834 public void visitDUP2(DUP2 obj) { }
9835 public void visitIF_ACMPEQ(IF_ACMPEQ obj) { }
9836 public void visitMONITORENTER(MONITORENTER obj) { }
9837 public void visitLSHL(LSHL obj) { }
9838 public void visitDCMPG(DCMPG obj) { }
9839 public void visitD2L(D2L obj) { }
9840 public void visitL2D(L2D obj) { }
9841 public void visitRET(RET obj) { }
9842 public void visitIFGT(IFGT obj) { }
9843 public void visitIXOR(IXOR obj) { }
9844 public void visitINVOKEVIRTUAL(INVOKEVIRTUAL obj) { }
9845 public void visitFASTORE(FASTORE obj) { }
9846 public void visitIRETURN(IRETURN obj) { }
9847 public void visitIF_ICMPNE(IF_ICMPNE obj) { }
9848 public void visitFLOAD(FLOAD obj) { }
9849 public void visitLDIV(LDIV obj) { }
9850 public void visitPUTSTATIC(PUTSTATIC obj) { }
9851 public void visitAALOAD(AALOAD obj) { }
9852 public void visitD2I(D2I obj) { }
9853 public void visitIF_ICMPEQ(IF_ICMPEQ obj) { }
9854 public void visitAASTORE(AASTORE obj) { }
9855 public void visitARETURN(ARETURN obj) { }
9856 public void visitDUP2_X1(DUP2_X1 obj) { }
9857 public void visitFNEG(FNEG obj) { }
9858 public void visitGOTO_W(GOTO_W obj) { }
9859 public void visitD2F(D2F obj) { }
9860 public void visitGOTO(GOTO obj) { }
9861 public void visitISUB(ISUB obj) { }
9862 public void visitF2I(F2I obj) { }
9863 public void visitDNEG(DNEG obj) { }
9864 public void visitICONST(ICONST obj) { }
9865 public void visitFDIV(FDIV obj) { }
9866 public void visitI2B(I2B obj) { }
9867 public void visitLNEG(LNEG obj) { }
9868 public void visitLREM(LREM obj) { }
9869 public void visitIMUL(IMUL obj) { }
9870 public void visitIADD(IADD obj) { }
9871 public void visitLSHR(LSHR obj) { }
9872 public void visitLOOKUPSWITCH(LOOKUPSWITCH obj) { }
9873 public void visitDUP_X1(DUP_X1 obj) { }
9874 public void visitFCMPL(FCMPL obj) { }
9875 public void visitI2C(I2C obj) { }
9876 public void visitLMUL(LMUL obj) { }
9877 public void visitLUSHR(LUSHR obj) { }
9878 public void visitISHL(ISHL obj) { }
9879 public void visitLALOAD(LALOAD obj) { }
9880 public void visitASTORE(ASTORE obj) { }
9881 public void visitANEWARRAY(ANEWARRAY obj) { }
9882 public void visitFRETURN(FRETURN obj) { }
9883 public void visitFADD(FADD obj) { }
9884 public void visitBREAKPOINT(BREAKPOINT obj) { }
9885 }
9886
9887 }