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.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Abadi, M., Birrell, A., Harris, T., Isard, M.: Semantics of transactional memory and automatic mutual exclusion. In: POPL 2008, pp. 63–74 (2008)
Berger, E.D., Yang, T., Liu, T., Novark, G.: Grace: safe multithreaded programming for c/c++. In: OOPSLA 2009, pp. 81–96 (2009)
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)
CarlStrom, B., McDonald, A., Chafi, H., Chung, J., Minh, C., Kozyrakis, C., Olukotun, K.: The atomos transactional programming language. In: PLDI 2006 (June 2006)
Emmi, M., Fischer, J.S., Jhala, R., Majumdar, R.: Lock allocation. In: POPL 2007, pp. 291–296 (2007)
Flanagan, C., Qadeer, S.: A type and effect system for atomicity. In: PLDI 2003, pp. 338–349 (2003)
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)
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)
Harris, T.: Exceptions and side-effects in atomic blocks. Sci. Comput. Program. 58(3), 325–343 (2005)
Harris, T., Fraser, K.: Language support for lightweight transactions. In: OOPSLA 2003, pp. 388–402 (2003)
Hicks, M., Foster, J.S., Prattikakis, P.: Lock inference for atomic sections. In: TRANSACT 2006 (June 2006)
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)
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)
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)
Kulkarni, A., Liu, Y.D., Smith, S.F.: Task types for pervasive atomicity. In: OOPSLA 2010 (October 2010)
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)
Leroy, X.: The Objective Caml system (2008), http://caml.inria.fr/pub/docs/manual-ocaml/index.html
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)
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)
Liang, S.: Java Native Interface: Programmer’s Guide and Reference. Addison-Wesley Longman Publishing Co., Inc. (1999)
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)
Martin, M.M.K., Blundell, C., Lewis, E.: Subtleties of transactional memory atomicity semantics. Computer Architecture Letters 5(2) (2006)
McCloskey, B., Zhou, F., Gay, D., Brewer, E.: Autolocker: synchronization inference for atomic sections. In: POPL 2006, pp. 346–358 (2006)
messAdmin, http://messadmin.sourceforge.net/
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)
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)
Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: OOPSLA 1991, pp. 146–161 (1991)
Python/C API reference manual (April 2009), http://docs.python.org/c-api/index.html
Shivers, O.: Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie-Mellon University, Pittsburgh, PA (May 1991), CMU-CS-91-145
SPECjvm2008, http://www.spec.org/jvm2008/
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)
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)
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)
Whaley, J., Lam, M.S.: Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In: PLDI 2004, pp. 131–144 (2004)
Zhu, H.S., Liu, Y.D.: Scalable object locality analysis with cypress principle. Technical report, SUNY Binghamton (May 2012)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)