Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to main content

Principles of Staged Static+Dynamic Partial Analysis

  • Conference paper
  • First Online:
Static Analysis (SAS 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13790))

Included in the following conference series:

Abstract

In spite of decades of static-analysis research behind developing precise whole-program analyses, languages that use just-in-time (JIT) compilers suffer from the imprecision of resource-bound analyses local to the scope of compilation. Recent promising approaches bridge this gap by splitting program analysis into two phases: a static phase that identifies interprocedural dependencies across program elements, and a dynamic phase that resolves those dependencies to generate final analysis results. Though this approach is capable of generating precise analysis results without incurring analysis cost in JIT compilers, such “staged analyses” lack a theoretical backing. In particular, it is unclear if one could transform a general whole-program analysis (that resolves dependencies across all program elements) to a staged one that involves evaluation of statically generated partial results later. Similarly, it would be interesting if one could generate such “partial-result evaluators” in a way that can also be used to argue about their correctness. In this paper, we propose a novel model of static+dynamic partial analysis that addresses all these points, based on the classic theory of partial evaluation.

We begin by shedding light on the enigmatic idea of partial evaluation as well as the associated notion of Futamura projections to generate specialized program interpreters. We then describe partial analysis as the process of evaluating dependencies across program elements with respect to the statically available parts of a program, resulting into partial results. Next, we devise a strategy (by deriving a novel notion of AM projections from Futamura projections) to statically generate specialized evaluators that can process partial results using dynamic dependencies, at run-time. Later, we use our proposed model to straightforwardly establish the correctness and precision properties of the idea of staging, independent of the program analysis under consideration. We demonstrate the applicability of our model by showcasing examples from non-trivial Java program analyses, implementing the pipeline for one of them, and also discussing future possibilities to extend the same. We believe that our contributions in formulating this theory of partial analysis will significantly extend the usage of existing partial analyzers, as well as promote the design of new ones, for and even beyond Java.

This research was partially supported by the project IITM/SERB/MTH/311 funded by the Science and Engineering Research Board (SERB), Government of India.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

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

Similar content being viewed by others

Notes

  1. 1.

    Note that at the machine level, there is an interpreter that actually executes the program along with its input; we are simply avoiding verbosity here.

  2. 2.

    We obtain a result later (Corollary 2) which implies that this is the only possible partial result for a given set \(S_x\) of statically available dependencies.

