Skip to main content

JATO: Native Code Atomicity for Java

  • Conference paper
Programming Languages and Systems (APLAS 2012)

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

Included in the following conference series:

Abstract

Atomicity enforcement in a multi-threaded application can be critical to the application’s safety. In this paper, we take the challenge of enforcing atomicity in a multilingual application, which is developed in multiple programming languages. Specifically, we describe the design and implementation of JATO, which enforces the atomicity of a native method when a Java application invokes the native method through the Java Native Interface (JNI). JATO relies on a constraint-based system, which generates constraints from both Java and native code based on how Java objects are accessed by threads. Constraints are then solved to infer a set of Java objects that need to be locked in native methods to enforce the atomicity of the native method invocation. We also propose a number of optimizations that soundly improve the performance. Evaluation through JATO’s prototype implementation demonstrates it enforces native-method atomicity with reasonable run-time overhead.

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 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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. Abadi, M., Birrell, A., Harris, T., Isard, M.: Semantics of transactional memory and automatic mutual exclusion. In: POPL 2008, pp. 63–74 (2008)

    Google Scholar 

  2. Berger, E.D., Yang, T., Liu, T., Novark, G.: Grace: safe multithreaded programming for c/c++. In: OOPSLA 2009, pp. 81–96 (2009)

    Google Scholar 

  3. Bocchino Jr., R.L., Heumann, S., Honarmand, N., Adve, S.V., Adve, V.S., Welc, A., Shpeisman, T.: Safe nondeterminism in a deterministic-by-default parallel language. In: POPL 2011, pp. 535–548 (2011)

    Google Scholar 

  4. CarlStrom, B., McDonald, A., Chafi, H., Chung, J., Minh, C., Kozyrakis, C., Olukotun, K.: The atomos transactional programming language. In: PLDI 2006 (June 2006)

    Google Scholar 

  5. Emmi, M., Fischer, J.S., Jhala, R., Majumdar, R.: Lock allocation. In: POPL 2007, pp. 291–296 (2007)

    Google Scholar 

  6. Flanagan, C., Qadeer, S.: A type and effect system for atomicity. In: PLDI 2003, pp. 338–349 (2003)

    Google Scholar 

  7. Furr, M., Foster, J.S.: Checking type safety of foreign function calls. In: ACM Conference on Programming Language Design and Implementation, PLDI, pp. 62–72 (2005)

    Google Scholar 

  8. Furr, M., Foster, J.S.: Polymorphic Type Inference for the JNI. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 309–324. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  9. Harris, T.: Exceptions and side-effects in atomic blocks. Sci. Comput. Program. 58(3), 325–343 (2005)

    Article  MATH  Google Scholar 

  10. Harris, T., Fraser, K.: Language support for lightweight transactions. In: OOPSLA 2003, pp. 388–402 (2003)

    Google Scholar 

  11. Hicks, M., Foster, J.S., Prattikakis, P.: Lock inference for atomic sections. In: TRANSACT 2006 (June 2006)

    Google Scholar 

  12. Hirzel, M., Grimm, R.: Jeannie: Granting Java Native Interface developers their wishes. In: ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA, pp. 19–38 (2007)

    Google Scholar 

  13. Igarashi, A., Pierce, B., Wadler, P.: Featherweight java - a minimal core calculus for java and gj. ACM Transactions on Programming Languages and Systems, 132–146 (1999)

    Google Scholar 

  14. Kondoh, G., Onodera, T.: Finding bugs in Java Native Interface programs. In: ISSTA 2008: Proceedings of the 2008 International Symposium on Software Testing and Analysis, pp. 109–118. ACM, New York (2008)

    Chapter  Google Scholar 

  15. Kulkarni, A., Liu, Y.D., Smith, S.F.: Task types for pervasive atomicity. In: OOPSLA 2010 (October 2010)

    Google Scholar 

  16. Lee, B., Hirzel, M., Grimm, R., Wiedermann, B., McKinley, K.S.: Jinn: Synthesizing a dynamic bug detector for foreign language interfaces. In: ACM Conference on Programming Language Design and Implementation, PLDI, pp. 36–49 (2010)

    Google Scholar 

  17. Leroy, X.: The Objective Caml system (2008), http://caml.inria.fr/pub/docs/manual-ocaml/index.html

  18. Li, S., Tan, G.: Finding bugs in exceptional situations of JNI programs. In: 16th ACM Conference on Computer and Communications Security, CCS, pp. 442–452 (2009)

    Google Scholar 

  19. Li, S., Tan, G.: JET: Exception checking in the Java Native Interface. In: ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA, pp. 345–358 (2011)

    Google Scholar 

  20. Liang, S.: Java Native Interface: Programmer’s Guide and Reference. Addison-Wesley Longman Publishing Co., Inc. (1999)

    Google Scholar 

  21. Liu, Y.D., Lu, X., Smith, S.F.: Coqa: Concurrent Objects with Quantized Atomicity. In: Hendren, L. (ed.) CC 2008. LNCS, vol. 4959, pp. 260–275. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  22. Martin, M.M.K., Blundell, C., Lewis, E.: Subtleties of transactional memory atomicity semantics. Computer Architecture Letters 5(2) (2006)

    Google Scholar 

  23. McCloskey, B., Zhou, F., Gay, D., Brewer, E.: Autolocker: synchronization inference for atomic sections. In: POPL 2006, pp. 346–358 (2006)

    Google Scholar 

  24. messAdmin, http://messadmin.sourceforge.net/

  25. Milanova, A., Rountev, A., Ryder, B.G.: Parameterized object sensitivity for points-to analysis for java. ACM Trans. Softw. Eng. Methodol. 14(1), 1–41 (2005)

    Article  Google Scholar 

  26. Necula, G.C., McPeak, S., Rahul, S.P., Weimer, W.: CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs. In: Horspool, R.N. (ed.) CC 2002. LNCS, vol. 2304, pp. 213–228. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  27. Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: OOPSLA 1991, pp. 146–161 (1991)

    Google Scholar 

  28. Python/C API reference manual (April 2009), http://docs.python.org/c-api/index.html

  29. Shivers, O.: Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie-Mellon University, Pittsburgh, PA (May 1991), CMU-CS-91-145

    Google Scholar 

  30. SPECjvm2008, http://www.spec.org/jvm2008/

  31. Tan, G., Appel, A., Chakradhar, S., Raghunathan, A., Ravi, S., Wang, D.: Safe Java Native Interface. In: Proceedings of IEEE International Symposium on Secure Software Engineering, pp. 97–106 (2006)

    Google Scholar 

  32. Tan, G., Morrisett, G.: ILEA: Inter-language analysis across Java and C. In: ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA, pp. 39–56 (2007)

    Google Scholar 

  33. Wendykier, P., Nagy, J.G.: Parallel colt: A high-performance java library for scientific computing and image processing. ACM Trans. Math. Softw. 37(3), 31:1–31:22 (2010)

    Google Scholar 

  34. Whaley, J., Lam, M.S.: Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In: PLDI 2004, pp. 131–144 (2004)

    Google Scholar 

  35. Zhu, H.S., Liu, Y.D.: Scalable object locality analysis with cypress principle. Technical report, SUNY Binghamton (May 2012)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Li, S., Liu, Y.D., Tan, G. (2012). JATO: Native Code Atomicity for Java. In: Jhala, R., Igarashi, A. (eds) Programming Languages and Systems. APLAS 2012. Lecture Notes in Computer Science, vol 7705. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35182-2_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-35182-2_2

  • Publisher Name: Springer, Berlin, Heidelberg

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

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

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics