1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.jdo.impl.enhancer.classfile;
20
21 import java.io.PrintStream;
22 import java.util.Stack;
23
24 /***
25 * InsnTarget is a pseudo-instruction which represents a branch target
26 * in an instruction stream.
27 */
28 public class InsnTarget extends Insn {
29
30 private boolean branchTarget = false;
31
32 public int nStackArgs() {
33 return 0;
34 }
35
36 public int nStackResults() {
37 return 0;
38 }
39
40 public String argTypes() {
41 return "";
42 }
43
44 public String resultTypes() {
45 return "";
46 }
47
48 public boolean branches() {
49 return false;
50 }
51
52 public void setBranchTarget() {
53 branchTarget = true;
54 }
55
56
57 public boolean isBranchTarget() {
58 return branchTarget;
59 }
60
61 /***
62 * Constructor
63 */
64 public InsnTarget() {
65 super(opc_target, NO_OFFSET);
66 }
67
68 /***
69 * Compares this instance with another for structural equality.
70 */
71
72 public boolean isEqual(Stack msg, Object obj) {
73 if (!(obj instanceof InsnTarget)) {
74 msg.push("obj/obj.getClass() = "
75 + (obj == null ? null : obj.getClass()));
76 msg.push("this.getClass() = "
77 + this.getClass());
78 return false;
79 }
80 InsnTarget other = (InsnTarget)obj;
81
82 if (!super.isEqual(msg, other)) {
83 return false;
84 }
85
86 if (this.branchTarget != other.branchTarget) {
87 msg.push(String.valueOf("branchTarget = "
88 + other.branchTarget));
89 msg.push(String.valueOf("branchTarget = "
90 + this.branchTarget));
91 return false;
92 }
93 return true;
94 }
95
96 /* package local methods *//package-summary/html">class="comment"> package local methods *//package-summary.html">
97
98 void print (PrintStream out, int indent) {
99 ClassPrint.spaces(out, indent);
100 out.println(offset() + ":");
101 }
102
103 int store(byte buf[], int index) {
104 return index;
105 }
106
107 int size() {
108 return 0;
109 }
110
111 InsnTarget(int offset) {
112 super(opc_target, offset);
113 }
114 }