References

  1. Albarghouthi, A., Dillig, I., Gurfinkel, A.: Maximal specification synthesis. In: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. POPL 2016, pp. 789–801. Association for Computing Machinery, New York (2016). https://doi.org/10.1145/2837614.2837628

  2. Ali, K.: The Separate Compilation Assumption. Ph.D. thesis, University of Waterloo, Waterloo, Ontario, Canada (2014)

    Google Scholar 

  3. Ali, K., Lhoták, O.: Averroes: Whole-program analysis without the whole program. In: Castagna, G. (ed.) ECOOP 2013. LNCS, vol. 7920, pp. 378–400. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39038-8_16

    Chapter  Google Scholar 

  4. Allen, N., Krishnan, P., Scholz, B.: Combining type-analysis with points-to analysis for analyzing Java library source-Code. In: Proceedings of the 4th ACM SIGPLAN International Workshop on State Of the Art in Program Analysis. SOAP 2015, pp. 13–18. Association for Computing Machinery, New York (2015). https://doi.org/10.1145/2771284.2771287

  5. Ancona, D., Ancona, M., Cuni, A., Matsakis, N.D.: RPython: a step towards reconciling dynamically and statically typed OO languages. In: Proceedings of the 2007 Symposium on Dynamic Languages. DLS 2007, pp. 53–64. Association for Computing Machinery, New York (2007). https://doi.org/10.1145/1297081.1297091

  6. Bastani, O., Sharma, R., Clapp, L., Anand, S., Aiken, A.: Eventually sound points-to analysis with specifications. In: Donaldson, A.F. (ed.) 33rd European Conference on Object-Oriented Programming (ECOOP 2019). Leibniz International Proceedings in Informatics (LIPIcs), vol. 134, pp. 11:1–11:28. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany (2019). https://doi.org/10.4230/LIPIcs.ECOOP.2019.11

  7. Blanchet, B.: Escape analysis for JavaTM: theory and practice. ACM Trans. Program. Lang. Syst. 25(6), 713–775 (2003). https://doi.org/10.1145/945885.945886

    Article  Google Scholar 

  8. Chugh, R., Meister, J.A., Jhala, R., Lerner, S.: Staged information flow for Javascript. In: Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation. PLDI 2009, pp. 50–62. Association for Computing Machinery, New York (2009). https://doi.org/10.1145/1542476.1542483

  9. Dagenais, B., Hendren, L.: Enabling static analysis for partial Java programs. SIGPLAN Not. 43(10), 313–328 (2008). https://doi.org/10.1145/1449955.1449790

    Article  Google Scholar 

  10. Daly, C., Horgan, J., Power, J., Waldron, J.: Platform independent dynamic Java virtual machine analysis: the Java grande forum benchmark suite. In: Proceedings of the 2001 Joint ACM-ISCOPE Conference on Java Grande. JGI 2001, pp. 106–115. ACM, New York (2001). https://doi.org/10.1145/376656.376826

  11. Dean, J., Chambers, C., Grove, D.: Selective specialization for object-oriented languages. In: Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation. PLDI 1995, pp. 93–102. Association for Computing Machinery, New York (1995). https://doi.org/10.1145/207110.207119

  12. Futamura, Y.: Partial evaluation of computation process - an approach to a compiler-compiler. Higher Order Symbol. Comput. 12(4), 381–391 (1999). https://doi.org/10.1023/A:1010095604496

    Article  MATH  Google Scholar 

  13. Heintze, N., Tardieu, O.: Demand-driven pointer analysis. In: Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation. PLDI 2001, pp. 24–34. Association for Computing Machinery, New York (2001). https://doi.org/10.1145/378795.378802

  14. Jones, N.D.: An introduction to partial evaluation. ACM Comput. Surv. 28(3), 480–503 (1996). https://doi.org/10.1145/243439.243447

    Article  Google Scholar 

  15. Kotzmann, T., Mössenböck, H.: Escape analysis in the context of dynamic compilation and deoptimization. In: Proceedings of the ACM/USENIX International Conference on Virtual Execution Environments. VEE 2005, pp. 111–120. ACM, New York (2005). https://doi.org/10.1145/1064979.1064996

  16. Latifi, F.: Practical second futamura projection: partial evaluation for high-performance language interpreters. In: Proceedings Companion of the 2019 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity. SPLASH Companion 2019, pp. 29–31. Association for Computing Machinery, New York (2019). https://doi.org/10.1145/3359061.3361077

  17. Marr, S., Ducasse, S.: Tracing vs. partial evaluation: comparing meta-compilation approaches for self-optimizing interpreters. In: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications. OOPSLA 2015, pp. 821–839. Association for Computing Machinery, New York (2015). https://doi.org/10.1145/2814270.2814275

  18. Melo, L.T.C., Ribeiro, R.G., de Araújo, M.R., Pereira, F.M.Q.A.: Inference of static semantics for incomplete C programs. Proc. ACM Program. Lang. 2(POPL) (2017). https://doi.org/10.1145/3158117

  19. Mishne, A., Shoham, S., Yahav, E.: Typestate-based semantic code search over partial programs. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications. OOPSLA 2012, pp. 997–1016. Association for Computing Machinery, New York (2012). https://doi.org/10.1145/2384616.2384689

  20. Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, Burlington (1997)

    Google Scholar 

  21. Paleczny, M., Vick, C., Click, C.: The Java hotspot server compiler. In: Proceedings of the 2001 Symposium on JavaTM Virtual Machine Research and Technology Symposium. JVM 2001, vol. 1, p. 1. USENIX Association, USA (2001)

    Google Scholar 

  22. Perelman, D., Gulwani, S., Ball, T., Grossman, D.: Type-directed completion of partial expressions. In: Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation. PLDI 2012, pp. 275–286. Association for Computing Machinery, New York (2012). https://doi.org/10.1145/2254064.2254098

  23. Perugini, S., Williams, B.: Revisiting the Futamura projections: a diagrammatic approach. Theor. Appl. Inform. 28, 15–32 (2017). https://doi.org/10.20904/284015

  24. Rama, G.M., Komondoor, R., Sharma, H.: Refinement in object-sensitivity points-to analysis via slicing. Proc. ACM Program. Lang. 2(OOPSLA), 142:1–142:27 (2018). https://doi.org/10.1145/3276512

  25. Sharma, R., Kulshreshtha, S., Thakur, M.: Can we run in parallel? Automating loop parallelization for TornadoVM (2022). https://doi.org/10.48550/arXiv.2205.03590

  26. Succi, G., Wong, R.: The application of JAVACC to develop a C/C++ preprocessor. ACM SIGAPP Appl. Comput. Rev. 7, 11–18 (1999). https://doi.org/10.1145/333630.333633

  27. Nikhil, T.R., Yadav, D., Thakur, M.: Stava (2021). https://github.com/CompL-IITMandi/stava

  28. Thakur, M., Nandivada, V.K.: PYE: a framework for precise-yet-efficient just-in-time analyses for Java programs. ACM Trans. Program. Lang. Syst. 41(3), 16:1–16:37 (2019). https://doi.org/10.1145/3337794

  29. Vallée-Rai, R., Co, P., Gagnon, E., Hendren, L., Lam, P., Sundaresan, V.: Soot - a Java bytecode optimization framework. In: Proceedings of the 1999 Conference of the Centre for Advanced Studies on Collaborative Research. CASCON 1999, pp. 13–23. IBM Press (1999). http://dl.acm.org/citation.cfm?id=781995.782008

  30. Vivien, F., Rinard, M.: Incrementalized pointer and escape analysis. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. PLDI 2001, pp. 35–46. ACM, New York (2001). https://doi.org/10.1145/378795.378804

  31. Würthinger, T., et al.: Practical partial evaluation for high-performance dynamic language runtimes. In: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation. PLDI 2017, pp. 662–676. Association for Computing Machinery, New York (2017). https://doi.org/10.1145/3062341.3062381

  32. Zhong, H., Wang, X.: Boosting complete-code tool for partial program. In: Proceedings of the 32nd IEEE/ACM International Conference on Automated Software Engineering. ASE 2017, pp. 671–681. IEEE Press (2017)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Manas Thakur .

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

Anand, A., Thakur, M. (2022). Principles of Staged Static+Dynamic Partial Analysis. In: Singh, G., Urban, C. (eds) Static Analysis. SAS 2022. Lecture Notes in Computer Science, vol 13790. Springer, Cham. https://doi.org/10.1007/978-3-031-22308-2_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-22308-2_4

  • Published:

  • Publisher Name: Springer, Cham

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

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

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics