Skip to main content
Log in

A New Type System for JVM Lock Primitives

  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

A bytecode verifier for the Java virtual machine language (JVML) statically checks that bytecode does not cause any fatal error. However, the present verifier does not check correctness of the usage of lock primitives. To solve this problem, we extend Stata and Abadi’s type system for JVML by augmenting types with information about how each object is locked and unlocked. The resulting type system guarantees that when a thread terminates, it has released all the locks it has acquired and that a thread releases a lock only if it has acquired the lock previously. We have implemented a prototype Java bytecode verifier based on the type system. We have tested the verifier for several classes in the Java run time library and confirmed that the verifier runs efficiently and gives correct answers.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Barthe, G. and Rezk, T., “Non-interference for a jvm-like language,” in Proc. of ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI 2005), pp. 103–112, 2005.

  2. Bigliardi, G. and Laneve, C., “A type system for JVM threads,” in Proc. of 3rd ACM SIGPLAN Workshop on Types in Compilation (TIC2000), Montreal, Canada, 2000.

  3. Chaki, S., Rajamani, S. and Rehof, J., “Types as models: Model checking message-passing programs,” in Proc. of ACM SIGPLAN/SIGACT Symp. on Principles of Programming Languages, pp. 45–57, 2002.

  4. Christensen, S., Decidability and Decomposition in Process Algebras. PhD. thesis, University of Edinburgh, 1993.

  5. DeLine, R. and Fähndrich, M., “Enforcing high-level protocols in lowlevel software,” in Proc. of ACM SIGPLAN Conf. on Programming Language Design and Implementation, pp. 59–69, 2001.

  6. Esparza, J. and Nielsen, M., “Decidability issues for Petri nets - a survey,” Journal of Information Processing and Cybernetics, 30(3), pp. 143–160, 1994.

    MATH  Google Scholar 

  7. Flanagan, C. and Abadi, M., “Object types against races,” in CONCUR’ 99, LNCS 1664, Springer-Verlag, pp. 288–303, 1999.

  8. Flanagan, C. and Abadi, M., “Types for safe locking,” in Proc. of ESOP 1999, LNCS 1576, pp. 91–108, 1999.

  9. Flanagan, C. and Freund, S.N., “Type-based race detection for Java,” in Proc. of ACM SIGPLAN Conf. on Programming Language Design and Implementation, pp. 219–232, 2000.

  10. Foster, J.S., Terauchi, T. and Aiken, A., “Flow-sensitive type qualifiers,” in Proc. of ACM SIGPLAN Conf. on Programming Language Design and Implementation, 2002.

  11. Freund, S.N. and Mitchell. J.C., “A type system for object initialization in the Java bytecode language,” in OOPSLA ’98: Proc. of the 13th ACM SIGPLAN conf. on Object-oriented programming, systems, languages, and applications, ACM Press, pp. 310–327, New York, NY, USA, 1998.

  12. Freund, S.N. and Mitchell, J.C., “A type system for the Java bytecode language and verifier,” J. Autom. Reason, 30(3-4), pp. 271–321, 2003.

    Article  MATH  Google Scholar 

  13. Higuchi, T. and Ohori. A., “Java bytecode as a typed term calculus. in ACM PPDP conf. 2002, ACM Press, pp. 201–211, 2002.

  14. Igarashi, A. and Kobayashi, N., “A generic type system for the picalculus,” Theoretical Computer Science, 311(1-3), pp. 121–163, 2004.

    Article  MATH  MathSciNet  Google Scholar 

  15. Igarashi, A. and Kobayashi, N., “Resource usage analysis,” ACM Transactions on Programming Languages and Systems, 27(2), 2005. Preliminary summary appeared in Proc. of POPL 2002.

  16. Kobayashi, N., Saito, S. and Sumii, E., “An implicitly-typed deadlockfree process calculus,” in Proc. of CONCUR2000, LNCS 1877, Springer-Verlag, pp. 489-503, August 2000. The full version is available as technical report TR00-01, Dept. Info. Sci., Univ. Tokyo.

  17. Kobayashi, N. and Shirane, K., “Type-based information flow analysis for low-level languages,” Computer Software 20(2), pp. 2–21, 2003, in Japanese. A summary written in English appeared in informal proceedings of 2nd Asian Workshop on Programming Languages and Systems (APLAS’02).

  18. Kobayashi, N., Suenaga, K. and Wischik, L., “Resource usage analysis for the pi-calculus,” Logical Methods in Computer Science, 2(3:4), pp. 1–42, 2006.

    MathSciNet  Google Scholar 

  19. Laneve, C., “A type system for JVM Threads,” Theoretical Computer Science, 290(1), pp. 241–778, 2003.

    Article  MathSciNet  Google Scholar 

  20. Lindholm, T. and Yellin, F., The Java Virtual Machine Specification (2 nd edition), Addison Wesley, 1999.

  21. Mogensen, T., “Types for 0, 1 or many uses,” in Implementation of Functional Languages, LNCS 1467, pp. 112–122, 1998.

  22. Morrisett, G., Walker, D., Crary, K. and Glew, N., “From system f to typed assembly language,” ACM Transactions on Programming Languages and Systems, 21(3), pp. 528–569, May 1999.

    Google Scholar 

  23. Necula, G.C., “Proof-carrying code,” in Proc. of the 24 th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Langauges (POPL ’97), pp. 106–119, Paris, January 1997.

  24. Permandla, P. and Boyapati, C., “A type system for preventing data races and deadlocks in the Java virtual machine language,” Technical Report.

  25. Stata, R. and Abadi, M., “A type system for Java bytecode subroutines,” ACM Transactions on Programming Languages and Systems, 21(1), pp. 90–137, 1999.

    Article  Google Scholar 

  26. Sumii, E. and Kobayashi, N., “A generalized deadlock-free process calculus,” in Proc. of Workshop on High-Level Concurrent Language (HLCL’98), ENTCS, 16(3), pp. 55–77, 1998.

    MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Futoshi Iwama.

About this article

Cite this article

Iwama, F., Kobayashi, N. A New Type System for JVM Lock Primitives. New Gener. Comput. 26, 125–170 (2008). https://doi.org/10.1007/s00354-008-0038-8

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00354-008-0038-8

Keywords

Navigation