1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
diff -N -a -u -r -b bcel-5.1/build.xml bcel/build.xml
--- bcel-5.1/build.xml 2003-04-25 09:06:14.000000000 +0100
+++ bcel/build.xml 2004-08-11 21:25:17.449281600 +0100
@@ -65,7 +65,7 @@
<target name="build" depends="compile"/>
<!-- Jar the library -->
- <target name="jar" depends="examples">
+ <target name="jar" depends="init,compile">
<jar jarfile="${build.dir}/${name}.jar"
basedir="${build.dest}"
manifest="${basedir}/manifest.txt"
diff -N -a -u -r -b bcel-5.1/manifest.txt bcel/manifest.txt
--- bcel-5.1/manifest.txt 1970-01-01 00:00:00.000000000 +0000
+++ bcel/manifest.txt 2004-08-11 21:25:17.509368000 +0100
@@ -0,0 +1,3 @@
+Created-By: Jakarta BCEL 5.1
+Manifest-Version: 1.0
+Main-Class: listclass
diff -N -a -u -r -b bcel-5.1/src/java/org/apache/bcel/generic/Instruction.java bcel/src/java/org/apache/bcel/generic/Instruction.java
--- bcel-5.1/src/java/org/apache/bcel/generic/Instruction.java 2003-04-25 09:06:16.000000000 +0100
+++ bcel/src/java/org/apache/bcel/generic/Instruction.java 2004-08-11 21:28:49.424086400 +0100
@@ -190,26 +190,223 @@
Class clazz;
try {
- clazz = Class.forName(className(opcode));
- } catch (ClassNotFoundException cnfe){
- // If a class by that name does not exist, the opcode is illegal.
- // Note that IMPDEP1, IMPDEP2, BREAKPOINT are also illegal in a sense.
- throw new ClassGenException("Illegal opcode detected.");
+ switch(opcode) {
+ case Constants.NOP: obj = new NOP(); break;
+ case Constants.ACONST_NULL: obj = new ACONST_NULL(); break;
+ case Constants.ICONST_M1:
+ case Constants.ICONST_0:
+ case Constants.ICONST_1:
+ case Constants.ICONST_2:
+ case Constants.ICONST_3:
+ case Constants.ICONST_4:
+ case Constants.ICONST_5: obj = new ICONST(); break;
+ case Constants.LCONST_0:
+ case Constants.LCONST_1: obj = new LCONST(); break;
+ case Constants.FCONST_0:
+ case Constants.FCONST_1:
+ case Constants.FCONST_2: obj = new FCONST(); break;
+ case Constants.DCONST_0:
+ case Constants.DCONST_1: obj = new DCONST(); break;
+ case Constants.BIPUSH : obj = new BIPUSH(); break;
+ case Constants.SIPUSH : obj = new SIPUSH(); break;
+ case Constants.LDC : obj = new LDC(); break;
+ case Constants.LDC_W: obj = new LDC_W(); break;
+ case Constants.LDC2_W: obj = new LDC2_W(); break;
+ case Constants.ILOAD : obj = new ILOAD(); break;
+ case Constants.LLOAD : obj = new LLOAD(); break;
+ case Constants.FLOAD : obj = new FLOAD(); break;
+ case Constants.DLOAD : obj = new DLOAD(); break;
+ case Constants.ALOAD : obj = new ALOAD(); break;
+ case Constants.ILOAD_0:
+ case Constants.ILOAD_1:
+ case Constants.ILOAD_2:
+ case Constants.ILOAD_3: obj = new ILOAD(); break;
+ case Constants.LLOAD_0:
+ case Constants.LLOAD_1:
+ case Constants.LLOAD_2:
+ case Constants.LLOAD_3: obj = new LLOAD(); break;
+ case Constants.FLOAD_0:
+ case Constants.FLOAD_1:
+ case Constants.FLOAD_2:
+ case Constants.FLOAD_3: obj = new FLOAD(); break;
+ case Constants.DLOAD_0:
+ case Constants.DLOAD_1:
+ case Constants.DLOAD_2:
+ case Constants.DLOAD_3: obj = new DLOAD(); break;
+ case Constants.ALOAD_0:
+ case Constants.ALOAD_1:
+ case Constants.ALOAD_2:
+ case Constants.ALOAD_3: obj = new ALOAD(); break;
+ case Constants.IALOAD : obj = new IALOAD(); break;
+ case Constants.LALOAD : obj = new LALOAD(); break;
+ case Constants.FALOAD : obj = new FALOAD(); break;
+ case Constants.DALOAD : obj = new DALOAD(); break;
+ case Constants.AALOAD : obj = new AALOAD(); break;
+ case Constants.BALOAD : obj = new BALOAD(); break;
+ case Constants.CALOAD : obj = new CALOAD(); break;
+ case Constants.SALOAD : obj = new SALOAD(); break;
+ case Constants.ISTORE : obj = new ISTORE(); break;
+ case Constants.LSTORE : obj = new LSTORE(); break;
+ case Constants.FSTORE : obj = new FSTORE(); break;
+ case Constants.DSTORE : obj = new DSTORE(); break;
+ case Constants.ASTORE : obj = new ASTORE(); break;
+ case Constants.ISTORE_0:
+ case Constants.ISTORE_1:
+ case Constants.ISTORE_2:
+ case Constants.ISTORE_3: obj = new ISTORE(); break;
+ case Constants.LSTORE_0:
+ case Constants.LSTORE_1:
+ case Constants.LSTORE_2:
+ case Constants.LSTORE_3: obj = new LSTORE(); break;
+ case Constants.FSTORE_0:
+ case Constants.FSTORE_1:
+ case Constants.FSTORE_2:
+ case Constants.FSTORE_3: obj = new FSTORE(); break;
+ case Constants.DSTORE_0:
+ case Constants.DSTORE_1:
+ case Constants.DSTORE_2:
+ case Constants.DSTORE_3: obj = new DSTORE(); break;
+ case Constants.ASTORE_0:
+ case Constants.ASTORE_1:
+ case Constants.ASTORE_2:
+ case Constants.ASTORE_3: obj = new ASTORE(); break;
+ case Constants.IASTORE : obj = new IASTORE(); break;
+ case Constants.LASTORE : obj = new LASTORE(); break;
+ case Constants.FASTORE : obj = new FASTORE(); break;
+ case Constants.DASTORE : obj = new DASTORE(); break;
+ case Constants.AASTORE : obj = new AASTORE(); break;
+ case Constants.BASTORE : obj = new BASTORE(); break;
+ case Constants.CASTORE : obj = new CASTORE(); break;
+ case Constants.SASTORE : obj = new SASTORE(); break;
+ case Constants.POP : obj = new POP(); break;
+ case Constants.POP2 : obj = new POP2(); break;
+ case Constants.DUP : obj = new DUP(); break;
+ case Constants.DUP_X1: obj = new DUP_X1(); break;
+ case Constants.DUP_X2: obj = new DUP_X2(); break;
+ case Constants.DUP2 : obj = new DUP2(); break;
+ case Constants.DUP2_X1: obj = new DUP2_X1(); break;
+ case Constants.DUP2_X2: obj = new DUP2_X2(); break;
+ case Constants.SWAP : obj = new SWAP(); break;
+ case Constants.IADD : obj = new IADD(); break;
+ case Constants.LADD : obj = new LADD(); break;
+ case Constants.FADD : obj = new FADD(); break;
+ case Constants.DADD : obj = new DADD(); break;
+ case Constants.ISUB : obj = new ISUB(); break;
+ case Constants.LSUB : obj = new LSUB(); break;
+ case Constants.FSUB : obj = new FSUB(); break;
+ case Constants.DSUB : obj = new DSUB(); break;
+ case Constants.IMUL : obj = new IMUL(); break;
+ case Constants.LMUL : obj = new LMUL(); break;
+ case Constants.FMUL : obj = new FMUL(); break;
+ case Constants.DMUL : obj = new DMUL(); break;
+ case Constants.IDIV : obj = new IDIV(); break;
+ case Constants.LDIV : obj = new LDIV(); break;
+ case Constants.FDIV : obj = new FDIV(); break;
+ case Constants.DDIV : obj = new DDIV(); break;
+ case Constants.IREM : obj = new IREM(); break;
+ case Constants.LREM : obj = new LREM(); break;
+ case Constants.FREM : obj = new FREM(); break;
+ case Constants.DREM : obj = new DREM(); break;
+ case Constants.INEG : obj = new INEG(); break;
+ case Constants.LNEG : obj = new LNEG(); break;
+ case Constants.FNEG : obj = new FNEG(); break;
+ case Constants.DNEG : obj = new DNEG(); break;
+ case Constants.ISHL : obj = new ISHL(); break;
+ case Constants.LSHL : obj = new LSHL(); break;
+ case Constants.ISHR : obj = new ISHR(); break;
+ case Constants.LSHR : obj = new LSHR(); break;
+ case Constants.IUSHR : obj = new IUSHR(); break;
+ case Constants.LUSHR : obj = new LUSHR(); break;
+ case Constants.IAND : obj = new IAND(); break;
+ case Constants.LAND : obj = new LAND(); break;
+ case Constants.IOR : obj = new IOR(); break;
+ case Constants.LOR : obj = new LOR(); break;
+ case Constants.IXOR : obj = new IXOR(); break;
+ case Constants.LXOR : obj = new LXOR(); break;
+ case Constants.IINC : obj = new IINC(); break;
+ case Constants.I2L : obj = new I2L(); break;
+ case Constants.I2F : obj = new I2F(); break;
+ case Constants.I2D : obj = new I2D(); break;
+ case Constants.L2I : obj = new L2I(); break;
+ case Constants.L2F : obj = new L2F(); break;
+ case Constants.L2D : obj = new L2D(); break;
+ case Constants.F2I : obj = new F2I(); break;
+ case Constants.F2L : obj = new F2L(); break;
+ case Constants.F2D : obj = new F2D(); break;
+ case Constants.D2I : obj = new D2I(); break;
+ case Constants.D2L : obj = new D2L(); break;
+ case Constants.D2F : obj = new D2F(); break;
+ case Constants.I2B : obj = new I2B(); break;
+ case Constants.I2C : obj = new I2C(); break;
+ case Constants.I2S : obj = new I2S(); break;
+ case Constants.LCMP : obj = new LCMP(); break;
+ case Constants.FCMPL : obj = new FCMPL(); break;
+ case Constants.FCMPG : obj = new FCMPG(); break;
+ case Constants.DCMPL : obj = new DCMPL(); break;
+ case Constants.DCMPG : obj = new DCMPG(); break;
+ case Constants.IFEQ : obj = new IFEQ(); break;
+ case Constants.IFNE : obj = new IFNE(); break;
+ case Constants.IFLT : obj = new IFLT(); break;
+ case Constants.IFGE : obj = new IFGE(); break;
+ case Constants.IFGT : obj = new IFGT(); break;
+ case Constants.IFLE : obj = new IFLE(); break;
+ case Constants.IF_ICMPEQ: obj = new IF_ICMPEQ(); break;
+ case Constants.IF_ICMPNE: obj = new IF_ICMPNE(); break;
+ case Constants.IF_ICMPLT: obj = new IF_ICMPLT(); break;
+ case Constants.IF_ICMPGE: obj = new IF_ICMPGE(); break;
+ case Constants.IF_ICMPGT: obj = new IF_ICMPGT(); break;
+ case Constants.IF_ICMPLE: obj = new IF_ICMPLE(); break;
+ case Constants.IF_ACMPEQ: obj = new IF_ACMPEQ(); break;
+ case Constants.IF_ACMPNE : obj = new IF_ACMPNE(); break;
+ case Constants.GOTO : obj = new GOTO(); break;
+ case Constants.JSR : obj = new JSR(); break;
+ case Constants.RET : obj = new RET(); break;
+ case Constants.TABLESWITCH : obj = new TABLESWITCH(); break;
+ case Constants.LOOKUPSWITCH : obj = new LOOKUPSWITCH(); break;
+ case Constants.IRETURN : obj = new IRETURN(); break;
+ case Constants.LRETURN : obj = new LRETURN(); break;
+ case Constants.FRETURN : obj = new FRETURN(); break;
+ case Constants.DRETURN : obj = new DRETURN(); break;
+ case Constants.ARETURN : obj = new ARETURN(); break;
+ case Constants.RETURN : obj = new RETURN(); break;
+ case Constants.GETSTATIC : obj = new GETSTATIC(); break;
+ case Constants.PUTSTATIC : obj = new PUTSTATIC(); break;
+ case Constants.GETFIELD : obj = new GETFIELD(); break;
+ case Constants.PUTFIELD : obj = new PUTFIELD(); break;
+ case Constants.INVOKEVIRTUAL : obj = new INVOKEVIRTUAL(); break;
+ case Constants.INVOKESPECIAL : obj = new INVOKESPECIAL(); break;
+ case Constants.INVOKESTATIC : obj = new INVOKESTATIC(); break;
+ case Constants.INVOKEINTERFACE : obj = new INVOKEINTERFACE(); break;
+ case Constants.NEW : obj = new NEW(); break;
+ case Constants.NEWARRAY : obj = new NEWARRAY(); break;
+ case Constants.ANEWARRAY : obj = new ANEWARRAY(); break;
+ case Constants.ARRAYLENGTH : obj = new ARRAYLENGTH(); break;
+ case Constants.ATHROW : obj = new ATHROW(); break;
+ case Constants.CHECKCAST : obj = new CHECKCAST(); break;
+ case Constants.INSTANCEOF : obj = new INSTANCEOF(); break;
+ case Constants.MONITORENTER : obj = new MONITORENTER(); break;
+ case Constants.MONITOREXIT : obj = new MONITOREXIT(); break;
+ case Constants.MULTIANEWARRAY : obj = new MULTIANEWARRAY(); break;
+ case Constants.IFNULL : obj = new IFNULL(); break;
+ case Constants.IFNONNULL : obj = new IFNONNULL(); break;
+ case Constants.GOTO_W : obj = new GOTO_W(); break;
+ case Constants.JSR_W : obj = new JSR_W(); break;
+ default:
+ throw new ClassGenException("Illegal opcode detected");
+ }
+ } catch (ClassGenException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ClassGenException(e.toString());
}
-
- try {
- obj = (Instruction)clazz.newInstance();
-
if(wide && !((obj instanceof LocalVariableInstruction) ||
(obj instanceof IINC) ||
(obj instanceof RET)))
- throw new Exception("Illegal opcode after wide: " + opcode);
+ throw new ClassGenException("Illegal opcode after wide: " + opcode);
obj.setOpcode(opcode);
obj.initFromFile(bytes, wide); // Do further initializations, if any
// Byte code offset set in InstructionList
- } catch(Exception e) { throw new ClassGenException(e.toString()); }
-
return obj;
}
diff -N -a -u -r -b bcel-5.1/src/java/org/apache/bcel/generic/LDC_W.java bcel/src/java/org/apache/bcel/generic/LDC_W.java
--- bcel-5.1/src/java/org/apache/bcel/generic/LDC_W.java 2003-04-25 09:06:16.000000000 +0100
+++ bcel/src/java/org/apache/bcel/generic/LDC_W.java 2004-08-11 21:28:47.160832000 +0100
@@ -83,6 +83,6 @@
{
setIndex(bytes.readUnsignedShort());
// Override just in case it has been changed
- opcode = org.apache.bcel.Constants.LDC_W;
+ // opcode = org.apache.bcel.Constants.LDC_W;
}
}
diff -N -a -u -r -b bcel-5.1/src/java/org/apache/bcel/generic/MethodGen.java bcel/src/java/org/apache/bcel/generic/MethodGen.java
--- bcel-5.1/src/java/org/apache/bcel/generic/MethodGen.java 2003-04-25 09:06:16.000000000 +0100
+++ bcel/src/java/org/apache/bcel/generic/MethodGen.java 2004-08-11 21:28:47.641523200 +0100
@@ -133,9 +133,9 @@
/* Add local variables, namely the implicit `this' and the arguments
*/
- if(!isStatic() && (class_name != null)) { // Instance method -> `this' is local var 0
- addLocalVariable("this", new ObjectType(class_name), start, end);
- }
+// if(!isStatic() && (class_name != null)) { // Instance method -> `this' is local var 0
+// addLocalVariable("this", new ObjectType(class_name), start, end);
+// }
}
if(arg_types != null) {
@@ -152,17 +152,17 @@
throw new ClassGenException("Mismatch in argument array lengths: " +
size + " vs. " + arg_names.length);
} else { // Give them dummy names
- arg_names = new String[size];
-
- for(int i=0; i < size; i++)
- arg_names[i] = "arg" + i;
-
- setArgumentNames(arg_names);
+// arg_names = new String[size];
+//
+// for(int i=0; i < size; i++)
+// arg_names[i] = "arg" + i;
+//
+// setArgumentNames(arg_names);
}
if(!abstract_) {
for(int i=0; i < size; i++) {
- addLocalVariable(arg_names[i], arg_types[i], start, end);
+// addLocalVariable(arg_names[i], arg_types[i], start, end);
}
}
}
|