Main Page

   
Programming for the Java™ Virtual Machine
By Joshua Engel
   
Publisher : Addison Wesley
Pub Date : June 22, 1999
ISBN : 0-201-30972-6
Pages : 512


The core of Java technology, the Java virtual machine is an abstract computing machine that enables the Java platform to host applications on any computer or operating system without rewriting or recompiling. Anyone interested in designing a language or writing a compiler for the Java virtual machine must have an in-depth understanding of its binary class format and instruction set. If you are programming with the Java programming language, knowledge of the Java virtual machine will give you valuable insight into the Java platform's security capabilities and cross-platform portability. It will increase your understanding of the Java programming language, enabling you to improve the security and performance of your programs.

The author employs a tutorial approach that provides a detailed look into the central workings of the technology and teaches the reader how to write real programs for the Java virtual machine. He describes methods for becoming a better programmer through an advanced understanding of the Java virtual machine and Java technology. Programming for the Java Virtual Machine offers comprehensive coverage of all the major elements of the Java virtual machine--classes and objects, control instructions, debugging, class loaders, compiling the Java programming language, performance issues, security, and threads and synchronization. The book provides an introduction to the Java Virtual Machine Specification (JVMS), with a collection of topics that help programmers understand the Java virtual machine and the JVMS better. In addition, the book features implementations of Prolog and Scheme, a language that runs on top of the Java virtual machine, generating Java virtual machine code as it runs and using a Java virtual machine class loader to load the generated code into the system.

You will find detailed information on such topics as:

  • The Java virtual machine verification algorithm

  • How Java virtual machine security works, and what it can and can't do

  • Using class loaders to incorporate code and dynamically generated code from the Internet, the Java Foundation Classes, database queries, and other languages

  • The mechanics of compiling the Java programming language for the Java virtual machine

  • Implementing other languages using the Java virtual machine, including Scheme, Prolog, Sather, Eiffel, and regular expressions

   
•  Table of Contents
•  Examples
Programming for the Java™ Virtual Machine
By Joshua Engel
   
