Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 1 Negligent Class Loaders for Software Evolution Yoshiki Sato, Shigeru Chiba (Tokyo Institute of Technology.

Slides:



Advertisements
Similar presentations
METHOD OVERRIDING 1.Sub class can override the methods defined by the super class. 2.Overridden Methods in the sub classes should have same name, same.
Advertisements

Chapter 3 Loaders and Linkers
Java Virtual Machine (JVM). Lecture Objectives Learn about the Java Virtual Machine (JVM) Understand the functionalities of the class loader subsystem.
Software Design 8.1 XML and XSLT and other TLA's l XML: more than buzzword compliancy  Future of information interchange  Leverages Internet and TCP/IP.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Load-time structural reflection in Java – Shigeru Chiba, 2000 May 27, 2004 Shimin.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
CMSC 414 Computer (and Network) Security Lecture 13 Jonathan Katz.
Lab#1 (14/3/1431h) Introduction To java programming cs425
Overview of Java (continue). Announcements You should have access to your repositories and HW0 If you have problems getting HW0, let me know If you’ve.
Supporting Unanticipated Dynamic Adaptation of Application Behaviour Barry Redmond and Vinny Cahill Distributed Systems Group Trinity College, Dublin.
Introduction to Java Kiyeol Ryu Java Programming Language.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Chapter 9: Subprogram Control
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
C++ fundamentals.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
Are you Confident that data in your non-production systems is secured?
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.
1 Testing Concurrent Programs Why Test?  Eliminate bugs?  Software Engineering vs Computer Science perspectives What properties are we testing for? 
Previous Next 06/18/2000Shanghai Jiaotong Univ. Computer Science & Engineering Dept. C+J Software Architecture Shanghai Jiaotong University Author: Lu,
Programming Languages and Paradigms Object-Oriented Programming.
Java and C++, The Difference An introduction Unit - 00.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Eric Keller, Evan Green Princeton University PRESTO /22/08 Virtualizing the Data Plane Through Source Code Merging.
Programming With Java ICS201 University Of Ha’il1 Chapter 8 Polymorphism and Abstract Classes.
Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) 1 A Small Extension to Java for Class Refinement ACM SAC'08, March 18, 2008.
Java 2 security model Valentina Casola. Components of Java the development environment –development lifecycle –Java language features –class files and.
Copyright (C) 2005 July 25-29, th ECOOP 2005, Glasgow, UK 1 Loosely-separated “Sister” Namespaces in Java Yoshiki Sato (Tokyo Tech.,
Programming With Java ICS Chapter 8 Polymorphism.
Introduction to Object Oriented Programming CMSC 331.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Polymorphism. 3 main programming mechanisms that constitute OOP: 1. Encapsulation 2. Inheritance 3. Polymorphism.
Virtual Support for Dynamic Join Points C. Bockisch, M. Haupt, M. Mezini, K. Ostermann Presented by Itai Sharon
Object Oriented Software Development
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Problem: Efficient dynamic type checking for Java ƒsingle class inheritance ƒmultiple interface inheritance ƒarray subtyping Solutions ƒLeverage (JIT)
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
1 The finalize, clone, and getClass Methods  The finalize method is invoked by the garbage collector on an object when the object becomes garbage.  The.
Session 07 Module 13 - Collections. Collections / Session 7 / 2 of 32 Review  A delegate in C# is used to refer to a method in a safe manner.  To invoke.
On Implementing High Level Concurrency in Java G Stewart von Itzstein Mark Jasiunas University of South Australia.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Programming in java Packages Access Protection Importing packages Java program structure Interfaces Why interface Defining interface Accessing impln thru.
Inheritance ndex.html ndex.htmland “Java.
CH10 Supplementary Material Prepared by Fatimah Alakeel Oct 2010.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
METADATA IN.NET Presented By Sukumar Manduva. INTRODUCTION  What is Metadata ? Metadata is a binary information which contains the complete description.
J AVA P ROGRAMMING 2 CH 04: C LASSES, O BJECTS AND M ETHODS (II) 0.
Design issues for Object-Oriented Languages
Memory Protection: Kernel and User Address Spaces
Java Primer 1: Types, Classes and Operators
Lecture 1 Runtime environments.
Introduction Enosis Learning.
Memory Protection: Kernel and User Address Spaces
Introduction Enosis Learning.
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Towards JIT compiler for IO language Dynamic mixin optimization
point when a program element is bound to a characteristic or property
Memory Protection: Kernel and User Address Spaces
Plug-In Architecture Pattern
Presentation transcript:

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 1 Negligent Class Loaders for Software Evolution Yoshiki Sato, Shigeru Chiba (Tokyo Institute of Technology and Japan Science and Technology Corp)

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 2 Java class loaders are great!!  How do you implement dynamic AOP or reflection ? It should be easy if using class loaders loader = new CustomClassLoader(…); byte[] modifiedclass = translator.compose(“Product”, “Logging”); Class c = loader.load(modifiedClass); Product p = (Product) c.newInstance(); 1.Creating a custom class loader 2.Putting the logging functionality on the Product class using a translator 3.Loading the modified version of the Product class Finally, we can get an instance of the new Product class Common mistake!!!

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 3 Java class loaders are useless!!  This is wrong implementation Two Product classes are loaded as different classes  The system class loader loads one class file  The CustomClassLoader loads another They have the same name but are not compatible  Some experts may define the Product class as an interface But it is troublesome, slow and inflexible loader = new CustomClassLoader(…); byte[] modifiedclass = translator.compose(“Product”, “Logging”); Class c = loader.load(modifiedClass); Product p = (Product) c.newInstance(); ClassCastException We want to enable such a cast operation

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 4 The version barrier forbids this cast  The version barrier is an obstacle to software evolution as well as the restricted ability for reloading a class  Different versions of a class is not compatible in Java Those are separately loaded by distinct class loaders An instance can not be assigned to a variable of another version of a class Version barrier (i.e. namespace) product old new incompatible loader1 loader2

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 5 Why did the Java designer select this ?  The version barrier guards JVMs against type- spoofing without runtime type checks Type-spoofing may crash JVMs by accessing an illegal memory space (Sun JDK1.1 had the similar problem reported by Saraswat) Product p = (Product) c.newInstance(); int price = p.getPrice(); Product getName() getPrice() Product getName() p  If the JVM does type checks on every instance access, the version barrier is not needed It is unacceptable for Java Because the Java design prefers high-performance loader1( Segmentation fault p.getPrice() loader2(

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 6 Proposal: Negligent Class Loader (NCL)  The NCL can relax the version barrier among the sibling loaders pairing in advance 1.Allows changing the class schema securely 2.Needs additional runtime checks but minimum 3.Negligent in updating instances Parent class loader product Elder NCL Younger NCL An instance can be assigned to a variable of the version of the pairing loader

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 7 Proposal: Negligent Class Loader (NCL)  The NCL can relax the version barrier among the sibling loaders pairing in advance 1. Allows changing the class schema securely  Adding, deleting and changing a method  Not allowed weakening the access restriction  Not allowed changing the class hierarchy 2. Needs additional runtime checks but minimum 3. Negligent in updating instances

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 8 Proposal: Negligent Class Loader (NCL)  The NCL can relax the version barrier among the sibling loaders paired in advance 1. Allows changing the class schema securely 2. Needs additional runtime checks but minimum  Compliant schema updates at class liking time  The additional type checks for the NCL are needed only when an explicit cast operator is executed 3. Negligent in updating instances

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 9 Proposal: Negligent Class Loader (NCL)  The NCL can relax the version barrier among the sibling loaders paired in advance 1. Allows changing the class schema securely 2. Needs additional runtime checks but minimum 3. Negligent in updating instances  The NCL doesn’t change the class versions of existing instances  Multiple class versions of instances coexist in a single namespace without using an interface  An instance keeps the initial version of the class as long as it works properly

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 10 Changing the class schema securely  The TIBs of both versions are updated to be compliant with each other when a new version is loaded The corresponding methods share the same index into the TIB A TIB entry of a missing method is filled up with a SHF (secure handling function) e.g. RuntimeException caller code TIB object Compliant schema updates a b c() a() b a a c SHF 1 a() 2 b() 1 a() 2 b() A new version is loaded compatible Old New (TIB: type information block) Old

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 11 Additional runtime checks  Only runtime checks by checkcast is extended Different versions of the class are compatible between the pairing NCLs (relaxed version barrier) Other instructions such as invokevirtual, getfield and astore are not extended because of the bridge-safe property An instance from the pairing NCL must be  upcast to their supertype loaded by their common parent loader  downcast to a variable of the corresponding type Elder NCL Younger NCL Parent CL Object obj = Product p = c.newInstance(); (Product) obj; checkcast

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 12 Most of previous work Two approaches for runtime evolution  Dealing with instances of multiple versions of a class Negligent Class Loaders  Runtime instrumentation of running programs  Sun JDK1.4 JPDA (JDK1.5 java.lang.instrument)  Dynamic Java Classes [Malabarba00ECOOP]  PROSE2 [Popovicci03ECOOP]  Steamloom [Bockisch04AOSD] Recompiling a new version of a class definition And invalidating an old version of a class definition It implies performance penalties and spoils runtime optimizations by a JIT compiler

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 13 Conclusions Runtime overhead Extensibility Static typing Java,C#,C++ -> fast but inflexible Dynamic typing CLOS,Smalltalk,Ruby -> flexible but slow Our goal  We are currently implementing our approach on IBM Jikes RVM  Future directions Evaluating performance overheads Handling fields and arrays of multi-versioned class The proof of type safety and Java security architecture

Jun 14, 2004RAM-SE'04 Workshop, Oslo, Norway 14 Difficult issues  The existing fields must not be decreased in the new version and only a private field can be added into the new version Because an entry of a field table is generally not a function but just an element of arrays The SHF can not be invoked at a field access by being inserted into a field table  Inlining methods must be invalidated Because it is not executed by referring the function tables with the specified method index An instance can not be handled keeping its own version