継続は力にゃりん。毎日続けることができるのか? 進捗 * 2005-11-24 中断 * 2005-11-15 いろいろ * 2005-11-10 Class * 2005-11-05 Method * 2005-11-03 Subroutines * 2005-11-01 Switches * 2005-10-10 Control Instructions * 2005-10-09 Just Biding Your Time * 2005-09-30 Arrays of Numbers * 2005-09-20 Stack Manipulations * 2005-09-15 Type Conversions * 2005-09-13 Bitwise Operation * 2005-09-11 Nonnumbers and Infinity * 2005-09-07 Arithmetic operations * 2005-08-26 load, store * 2005-08-23 複数 println * 2005-08-21 push * 2005-08-10 *const_* * 2005-08-06 ldc* と println * 2005-08-01 start !2005-11-23 Wed .class public C2005112300 .super java/lang/Object .method static foo(I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_0 invokevirtual java/io/PrintStream/println (I)V return .end method .method static foo(I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_0 invokevirtual java/io/PrintStream/println (I)V return .end method .method public static main ([Ljava/lang/String;)V ldc 1 invokestatic C2005112300/foo(I)V return .end method .end class で、コンパイルは通ってしまい、実行は、 Exception in thread "main" java.lang.ClassFormatError: Repetitive method name/signature in class file C2005112300 !2005-11-22 Tue .class public C2005112200 .super java/lang/Object .method static foo(I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_0 invokevirtual java/io/PrintStream/println (I)V return .end method .method static foo(II)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_0 iload_1 iadd invokevirtual java/io/PrintStream/println (I)V return .end method .method public static main ([Ljava/lang/String;)V ldc 1 invokestatic C2005112200/foo(I)V ldc 1 ldc 2 invokestatic C2005112200/foo(II)V return .end method .end class で、 1 3 !2005-11-21 Mon .class public C2005112100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 5 iconst_5 newarray char dup iconst_0 bipush 72 castore dup iconst_1 bipush 101 castore dup iconst_2 bipush 108 castore dup iconst_3 bipush 108 castore dup iconst_4 bipush 111 castore astore_1 getstatic java/lang/System/out Ljava/io/PrintStream; new java/lang/String dup aload_1 invokespecial java/lang/String/ ([C)V invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 Hello !2005-11-20 Sun .class public C2005112000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello, World!!" ldc 0 invokevirtual java/lang/String/charAt (I)C invokevirtual java/io/PrintStream/println (C)V return .end method .end class で、 H !2005-11-19 Sat .class public C2005111900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 5 iconst_3 newarray int dup iconst_0 iconst_1 iastore dup iconst_1 iconst_2 iastore dup iconst_2 iconst_3 iastore arraylength getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 3 !2005-11-18 Fri .class public C2005111800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 invokevirtual java/io/PrintStream/println (Z)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0 invokevirtual java/io/PrintStream/println (Z)V return .end method .end class で、 true false boolean 型なのに、なぜ数値 ??? !2005-11-17 Thu .class public C2005111700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 65 invokevirtual java/io/PrintStream/println (C)V return .end method .end class で、 A !2005-11-16 Wed .class public C2005111600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 5 getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 2.0 ldc2_w 3.0 invokestatic java/lang/Math/pow (DD)D invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 8.0 !2005-11-15 Tue .class public C2005111500 .super java/lang/Object .method static read_num()I .throws java/io/IOException new java/io/BufferedReader dup new java/io/InputStreamReader dup getstatic java/lang/System/in Ljava/io/InputStream; invokespecial java/io/InputStreamReader/ (Ljava/io/InputStream;)V invokespecial java/io/BufferedReader/ (Ljava/io/Reader;)V astore_0 aload_0 invokevirtual java/io/BufferedReader/readLine()Ljava/lang/String; invokestatic java/lang/Integer/parseInt (Ljava/lang/String;)I ireturn .end method .method public static main ([Ljava/lang/String;)V .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; invokestatic C2005111500/read_num()I invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 1 !2005-11-14 Mon .class C20051114 .super java/lang/Object .field x I .method ()V aload_0 invokespecial java/lang/Object/ ()V return .end method .method public set_x(I)V aload_0 iload_1 putfield C20051114/x I return .end method .method public get_x()I aload_0 getfield C20051114/x I ireturn .end method .end class .class public C2005111400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 new C20051114 dup invokespecial C20051114/ ()V astore_2 aload_2 ldc 10 invokevirtual C20051114/set_x (I)V aload_2 invokevirtual C20051114/get_x ()I getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 10 !2005-11-13 Sun .class C20051113 .super java/lang/Object .method ()V aload_0 invokespecial java/lang/Object/ ()V return .end method .method public foo()V getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class .class public C2005111300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 new C20051113 dup invokespecial C20051113/ ()V invokevirtual C20051113/foo ()V return .end method .end class で、 foo !2005-11-12 Sat こんなのを class C20051112 { C20051112() {} public void foo() { System.out.println("foo"); } } 用意して、 .class public C2005111200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 new C20051112 dup invokespecial C20051112/ ()V invokevirtual C20051112/foo ()V return .end method .end class で、 foo !2005-11-11 Fri .class public C2005111100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 new java/lang/Integer dup bipush 123 invokespecial java/lang/Integer/ (I)V invokevirtual java/lang/Integer/intValue ()I invokestatic java/lang/Integer/toString (I)Ljava/lang/String; getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 123 !2005-11-10 Thu .class public C2005111000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 bipush 123 invokestatic java/lang/Integer/toString (I)Ljava/lang/String; getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 123 !2005-11-09 Wed .class public C2005110900 .super java/lang/Object .method static foo(II)I iload_0 iload_1 iadd ireturn .end method .method public static main ([Ljava/lang/String;)V .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 invokestatic C2005110900/foo(II)I invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 3 !2005-11-08 Tue .class public C2005110800 .super java/lang/Object .method static foo(I)I iload_0 bipush 1 iadd ireturn .end method .method public static main ([Ljava/lang/String;)V .limit stack 2 getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 invokestatic C2005110800/foo(I)I invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 2 !2005-11-07 Mon .class public C2005110700 .super java/lang/Object .method static foo(I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_0 invokevirtual java/io/PrintStream/println (I)V return .end method .method public static main ([Ljava/lang/String;)V .limit stack 2 ldc 1 invokestatic C2005110700/foo(I)V return .end method .end class で、 1 !2005-11-06 Sun .class public C2005110600 .super java/lang/Object .method static foo()V getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .method public static main ([Ljava/lang/String;)V .limit stack 2 invokestatic C2005110600/foo()V return .end method .end class で、 foo !2005-11-05 Sat .class public C2005110500 .super java/lang/Object .method public static foo()V getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .method public static main ([Ljava/lang/String;)V .limit stack 2 invokestatic C2005110500/foo()V return .end method .end class で、 foo !2005-11-04 Fri .class public C2005110400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 2 jsr hoge return hoge: astore_0 getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello World" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V ret 0 .end method .end class で、 Hello World まだ完全には理解できていないが、かなり苦労したよ〜 !2005-11-03 Thu .class public C2005110300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ;.limit stack 2 ; OK .limit stack 3 jsr hoge return hoge: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "in hoge" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 in hoge return しちゃったら、main を終了してしまっている気がするなあ。ダメじゃん。 !2005-11-02 Wed .class public C2005110200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 1 i2l ldc 1 i2l lcmp tableswitch -1 less equal greater default: fail less: ldc "<" astore_0 goto print equal: ldc "==" astore_0 goto print greater: ldc ">" astore_0 goto print print: getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V fail: return .end method .end class で、 == !2005-11-01 Tue .class public C2005110100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 1 i2l ldc 1 i2l lcmp lookupswitch -1: less 0: equal 1: greater default: fail less: ldc "<" astore_0 goto print equal: ldc "==" astore_0 goto print greater: ldc ">" astore_0 goto print print: getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V fail: return .end method .end class で、 == なんだか分からないけど、 .class public C2005110101 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 5 getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 i2l ldc 1 i2l lcmp lookupswitch -1: less 0: equal 1: greater default: fail less: ldc "<" goto print equal: ldc "==" goto print greater: ldc ">" goto print print: invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V fail: return .end method .end class だと、 Exception in thread "main" java.lang.VerifyError: (class: C2005110101, method: main signature: ([Ljava/lang/String;)V) Inconsistent stack height 0 != 1 なぞと怒られてしまう !2005-10-31 Mon .class public C2005103100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1 ldc2_w 10 lcmp invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 !2005-10-30 Sun .class public C2005103000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ;.limit stack 5 .limit stack 6 getstatic java/lang/System/out Ljava/io/PrintStream; getstatic java/lang/Math/PI D d2f dconst_1 dconst_0 ddiv d2f fcmpg invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; getstatic java/lang/Math/PI D d2f dconst_1 dconst_0 ddiv d2f fcmpl invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 -1 !2005-10-29 Sat .class public C2005102900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ;.limit stack 3 .limit stack 4 getstatic java/lang/System/out Ljava/io/PrintStream; getstatic java/lang/Math/PI D d2f ldc2_w 3.1416D d2f fcmpg invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 !2005-10-28 Fri .class public C2005102800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ;.limit stack 6 .limit stack 7 getstatic java/lang/System/out Ljava/io/PrintStream; getstatic java/lang/Math/PI D dconst_1 dconst_0 ddiv dcmpg invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; getstatic java/lang/Math/PI D dconst_1 dconst_0 ddiv dcmpl invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 -1 dcmpg, dcmpl 違いがないなあ? !2005-10-27 Thu .class public C2005102700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ;.limit stack 4 .limit stack 5 getstatic java/lang/System/out Ljava/io/PrintStream; getstatic java/lang/Math/PI D ldc2_w 3.1416D dcmpg invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 !2005-10-26 Wed .class public C2005102600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ;.limit stack 3 .limit stack 4 getstatic java/lang/Math/PI D ldc2_w 3.1416D dcmpg iflt approxTooHigh getstatic java/lang/System/out Ljava/io/PrintStream; ldc "PI >= 3.1416" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return approxTooHigh: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "PI < 3.1416" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 PI < 3.1416 !2005-10-25 Tue .class public C2005102500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ;ldc "foo" aconst_null ifnonnull non_null getstatic java/lang/System/out Ljava/io/PrintStream; ldc "null" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return non_null: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "not null" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 null !2005-10-24 Mon .class public C2005102400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc "foo" ifnull null getstatic java/lang/System/out Ljava/io/PrintStream; ldc "not null" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return null: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "null" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 not null !2005-10-23 Sun .class public C2005102300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc "foo" ldc "foo" if_acmpne acmp getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo == foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return acmp: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo != foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 foo == foo !2005-10-22 Sat .class public C2005102200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc "foo" ldc "foo" if_acmpeq acmp getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo != foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return acmp: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "foo == foo" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 foo == foo あれ?同じなんだ !2005-10-21 Fri .class public C2005102100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 ifne not_equal getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 == 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return not_equal: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 != 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 != 0 !2005-10-20 Thu .class public C2005102000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 ifeq equal getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 != 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return equal: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 == 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 != 0 !2005-10-19 Wed .class public C2005101900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 ifle lesser getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 > 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return lesser: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 <= 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 > 0 !2005-10-18 Tue .class public C2005101800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 iflt lesser getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 >= 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return lesser: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 < 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 >= 0 !2005-10-17 Mon .class public C2005101700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 ifge greater getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 < 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return greater: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 >= 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 >= 0 !2005-10-16 Sun .class public C2005101600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 ifgt greater getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 <= 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return greater: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 > 0" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 > 0 !2005-10-15 Sat .class public C2005101500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 bipush 10 if_icmpne not_equal getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 == 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return not_equal: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 != 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 != 10 !2005-10-14 Fri .class public C2005101400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 bipush 10 if_icmpeq equal getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 != 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return equal: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 == 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 != 10 !2005-10-13 Thu .class public C2005101300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 bipush 10 if_icmple lesser getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 > 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return lesser: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 <= 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 <= 10 !2005-10-12 Wed .class public C2005101200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 bipush 10 if_icmplt lesser getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 >= 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return lesser: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 < 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 < 10 !2005-10-11 Tue .class public C2005101100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 bipush 10 if_icmpge greater getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 < 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return greater: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 >= 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 < 10 !2005-10-10 Mon .class public C2005101000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V bipush 1 bipush 10 if_icmpgt greater getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 <= 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return greater: getstatic java/lang/System/out Ljava/io/PrintStream; ldc "1 > 10" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 <= 10 !2005-10-09 Sun multianewarray とばし。 ってどういう時に使うのか、良く分からないから。 .class public C2005100900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V nop nop nop return .end method .end class で、javap で確かめると、 Compiled from 2005100900.j public class C2005100900 extends java.lang.Object /* ACC_SUPER bit NOT set */ { public static void main(java.lang.String[]); } Method void main(java.lang.String[]) 0 nop 1 nop 2 nop 3 return !2005-10-08 Sat .class public C2005100800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 anewarray java/lang/String astore_0 aload_0 ; set variable ldc 0 ldc "a" aastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 aaload invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 a !2005-10-07 Fri .class public C2005100700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray char astore_0 aload_0 ; set variable ldc 0 ldc 10 i2c castore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 caload invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 10 !2005-10-06 Thu .class public C2005100600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray byte astore_0 aload_0 ; set variable ldc 0 ldc 10 i2b bastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 baload invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 10 !2005-10-05 Wed .class public C2005100500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray double astore_0 aload_0 ; set variable ldc 0 ldc2_w 1.2D dastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 daload invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 1.2 !2005-10-04 Tue .class public C2005100400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray float astore_0 aload_0 ; set variable ldc 0 ;ldc 1.2 ldc2_w 1.2D d2f fastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 faload invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 1.2 !2005-10-03 Mon .class public C2005100300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray short astore_0 aload_0 ; set variable ldc 0 ldc 10 i2s sastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 saload invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 10 考えてみると、short を (I) で表示して大丈夫なんだろうか? !2005-10-02 Sun .class public C2005100200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray long astore_0 aload_0 ; set variable ldc 0 ;ldc 10 ldc2_w 10L lastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 laload invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 10 !2005-10-01 Sat .class public C2005100101 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 3 newarray int astore_0 aload_0 ; set variable ldc 0 ldc 10 iastore getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 ldc 0 iaload invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 10 !2005-09-30 Fri .class public C2005093000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 10 newarray int ;astore_0 ;aload_0 ldc 1 iaload invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 0 !2005-09-29 Thu .class public C2005092900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L ldc2_w 2L ldc2_w 3L dup2_x2 ladd ladd ladd invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 9 !2005-09-28 Wed .class public C2005092800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc2_w 2L dup2_x1 l2i isub i2l ladd invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 1 !2005-09-27 Tue .class public C2005092700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L dup2 ladd invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 2 !2005-09-26 Mon .class public C2005092600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 ldc 3 dup_x2 iadd iadd iadd invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 9 !2005-09-25 Sun .class public C2005092500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 dup_x1 isub iadd invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 dup_x1 iadd iadd invokevirtual java/io/PrintStream/println (I)V ldc "O" ldc "S" dup_x1 getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; swap invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 1 5 S O S !2005-09-24 Sat .class public C2005092400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 dup iadd invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 2 !2005-09-23 Fri .class public C2005092300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 swap isub invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-09-22 Thu .class public C2005092200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc2_w 1L pop2 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-09-21 Wed .class public C2005092100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 ldc 3 pop2 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-09-20 Tue .class public C2005092000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 2 pop invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-09-19 Mon .class public C2005091900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ; .limit stack 2 ; OK .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.2 d2i invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.2 d2l invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.2 d2f invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.2D d2f invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 1 1 1.2 1.2 !2005-09-18 Sun .class public C2005091800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ; .limit stack 2 ; OK .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 f2i invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 f2l invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 f2d invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 1 1 1.0 ldc 1.2 だと以下のエラー invalid argument to ldc 今まで気がつかなかったが、.0 しか使っていなかったからのよう。 未解決。 !2005-09-17 Sat .class public C2005091700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ; .limit stack 2 ; OK .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L l2i invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L l2f invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L l2d invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 1 1.0 1.0 !2005-09-16 Fri .class public C2005091600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ; .limit stack 2 ; OK .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x7fff i2b invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x7f i2b invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x7fffffff i2c invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x7fffffff i2s invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x7fff i2s invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 127 65535 -1 32767 0xffff をなぜ 65535 と表示するんだろう? !2005-09-15 Thu .class public C2005091500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; NG ; .limit stack 2 ; OK .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 i2l invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 i2f invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 i2d invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 10 10.0 10.0 stack size を指定しないと、実行時エラーに !2005-09-14 Wed .class public C2005091400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L ;ldc2_w 3L ldc 3 lshl invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 16 ldc 3 lshr invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w -1 ldc 3 lshr invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w -1 ldc 3 lushr invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L ldc2_w 3L land invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L ldc2_w 3L lor invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L ldc2_w 3L lxor invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 8 2 -1 2305843009213693951 1 3 2 シフト量が long だと実行時エラーになってしまうようだ ldc2_w 0x80000000 というように書くとコンパイルできない。 16進で書けないの??? !2005-09-13 Tue .class public C2005091300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 3 ishl invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 8 ldc 3 ishr invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x80000000 ldc 3 ishr invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 0x80000000 ldc 3 iushr invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 3 iand invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 3 ior invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ldc 3 ixor invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 8 1 -268435456 268435456 1 3 2 「ldc 0x80000000」を「ldc 2147483648」と書くと、実行時エラーに。なぜ? !2005-09-12 Mon .class public C2005091200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; fconst_1 fconst_0 fdiv invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fconst_1 fconst_0 fdiv fconst_1 fadd invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fconst_1 fconst_0 fdiv dup fsub invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 Infinity Infinity NaN !2005-09-11 Sun .class public C2005091100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; fconst_0 fconst_0 fdiv invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fconst_0 fconst_0 fdiv fconst_0 fadd invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 NaN NaN !2005-09-10 Sat .class public C2005091000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.0 dconst_1 dadd invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.0 ldc2_w 2.0 dadd invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.0 ldc2_w 2.0 dadd invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 2.0 ldc2_w 1.0 dsub invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 2.0 ldc2_w 3.0 dmul invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 10.0 ldc2_w 3.0 ddiv invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 10.0 ldc2_w 3.0 drem invokevirtual java/io/PrintStream/println (D)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1.0 dneg invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 2.0 3.0 3.0 1.0 6.0 3.3333333333333335 1.0 -1.0 !2005-09-09 Fri .class public C2005090900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 ldc 1.0 fadd invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 2.0 ldc 1.0 fsub invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 2.0 ldc 3.0 fmul invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 10.0 ldc 3.0 fdiv invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 10.0 ldc 3.0 frem invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 fneg invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 2.0 1.0 6.0 3.3333333 1.0 -1.0 !2005-09-08 Thu .class public C2005090800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L lconst_1 ladd invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L ldc2_w 2L ladd invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1 ldc2_w 2 ladd invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 2 ldc2_w 1 lsub invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 2 ldc2_w 3 lmul invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 10 ldc2_w 3 ldiv invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 10 ldc2_w 3 lrem invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1 lneg invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 2 3 3 1 6 3 1 -1 !2005-09-07 Wed .class public C2005090700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 bipush 1 iadd invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 2 bipush 1 isub invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 2 bipush 3 imul invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 10 bipush 3 idiv invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 10 bipush 3 irem invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 ineg invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 2 1 6 3 1 -1 !2005-09-06 Tue .class public C2005090600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V dconst_0 dstore_0 getstatic java/lang/System/out Ljava/io/PrintStream; dload_0 invokevirtual java/io/PrintStream/println (D)V dconst_1 dstore_1 getstatic java/lang/System/out Ljava/io/PrintStream; dload_1 invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 0.0 1.0 !2005-09-05 Mon .class public C2005090500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; dconst_1 dstore 0 dload 0 invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 1.0 !2005-09-04 Sun .class public C2005090400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc2_w 0L lstore_0 ldc2_w 2L lstore_2 getstatic java/lang/System/out Ljava/io/PrintStream; lload_0 invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; lload_2 invokevirtual java/io/PrintStream/println (J)V ldc2_w 1L lstore_1 ldc2_w 3L lstore_3 getstatic java/lang/System/out Ljava/io/PrintStream; lload_1 invokevirtual java/io/PrintStream/println (J)V getstatic java/lang/System/out Ljava/io/PrintStream; lload_3 invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 0 2 1 3 良く分かっていないが、近接している箇所を連続して使用すると、 エラーになってしまうようだ。 long の場合、2つ分使用するのが関係していそう。 破壊しちゃうのかな??? !2005-09-03 Sat .class public C2005090300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 0L lstore_0 lload_0 invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 0 !2005-09-02 Fri .class public C2005090200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc "foo 0" astore_0 ldc "foo 1" astore_1 ldc "foo 2" astore_2 ldc "foo 3" astore_3 getstatic java/lang/System/out Ljava/io/PrintStream; aload_0 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; aload_1 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; aload_2 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; aload_3 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 foo 0 foo 1 foo 2 foo 3 !2005-09-01 Thu .class public C2005090100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello, World" astore 0 aload 0 invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 Hello, World !2005-08-31 Wed .class public C2005083100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V fconst_0 fstore_0 fconst_1 fstore_1 fconst_2 fstore_2 getstatic java/lang/System/out Ljava/io/PrintStream; fload_0 invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fload_1 invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fload_2 invokevirtual java/io/PrintStream/println (F)V fconst_0 fstore_0 fconst_1 fstore_1 fconst_2 fstore_2 getstatic java/lang/System/out Ljava/io/PrintStream; fload_2 invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fload_1 invokevirtual java/io/PrintStream/println (F)V getstatic java/lang/System/out Ljava/io/PrintStream; fload_0 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 0.0 1.0 2.0 2.0 1.0 0.0 !2005-08-30 Tue .class public C2005083000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; fconst_1 fstore 0 fload 0 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 1.0 !2005-08-29 Mon .class public C2005082900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V ldc 0 istore_0 ldc 1 istore_1 ldc 2 istore_2 ldc 3 istore_3 getstatic java/lang/System/out Ljava/io/PrintStream; iload_0 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_1 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_2 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; iload_3 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 0 1 2 3 !2005-08-28 Sun .class public C2005082800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 istore_0 iload_0 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-08-27 Sat .class public C2005082700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 istore 5 iload 5 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-08-26 Fri .class public C2005082600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 istore 0 iload 0 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-08-25 Thu .class public C2005082500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_m1 getstatic java/lang/System/out Ljava/io/PrintStream; iconst_0 getstatic java/lang/System/out Ljava/io/PrintStream; iconst_1 getstatic java/lang/System/out Ljava/io/PrintStream; iconst_5 invokevirtual java/io/PrintStream/println (I)V invokevirtual java/io/PrintStream/println (I)V invokevirtual java/io/PrintStream/println (I)V invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 5 1 0 -1 !2005-08-24 Wed .class public C2005082400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_m1 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_0 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_1 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_5 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 -1 0 1 5 !2005-08-23 Tue 複数 println を書く方法が分からなかったので、javap -c で逆アセンブルしてみた。 getstatic がそれぞれに必要らしいことが分かった。 jad の場合は、-dis で良いのかな? .class public C2005082300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 invokevirtual java/io/PrintStream/println (I)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 1 1.0 !2005-08-22 Mon .class public C2005082200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; sipush 1 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 bipush と sipush 何が違うんだったけ? .class public C2005082101 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; bipush 256 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 0 文句は言われないけど、bipush は小さな数ということらしい。 !2005-08-21 Sun .class public C2005082100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; bipush 1 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-08-20 Sat .class public C2005082000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; dconst_1 invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 1.0 !2005-08-19 Fri .class public C2005081900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; dconst_0 invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 0.0 !2005-08-18 Thu .class public C2005081800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 2 getstatic java/lang/System/out Ljava/io/PrintStream; fconst_2 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 2.0 !2005-08-17 Wed .class public C2005081700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 2 getstatic java/lang/System/out Ljava/io/PrintStream; fconst_1 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 1.0 !2005-08-16 Tue .class public C2005081600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 2 getstatic java/lang/System/out Ljava/io/PrintStream; fconst_0 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 0.0 stack size 2 でも OK。理由不明。 !2005-08-15 Mon .class public C2005081500 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 getstatic java/lang/System/out Ljava/io/PrintStream; lconst_1 invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 1 !2005-08-14 Sun .class public C2005081400 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 3 ; OK ; .limit stack 2 ; NG getstatic java/lang/System/out Ljava/io/PrintStream; lconst_0 invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 0 !2005-08-13 Sat .class public C2005081300 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_5 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 5 !2005-08-12 Fri .class public C2005081200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_1 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-08-11 Thu .class public C2005081100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_0 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 0 !2005-08-10 Wed .class public C2005081000 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; iconst_m1 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 0 !2005-08-09 Tue .class public C2005080900 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 1L invokevirtual java/io/PrintStream/println (J)V return .end method .end class で、 1 !2005-08-08 Mon .class public C2005080800 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc2_w 3.14 invokevirtual java/io/PrintStream/println (D)V return .end method .end class で、 3.14 !2005-08-07 Sun .class public C2005080700 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1.0 invokevirtual java/io/PrintStream/println (F)V return .end method .end class で、 1.0 !2005-08-06 Sat .class public C2005080600 .super java/lang/Object .method public static main ([Ljava/lang/String;)V getstatic java/lang/System/out Ljava/io/PrintStream; ldc 1 invokevirtual java/io/PrintStream/println (I)V return .end method .end class で、 1 !2005-08-05 Fri getstatic ... を削ってみる。 .class public C2005080500 ; .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; .limit stack 2 ; .limit locals 1 ; getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello World" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 Exception in thread "main" java.lang.VerifyError: (class: C2005080500, method: main signature: ([Ljava/lang/String;)V) Unable to pop operand off an empty stack !2005-08-04 Thu 削れそうなものを削ってみる return を削っちゃえ。 .class public C2005080400 ; .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; .limit stack 2 ; .limit locals 1 getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello World" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V ; return .end method .end class で、 Exception in thread "main" java.lang.VerifyError: (class: C2005080400, method: main signature: ([Ljava/lang/String;)V) Falling off the end of the code !2005-08-03 Wed 削れそうなものを削ってみる .super を削っちゃえ。 コメントは、; でも、// でも良いのか? .class public C2005080300 ; .super java/lang/Object .method public static main ([Ljava/lang/String;)V ; .limit stack 2 ; .limit locals 1 getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello World" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 Hello World !2005-08-02 Tue 削れそうなものを削ってみる .class public C2005080200 .super java/lang/Object .method public static main ([Ljava/lang/String;)V // .limit stack 2 // .limit locals 1 getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello World" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 Hello World !2005-08-01 Mon .class public C2005080100 .super java/lang/Object .method public static main ([Ljava/lang/String;)V .limit stack 2 .limit locals 1 getstatic java/lang/System/out Ljava/io/PrintStream; ldc "Hello World" invokevirtual java/io/PrintStream/println (Ljava/lang/String;)V return .end method .end class で、 Hello World