Towards eliminating runtime array bound checks in the Java Virtual Machine Hongwei Songtao

Slides:



Advertisements
Similar presentations
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Advertisements

SCIP Optimization Suite
Exercise 1 Generics and Assignments. Language with Generics and Lots of Type Annotations Simple language with this syntax types:T ::= Int | Bool | T =>
Compilation 2007 Code Generation Michael I. Schwartzbach BRICS, University of Aarhus.
Java Applet Security Diana Dong CS 265 Spring 2004.
Java security (in a nutshell)
Chapter FourModern Programming Languages1 Language Systems.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
Ross Tate, Juan Chen, Chris Hawblitzel. Typed Assembly Languages Compilers are great but they make mistakes and can introduce vulnerabilities Typed assembly.
Trace-based Just-in-Time Type Specialization for Dynamic Languages Andreas Gal, Brendan Eich, Mike Shaver, David Anderson, David Mandelin, Mohammad R.
Lightweight Modeling of Java Virtual Machine Security Constraints using Alloy Mark Reynolds BU CS511 Midterm Report March 26, 2008.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Facilitating Program Verification with Dependent Types Hongwei Xi Boston University.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
1 Enforcing Confidentiality in Low-level Programs Andrew Myers Cornell University.
1 A Dependently Typed Assembly Language Hongwei Xi University of Cincinnati and Robert Harper Carnegie Mellon University.
Programmability with Proof-Carrying Code George C. Necula University of California Berkeley Peter Lee Carnegie Mellon University.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Lightweight Modeling of Java Virtual Machine Security Constraints using Alloy Mark Reynolds BU CS511 Final Report May 7, 2008.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
A Type System for Expressive Security Policies David Walker Cornell University.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Toba Gregg M. Townsend Executable Code from Java Source.
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
COP4020 Programming Languages
CSc 453 Interpreters & Interpretation Saumya Debray The University of Arizona Tucson.
Source Code Basics. Code For a computer to execute instructions, it needs to be in binary Each instruction is given a number Known as “operation code”
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Previous Next 06/18/2000Shanghai Jiaotong Univ. Computer Science & Engineering Dept. C+J Software Architecture Shanghai Jiaotong University Author: Lu,
CSC 8505 Compiler Construction IR Example: Java Bytecode (looking inside class files)
Just-In-Time Java Compilation for the Itanium Processor Tatiana Shpeisman Guei-Yuan Lueh Ali-Reza Adl-Tabatabai Intel Labs.
Secure Web Applications via Automatic Partitioning Stephen Chong, Jed Liu, Andrew C. Meyers, Xin Qi, K. Vikram, Lantian Zheng, Xin Zheng. Cornell University.
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
Introduction to Programming Languages. Problem Solving in Programming.
Java Virtual Machine Java Virtual Machine A Java Virtual Machine (JVM) is a set of computer software programs and data structures that use.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Java Bytecode What is a.class file anyway? Dan Fleck George Mason University Fall 2007.
ITEC 352 Lecture 20 JVM Intro. Functions + Assembly Review Questions? Project due today Activation record –How is it used?
Lecture 10 : Introduction to Java Virtual Machine
Introduction to the Java Virtual Machine 井民全. JVM (Java Virtual Machine) the environment in which the java programs execute The specification define an.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
O VERVIEW OF THE IBM J AVA J UST - IN -T IME C OMPILER Presenters: Zhenhua Liu, Sanjeev Singh 1.
Java 2 security model Valentina Casola. Components of Java the development environment –development lifecycle –Java language features –class files and.
Exception. Runtime Error Consider the following program: public class BadArray { public static void main(String[] args) { // Create an array with three.
Java Security Model For Mobile Code Abdo Achkar. Mobile Code A mobile object is a “self contained piece” of executable code. Definition:  Code that can.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
The Fail-Safe C to Java translator Yuhki Kamijima (Tohoku Univ.)
1 Chapter 1 Programming Languages Evolution of Programming Languages To run a Java program: Java instructions need to be translated into an intermediate.
By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual.
Java FilesOops - Mistake Java lingoSyntax
Getting Started With Java September 22, Java Bytecode  Bytecode : is a highly optimized set of instructions designed to be executed by the Java.
Chap. 10, Intermediate Representations J. H. Wang Dec. 27, 2011.
CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Compilers and Interpreters
Software. Introduction n A computer can’t do anything without a program of instructions. n A program is a set of instructions a computer carries out.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
BPF+ Exploiting Global Data-flow Optimization in a Packet Filter Architecture Andrew Begel, Steven McCanne, Susan L. Graham University of California, Berkeley.
Applications Active Web Documents Active Web Documents.
Introduction CSC 111.
The Design & Implementation of Hyperupcalls
M S COLLEGE ART’S, COMM., SCI. & BMS
CSc 453 Interpreters & Interpretation
Presentation transcript:

Towards eliminating runtime array bound checks in the Java Virtual Machine Hongwei Songtao

Friday, June 19, Outline Runtime array bounds checking in JVMRuntime array bounds checking in JVM –required by security policy of JVM –incurs performance overhead Problems with current approaches based on flow analysisProblems with current approaches based on flow analysis Our solutionOur solution –a type system for a JVML-like language Current work and conclusionCurrent work and conclusion

Friday, June 19, Security Concern with JVM

Friday, June 19, Array Bound Checks in JVM The security policy of JVMThe security policy of JVM –prevents out-of-bounds array access JVM implementationsJVM implementations –verifiers are unable to guarantee safety statically –interpreters have to check array bounds Runtime checks incur overheadRuntime checks incur overhead

Friday, June 19, Array Bound Checks in JVM (cont.) Overhead incurred by runtime checksOverhead incurred by runtime checks –overshadowed by the overhead of interpretation –significant in such applications as 3-D graphics When seeking high performance, this overhead cannot be neglectedWhen seeking high performance, this overhead cannot be neglected

Friday, June 19, Flow Analysis On Mobile Code is used to draw conclusionis used to draw conclusion –that index variable will not exceed the bounds of array can be applied, but where?can be applied, but where? –at the receiver side? Time is wasted –at the code source? why should I trust your result?

Friday, June 19, Our Approach Program invariantsProgram invariants –acquired at code source –translated into dependent type annotations Dependent type annotationsDependent type annotations –packed into.class file –transferred to the receiver

Friday, June 19, Our Approach (cont.) A JVM that supports our approachA JVM that supports our approach –type checks bytecode program –with the help of the type annotation A well-typed programA well-typed program –is guaranteed never to make out-of-bounds array accesses

Friday, June 19, Illustration of Our Method.class file +annotations

Friday, June 19, Type System is built on the given propertiesis built on the given properties –given properties are at basic block entries –properties are expressed in dependent type terms will generate constraints ( predicates) over integer domainwill generate constraints ( predicates) over integer domain –integer programming algorithm is adopted

Friday, June 19, Basic Blocks Given properties instruction Basic block 1 Basic block 2 instruction

Friday, June 19, Inside Basic Blocks iaload Properties Given properties iload 2 aload 1

Friday, June 19, Inside Basic Blocks iaload Properties …… Safe/unsafe iload 2 aload 1

Friday, June 19, Leaving Basic Blocks instruction Basic block 1 Given Properties Preserved/not jeq loop instruction

Friday, June 19, Type Checking

Friday, June 19, Type Checking

Friday, June 19, Type Checking

Friday, June 19, Constraints “Implies” relation“Implies” relation –is reduced to predicates over integer domain:Constraints Satisfaction of constraintsSatisfaction of constraints –equivalent to integer programming problem Integer programming algorithmsInteger programming algorithms –Simplex, Branch and Bound, etc. –evidence to suggest efficiency

Friday, June 19, Conclusion. Our method... Can deal with hard problems such as binary searchCan deal with hard problems such as binary search Gives high confidence at the receiver sideGives high confidence at the receiver side Is compatible with byte-code formatIs compatible with byte-code format Is expected to be relatively lightweightIs expected to be relatively lightweight