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