Appendix A: Full disassembly of Hello.class

user@home> ./jallie --dis Hello.class 2>/dev/null
ClassFile  {
  u4 magic = 0xcafebabe
  u2 minor_version = 0
  u2 major_version = 50
  u2 constant_pool_count = 29
  cp_info constant_pool[29] {
    [ 0 ] [Unused]
    [ 1 ] CONSTANT_Methodref_info  {
      u1 tag = 10
      u2 class_index = #6 // "java/lang/Object"
      u2 name_and_type_index = #15 //  ()V
    }
    [ 2 ] CONSTANT_Fieldref_info  {
      u1 tag = 9
      u2 class_index = #16 // "java/lang/System"
      u2 name_and_type_index = #17 // out Ljava/io/PrintStream;
    }
    [ 3 ] CONSTANT_String_info  {
      u1 tag = 8
      u2 string_index = #18 // "Hello, world!"
    }
    [ 4 ] CONSTANT_Methodref_info  {
      u1 tag = 10
      u2 class_index = #19 // "java/io/PrintStream"
      u2 name_and_type_index = #20 // println (Ljava/lang/String;)V
    }
    [ 5 ] CONSTANT_Class_info  {
      u1 tag = 7
      u2 name_index = #21 // "Hello"
    }
    [ 6 ] CONSTANT_Class_info  {
      u1 tag = 7
      u2 name_index = #22 // "java/lang/Object"
    }
    [ 7 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 6
      u1 bytes[] = ""
    }
    [ 8 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 3
      u1 bytes[] = "()V"
    }
    [ 9 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 4
      u1 bytes[] = "Code"
    }
    [ 10 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 15
      u1 bytes[] = "LineNumberTable"
    }
    [ 11 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 4
      u1 bytes[] = "main"
    }
    [ 12 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 22
      u1 bytes[] = "([Ljava/lang/String;)V"
    }
    [ 13 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 10
      u1 bytes[] = "SourceFile"
    }
    [ 14 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 10
      u1 bytes[] = "Hello.java"
    }
    [ 15 ] CONSTANT_NameAndType_info  {
      u1 tag = 12
      u2 name_index = #7 // ""
      u2 descriptor_index = #8 // "()V"
    }
    [ 16 ] CONSTANT_Class_info  {
      u1 tag = 7
      u2 name_index = #23 // "java/lang/System"
    }
    [ 17 ] CONSTANT_NameAndType_info  {
      u1 tag = 12
      u2 name_index = #24 // "out"
      u2 descriptor_index = #25 // "Ljava/io/PrintStream;"
    }
    [ 18 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 13
      u1 bytes[] = "Hello, world!"
    }
    [ 19 ] CONSTANT_Class_info  {
      u1 tag = 7
      u2 name_index = #26 // "java/io/PrintStream"
    }
    [ 20 ] CONSTANT_NameAndType_info  {
      u1 tag = 12
      u2 name_index = #27 // "println"
      u2 descriptor_index = #28 // "(Ljava/lang/String;)V"
    }
    [ 21 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 5
      u1 bytes[] = "Hello"
    }
    [ 22 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 16
      u1 bytes[] = "java/lang/Object"
    }
    [ 23 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 16
      u1 bytes[] = "java/lang/System"
    }
    [ 24 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 3
      u1 bytes[] = "out"
    }
    [ 25 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 21
      u1 bytes[] = "Ljava/io/PrintStream;"
    }
    [ 26 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 19
      u1 bytes[] = "java/io/PrintStream"
    }
    [ 27 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 7
      u1 bytes[] = "println"
    }
    [ 28 ] CONSTANT_Utf8_info  {
      u1 tag = 1
      u2 length = 21
      u1 bytes[] = "(Ljava/lang/String;)V"
    }
  }
  u2 access_flags = ( ACC_PUBLIC, ACC_SUPER )
  u2 this_class = #5 // "Hello"
  u2 super_class = #6 // "java/lang/Object"
  u2 interfaces_count = 0
  u2 interfaces[0] {
  }
  u2 fields_count = 0
  field_info fields[0] {
  }
  u2 methods_count = 2
  method_info methods[2] {
    [ 0 ] method_info  {
      u2 access_flags = ( ACC_PUBLIC )
      u2 name_index = #7 // ""
      u2 descriptor_index = #8 // "()V"
      u2 attributes_count = 1
      attribute_info attributes[1] {
        [ 0 ] Code_attribute  {
          u2 attribute_name_index = #9 // "Code"
          u4 attribute_length = 29
          u2 max_stack = 1
          u2 max_locals = 1
          u4 code_length = 5
          bytecode code[3] {
            [  0 ] aload_0  {
              u1 opcode = 0x2a
            }
            [  1 ] invokespecial  {
              u1 opcode = 0xb7
              u2 index = #1 // java/lang/Object. ()V
            }
            [  2 ] vreturn  {
              u1 opcode = 0xb1
            }
          }
          u2 exception_table_length = 0
          exception_table_entry exception_table[0] {
          }
          u2 attributes_count = 1
          attribute_info attributes[1] {
            [ 0 ] LineNumberTable_attribute  {
              u2 attribute_name_index = #10 // "LineNumberTable"
              u4 attribute_length = 6
              u2 line_number_table_length = 1
              line_number_table_entry line_number_table[1] {
                [ 0 ] line_number_table_entry  {
                  u2 start_pc = 0
                  u2 line_number = 1
                }
              }
            }
          }
        }
      }
    }
    [ 1 ] method_info  {
      u2 access_flags = ( ACC_PUBLIC, ACC_STATIC )
      u2 name_index = #11 // "main"
      u2 descriptor_index = #12 // "([Ljava/lang/String;)V"
      u2 attributes_count = 1
      attribute_info attributes[1] {
        [ 0 ] Code_attribute  {
          u2 attribute_name_index = #9 // "Code"
          u4 attribute_length = 37
          u2 max_stack = 2
          u2 max_locals = 1
          u4 code_length = 9
          bytecode code[4] {
            [  0 ] getstatic  {
              u1 opcode = 0xb2
              u2 index = #2 // java/lang/System.out Ljava/io/PrintStream;
            }
            [  1 ] ldc  {
              u1 opcode = 0x12
              u1 index = #3 // "Hello, world!"
            }
            [  2 ] invokevirtual  {
              u1 opcode = 0xb6
              u2 index = #4 // java/io/PrintStream.println (Ljava/lang/String;)V
            }
            [  3 ] vreturn  {
              u1 opcode = 0xb1
            }
          }
          u2 exception_table_length = 0
          exception_table_entry exception_table[0] {
          }
          u2 attributes_count = 1
          attribute_info attributes[1] {
            [ 0 ] LineNumberTable_attribute  {
              u2 attribute_name_index = #10 // "LineNumberTable"
              u4 attribute_length = 10
              u2 line_number_table_length = 2
              line_number_table_entry line_number_table[2] {
                [ 0 ] line_number_table_entry  {
                  u2 start_pc = 0
                  u2 line_number = 3
                }
                [ 1 ] line_number_table_entry  {
                  u2 start_pc = 8
                  u2 line_number = 4
                }
              }
            }
          }
        }
      }
    }
  }
  u2 attributes_count = 1
  attribute_info attributes[1] {
    [ 0 ] SourceFile_attribute  {
      u2 attribute_name_index = #13 // "SourceFile"
      u4 attribute_length = 2
      u2 sourcefile_index = #14 // "Hello.java"
    }
  }
}
    

Hosted by:
SourceForge.net Logo