Skip to main content

Inferring Region Types via an Abstract Notion of Environment Transformation

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2022)

Abstract

Region-based type systems are a powerful tool for various kinds of program analysis. We introduce a new inference algorithm for region types based on an abstract notion of environment transformation. It analyzes the code of a method only once, even when there are multiple invocations of the method of different region types in the program. Elements of such an abstract transformation are essentially constraints for equality and subtyping that capture flow information of the program. In particular, we work with access graphs in the definition of abstract transformations to guarantee the termination of the inference algorithm, because they provide a finite representation of field access paths.

Supported by the German Research Foundation (DFG) under the research grant 250888164 (GuideForce).

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 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.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

References

  1. Agesen, O.: Constraint-based type inference and parametric polymorphism. In: Le Charlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 78–100. Springer, Heidelberg (1994). https://doi.org/10.1007/3-540-58485-4_34

    Chapter  Google Scholar 

  2. Fuh, Y.-C., Mishra, P.: Type inference with subtypes. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 94–114. Springer, Heidelberg (1988). https://doi.org/10.1007/3-540-19027-9_7

    Chapter  Google Scholar 

  3. Aiken, A., Wimmers, E.L.: Type inclusion constraints and type inference. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA 1993), p. 31–41. Association for Computing Machinery, New York (1993). https://doi.org/10.1145/165180.165188

  4. Baader, F., Snyder, W.: Unification theory. In: Robinson, J.A., Voronkov, A. (eds.) Handbook of Automated Reasoning (in 2 volumes), pp. 445–532. Elsevier and MIT Press (2001). https://doi.org/10.1016/b978-044450813-3/50010-2

  5. Beringer, L., Grabowski, R., Hofmann, M.: Verifying pointer and string analyses with region type systems. Comput. Lang. Syst. Struct. 39(2), 49–65 (2013). https://doi.org/10.1016/j.cl.2013.01.001

    Article  MATH  Google Scholar 

  6. Bodden, E.: Inter-procedural data-flow analysis with IFDS/IDE and Soot. In: Proceedings of the ACM SIGPLAN International Workshop on State of the Art in Java Program Analysis (SOAP 2012), pp. 3–8. Association for Computing Machinery (2012). https://doi.org/10.1145/2259051.2259052

  7. Boyapati, C., Salcianu, A., Beebee, W., Rinard, M.: Ownership types for safe region-based memory management in Real-Time Java. In: Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation (PLDI 2003), pp. 324–337. Association for Computing Machinery, New York (2003). https://doi.org/10.1145/781131.781168

  8. Chin, W.N., Craciun, F., Qin, S., Rinard, M.: Region inference for an object-oriented language. In: Proceedings of the ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation (PLDI 2004), pp. 243–254. Association for Computing Machinery, New York (2004). https://doi.org/10.1145/996841.996871

  9. Deutsch, A.: Interprocedural may-alias analysis for pointers: Beyond k-limiting. In: Proceedings of the ACM SIGPLAN 1994 conference on Programming language design and implementation (PLDI 1994), vol. 29(6), pp. 230–241. Association for Computing Machinery (1994). https://doi.org/10.1145/773473.178263

  10. Erbatur, S., Hofmann, M., Zălinescu, E.: Enforcing programming guidelines with region types and effects. In: Chang, B.-Y.E. (ed.) APLAS 2017. LNCS, vol. 10695, pp. 85–104. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-71237-6_5

    Chapter  Google Scholar 

  11. Erbatur, S., Schöpp, U., Xu, C.: Type-based enforcement of infinitary trace properties for Java. In: 23rd International Symposium on Principles and Practice of Declarative Programming (PPDP 2021), pp. 18:1–18:14. Association for Computing Machinery (2021). https://doi.org/10.1145/3479394.3479413

  12. Facebook: Flow - A static type checker for JavaScript. https://flow.org

  13. Gosling, J., Joy, B., Steele, G., Bracha, G., Buckley, A.: The Java Language Specification. Oracle America Inc., Java SE 14 edn. (2020). http://docs.oracle.com/javase/specs/jls/se14/jls14.pdf

  14. Grabowski, R., Hofmann, M., Li, K.: Type-based enforcement of secure programming guidelines - code injection prevention at SAP. In: Barthe, G., Datta, A., Etalle, S. (eds.) FAST 2011. LNCS, vol. 7140, pp. 182–197. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-29420-4_12

    Chapter  Google Scholar 

  15. Huang, W., Dong, Y., Milanova, A.: Type-based taint analysis for Java web applications. In: Gnesi, S., Rensink, A. (eds.) FASE 2014. LNCS, vol. 8411, pp. 140–154. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54804-8_10

    Chapter  Google Scholar 

  16. 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). https://doi.org/10.1145/503502.503505

    Article  Google Scholar 

  17. Jones, N.D., Muchnick, S.S.: Flow analysis and optimization of LISP-like structures. In: Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 1979), pp. 244–256. Association for Computing Machinery (1979). https://doi.org/10.1145/567752.567776

  18. Khedker, U.P., Sanyal, A., Karkare, A.: Heap reference analysis using access graphs. ACM Trans. Program. Lang. Syst. 30(1), 1–41 (2007). https://doi.org/10.1145/1290520.1290521

    Article  Google Scholar 

  19. Lerch, J., Späth, J., Bodden, E., Mezini, M.: Access-path abstraction: Scaling field-sensitive data-flow analysis with unbounded access paths. In: Proceedings of the 30th IEEE/ACM International Conference on Automated Software Engineering (ASE 2015), pp. 619–629. IEEE Press (2015). https://doi.org/10.1109/ASE.2015.9

  20. Microsoft: TypeScript - Typed JavaScript at any scale. https://www.typescriptlang.org/

  21. Odersky, M., Sulzmann, M., Wehr, M.: Type inference with constrained types. Theory Practice Object Syst. 5(1), 35–55 (1999). https://doi.org/10.1002/(SICI)1096-9942(199901/03)5:1<35::AID-TAPO4>3.0.CO;2-4

  22. Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. SIGPLAN Notices 26(11), 146–161 (1991). https://doi.org/10.1145/118014.117965

    Article  Google Scholar 

  23. Sable Group, M.U.: Heros IFDS/IDE solver. https://github.com/Sable/heros

  24. Sable Group M.U: Soot - A framework for analyzing and transforming Java and Android applications. https://soot-oss.github.io/soot/

  25. Sagiv, S., Reps, T.W., Horwitz, S.: Precise interprocedural dataflow analysis with applications to constant propagation. Theoret. Comput. Sci. 167(1–2), 131–170 (1996). https://doi.org/10.1016/0304-3975(96)00072-2

    Article  MathSciNet  MATH  Google Scholar 

  26. Schöpp, U., Xu, C.: Inferring region types via an abstract notion of environment transformation (2022). arXiv:2209.02147 [cs.PL]

  27. Schöpp, U., Xu, C.: Inferring Region Types via an Abstract Notion of Environment Transformation. Artifact (2022). https://doi.org/10.5281/zenodo.7009655

    Article  Google Scholar 

  28. Späth, J., Do, L.N.Q., Ali, K., Bodden, E.: Boomerang: Demand-Driven Flow- and Context-Sensitive Pointer Analysis for Java. In: Krishnamurthi, S., Lerner, B.S. (eds.) 30th European Conference on Object-Oriented Programming (ECOOP 2016). Leibniz International Proceedings in Informatics (LIPIcs), vol. 56, pp. 22:1–22:26. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany (2016). https://doi.org/10.4230/LIPIcs.ECOOP.2016.22

  29. Traytel, D., Berghofer, S., Nipkow, T.: Extending Hindley-Milner type inference with coercive structural subtyping. In: Yang, H. (ed.) APLAS 2011. LNCS, vol. 7078, pp. 89–104. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-25318-8_10

    Chapter  Google Scholar 

  30. Wand, M., O’Keefe, P.: On the complexity of type inference with coercion. In: Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture (FPCA 1989), pp. 293–298. Association for Computing Machinery, New York (1989). https://doi.org/10.1145/99370.99394

  31. Wang, T., Smith, S.F.: Precise constraint-based type inference for Java. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 99–117. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-45337-7_6

    Chapter  Google Scholar 

Download references

Acknowledgements

We thank Fredrick Nordvall Forsberg for the fruitful discussion on this work and the anonymous reviewers for their valuable comments and suggestions on the paper and its accompanying artifact.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Chuangjie Xu .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Schöpp, U., Xu, C. (2022). Inferring Region Types via an Abstract Notion of Environment Transformation. In: Sergey, I. (eds) Programming Languages and Systems. APLAS 2022. Lecture Notes in Computer Science, vol 13658. Springer, Cham. https://doi.org/10.1007/978-3-031-21037-2_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-21037-2_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-21036-5

  • Online ISBN: 978-3-031-21037-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics