+ All Categories
Home > Documents > Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Date post: 03-Jan-2016
Category:
Upload: penelope-alexander
View: 217 times
Download: 0 times
Share this document with a friend
29
Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao
Transcript
Page 1: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Replay Compilation: Improving Debuggability of a Just-in Time Complier

Presenter: Jun Tao

Page 2: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Outline

• Introduction• Behavior of a Dynamic Compiler• Overview of Replay Compilation• Implementation• Experimental Results

Page 3: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Introduction

• Difficulties in debugging with a dynamic compiler– Static compiler• Recompile and produce diagnostic output

– Dynamic compiler• Recompilation may not work

– Non-determinism in execution order– Applied optimization might change– Runtime information: resolution status, classes hierarchy,

runtime profile

Page 4: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Introduction

• Reproducing the Compilation– Invoke a dynamic compiler as if it were a stand-

alone tool– Reproduce the inputs

Page 5: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Introduction

• Solutions: trace-and-replay– Ordering-based• Record and replay the order of synchronization events• Compiler operates deterministically• Results may change because non-deterministic input

– Content-based• Save and restore the values of the input• Generates prohibitively large amount of data• Significantly increases the execution time

Page 6: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Introduction

• Other Solution– First error data capture (FEDC)• Uses special hardware, firmware and software to

record information• Efficient

Page 7: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Introduction

• Replay JIT compilation– Content-based trace-and-replay approach– State-saving compiler• Records information into a log, which is in main

memory

– Replaying compiler• Reproduce the problem by using the system dump

– Confidence-based filtering• Only save inputs of methods that are likely to cause

errors

Page 8: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Behavior of a Dynamic Compiler

• Static compiler– Invoked by users– Source files– Options as command line arguments

• Dynamic compiler– A component of a virtual machine– Determines which methods to compile with what

set of options– Inputs are provided as runtime data structures

Page 9: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Behavior of a Dynamic Compiler

• Runtime information as inputs– System configuration data• Configuration of hardware and software• Command line options and the environment variables

– Virtual machine states• Set of classes that have been initialized• Address of the compiled optimizations• Class hierarchy of the loaded classes• Resolution statuses of external references

– Runtime profile• Runtime profiler output• Optimization level

Page 10: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Behavior of a Dynamic Compiler

• Variable and Fixed Inputs– Variable inputs• May change after a compilation of a method• Virtual machine status• Runtime profiles

– Fixed Inputs• Target methods• System configuration

Page 11: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Overview of Replay Compilation

• System Dump Based Approach– Virtual machine must be configured to generate a

system dump at crashes and user interrupts– Avoids expensive I/O– Suffices to invoke the replaying compiler with the

system dump– Replaying compiler can be invoked in a different

platform

Page 12: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Overview of Replay Compilation

• Log Structure– Input by data structure access• Records a pair of the address and the value into a log• Retrieve the value by using the address as a key

– Input in a function call• Records into a log the return value together with a list

of function identifier and the parameter values• Retrieves the return value by using the list as a key

– The values for fixed inputs can be saved at the time of creating the system dump

Page 13: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.
Page 14: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Overview of Replay Compilation• Building State-saving and Replaying Compilers

– Uses different macros, depending on input types

Page 15: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

• Building State-saving and Replaying Compilers (continued)

Page 16: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

• Building State-saving and Replaying Compilers (continued)

Page 17: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Overview of Replay Compilation

• Replaying the Compilation– User invokes the replaying compiler and specifies

method signatures or addresses of compiled code– Replay compiler load the system dump into its

address space– Adjust the address used in state-saving process• Can be avoid by restoring a system dump into the same

address as the state-saving address

Page 18: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Overview of Replay Compilation

• Further reducing the size of log– Compress the logs– Exploit default values– Confidence-based filtering• Increase the confidence of a method, if the method is

in heavily used libraries• Decrease the confidence of a method, if the control

flow of the method is complex

Page 19: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Overview of Replay Compilation

• Some other topics– We can use different set of options to narrow

down the cause of options– System dump will not include the data structures

for unloaded classes• Ignore• Store the data structure when it is unloaded

Page 20: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Implementation

• State-Saving Compiler– Allocates a memory area as the log for each

compilation of a method– Compresses each log– Associates each log with the address of the JIT-

compiled code

Page 21: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Implementation

• State-Saving Compiler (continued)– Creates an anchor structure• Markers in its header and trailer• Size• Version number of the state-saving compiler• A link list of the logs• Another pointer called current log

– Should not be accessible in the list of complete logs

Page 22: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Implementation

• Replaying Compiler– Restores a system dump– Scans the markers– Scans the list for the log

Page 23: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Experiment Results

Page 24: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Experiment Results

Page 25: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Experiment Results

Page 26: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Experiment Results

Page 27: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Experiment Results

Page 28: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Conclusion

• State-saving compiler saves inputs in logs• Replaying compiler gets logs from system

dump• Logs reside in main memory • Compression and filtering are used

Page 29: Replay Compilation: Improving Debuggability of a Just-in Time Complier Presenter: Jun Tao.

Questions ?


Recommended