dept of computer & information sciences university of delaware

12
CISC 673 : Optimizing Compilers Dept of Computer & Information Sciences University of Delaware JikesRVM

Upload: meriel

Post on 31-Jan-2016

46 views

Category:

Documents


0 download

DESCRIPTION

Dept of Computer & Information Sciences University of Delaware. JikesRVM. Contents. Introduction to JikesRVM Optimizations IRs (Intermediate Representations) Editing JikesRVM Steps For Project1 Questions. Introduction to JikesRVM. This is not a Java source compiler. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Dept of Computer & Information Sciences

University of Delaware

JikesRVM

Page 2: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Contents

• Introduction to JikesRVM

• Optimizations

• IRs (Intermediate Representations)

• Editing JikesRVM

• Steps For Project1

• Questions

Page 3: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Introduction to JikesRVM

• This is not a Java source compiler.

• JikesRVM is a Virtual Machine.

• Open Source.

• Converts from Byte code Machine Code

Page 4: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Functions of the RVM

• Loads the required class files

• Converts the class files (OS independent bytecode) to machine code (OS and Architecture dependent)

• Optimizes byte code in the process of the above conversion.

• Tracks Compilation time and provides rudimentary profiling.

Page 5: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Compilation

• Download the gz file from source forge

• http://downloads.sourceforge.net/jikesrvm/jikesrvm-3.0.1.tar.bz2

by using the command wget <web link>

• Untar the file “tar –zxf jikesrvm-3.0.1.tar.bz2”

• Inside the jikesrvm directory create a new .ant.properties file

http://www.cis.udel.edu/~skulkarn/ta_files/.ant.properties

Page 6: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Compilation II

• Run command “java-config -s sun-jdk-1.6”

• Inside this directory run “ant” and this would create the executable image of the rvm.

• Binaries are stored in (jikesrvm-3.0.1/dist/FastAdaptiveGenMS_x86_64-linux) folder

• Compile your source code with javac

• Run using the “rvm” binary present in the above folder.

• You may want to add this directory to the PATH environment variable.

Page 7: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Optimization

• There are different levels of optimizations from O0 to O3.

• List of optimizations that are performed in all the different optimization levels are available at

http://www.cis.udel.edu/~skulkarn/ta_files/OptLevels.tar.gz

• In brief no of steps in various optimization levels are:

• Each level of optimization is a super set of the previous level.

O0 44O1 53

O2 53

Page 8: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Intermediate Representations

For more information please go thru http://www.ugrad.cs.ubc.ca/~cs411/2006W2/handouts/jikes-IR-shane-brewer.pdf

Page 9: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Editing the JikesRVM

• Adding of a new command line argument• The list of files that govern and define the parameters are at “jikesrvm-

3.0.0/rvm/src-generated/options”• I wanted to add a parameter that could switch off multiple optimizations

at the same time, so I added “V LIST_TO_SKIP String \"123\“List of optimizations to skip”

• Remember that the number of new lines also are important. So do not upset those.

• You will have to clean the previous build by using “ant very-clean” command

• Build again by “ant” command.

Page 10: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Important source directories

• Package responsible for choosing the optimizations is org.jikesrvm.compilers.opt.driver

• OptimizationPlanner.java: is responsible for creating the list of optimizations that the code would go through.

• CompilationPlan.java: Performs those optimizations in the order that was set in OptimizationPlanner.

• Actuall implementations of the optimizations can be found under the root package org.jikesrvm.compilers.opt e.g. LocalCastOptimization.java is the implementation LocalCastOptimization.

Page 11: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Steps for Project1

• Step1 and Step 2 are straightfwd.

• Step3: use “time rvm <command line parameters>”

• Step4: Based on the different optimizations that you would like to switch off, find and compare the results of running time. E.g. You might want to switch off “Local ConstantProp” or “Branch Optimizations” and see the effect it has on the running times.

Page 12: Dept of Computer & Information Sciences University of Delaware

CISC 673 : Optimizing Compilers

Questions?

Most of the files and this presentation is available at

http://www.cis.udel.edu/~skulkarn/ta.html