JVM白皮书
Table of Contents1 Introduction 11.1 A Bit of History 11.2 The Java Virtual Machine 21.3 Organization of the Specification 31.4 Notation 41.5 Feedback 42 The Structure of the Java Virtual Machine 52.1 The class File Format 52.2 Data Types 62.3 Primitive Types and Values 62.3.1 Integral Types and Values 72.3.2 Floating-Point Types, Value Sets, and Values 82.3.3 The returnAddress Type and Values 102.3.4 The boolean Type 102.4 Reference Types and Values 112.5 Run-Time Data Areas 112.5.1 The pc Register 122.5.2 Java Virtual Machine Stacks 122.5.3 Heap 132.5.4 Method Area 132.5.5 Run-Time Constant Pool 142.5.6 Native Method Stacks 142.6 Frames 152.6.1 Local Variables 162.6.2 Operand Stacks 172.6.3 Dynamic Linking 182.6.4 Normal Method Invocation Completion 182.6.5 Abrupt Method Invocation Completion 182.7 Representation of Objects 192.8 Floating-Point Arithmetic 192.8.1 Java Virtual Machine Floating-Point Arithmetic and IEEE754 192.8.2 Floating-Point Modes 202.8.3 Value Set Conversion 202.9 Special Methods 222.9.1 Instance Initialization Methods 222.9.2 Class Initialization Methods 222.9.3 Signature Polymorphic Methods 232.10 Exceptions 23The Java® Virtual Machine Specificationiv2.11 Instruction Set Summary 262.11.1 Types and the Java Virtual Machine 262.11.2 Load and Store Instructions 292.11.3 Arithmetic Instructions 302.11.4 Type Conversion Instructions 322.11.5 Object Creation and Manipulation 342.11.6 Operand Stack Management Instructions 342.11.7 Control Transfer Instructions 342.11.8 Method Invocation and Return Instructions 352.11.9 Throwing Exceptions 362.11.10 Synchronization 362.12 Class Libraries 372.13 Public Design, Private Implementation 373 Compiling for the Java Virtual Machine 393.1 Format of Examples 393.2 Use of Constants, Local Variables, and Control Constructs 403.3 Arithmetic 453.4 Accessing the Run-Time Constant Pool 463.5 More Control Examples 473.6 Receiving Arguments 503.7 Invoking Methods 513.8 Working with Class Instances 533.9 Arrays 553.10 Compiling Switches 573.11 Operations on the Operand Stack 593.12 Throwing and Handling Exceptions 593.13 Compiling finally 633.14 Synchronization 663.15 Annotations 673.16 Modules 684 The class File Format 714.1 The ClassFile Structure 724.2 Names 774.2.1 Binary Class and Interface Names 774.2.2 Unqualified Names 784.2.3 Module and Package Names 784.3 Descriptors 794.3.1 Grammar Notation 794.3.2 Field Descriptors 794.3.3 Method Descriptors 814.4 The Constant Pool 824.4.1 The CONSTANT_Class_info Structure 854.4.2 The CONSTANT_Fieldref_info, CONSTANT_Methodref_info, andCONSTANT_InterfaceMethodref_info Structures 864.4.3 The CONSTANT_String_info Structure 87The Java® Virtual Machine Specificationv4.4.4 The CONSTANT_Integer_info and CONSTANT_Float_infoStructures 874.4.5 The CONSTANT_Long_info and CONSTANT_Double_infoStructures 894.4.6 The CONSTANT_NameAndType_info Structure 904.4.7 The CONSTANT_Utf8_info Structure 914.4.8 The CONSTANT_MethodHandle_info Structure 934.4.9 The CONSTANT_MethodType_info Structure 954.4.10 The CONSTANT_Dynamic_info andCONSTANT_InvokeDynamic_info Structures 954.4.11 The CONSTANT_Module_info Structure 964.4.12 The CONSTANT_Package_info Structure 974.5 Fields 984.6 Methods 1004.7 Attributes 1034.7.1 Defining and Naming New Attributes 1104.7.2 The ConstantValue Attribute 1104.7.3 The Code Attribute 1114.7.4 The StackMapTable Attribute 1154.7.5 The Exceptions Attribute 1224.7.6 The InnerClasses Attribute 1234.7.7 The EnclosingMethod Attribute 1264.7.8 The Synthetic Attribute 1274.7.9 The Signature Attribute 1284.7.9.1 Signatures 1294.7.10 The SourceFile Attribute 1334.7.11 The SourceDebugExtension Attribute 1334.7.12 The LineNumberTable Attribute 1344.7.13 The LocalVariableTable Attribute 1354.7.14 The LocalVariableTypeTable Attribute 1374.7.15 The Deprecated Attribute 1394.7.16 The RuntimeVisibleAnnotations Attribute 1404.7.16.1 The element_value structure 1424.7.17 The RuntimeInvisibleAnnotations Attribute 1454.7.18 The RuntimeVisibleParameterAnnotations Attribute 1464.7.19 The RuntimeInvisibleParameterAnnotations Attribute 1474.7.20 The RuntimeVisibleTypeAnnotations Attribute 1494.7.20.1 The target_info union 1554.7.20.2 The type_path structure 1594.7.21 The RuntimeInvisibleTypeAnnotations Attribute 1634.7.22 The AnnotationDefault Attribute 1644.7.23 The BootstrapMethods Attribute 1654.7.24 The MethodParameters Attribute 1674.7.25 The Module Attribute 1694.7.26 The ModulePackages Attribute 1764.7.27 The ModuleMainClass Attribute 1774.7.28 The NestHost Attribute 1784.7.29 The NestMembers Attribute 178The Java® Virtual Machine Specificationvi4.8 Format Checking 1804.9 Constraints on Java Virtual Machine Code 1804.9.1 Static Constraints 1814.9.2 Structural Constraints 1844.10 Verification of class Files 1884.10.1 Verification by Type Checking 1894.10.1.1 Accessors for Java Virtual Machine Artifacts 1924.10.1.2 Verification Type System 1964.10.1.3 Instruction Representation 2004.10.1.4 Stack Map Frames and Type Transitions 2024.10.1.5 Type Checking Abstract and Native Methods 2074.10.1.6 Type Checking Methods with Code 2104.10.1.7 Type Checking Load and Store Instructions 2194.10.1.8 Type Checking for protected Members 2214.10.1.9 Type Checking Instructions 2244.10.2 Verification by Type Inference 3434.10.2.1 The Process of Verification by Type Inference 3434.10.2.2 The Bytecode Verifier 3434.10.2.3 Values of Types long and double 3474.10.2.4 Instance Initialization Methods and Newly CreatedObjects 3474.10.2.5 Exceptions and finally 3494.11 Limitations of the Java Virtual Machine 3515 Loading, Linking, and Initializing 3535.1 The Run-Time Constant Pool 3535.2 Java Virtual Machine Startup 3565.3 Creation and Loading 3575.3.1 Loading Using the Bootstrap Class Loader 3595.3.2 Loading Using a User-defined Class Loader 3595.3.3 Creating Array Classes 3605.3.4 Loading Constraints 3615.3.5 Deriving a Class from a class File Representation 3625.3.6 Modules and Layers 3645.4 Linking 3665.4.1 Verification 3675.4.2 Preparation 3675.4.3 Resolution 3685.4.3.1 Class and Interface Resolution 3705.4.3.2 Field Resolution 3715.4.3.3 Method Resolution 3725.4.3.4 Interface Method Resolution 3745.4.3.5 Method Type and Method Handle Resolution 3755.4.3.6 Dynamically-Computed Constant and Call SiteResolution 3795.4.4 Access Control 3845.4.5 Method Overriding 386The Java® Virtual Machine Specificationvii5.4.6 Method Selection 3875.5 Initialization 3875.6 Binding Native Method Implementations 3905.7 Java Virtual Machine Exit 3916 The Java Virtual Machine Instruction Set 3936.1 Assumptions: The Meaning of "Must" 3936.2 Reserved Opcodes 3946.3 Virtual Machine Errors 3946.4 Format of Instruction Descriptions 395mnemonic 3966.5 Instructions 398aaload 399aastore 400aconst_null 402aload 403aload_<n> 404anewarray 405areturn 406arraylength 407astore 408astore_<n> 409athrow 410baload 412bastore 413bipush 414caload 415castore 416checkcast 417d2f 419d2i 420d2l 421dadd 422daload 424dastore 425dcmp<op> 426dconst_<d> 428ddiv 429dload 431dload_<n> 432dmul 433dneg 435drem 436dreturn 438dstore 439dstore_<n> 440dsub 441The Java® Virtual Machine Specificationviiidup 442dup_x1 443dup_x2 444dup2 445dup2_x1 446dup2_x2 447f2d 449f2i 450f2l 451fadd 452faload 454fastore 455fcmp<op> 456fconst_<f> 458fdiv 459fload 461fload_<n> 462fmul 463fneg 465frem 466freturn 468fstore 469fstore_<n> 470fsub 471getfield 472getstatic 473goto 475goto_w 476i2b 477i2c 478i2d 479i2f 480i2l 481i2s 482iadd 483iaload 484iand 485iastore 486iconst_<i> 487idiv 488if_acmp<cond> 489if_icmp<cond> 490if<cond> 492ifnonnull 494ifnull 495iinc 496iload 497iload_<n> 498The Java® Virtual Machine Specificationiximul 499ineg 500instanceof 501invokedynamic 503invokeinterface 505invokespecial 509invokestatic 513invokevirtual 516ior 523irem 524ireturn 525ishl 527ishr 528istore 529istore_<n> 530isub 531iushr 532ixor 533jsr 534jsr_w 535l2d 536l2f 537l2i 538ladd 539laload 540land 541lastore 542lcmp 543lconst_<l> 544ldc 545ldc_w 547ldc2_w 549ldiv 551lload 552lload_<n> 553lmul 554lneg 555lookupswitch 556lor 558lrem 559lreturn 560lshl 561lshr 562lstore 563lstore_<n> 564lsub 565lushr 566lxor 567The Java® Virtual Machine Specificationxmonitorenter 568monitorexit 570multianewarray 572new 574newarray 576nop 578pop 579pop2 580putfield 581putstatic 583ret 585return 586saload 587sastore 588sipush 589swap 590tableswitch 591wide 5937 Opcode Mnemonics by Opcode 595A Limited License Grant 599
评论