Skip to main content

Capabilities for Uniqueness and Borrowing

  • Conference paper
ECOOP 2010 – Object-Oriented Programming (ECOOP 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6183))

Included in the following conference series:

Abstract

An important application of unique object references is safe and efficient message passing in concurrent object-oriented programming. However, to prevent the ill effects of aliasing, practical systems often severely restrict the shape of messages passed by reference. Moreover, the problematic interplay between destructive reads–often used to implement unique references–and temporary aliasing through “borrowed” references is exacerbated in a concurrent setting, increasing the potential for unpredictable run-time errors.

This paper introduces a new approach to uniqueness. The idea is to use capabilities for enforcing both at-most-once consumption of unique references, and a flexible notion of uniqueness. The main novelty of our approach is a model of uniqueness and borrowing based on simple, unstructured capabilities. The advantages are: first, it provides simple foundations for uniqueness and borrowing. Second, it can be formalized using a relatively simple type system, for which we provide a complete soundness proof. Third, it avoids common problems involving borrowing and destructive reads, since unique references subsume borrowed references.

We have implemented our type system as an extension to Scala. Practical experience suggests that our system allows type checking real-world actor-based concurrent programs with only a small number of additional type annotations.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Almeida, P.S.: Balloon types: Controlling sharing of state in data types. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 32–59. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  2. Anderson, Z.R., Gay, D., Naik, M.: Lightweight annotations for controlling sharing in concurrent data structures. In: PLDI, pp. 98–109. ACM, New York (2009)

    Chapter  Google Scholar 

  3. Armstrong, J., Virding, R., Wikström, C., Williams, M.: Concurrent Programming in Erlang, 2nd edn. Prentice-Hall, Englewood Cliffs (1996)

    Google Scholar 

  4. Auerbach, J.S., Bacon, D.F., Guerraoui, R., Spring, J.H., Vitek, J.: Flexible task graphs: a unified restricted thread programming model for java. In: LCTES, pp. 1–11. ACM, New York (2008)

    Chapter  Google Scholar 

  5. Beckman, N.E., Bierhoff, K., Aldrich, J.: Verifying correct usage of atomic blocks and typestate. In: Harris, G.E. (ed.) OOPSLA, pp. 227–244. ACM, New York (2008)

    Google Scholar 

  6. Bierhoff, K., Aldrich, J.: Modular typestate checking of aliased objects. In: OOPSLA, pp. 301–320. ACM, New York (2007)

    Google Scholar 

  7. Bornat, R., Calcagno, C., O’Hearn, P.W., Parkinson, M.J.: Permission accounting in separation logic. In: POPL, pp. 259–270. ACM, New York (2005)

    Google Scholar 

  8. Boyapati, C., Lee, R., Rinard, M.C.: Ownership types for safe programming: preventing data races and deadlocks. In: OOPSLA, pp. 211–230 (2002)

    Google Scholar 

  9. Boyland, J.T., Retert, W.: Connecting effects and uniqueness with adoption. In: POPL, pp. 283–295. ACM, New York (2005)

    Google Scholar 

  10. Caromel, D.: Towards a method of object-oriented concurrent programming. ACM Commun. 36(9), 90–102 (1993)

    Article  Google Scholar 

  11. Charguéraud, A., Pottier, F.: Functional translation of a calculus of capabilities. In: ICFP, pp. 213–224. ACM, New York (2008)

    Chapter  Google Scholar 

  12. Clarke, D., Wrigstad, T.: External uniqueness is unique enough. In: Cardelli, L. (ed.) ECOOP 2003. LNCS, vol. 2743, pp. 176–200. Springer, Heidelberg (2003)

    Google Scholar 

  13. Clarke, D., Wrigstad, T., Östlund, J., Johnsen, E.B.: Minimal ownership for active objects. In: APLAS, pp. 139–154. Springer, Heidelberg (2008)

    Google Scholar 

  14. Clarke, D.G., Potter, J., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA, pp. 48–64 (1998)

    Google Scholar 

  15. Degen, M., Thiemann, P., Wehr, S.: Tracking linear and affine resources with java(X). In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 550–574. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  16. Dietl, W., Drossopoulou, S., Müller, P.: Generic universe types. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 28–53. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  17. Dietl, W., Müller, P.: Universes: Lightweight ownership for JML. Journal of Object Technology 4(8), 5–32 (2005)

    Google Scholar 

  18. Distefano, D., Parkinson, M.J.: jstar: towards practical verification for java. In: OOPSLA, pp. 213–226. ACM, New York (2008)

    Google Scholar 

  19. Ennals, R., Sharp, R., Mycroft, A.: Linear types for packet processing. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 204–218. Springer, Heidelberg (2004)

    Google Scholar 

  20. Fähndrich, M., Aiken, M., Hawblitzel, C., Hodson, O., Hunt, G.C., Larus, J.R., Levi, S.: Language support for fast and reliable message-based communication in singularity OS. In: EuroSys, pp. 177–190. ACM, New York (2006)

    Chapter  Google Scholar 

  21. Fähndrich, M., DeLine, R.: Adoption and focus: Practical linear types for imperative programming. In: PLDI, pp. 13–24 (2002)

    Google Scholar 

  22. Flanagan, C., Sabry, A., Duba, B.F., Felleisen, M.: The essence of compiling with continuations. In: PLDI, pp. 237–247 (1993)

    Google Scholar 

  23. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns. Addison-Wesley, Reading (1995)

    Google Scholar 

  24. Haller, P., Odersky, M.: Capabilities for uniqueness and borrowing. Technical Report LAMP-REPORT-2009-004 EPFL, Lausanne, Switzerland (December 2009), http://infoscience.epfl.ch/record/142817

  25. Haller, P., Odersky, M.: Scala actors: Unifying thread-based and event-based programming. Theor. Comput. Sci. 410(2-3), 202–220 (2009)

    Article  MATH  MathSciNet  Google Scholar 

  26. Harms, D.E., Weide, B.W.: Copying and swapping: Influences on the design of reusable software components. IEEE Trans. Software Eng. 17(5), 424–435 (1991)

    Article  Google Scholar 

  27. Hicks, M.W., Morrisett, J.G., Grossman, D., Jim, T.: Experience with safe manual memory-management in cyclone. In: ISMM, pp. 73–84 (2004)

    Google Scholar 

  28. Hogg, J.: Islands: Aliasing protection in object-oriented languages. In: OOPSLA (1991)

    Google Scholar 

  29. Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight java: a minimal core calculus for java and GJ. ACM Trans. Program. Lang. Syst. 23(3), 396–450 (2001)

    Article  Google Scholar 

  30. Kobayashi, N.: Quasi-linear types. In: POPL, pp. 29–42 (1999)

    Google Scholar 

  31. Lindholm, T., Yellin, F.: The Java Virtual Machine Specification. Addison-Wesley, Reading (1996)

    Google Scholar 

  32. Müller, P., Rudich, A.: Ownership transfer in universe types. In: OOPSLA (2007)

    Google Scholar 

  33. Noble, J., Vitek, J., Potter, J.: Flexible alias protection. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 158–185. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  34. Odersky, M.: Observers for linear types. In: Krieg-Brückner, B. (ed.) ESOP 1992. LNCS, vol. 582, pp. 390–407. Springer, Heidelberg (1992)

    Google Scholar 

  35. Odersky, M., Spoon, L., Venners, B.: Programming in Scala. Artima Press, Mountain View (2008)

    Google Scholar 

  36. O’Hearn, P.W., Reynolds, J.C., Yang, H.: Local reasoning about programs that alter data structures. In: Fribourg, L. (ed.) CSL 2001 and EACSL 2001. LNCS, vol. 2142, pp. 1–19. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  37. Parkinson, M.J., Bierman, G.M.: Separation logic, abstraction and inheritance. In: POPL, pp. 75–86. ACM, New York (2008)

    Google Scholar 

  38. Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)

    Google Scholar 

  39. Spring, J.H., Privat, J., Guerraoui, R., Vitek, J.: Streamflex: high-throughput stream programming in java. In: OOPSLA, pp. 211–228 (2007)

    Google Scholar 

  40. Srinivasan, S., Mycroft, A.: Kilim: Isolation-typed actors for java. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 104–128. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  41. Strnisa, R., Sewell, P., Parkinson, M.J.: The java module system: core design and semantic definition. In: OOPSLA, pp. 499–514 (2007)

    Google Scholar 

  42. Tofte, M., Talpin, J.-P.: Region-based memory management. Inf. Comput. 132(2), 109–176 (1997)

    Article  MATH  MathSciNet  Google Scholar 

  43. Wadler, P.: Linear types can change the world! In: Programming Concepts and Methods, IFIP TC 2 Working Conference, Israel (1990)

    Google Scholar 

  44. Walker, D., Crary, K., Morrisett, J.G.: Typed memory management via static capabilities. ACM Trans. Program. Lang. Syst. 22(4), 701–771 (2000)

    Article  Google Scholar 

  45. Walker, D., Morrisett, J.G.: Alias types for recursive data structures. In: Harper, R. (ed.) TIC 2000. LNCS, vol. 2071, pp. 177–206. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  46. Walker, D., Watkins, K.: On regions and linear types. In: ICFP (2001)

    Google Scholar 

  47. Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  48. Wrigstad, T.: Ownership-Based Alias Managemant. PhD thesis, KTH, Sweden (2006)

    Google Scholar 

  49. Wrigstad, T., Clarke, D.: Existential owners for ownership types. Journal of Object Technology 6(4) (2007)

    Google Scholar 

  50. Wrigstad, T., Pizlo, F., Meawad, F., Zhao, L., Vitek, J.: Loci: Simple thread-locality for java. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 445–469. Springer, Heidelberg (2009)

    Google Scholar 

  51. Yonezawa, A., Briot, J.-P., Shibayama, E.: Object-oriented concurrent programming in ABCL/1. In: OOPSLA, pp. 258–268 (1986)

    Google Scholar 

  52. Zhao, T., Noble, J., Vitek, J.: Scoped types for real-time java. In: RTSS, pp. 241–251. IEEE Computer Society, Los Alamitos (2004)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Haller, P., Odersky, M. (2010). Capabilities for Uniqueness and Borrowing. In: D’Hondt, T. (eds) ECOOP 2010 – Object-Oriented Programming. ECOOP 2010. Lecture Notes in Computer Science, vol 6183. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14107-2_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-14107-2_17

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-14106-5

  • Online ISBN: 978-3-642-14107-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics