Safe Runtime Downcasts With Ownership Types

The possibility of aliasing between objects constitutes one of the primary challenges in understanding and reasoning about correctness of object-oriented programs. Ownership types provide a principled way of specifying statically enforcable restrictions on object aliasing. Ownership types have been used to aid program understanding and evolution, verify absence of data races and deadlocks in multithreaded programs, and verify absence of memory errors in programs with explicit deallocation. This paper describes an efficient technique for supporting safe runtime downcasts with ownership types. This technique uses the type passing approach, but avoids the associated significant space overhead by storing runtime ownership information only for objects that are potentially involved in downcasts. Moreover, this technique does not use any interprocedural analysis, so it preserves the separate compilation model of Java. We implemented our technique in the context of Safe Concurrent Java, which is an extension to Java that uses ownership types to guarantee the absence of data races and deadlocks in well-typed programs. Our approach is JVM-compatible: our implementation translates programs to bytecodes that can be run on regular JVMs.

[1]  Martin C. Rinard,et al.  A parameterized type system for race-free Java programs , 2001, OOPSLA '01.

[2]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[3]  David Gerard Clarke,et al.  Object ownership and containment , 2003 .

[4]  Craig Chambers,et al.  Alias annotations for program understanding , 2002, OOPSLA '02.

[5]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[6]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[7]  Robert Cartwright,et al.  Compatible genericity with run-time types for the Java programming language , 1998, OOPSLA '98.

[8]  Mirko Viroli,et al.  Parametric polymorphism in Java: an approach to translation based on reflective features , 2000, OOPSLA '00.

[9]  Naftaly H. Minsky Towards Alias-Free Pointers , 1996, ECOOP.

[10]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[11]  Stephen N. Freund,et al.  Adding type parameterization to the Java language , 1997, OOPSLA '97.

[12]  Richard C. Holt,et al.  The Geneva convention on the treatment of object aliasing , 1992, OOPS.

[13]  Liuba Shrira,et al.  Lazy modular upgrades in persistent object stores , 2003, OOPSLA.

[14]  Sophia Drossopoulou,et al.  Ownership, encapsulation and the disjointness of type and effect , 2002, OOPSLA '02.

[15]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[16]  David F. Bacon,et al.  Guava: a dialect of Java without data races , 2000, OOPSLA '00.

[17]  Liuba Shrira,et al.  Ownership types for object encapsulation , 2003, POPL '03.

[18]  James Noble,et al.  Simple Ownership Types for Object Containment , 2001, ECOOP.

[19]  Andrew C. Myers,et al.  Parameterized types for Java , 1997, POPL '97.

[20]  Martin C. Rinard,et al.  Ownership types for safe region-based memory management in real-time Java , 2003, PLDI '03.

[21]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[22]  Miles H. Krumbine Hell , 1930, The Journal of Religion.

[23]  K. Rustan M. Leino,et al.  Using data groups to specify and check side effects , 2002, PLDI '02.

[24]  Dave Clarke,et al.  External Uniqueness Is Unique Enough , 2003, ECOOP.

[25]  SalcianuAlexandru,et al.  Ownership types for safe region-based memory management in real-time Java , 2003 .

[26]  James Noble,et al.  Ownership types for flexible alias protection , 1998, OOPSLA '98.

[27]  K. Rustan M. Leino,et al.  Extended static checking , 1998, PROCOMET.

[28]  Mirko Viroli Parametric polymorphism in Java: an efficient implementation for parametric methods , 2001, SAC.