Link-Time Static Analysis for Efficient Separate Compilation of Object-Oriented Languages



From this document you will learn the answers to the following questions:

What is the name of the piece that describes the global compilation?

What type of tree is used?

What is the main purpose of global compilation?

Similar documents
Link-Time Static Analysis for Efficient Separate Compilation of Object-Oriented Languages

Implementing Statically Typed Object-Oriented Programming Languages

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

Habanero Extreme Scale Software Research Project

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

1. What are Data Structures? Introduction to Data Structures. 2. What will we Study? CITS2200 Data Structures and Algorithms

Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111

Combining Static and Dynamic Data in Code Visualization

Glossary of Object Oriented Terms

Programming Languages

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Java Interfaces. Recall: A List Interface. Another Java Interface Example. Interface Notes. Why an interface construct? Interfaces & Java Types

Chapter 1 Fundamentals of Java Programming

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.

The Needle Programming Language

Static Analysis of Virtualization- Obfuscated Binaries

Course Title: Software Development

Algorithms, Flowcharts & Program Design. ComPro

Cobol. By: Steven Conner. COBOL, COmmon Business Oriented Language, one of the. oldest programming languages, was designed in the last six

Structural Typing on the Java Virtual. Machine with invokedynamic

Virtual Machine Learning: Thinking Like a Computer Architect

Automated Validation & Verification of Software Paper Presentation

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C


problem for browsers and other program-understanding tools: if every potential target of a virtual function call is included in the call graph, the us

Plug and Play Solution for AUTOSAR Software Components

Eliminating Virtual Function Calls in C++ Programs

Formal Engineering for Industrial Software Development

Dsc+Mock: A Test Case + Mock Class Generator in Support of Coding Against Interfaces

The Command Dispatcher Pattern

Regression Test Selection for Java Software

Terms and Definitions for CMS Administrators, Architects, and Developers

Object Oriented Design

Semantic Analysis: Types and Type Checking

Unified Static and Runtime Verification of Object-Oriented Software

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

Fundamentals of Java Programming


How to Sandbox IIS Automatically without 0 False Positive and Negative

Fast Static Analysis of C++ Virtual Function Calls

MPLAB TM C30 Managed PSV Pointers. Beta support included with MPLAB C30 V3.00

1/20/2016 INTRODUCTION

Aspect Weaving for OSGi. Martin Lippert (akquinet it-agile GmbH)

SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin

A Thread Monitoring System for Multithreaded Java Programs

Efficient Monitoring in Actor-based Mobile Hybrid Cloud Framework. Kirill Mechitov, Reza Shiftehfar, and Gul Agha

C++ Programming Language

McMPI. Managed-code MPI library in Pure C# Dr D Holmes, EPCC dholmes@epcc.ed.ac.uk

Konzepte objektorientierter Programmierung

Course MS10975A Introduction to Programming. Length: 5 Days

jmonitor: Java Runtime Event Specification and Monitoring Library

El Dorado Union High School District Educational Services

ITS. Java WebService. ITS Data-Solutions Pvt Ltd BENEFITS OF ATTENDANCE:

Objectif. Participant. Prérequis. Remarque. Programme. C# 3.0 Programming in the.net Framework. 1. Introduction to the.

Problems and Measures Regarding Waste 1 Management and 3R Era of public health improvement Situation subsequent to the Meiji Restoration

WEB SERVICES. Revised 9/29/2015

Progressive Enhancement With GQuery and GWT. Ray Cromwell

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Java Web Services Training

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Checking Access to Protected Members in the Java Virtual Machine

CCured: Type-Safe Retrofitting of Legacy Software

Write Barrier Removal by Static Analysis

Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis

Basic Programming and PC Skills: Basic Programming and PC Skills:

Integrating TAU With Eclipse: A Performance Analysis System in an Integrated Development Environment

Java (12 Weeks) Introduction to Java Programming Language

Inheritance in Programming Languages

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

From Control Loops to Software

AN ENABLING OPTIMIZATION FOR C++ VIRTUAL FUNCTIONS

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

The V8 JavaScript Engine

UOFL SHAREPOINT ADMINISTRATORS GUIDE

Perf Tool: Performance Analysis Tool for Linux

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

Type Casting Verification: Stopping an Emerging Attack Vector

Developing Software in a Private workspace PM PMS

Developing Java Web Services

On Demand Loading of Code in MMUless Embedded System

Instruction Set Architecture (ISA)

ForeverSOA: Towards the Maintenance of Service-Oriented Architecture (SOA) Software

Lecture 22: C Programming 4 Embedded Systems

Software documentation systems

Enterprise Application Development In Java with AJAX and ORM

OO Design Quality Metrics

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

The C Programming Language course syllabus associate level

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

Quotes from Object-Oriented Software Construction

Chap 4. Using Metrics To Manage Software Risks

Getting Started with the Internet Communications Engine

C++FA 3.1 OPTIMIZING C++

MCI-Java: A Modified Java Virtual Machine Approach to Multiple Code Inheritance

Evaluating parallel file system security

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Object Oriented Databases. OOAD Fall 2012 Arjun Gopalakrishna Bhavya Udayashankar

Transcription:

Link-Time Static Analysis for Efficient Separate Compilation of Object-Oriented Languages Jean Privat Roland Ducournau LIRMM CNRS/Université Montpellier II France Program Analysis for Software Tools and Engineering Lisbon 2005 Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 1 / 24

Outline 1 Motivation 2 Global Techniques Type Analysis Coloring Binary Tree Dispatch 3 Separate Compilation 4 Benchmarks Description Results Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 2 / 24

