Runtime checking of expressive heap assertions Greta Yorsh, Martin Vechev, Eran Yahav, Bard Bloom.

Slides:



Advertisements
Similar presentations
1 Write Barrier Elision for Concurrent Garbage Collectors Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center.
Advertisements

Automatic Memory Management Noam Rinetzky Schreiber 123A /seminar/seminar1415a.html.
CERTIFICATION OBJECTIVES Use Class Members Develop Wrapper Code & Autoboxing Code Determine the Effects of Passing Variables into Methods Recognize when.
Dept. of Computer Science A Runtime Assertion Checker for the Java Modeling Language (JML) Yoonsik Cheon and Gary T. Leavens SERP 2002, June 24-27, 2002.
Asynchronous Assertions Eddie Aftandilian and Sam Guyer Tufts University Martin Vechev ETH Zurich and IBM Research Eran Yahav Technion.
Aarhus University, 2005Esmertec AG1 Implementing Object-Oriented Virtual Machines Lars Bak & Kasper Lund Esmertec AG
Introduction to Java Programming Language Junji Zhi University of Toronto 1.
Memory Management for Real-Time Java Wes Beebee and Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Supported by: DARPA.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
University of Michigan Electrical Engineering and Computer Science 1 Practical Lock/Unlock Pairing for Concurrent Programs Hyoun Kyu Cho 1, Yin Wang 2,
OOP Languages: Java vs C++
C. FlanaganType Systems for Multithreaded Software1 Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College Shaz Qadeer Microsoft Research.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
February Semantion Privately owned, founded in 2000 First commercial implementation of OASIS ebXML Registry and Repository.
An Efficient Runtime for Detecting Defects in Deployed Systems Matt ArnoldMartin VechevEran Yahav.
A Bridge to Your First Computer Science Course Prof. H.E. Dunsmore Concurrent Programming Threads Synchronization.
Lecture Objectives To understand how Java implements a stack To learn how to implement a stack using an underlying array or linked list Implement a simple.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Cs2220: Engineering Software Class 8: Implementing Data Abstractions Fall 2010 University of Virginia David Evans.
Java Virtual Machine Java Virtual Machine A Java Virtual Machine (JVM) is a set of computer software programs and data structures that use.
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
Testing and Verifying Atomicity of Composed Concurrent Operations Ohad Shacham Tel Aviv University Nathan Bronson Stanford University Alex Aiken Stanford.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Effective Java: Generics Last Updated: Spring 2009.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
Chapter 7 Stacks. © 2004 Pearson Addison-Wesley. All rights reserved 7-2 The Abstract Data Type: Developing an ADT During the Design of a Solution Specifications.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
Parallel Checking of Expressive Heap Assertions Greta YorshMartin VechevEran YahavBard Bloom IBM T.J. Watson Research Center.
tom perkins1 XML Web Services -.NET FRAMEWORK – Part 1 CHAPTER 1.1 – 1.3.
1 (Worker Queues) cs What is a Thread Pool? A collection of threads that are created once (e.g. when a server starts) That is, no need to create.
CS 346 – Chapter 4 Threads –How they differ from processes –Definition, purpose Threads of the same process share: code, data, open files –Types –Support.
Chameleon Automatic Selection of Collections Ohad Shacham Martin VechevEran Yahav Tel Aviv University IBM T.J. Watson Research Center Presented by: Yingyi.
Cs2220: Engineering Software Class 6: Defensive Programming Fall 2010 University of Virginia David Evans.
Aritra Sengupta, Swarnendu Biswas, Minjia Zhang, Michael D. Bond and Milind Kulkarni ASPLOS 2015, ISTANBUL, TURKEY Hybrid Static-Dynamic Analysis for Statically.
Writing Systems Software in a Functional Language An Experience Report Iavor Diatchki, Thomas Hallgren, Mark Jones, Rebekah Leslie, Andrew Tolmach.
Dynamic Architectures (Component Reconfiguration) with Fractal.
Multithreading in Java Sameer Singh Chauhan Lecturer, I. T. Dept., SVIT, Vasad.
Celluloid An interactive media sequencing language.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Gedae, Inc. Gedae: Auto Coding to a Virtual Machine Authors: William I. Lundgren, Kerry B. Barnes, James W. Steed HPEC 2004.
Heap liveness and its usage in automatic memory management Ran Shaham Elliot Kolodner Mooly Sagiv ISMM’02 Unpublished TVLA.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
CIS 200 Test 01 Review. Built-In Types Properties  Exposed “Variables” or accessible values of an object  Can have access controlled via scope modifiers.
SCoPE: an AspectJ Compiler for Supporting User-Defined Analysis-Based Pointcuts Tomoyuki Aotani Hidehiko Masuhara
® July 21, 2004GC Summer School1 Cycles to Recycle: Copy GC Without Stopping the World The Sapphire Collector Richard L. Hudson J. Eliot B. Moss Originally.
Defensive Programming. Good programming practices that protect you from your own programming mistakes, as well as those of others – Assertions – Parameter.
GC Assertions: Using the Garbage Collector To Check Heap Properties Samuel Z. Guyer Tufts University Edward Aftandilian Tufts University.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
OOP Tirgul 7. What We’ll Be Seeing Today  Packages  Exceptions  Ex4 2.
Java™ 2 Platform Getting Started.
Support for Program Analysis as a First-Class Design Constraint in Legion Michael Bauer 02/22/17.
Jim Fawcett CSE687 – Object Oriented Design Spring 2016
Compositional Pointer and Escape Analysis for Java Programs
runtime verification Brief Overview Grigore Rosu
Improving java performance using Dynamic Method Migration on FPGAs
Testing Recap Testing can find problems, but cannot prove your program works Since exhaustive testing is impossible, select test cases with maximum likelihood.
null, true, and false are also reserved.
Generic programming in Java
Units with – James tedder
Standard Template Library
Subtype Substitution Principle
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
Jim Fawcett CSE687 – Object Oriented Design Spring 2015
Presentation transcript:

Runtime checking of expressive heap assertions Greta Yorsh, Martin Vechev, Eran Yahav, Bard Bloom

Motivation Reliability of large software systems – illusive concurrency bugs, misuse of interfaces – static analysis are inherently limited Vision: runtime analysis of deep semantic properties with low overhead – testing, debugging, and production – real applications – leverage available system cores 2

Our goal Checking expressive heap assertions at runtime with low overhead – reuse components of parallel GC Enable reasoning about path properties – sharing – reachability through/avoiding – disjointness – domination object ownership (encapsulation) thread ownership (concurrency) stack ownership (escape analysis) 3

public class ConnectionSource { private Connection conn; private boolean used; public Connection getConnection() throws SQLEx { if (!used) { used = true; return conn; } throw new SQLEx(...); } Motivating Example: JdbF public class Database { private ConnectionManager cm; public int insert(...) throws MappingEx { Connection c = cm.getConnection(...);... }... } public class ConnectionManager { private Map conns = Collections.synchronizedMap(new HashMap()); public Connection getConnection(String s) throws MappingException { try { ConnectionSource c = conns.get(s); if (c != null) return c.getConnection(); throw new MappingException(...); } catch (SQLEx e) {... } }... }

Running Thread Stack Database Root Running Thread Stack HashMap Connection Source Connection Source Connection Source Connection Source Connection Static Connection Source Connection Source Connection Manager Connection Manager current thread every connection is reachable from at most one thread

Running Thread Stack Database Root Running Thread Stack HashMap Connection Source Connection Source Connection Source Connection Source Connection Static Connection Source Connection Source Connection Manager Connection Manager current thread every connection is reachable from at most one thread

public class ConnectionSource { private Connection conn; private boolean used; public Connection getConnection() throws SQLEx { if (!used) { used = true; return conn; } throw new SQLEx(...); } Motivating Example: JdbF public class Database { private ConnectionManager cm; public int insert(...) throws MappingEx { Connection c = cm.getConnection(...); assert Phalanx.getThreadReach(c,cm) == 1... }... } public class ConnectionManager { private Map conns = Collections.synchronizedMap(new HashMap()); public Connection getConnection(String s) throws MappingException { try { ConnectionSource c = conns.get(s); if (c != null) return c.getConnection(); throw new MappingException(...); } catch (SQLEx e) {... } }... } every connection is only reachable from one thread (avoiding connection manager)

Common Heap Queries QueryDescription Heappred(o).size() > 0Is o pointed to by a heap object? Sharingpred(o).size() > 1Is o pointed to by two or more heap objects? Reachabilityreach(src).has(dst)Is dst reachable from src? Disjointnesss!(exists Object v; reach(o1).has(v); reach(o2).has(v)) Is there an object reachable from both o1 and o2? Ownership!(exists Object v ; reach(o).has(v) ; !dom(o,v)) Does o dominate all objects reachable from it? Reachability through!reach(o1,cut).has(o2)Does every path from o1 to o2 go through an object in cut Thread ownershipdom(Thread.currentThread(), o)Does the current thread dominate o?...……

Subtle Semantics dom(x,y) = ? 9 Root Running Thread Stack y y x x 

Tool: Phalanx JML extended with additional primitives – reach(Object o, Object[] avoiding) – pred(Object o) – dom(Object o1,Object o2) – … Modified JML compiler maps common queries to efficient implementation in Phalanx runtime

Experimental evaluation Implementation on top of QVM platform – IBM J9 production virtual machine – can leverage QVM adaptive overhead manager – new parallel algorithms for common queries Implementation based on JVMTI – less efficient, no parallel algorithms – portable

Heap Assertions in Real Applications

Disposal of Shared SWT Resources replace code of the form: exp.dispose(); with code of the form if (Phalanx.isShared(exp)) Phalanx.warning(”disposal of \ shared resource”+exp) ; exp.dispose();

Redundant Synchronization replace code of the form: synchronized(exp) {... } with code of the form synchronized(exp) { if(Phalanx.dom(Thread.currentThread(),exp)) Phalanx.warning(”synchronization on \ an owned object”+exp) ;... }

Summary common heap queries and usage scenarios new JML primitives modified JML compiler subtle semantics implementation – parallel implementation in J9 production jvm – portable implementation in JVMTI experimental evaluation – real-world applications – performance benchmarks 15