13-GC-Runtime - CS 421 Lecture 13: Run-time systems and...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 421 Lecture 13: Run-time systems and garbage collection s Lecture outline s Execution of dynamic languages s Sun HotSpot run-time system for Java s Tags, JIT compilation, reflection s Memory management emory layout; definition of garbage s Memory layout; definition of garbage s Reference-counting s Garbage collection s Non-compacting (mark-and-sweep) s Compacting 6/29/2009 1 Dynamic languages s Automatic memory management s Tagged values s For GC, run-time type-checking, reflection s Sometimes: s Dynamic type-checking s Reflection s Usually: s Execute virtual machine code s Will use Sun HotSpot Java virtual machine as example 6/29/2009 2 Java HotSpot run-time system s Developed around 1999 replaced existing widely-used Java VM s Described in several places, e . g . : http://java.sun.com/products/hotspot/whitepaper.html s HotSpot is VM used in java program, and embedded in many browsers (Note re: above document word compiler used to refer to translator from Java bytecode to native machine code, not translator from source code.) 6/29/2009 3 Java HotSpot run-time system s Garbage collection s Two-word object headers s Executes .class files (Java VM code) s Just-in-time compilation s Meta-objects represented as objects 6/29/2009 4 Meta-objects represented as objects s Class and Method are classes s Each class corresponds to a Class object s Methods of class Class include getDeclaredMethods(), getFields(), s Each method corresponds to a Method object s Methods of class Method include getParameterTypes, getReturnType, s Can invoke methods that are detected dynamically e . g . , search all objects reachable from one object and invoke method print on any object whose class contains a print method. 6/29/2009 5 Two-word headers s Every object in heap is preceded by two words s First word is pointer to Class object of this methods class (which gives layout of object) s Second word contains GC info s Arrays contain third word giving length 6/29/2009 6 Just-in-time compilation s Methods obtained in bytecode form (.class files) translated to native machine code on the fly s Numerous optimizations employed s Very important optimization: inlining s Level of optimization determined by monitoring execution...
View Full Document

Page1 / 28

13-GC-Runtime - CS 421 Lecture 13: Run-time systems and...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online