Publisher : Addison Wesley
Pub Date : June 22, 1999
ISBN : 0-201-30972-6
Pages : 512
Copyright
    Preface
      Prerequisites
      Books
      Acknowledgments
   
    Chapter 1.  Introduction to the Java Virtual Machine
      Section 1.1.  Java Virtual Machine and Java
      Section 1.2.  What Is the Java Virtual Machine?
      Section 1.3.  Java Platform
      Section 1.4.  Organization of the Java Virtual Machine
      Section 1.5.  Garbage Collection
      Section 1.6.  JVM Implementations
      Section 1.7.  Versions of the Virtual Machine
      Section 1.8.  Future of the Java Virtual Machine
   
    Chapter 2.  Oolong
      Section 2.1.  Hello, World
      Section 2.2.  Structure of an Oolong Program
      Section 2.3.  Defining the Class
      Section 2.4.  Superclasses
      Section 2.5.  Declaring Fields
      Section 2.6.  Declaring Methods
      Section 2.7.  Interfaces
   
    Chapter 3.  Writing Methods
      Section 3.1.  Some Definitions
      Section 3.2.  Types
      Section 3.3.  Mnemonic Naming Conventions
      Section 3.4.  Testing Code Examples
      Section 3.5.  Returns
      Section 3.6.  Constants
      Section 3.7.  Local Variables
      Section 3.8.  Math
      Section 3.9.  Type Conversions
      Section 3.10.  Stack Manipulations
      Section 3.11.  Arrays of Numbers
      Section 3.12.  Just Biding Your Time
   
    Chapter 4.  Classes and Objects
      Section 4.1.  What Is an Object?
      Section 4.2.  Creating Objects
      Section 4.3.  Constructors
      Section 4.4.  Using Fields
      Section 4.5.  Invoking Methods on Objects
      Section 4.6.  Casting
      Section 4.7.  Casting, Fields, Methods, and Java
      Section 4.8.  Returning Objects
      Section 4.9.  Interfaces
      Section 4.10.  Static Fields and Methods
      Section 4.11.  Class Initialization
      Section 4.12.  Arrays
   
    Chapter 5.  Control Instructions
      Section 5.1.  Comparing Integers
      Section 5.2.  Comparing References
      Section 5.3.  Other Comparisons
      Section 5.4.  Switches
      Section 5.5.  Subroutines
      Section 5.6.  Exceptions
      Section 5.7.  A Gentler Way of Checking Type
   
    Chapter 6.  Verification Process
      Section 6.1.  How the Verification Algorithm Works
      Section 6.2.  Is It a Structurally Valid class File?
      Section 6.3.  Are All Constant References Correct?
      Section 6.4.  Are All the Instructions Valid?
      Section 6.5.  Will Each Instruction Always Find a Correctly Formed Stack and Local Variable Array?
      Section 6.6.  Do External References Check Out?
      Section 6.7.  Java Language and Verification Algorithm
      Section 6.8.  Other Safety Requirements
      Section 6.9.  Checking Verification
   
    Chapter 7.  Debugging
      Section 7.1.  Debugging Directives in Oolong
      Section 7.2.  Debugging Oolong Programs
      Section 7.3.  Runtime Tracing
   
    Chapter 8.  Class Loaders
      Section 8.1.  How Classes Are Loaded
      Section 8.2.  Loading Classes without a Class Loader
      Section 8.3.  Making Your Own Class Loader
      Section 8.4.  Working with Class Objects
      Section 8.5.  Reflection
   
    Chapter 9.  Inside a Java class File
      Section 9.1.  class File Header
      Section 9.2.  Constant Pool
      Section 9.3.  Class Information
      Section 9.4.  Fields and Methods
      Section 9.5.  Class Attributes
      Section 9.6.  Other Attributes
   
    Chapter 10.  Compiling Java
      Section 10.1.  Expressions and Statements
      Section 10.2.  Expression Types
      Section 10.3.  Compiling Statements and Expressions
      Section 10.4.  Local Variable Declarations
      Section 10.5.  Fields and Variables
      Section 10.6.  Creating New Objects
      Section 10.7.  Class Name Abbreviations
      Section 10.8.  Arithmetic Expressions
      Section 10.9.  Method Calls
      Section 10.10.  Expressions as Statements
      Section 10.11.  Ifs and Booleans
      Section 10.12.  Other Control Structures
      Section 10.13.  Returns
      Section 10.14.  Field Declarations
      Section 10.15.  Method Declarations
      Section 10.16.  Constructors
      Section 10.17.  Conclusion
   
    Chapter 11.  Compiling Other Languages
      Section 11.1.  Java Version 1.1
      Section 11.2.  Regular Expressions
      Section 11.3.  Iterators
      Section 11.4.  Parameterized Types
      Section 11.5.  Multiple Inheritance
      Section 11.6.  Conclusion
   
    Chapter 12.  Implementing Scheme
      Section 12.1.  Scheme Concepts
      Section 12.2.  Compiling Scheme into Bytecodes
      Section 12.3.  Compiling Lambda Expressions
      Section 12.4.  Example
      Section 12.5.  Scheme Library
      Section 12.6.  Optimizing Scheme
   
    Chapter 13.  Implementing Prolog
      Section 13.1.  Introduction to Prolog
      Section 13.2.  Implementation Basics
      Section 13.3.  Unification
      Section 13.4.  Rules as Programs
      Section 13.5.  Implementing Rules
      Section 13.6.  Compiling Facts
      Section 13.7.  Case Study
   
    Chapter 14.  Performance
      Section 14.1.  Fast Virtual Machines
      Section 14.2.  Bytecode Optimization Techniques
      Section 14.3.  Inlining
   
    Chapter 15.  Security and the Virtual Machine
      Section 15.1.  Java Platform and Need for Security
      Section 15.2.  Security Promises of the JVM
      Section 15.3.  Security Architecture and Security Policy
      Section 15.4.  Some Potential Attacks
      Section 15.5.  Conclusion
   
    Chapter 16.  Threads and Synchronization
      Section 16.1.  Threads
      Section 16.2.  Sharing State Between Threads
      Section 16.3.  Monitors and Object Locks
      Section 16.4.  Scheduling
      Section 16.5.  Conclusion
   
    Appendix A.  Tables
      Section A.1.  Instructions by Opcode
      Section A.2.  Instructions Alphabetically
      Section A.3.  Instructions by Category
   
    Appendix B.  Oolong Reference
      Section B.1.  Using the Oolong Assembler
      Section B.2.  Gnoloo
      Section B.3.  DumpClass
      Section B.4.  Oolong Language
      Section B.5.  Instructions
   
    Appendix C.  Answers to Selected Exercises
    Further Reading
      Java and the JVM
      Newsgroup
      Other Languages
      Compilers