| Java Virtual Machines provide a layer of abstraction supporting any services required for the execution of Java programs; from the viewpoint of Java programs, a Java Virtual Machine is a kind of "virtual hardware". However, fundamentally, any job of this virtual hardware is done by the real low level hardware, and behavioural changes in the virtual hardware are eventually reflected by performance variations in the real hardware. Investigating the real hardware performance is thus important for understanding the behaviour of higher levels, including virtual machines themselves and the Java programs they run. Hardware information also has significant potential for optimizing Java Virtual Machines and achieving better runtime performance for Java programs.;Our approach and set of techniques highlight a problem for optimization development and a design that adaptively compensates. As hardware performance becomes an increasingly important factor it becomes a greater consideration in the construction of runtime environments, including Java Virtual Machines. We are able to show in our work that hardware monitoring can be the basis of both high level understanding and many new optimizations.;In this thesis, we introduce a series of adaptive optimizations in a Java Virtual Machine based on hardware information. We investigate the recurrent behaviour apparent in hardware data and detect the recurrent, periodic phases, i.e., the repetitive behaviour, in high level program execution. These phase detection results can be used for a variety of purposes including optimization and program understanding. For example, phase data can be used to select only the representative portions in program execution for runtime profiling. This selective profiling technique achieves a similar accuracy to that of the continuous profiling with a significant workload reduction. Based on further hardware investigation results we roughly divide the lifetime of a program into different phases and dynamically apply appropriate hot method recompilation strategies which generally improve performance and demonstrate a real world optimization using our technique. Hardware information can also bring benefits to the selection of better garbage collection points. We implement a collector with a garbage collection point analytic model based on our hardware data analyzer and provide a deep study of the relative factors in collection point selection. |