• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
testing ppt
 

testing ppt

on

  • 661 views

 

Statistics

Views

Total Views
661
Views on SlideShare
659
Embed Views
2

Actions

Likes
0
Downloads
1
Comments
0

2 Embeds 2

http://devel2.inet.cmpnet.com:9013 1
http://devel2.informationweek.com:9007 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    testing ppt testing ppt Presentation Transcript

    • JVM Overview References Virtual Machine Background JVM: operational view JVM: structural view Concluding remarks
    • Reading List
      • Primary:
        • LY99 Chapter 3. Structure of the Java Virtual Machine
        • Venners98 Chapter 5. The Java Virtual Machine
        • GJS96 Chapter 12: Execution
      • Other references
        • Survey of VM Research 1974
          • “ Virtual machines have finally arrived. Dismissed for a number of years as academic curiosities, they are now seen as cost effective techniques for organizing computer systems…”
        • Inferno Virtual Machine
        • Oak Intermediate Bytecode
        • Variety of web-sites
    • What is a virtual machine?
      • David Gelernter: Truth, beauty, and VMs
        • “ A running program is often referred to as a VM -- a machine that doesn’t exist as a matter of actual physical reality. The virtual machine idea is … most elegant in the history of technology … a crucial step in the evolution of ideas about software.”
      • an operating system
      • a control program to run multiple operating systems
    • Design Goals
      • abstract enough
      • close enough to the hardware
      • question: what is the intended use?
      • Inferno: run OS code
      • JVM: run application code
    • What is the JVM?
    • Key Distinction
      • what is the specification?
      • what is the implementation?
        • object layout is not part of the specification
        • garbage collection is not part of the spec
    • JVM: View
      • from the language point of view
      • trace the lifetime of a virtual machine
      • invocation, loading-linking, object lifetime, exit
    • VM in action
      • invoked “java Test args”
      • attempts to find class Test
      • VM uses the class loader
      • Link
      • Initialize
      • Invoke Test.main
    • Loading
      • check whether already loaded
      • if not, invoke the appropriate loader.loadClass
      • internal table is part of the specification?
      • class loader flexibility: prefetch, load a bunch
      • prefetching can be non-transparent!
      • errors, however, need to be reported separately
      • class loader hooks: defineClass, findSystemClass, resolveClass
    • Link
      • Link = verification, preparation, resolution
      • Verification: semantic checks, proper symbol table
        • proper opcodes, good branch targets
        • conservation of stack depth
      • Preparation: allocation of storage (method tables)
      • Resolution: resolve symbol references, check access, check concreteness
      • Resolution: eager vs lazy strategy
    • Initialization
      • initialize class variables, static initializers
      • direct superclass need to be initialized prior
      • happens on direct use: method invocation, construction, field access
      • synchronized initializations: state in Class object
        • check for recursive initializations
    • Example class Super { static { System.out.print(“Super “); } class One { static { System.out.print(“One “); } class Two extends Super { static { System.out.print(“Two “); } class Test { public static void main(String[] args) { One o = null; Two t = new Two(); System.out.println((Object)o == (Object)t); } }
    • Example class Super { static int taxi = 1729; } class Sub extends Super { static { System.out.print(“Sub “); } class Test { public static void main(String[] args) { System.out.println(Sub.taxi); } }
    • Creation of new instances
      • instance creation expressions: new
      • Class.newInstance()
      • string literals, concatenation operations
      • order:
        • default field values
        • invoke constructor
        • invoke another constructor of this class
        • invoke super’s constructors
        • initialize instance variables
        • execute rest of the constructor
    • Finalization
      • invoked just before garbage collection
      • language does not specify when it is invoked
      • also does not specify which thread
      • no automatic invocation of super’s finalizers
      • very tricky!
      void finalize() { classVariable = field; // field is now reachable }
    • VM Exit
      • classFinalize similar to object finalization
      • class can be unloaded when
        • no instances exist
        • class object is unreachable
      • VM exits when:
        • all its threads terminate
        • Runtime.exit or System.exit assuming it is secure
      • finalizers can be optionally invoked on all objects just before exit