• R/O
  • HTTP
  • SSH
  • HTTPS

jcfa: Commit

JavaClassFileAnalyzer (jcfa) のメインリポジトリです。


Commit MetaInfo

Revision19f90d0d3297e61f19d0dea5efa4376fa9f10ff4 (tree)
Time2014-04-03 21:48:16
Authoriga <tosiki.iga@nift...>
Commiteriga

Log Message

save

Change Summary

Incremental Difference

--- a/jcfa/src/jp/igapyon/jcfa/util/JcfaWriteUtil.java
+++ b/jcfa/src/jp/igapyon/jcfa/util/JcfaWriteUtil.java
@@ -139,29 +139,24 @@ public class JcfaWriteUtil {
139139 final JavaClass jc = jcfaCode.getJavaClass();
140140
141141 switch (jcfaCode.getOpcode()) {
142- case Constants.ALOAD_0: {
143- final JcfaItemLocalVariable osLocalVariable = new JcfaItemLocalVariable();
144- jcfaMethod.getFrame().getOperandStack().push(osLocalVariable);
145- osLocalVariable.setLocalVariable(jcfaMethod.getFrame()
146- .getLocalVariableList().get(0));
147-
148- jcfaCode.getComment().getCommentList()
149- .add(osLocalVariable.getLocalVariable().getName());
150-
151- break;
152- }
153- case Constants.RETURN: {
154- break;
155- }
156- case Constants.GETSTATIC: {
157- final JcfaItemReference osRef = new JcfaItemReference();
158- jcfaMethod.getFrame().getOperandStack().push(osRef);
159- osRef.setObject(JcfaUtil.getConstantFieldrefString(jc,
160- codes[1], codes[2]));
161-
162- jcfaCode.getComment().getCommentList().add(osRef.getObject());
163- break;
164- }
142+ case Constants.NOP:
143+ case Constants.ACONST_NULL:
144+ case Constants.ICONST_M1:
145+ case Constants.ICONST_0:
146+ case Constants.ICONST_1:
147+ case Constants.ICONST_2:
148+ case Constants.ICONST_3:
149+ case Constants.ICONST_4:
150+ case Constants.ICONST_5:
151+ case Constants.LCONST_0:
152+ case Constants.LCONST_1:
153+ case Constants.FCONST_0:
154+ case Constants.FCONST_1:
155+ case Constants.FCONST_2:
156+ case Constants.DCONST_0:
157+ case Constants.DCONST_1:
158+ case Constants.BIPUSH:
159+ case Constants.SIPUSH:
165160 case Constants.LDC: {
166161 final JcfaItemReference osString = new JcfaItemReference();
167162 jcfaMethod.getFrame().getOperandStack().push(osString);
@@ -169,32 +164,171 @@ public class JcfaWriteUtil {
169164
170165 jcfaCode.getComment().getCommentList()
171166 .add(osString.getObject());
172- }
173167 break;
174- case Constants.INVOKEVIRTUAL:
175- case Constants.INVOKESPECIAL: {
176- final int operand = JcfaUtil.byte2UnsignedShort(codes[1],
177- codes[2]);
178- jcfaCode.getComment().getCommentList()
179- .add(JcfaUtil.getConstantMethodRefString(jc, operand));
168+ }
169+ case Constants.LDC_W:
170+ case Constants.LDC2_W:
171+ case Constants.ILOAD:
172+ case Constants.LLOAD:
173+ case Constants.FLOAD:
174+ case Constants.DLOAD:
175+ case Constants.ALOAD: {
176+ final JcfaItemLocalVariable osLocalVariable = new JcfaItemLocalVariable();
177+ jcfaMethod.getFrame().getOperandStack().push(osLocalVariable);
178+ osLocalVariable.setLocalVariable(jcfaMethod.getFrame()
179+ .getLocalVariableList().get(0));
180180
181181 jcfaCode.getComment().getCommentList()
182- .add("TODO get args count from signature.");
183- // get n args.
184- final JcfaItem osNodeArg0 = jcfaMethod.getFrame()
185- .getOperandStack().pop();
186-
187- final JcfaItemReference osRef = (JcfaItemReference) jcfaMethod
188- .getFrame().getOperandStack().pop();
189-
190- jcfaCode.getComment()
191- .getCommentList()
192- .add("" + osRef.getObject() + "#"
193- + osNodeArg0.toString());
182+ .add(osLocalVariable.getLocalVariable().getName());
194183
195- }
196184 break;
197- case Constants.LOOKUPSWITCH:
185+ }
186+ case Constants.ILOAD_0:
187+ case Constants.ILOAD_1:
188+ case Constants.ILOAD_2:
189+ case Constants.ILOAD_3:
190+ case Constants.LLOAD_0:
191+ case Constants.LLOAD_1:
192+ case Constants.LLOAD_2:
193+ case Constants.LLOAD_3:
194+ case Constants.FLOAD_0:
195+ case Constants.FLOAD_1:
196+ case Constants.FLOAD_2:
197+ case Constants.FLOAD_3:
198+ case Constants.DLOAD_0:
199+ case Constants.DLOAD_1:
200+ case Constants.DLOAD_2:
201+ case Constants.DLOAD_3:
202+ case Constants.ALOAD_0:
203+ case Constants.ALOAD_1:
204+ case Constants.ALOAD_2:
205+ case Constants.ALOAD_3:
206+ case Constants.IALOAD:
207+ case Constants.LALOAD:
208+ case Constants.FALOAD:
209+ case Constants.DALOAD:
210+ case Constants.AALOAD:
211+ case Constants.BALOAD:
212+ case Constants.CALOAD:
213+ case Constants.SALOAD:
214+ case Constants.ISTORE:
215+ case Constants.LSTORE:
216+ case Constants.FSTORE:
217+ case Constants.DSTORE:
218+ case Constants.ASTORE:
219+ case Constants.ISTORE_0:
220+ case Constants.ISTORE_1:
221+ case Constants.ISTORE_2:
222+ case Constants.ISTORE_3:
223+ case Constants.LSTORE_0:
224+ case Constants.LSTORE_1:
225+ case Constants.LSTORE_2:
226+ case Constants.LSTORE_3:
227+ case Constants.FSTORE_0:
228+ case Constants.FSTORE_1:
229+ case Constants.FSTORE_2:
230+ case Constants.FSTORE_3:
231+ case Constants.DSTORE_0:
232+ case Constants.DSTORE_1:
233+ case Constants.DSTORE_2:
234+ case Constants.DSTORE_3:
235+ case Constants.ASTORE_0:
236+ case Constants.ASTORE_1:
237+ case Constants.ASTORE_2:
238+ case Constants.ASTORE_3:
239+ case Constants.IASTORE:
240+ case Constants.LASTORE:
241+ case Constants.FASTORE:
242+ case Constants.DASTORE:
243+ case Constants.AASTORE:
244+ case Constants.BASTORE:
245+ case Constants.CASTORE:
246+ case Constants.SASTORE:
247+ case Constants.POP:
248+ case Constants.POP2:
249+ case Constants.DUP:
250+ case Constants.DUP_X1:
251+ case Constants.DUP_X2:
252+ case Constants.DUP2:
253+ case Constants.DUP2_X1:
254+ case Constants.DUP2_X2:
255+ case Constants.SWAP:
256+ case Constants.IADD:
257+ case Constants.LADD:
258+ case Constants.FADD:
259+ case Constants.DADD:
260+ case Constants.ISUB:
261+ case Constants.LSUB:
262+ case Constants.FSUB:
263+ case Constants.DSUB:
264+ case Constants.IMUL:
265+ case Constants.LMUL:
266+ case Constants.FMUL:
267+ case Constants.DMUL:
268+ case Constants.IDIV:
269+ case Constants.LDIV:
270+ case Constants.FDIV:
271+ case Constants.DDIV:
272+ case Constants.IREM:
273+ case Constants.LREM:
274+ case Constants.FREM:
275+ case Constants.DREM:
276+ case Constants.INEG:
277+ case Constants.LNEG:
278+ case Constants.FNEG:
279+ case Constants.DNEG:
280+ case Constants.ISHL:
281+ case Constants.LSHL:
282+ case Constants.ISHR:
283+ case Constants.LSHR:
284+ case Constants.IUSHR:
285+ case Constants.LUSHR:
286+ case Constants.IAND:
287+ case Constants.LAND:
288+ case Constants.IOR:
289+ case Constants.LOR:
290+ case Constants.IXOR:
291+ case Constants.LXOR:
292+ case Constants.IINC:
293+ case Constants.I2L:
294+ case Constants.I2F:
295+ case Constants.I2D:
296+ case Constants.L2I:
297+ case Constants.L2F:
298+ case Constants.L2D:
299+ case Constants.F2I:
300+ case Constants.F2L:
301+ case Constants.F2D:
302+ case Constants.D2I:
303+ case Constants.D2L:
304+ case Constants.D2F:
305+ case Constants.I2B:
306+ case Constants.I2C:
307+ case Constants.I2S:
308+ case Constants.LCMP:
309+ case Constants.FCMPL:
310+ case Constants.FCMPG:
311+ case Constants.DCMPL:
312+ case Constants.DCMPG:
313+ case Constants.IFEQ:
314+ case Constants.IFNE:
315+ case Constants.IFLT:
316+ case Constants.IFGE:
317+ case Constants.IFGT:
318+ case Constants.IFLE:
319+ case Constants.IF_ICMPEQ:
320+ case Constants.IF_ICMPNE:
321+ case Constants.IF_ICMPLT:
322+ case Constants.IF_ICMPGE:
323+ case Constants.IF_ICMPGT:
324+ case Constants.IF_ICMPLE:
325+ case Constants.IF_ACMPEQ:
326+ case Constants.IF_ACMPNE:
327+ case Constants.GOTO:
328+ case Constants.JSR:
329+ case Constants.RET:
330+ case Constants.TABLESWITCH:
331+ case Constants.LOOKUPSWITCH: {
198332 if (true) {
199333 jcfaCode.getComment().getCommentList()
200334 .add(" TODO temporary disabled.");
@@ -233,6 +367,67 @@ public class JcfaWriteUtil {
233367 .add(" TODO skipping bytes: " + (diff2));
234368
235369 break;
370+ }
371+ case Constants.IRETURN:
372+ case Constants.LRETURN:
373+ case Constants.FRETURN:
374+ case Constants.DRETURN:
375+ case Constants.ARETURN:
376+ case Constants.RETURN: {
377+ break;
378+ }
379+ case Constants.GETSTATIC: {
380+ final JcfaItemReference osRef = new JcfaItemReference();
381+ jcfaMethod.getFrame().getOperandStack().push(osRef);
382+ osRef.setObject(JcfaUtil.getConstantFieldrefString(jc,
383+ codes[1], codes[2]));
384+
385+ jcfaCode.getComment().getCommentList().add(osRef.getObject());
386+ break;
387+ }
388+ case Constants.PUTSTATIC:
389+ case Constants.GETFIELD:
390+ case Constants.PUTFIELD:
391+ case Constants.INVOKEVIRTUAL:
392+ case Constants.INVOKESPECIAL: {
393+ final int operand = JcfaUtil.byte2UnsignedShort(codes[1],
394+ codes[2]);
395+ jcfaCode.getComment().getCommentList()
396+ .add(JcfaUtil.getConstantMethodRefString(jc, operand));
397+
398+ jcfaCode.getComment().getCommentList()
399+ .add("TODO get args count from signature.");
400+ // get n args.
401+ final JcfaItem osNodeArg0 = jcfaMethod.getFrame()
402+ .getOperandStack().pop();
403+
404+ final JcfaItemReference osRef = (JcfaItemReference) jcfaMethod
405+ .getFrame().getOperandStack().pop();
406+
407+ jcfaCode.getComment()
408+ .getCommentList()
409+ .add("" + osRef.getObject() + "#"
410+ + osNodeArg0.toString());
411+
412+ break;
413+ }
414+ case Constants.INVOKESTATIC:
415+ case Constants.INVOKEINTERFACE:
416+ case Constants.NEW:
417+ case Constants.NEWARRAY:
418+ case Constants.ANEWARRAY:
419+ case Constants.ARRAYLENGTH:
420+ case Constants.ATHROW:
421+ case Constants.CHECKCAST:
422+ case Constants.INSTANCEOF:
423+ case Constants.MONITORENTER:
424+ case Constants.MONITOREXIT:
425+ case Constants.WIDE:
426+ case Constants.MULTIANEWARRAY:
427+ case Constants.IFNULL:
428+ case Constants.IFNONNULL:
429+ case Constants.GOTO_W:
430+ case Constants.JSR_W:
236431 default:
237432 jcfaCode.getComment().getCommentList()
238433 .add("TODO unsupported opcode");
--- a/jcfa/testJavaClass/output/test/TestJavaClass001.jcfa
+++ b/jcfa/testJavaClass/output/test/TestJavaClass001.jcfa
@@ -5,12 +5,12 @@ public class TestJavaClass001 {
55 /** Constructor. */
66 public TestJavaClass001() {
77 /*
8- * 0: aload_0 this
8+ * 0: aload_0 TODO temporary disabled.
99 */
1010
1111 /*
1212 * 1: invokespecial java/lang/Object#<init>()V TODO get args count from
13- * signature. null#jp.igapyon.jcfa.vo.item.JcfaItemLocalVariable@143c919
13+ * signature. null#jp.igapyon.jcfa.vo.item.JcfaItemReference@143c919
1414 */
1515
1616 /* 4: return */
--- a/jcfa/testJavaClass/output/test/TestJavaClass011.jcfa
+++ b/jcfa/testJavaClass/output/test/TestJavaClass011.jcfa
@@ -5,12 +5,12 @@ public class TestJavaClass011 {
55 /** Constructor. */
66 public TestJavaClass011() {
77 /*
8- * 0: aload_0 this
8+ * 0: aload_0 TODO temporary disabled.
99 */
1010
1111 /*
1212 * 1: invokespecial java/lang/Object#<init>()V TODO get args count from
13- * signature. null#jp.igapyon.jcfa.vo.item.JcfaItemLocalVariable@15c0729
13+ * signature. null#jp.igapyon.jcfa.vo.item.JcfaItemReference@15c0729
1414 */
1515
1616 /* 4: return */
Show on old repository browser