Inside Java Virtual Machine

  • Published on
    02-Oct-2014

  • View
    181

  • Download
    1

Transcript

Inside the Java Virtual Machine by Bill VennersSpecially Made for [OR] by OutlawtornInside the Java Virtual MachineAcknowledgments Introduction Part One: Java's Architecture1 Introduction to Java's ArchitectureWhy Java? The Architecture The Java Virtual Machine The Class Loader Architecture The Java Class File The Java API The Java Programming Language Architectural Tradeoffs Future Trends On the CD-ROM The Resources Page2 Platform independenceWhy Platform Independence? Java's Architectural Support for Platform Independence Scalability Factors that Influence Platform Independence The Java Platform Native Methods Other Factors Seven Steps to Platform Independence The Politics of Platform Independence The Resources Page3 SecurityWhy Security? The Sandbox The Class Loader Architecture The Class File Verifier Phase One: Internal Checks Phase Two: Verification of Symbolic References Safety Features Built Into the Java Virtual Machine The Security Manager and the Java API The Security API Security Beyond the Architecture The Resources Page4 Network-mobilityWhy Network Mobility? A New Software Paradigm Java's Architectural Support for Network-Mobility The Applet: An Example of Network-Mobile Java The Resources PagePart Two: Java Internals5 The Java Virtual MachineWhat is a Java Virtual Machine? The Lifetime of a Java Virtual Machine The Architecture of the Java Virtual Machine Data Types Word Size The Class Loader Subsystem Loading, Linking and Initialization The Primordial Class Loader Class Loader Objects Name Spaces The Method Area Type Information The Constant Pool Field Information Method Information Class Variables A Reference to Class ClassLoader A Reference to Class ClassMethod Tables An Example of Method Area Use The Heap Garbage Collection Object Representation Array Representation The Program Counter The Java Stack The Stack Frame Local Variables Operand Stack Frame Data Possible Implementations of the Java Stack Native Method Stacks Execution Engine The Instruction Set Execution Techniques Threads Native Method Interface The Real Machine Eternal Math: A Simulation On the CD-ROM The Resources Page6 The Java Class FileWhat is a Java Class File? What's in a Class File? Special Strings Fully Qualified Names Simple Names Descriptors The Constant Pool The CONSTANT_Utf8_info Table The CONSTANT_Integer_info Table The CONSTANT_Float_info Table The CONSTANT_Long_info Table The CONSTANT_Double_info Table The CONSTANT_Class_info Table The CONSTANT_String_info TableThe CONSTANT_Fieldref_info Table The CONSTANT_Methodref_info Table The CONSTANT_InterfaceMethodref_info Table The CONSTANT_NameAndType_info Table Fields Methods Attributes The Code Attribute The ConstantValue Attribute The Exceptions Attribute The InnerClasses Attribute The LineNumberTable Attribute The LocalVariableTable Attribute The SourceFile Attribute The Synthetic Attribute Getting Loaded: A Simulation On the CD-ROM The Resources Page7 The Lifetime of a ClassClass Loading, Linking, and Initialization Loading Verification Preparation Resolution Initialization The Class Initialization Method Active versus Passive Use The Lifetime of an Object Class Instantiation Garbage Collection and Finalization of Objects Unloading and Finalization of Classes On the CD-ROM The Resources Page8 The Linking ModelDynamic Linking and Resolution Resolution and Dynamic Extension Constant Pool ResolutionResolution of CONSTANT_Class_info Entries Array Classes Non-Array Classes and Interfaces Resolution of CONSTANT_Fieldref_info Entries Resolution of CONSTANT_Methodref_info Entries Resolution of CONSTANT_InterfaceMethodref_info Entries Resolution of CONSTANT_String_info Entries Resolution of Other Types of Entries Compile-Time Resolution of Constants Direct References _quick Instructions Example: The Linking of the Salutation Application Example: The Dynamic Extension of the Greet Application Example: Unloading Unreachable Greeters On the CD-ROM The Resources Page9 Garbage CollectionWhy Garbage Collection? Garbage Collection Algorithms Reference Counting Collectors Tracing Collectors Compacting Collectors Copying Collectors Generational Collectors Adaptive Collectors Finalization Heap of Fish: A Simulation Allocate Fish Assign References Garbage Collect Compact Heap On the CD-ROM The Resources Page10 Stack and Local Variable OperationsPushing Constants Onto the Stack Generic Stack Operations Pushing Local Variables Onto the Stack Popping to Local Variables The wide Instruction Fibonacci Forever: A Simulation On the CD-ROMThe Resources Page11 Type ConversionThe Conversion Opcodes Conversion Diversion: A Simulation On the CD-ROM The Resources Page12 Integer ArithmeticTwo's Complement Arithmetic Inner Int: A Java int Reveals its Inner Nature Arithmetic Opcodes Prime Time: A Simulation On the CD-ROM The Resources Page13 LogicThe Logic Opcodes Logical Results: A Simulation On the CD-ROM The Resources Page14 Floating Point ArithmeticFloating Point Numbers Inner Float: A Java float Reveals its Inner Nature The Floating Point Opcodes Circle of Squares: A Simulation On the CD-ROM The Resources Page15 Objects and ArraysA Refresher on Objects and Arrays Opcodes for Objects Opcodes for Arrays Three-Dimensional Array: A Simulation On the CD-ROM The Resources Page16 Control FlowConditional Branching Unconditional BranchingConditional Branching with Tables Saying Tomato: A Simulation On the CD-ROM The Resources Page17 ExceptionsThrowing and Catching Exceptions The Exception Table Play Ball!: A Simulation On the CD-ROM The Resources Page18 Finally ClausesMiniature Subroutines Asymmetrical Invocation and Return Hop Around: A Simulation On the CD-ROM The Resources Page19 Method Invocation and ReturnMethod Invocation Invoking a Java Method Invoking a Native Method Other Forms of Method Invocation The invokespecial instruction invokespecial and