Outline 1 Motivation 2 Global Techniques Type Analysis Coloring Binary Tree Dispatch 3 Separate Compilation 4 Benchmarks Description Results Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 3 / 24

Software Engineering Ideal Production of Modular Software Extensible software Reusable software components Object-Oriented Programming (inheritance + late binding) Production of Software in a Modular Way Small code modification small recompilation Shared software components are compiled only once Software components can be distributed in a compiled form Separate Compilation (compile components + link) Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 4 / 24

Compilation of OO Programs Global Techniques Knowledge of the whole program more efficient implementation: Method invocation Access to attribute Subtyping test The Problem Previous works use global technique with global compilation Global compilation is incompatible with modular production Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 5 / 24

Our Proposition A Compromise A separate compilation framework that includes 3 global compilation techniques How To? Perform global techniques at link-time Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 6 / 24

Outline 1 Motivation 2 Global Techniques Type Analysis Coloring Binary Tree Dispatch 3 Separate Compilation 4 Benchmarks Description Results Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 7 / 24

Type Analysis Problems Most method invocations are actually monomorphic Implement them with a static direct call (no late binding) Many methods are dead Remove them How to? Approximate 3 sets: Live classes and methods Concrete type of each expression Called methods of each call site Many type analysis exist Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 8 / 24

Coloring Problem Overhead with standard VFT in multiple inheritance: Subobjects Many VFT (quadratic number, cubic size) Solution Simple inheritance implementation even in multiple inheritance How to? Assign an identifier by class Assign a color (index) by class, method and attribute Minimize size of the tables A NP-hard problem Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 9 / 24

Coloring (example) A Methods introduced in A A table B C B table Gap C table D D table Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 10 / 24

Binary Tree Dispatch Problem Prediction of conditional branching of modern processors does not work with VFT Solution Use static jumps instead of VFT How to? Perform a type analysis Assign an identifier by live class For each live call site, enumerate concrete type in a select tree Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 11 / 24

Binary Tree Dispatch (Example) Compiling call site x.foo id is the class itentifier of the receiver x Concrete type of x is {A, B, C} Class A B C Identifier 19 12 15 foo implementation A foo B foo C foo Generated Code if id <= 15 then if id <= 12 then call B foo else call C foo else call A foo Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 12 / 24

Outline 1 Motivation 2 Global Techniques Type Analysis Coloring Binary Tree Dispatch 3 Separate Compilation 4 Benchmarks Description Results Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 13 / 24

Separate Compilation Source code Compiled component... void foo() {... bar... }...... void bar() {... foo... }... local phase local phase metadata... call... metadata bar?... call foo?... global phase Final executable... call... call... 0x05217 0x05175 Two Phases Local phase compiles independently of future use Global phase links compiled components Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 14 / 24

Local Phase Source code Compiled component Local phase Metamodel Metamodel Internal model Input Source code of a class Outputs Metamodel of required classes Compiled version of the class (with unresolved symbols) Metadata : metamodel, internal model Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 15 / 24

Compiled Component Method Call Site Assign a unique symbol by call site Compile into a direct call Attribute Access and Subtype Test Assign a unique symbol by color and identifier Compile into a direct access: in the instance for attribute access in the subtyping table for subtype tests Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 16 / 24

Global phase Metadata Compiled component Live global Type analysis model Coloring Symbol substitution Final excutable 3 Stages Type analysis: based on the metadata Coloring: computes colors Symbol substitution: generates the final executable Method Call Site Symbols Substitute the address of: monomorphic the invoked method polymorphic w/ BTD a generated select tree polymorphic w/ VFT a generated table access Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 17 / 24

Outline 1 Motivation 2 Global Techniques Type Analysis Coloring Binary Tree Dispatch 3 Separate Compilation 4 Benchmarks Description Results Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 18 / 24

Benchmarks Description Language and Compilers g++: Separate + VFT w/ subobjects SmartEiffel: Global + Binary Tree Dispatch prmc w/ VFT: Separate + Coloring + VFT prmc w/ BTD: Separate + Coloring + BTD Programs The same programs for all language 1 program per OO mechanism Small programs are generated by a script Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 19 / 24

Size of Executables Size of the Exec. (kb) 120 100 80 60 40 20 0 g++ SmartEiffel prmc w/ btd prmc w/ vft 0 10 20 30 40 50 60 70 Number of Classes Subobjects: many VTF an important overhead prmc: BTD VFT SmartEiffel: better dead code removal Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 20 / 24

Late Binding Time (s) 14 12 10 8 6 4 2 0 g++ SmartEiffel prmc w/ btd prmc w/ vft 0 10 20 30 40 50 60 70 Size of the Concrete Type of the Reicever Subobjects: constant overhead + cache misses Coloring: better on megamorphic calls BTD: better on oligomorphic calls Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 21 / 24

Attribute Access Time (s) 10 9 8 7 6 5 4 3 2 1 0 g++ SmartEiffel prmc 0 10 20 30 40 50 60 70 Size of the Concrete Type of Receiver Subobjects: constant overhead Coloring: constant attribute access SmartEiffel: can degenerate Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 22 / 24

Type Downcast Time (s) 35 30 25 20 15 10 5 0 g++ SmartEiffel prmc 0 10 20 30 40 50 60 70 Size of the Concrete Type of the Casted Expression g++: bad performances Coloring and BTD: equivalent and mainly constant Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 23 / 24

Summary Summary A separate compilation framework with global techniques for statically typed class-based languages Better modularity than global compilers Better performance than other separate compilers Outlook Shared libraries linked at load-time or dynamically loaded Time overhead of the global phase (link) Privat, Ducournau (LIRMM) Link-Time Static Analysis PASTE 05 24 / 24