Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3567512.3567523acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article
Open access

Specializing Scope Graph Resolution Queries

Published: 01 December 2022 Publication History

Abstract

To warrant programmer productivity, type checker results should be correct and available quickly. Correctness can be provided when a type checker implementation corresponds to a declarative type system specification. Statix is a type system specification language which achieves this by automatically deriving type checker implementations from declarative typing rules. A key feature of Statix is that it uses scope graphs for declarative specification of name resolution. However, compared to hand-written type checkers, type checkers derived from Statix specifications have sub-optimal run time performance.
In this paper, we identify and resolve a performance bottleneck in the Statix solver, namely part of the name resolution algorithm, using partial evaluation. To this end, we introduce a tailored procedural intermediate query resolution language, and provide a specializer that translates declarative queries to this language.
Evaluating this specializer by comparing type checking run time performance on three benchmarks (Apache Commons CSV, IO, and Lang3), shows that our specializer improves query resolution time up to 7.7x, which reduces the total type checking run time by 38 - 48%.

References

[1]
Edwin Brady and Kevin Hammond. 2010. Scrapping your inefficient engine: using partial evaluation to improve domain-specific language implementation. In Proceeding of the 15th ACM SIGPLAN international conference on Functional programming, ICFP 2010, Baltimore, Maryland, USA, September 27-29, 2010, Paul Hudak and Stephanie Weirich (Eds.). ACM, 297–308. isbn:978-1-60558-794-3 https://doi.org/10.1145/1863543.1863587
[2]
Janusz A. Brzozowski. 1964. Derivatives of Regular Expressions. J. ACM, 11, 4 (1964), 481–494.
[3]
Sebastian Erdweg, Oliver Bracevac, Edlira Kuci, Matthias Krebs, and Mira Mezini. 2015. A co-contextual formulation of type rules and its application to incremental type checking. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, Jonathan Aldrich and Patrick Eugster (Eds.). ACM, 880–897. isbn:978-1-4503-3689-5 https://doi.org/10.1145/2814270.2814277
[4]
Yoshihiko Futamura. 1982. Partial Computation of Programs. In RIMS Symposium on Software Science and Engineering, Kyoto, Japan, 1982, Proceedings, Eiichi Goto, Koichi Furukawa, Reiji Nakajima, Ikuo Nakata, and Akinori Yonezawa (Eds.) (Lecture Notes in Computer Science, Vol. 147). Springer, 1–35. isbn:3-540-11980-9 https://doi.org/10.1007/3-540-11980-9_13
[5]
Görel Hedin and Eva Magnusson. 2003. JastAdd–an aspect-oriented compiler construction system. Science of Computer Programming, 47, 1 (2003), 37–58. https://doi.org/10.1016/S0167-6423(02)00109-0
[6]
Christian Humer, Christian Wimmer, Christian Wirth, Andreas Wöß, and Thomas Würthinger. 2014. A domain-specific language for building self-optimizing AST interpreters. In Generative Programming: Concepts and Experiences, GPCE’14, Vasteras, Sweden, September 15-16, 2014, Ulrik Pagh Schultz and Matthew Flatt (Eds.). ACM, 123–132. isbn:978-1-4503-3161-6 https://doi.org/10.1145/2658761.2658776
[7]
Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. 1993. Partial Evaluation and Automatic Program Generation. Prentice Hall International, International Series in Computer Science. ISBN number 0-13-020249-5 (pbk)
[8]
Stephen Cole Kleene. 1952. Introduction to Metamathemathics. North Holland. isbn:978-0720421033
[9]
Phil Misteli. 2021. Renaming for Everyone: Language-parametric Renaming in Spoofax. Master’s thesis. Delft University of Technology. http://resolver.tudelft.nl/uuid:60f5710d-445d-4583-957c-79d6afa45be5
[10]
Philippe D. Misteli. 2020. Towards language-parametric refactorings. In Programming’20: 4th International Conference on the Art, Science, and Engineering of Programming, Porto, Portugal, March 23-26, 2020, Ademar Aguiar, Shigeru Chiba, and Elisa Gonzalez Boix (Eds.). ACM, 213–214. isbn:978-1-4503-7507-8 https://doi.org/10.1145/3397537.3398476
[11]
Pierre Néron, Andrew P. Tolmach, Eelco Visser, and Guido Wachsmuth. 2015. A Theory of Name Resolution. In Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings, Jan Vitek (Ed.) (Lecture Notes in Computer Science, Vol. 9032). Springer, 205–231. isbn:978-3-662-46668-1 https://doi.org/10.1007/978-3-662-46669-8_9
[12]
Oracle. 2021. Graal project. https://www.graalvm.org/
[13]
Scott Owens, John H. Reppy, and Aaron Turon. 2009. Regular-expression derivatives re-examined. Journal of Functional Programming, 19, 2 (2009), 173–190. https://doi.org/10.1017/S0956796808007090
[14]
André Pacak, Sebastian Erdweg, and Tamás Szabó. 2020. A systematic approach to deriving incremental type checkers. Proceedings of the ACM on Programming Languages, 4, OOPSLA (2020), https://doi.org/10.1145/3428195
[15]
Daniël A. A. Pelsmaeker, Hendrik van Antwerpen, Casper Bach Poulsen, and Eelco Visser. 2022. Language-parametric static semantic code completion. Proceedings of the ACM on Programming Languages, 6, OOPSLA (2022), 1–30. https://doi.org/10.1145/3527329
[16]
Casper Bach Poulsen, Pierre Néron, Andrew P. Tolmach, and Eelco Visser. 2016. Scopes Describe Frames: A Uniform Model for Memory Layout in Dynamic Semantics. In 30th European Conference on Object-Oriented Programming, ECOOP 2016, July 18-22, 2016, Rome, Italy, Shriram Krishnamurthi and Benjamin S. Lerner (Eds.) (LIPIcs, Vol. 56). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik. isbn:978-3-95977-014-9 https://doi.org/10.4230/LIPIcs.ECOOP.2016.20
[17]
Arjen Rouvoet, Hendrik van Antwerpen, Casper Bach Poulsen, Robbert Krebbers, and Eelco Visser. 2020. Knowing when to ask: sound scheduling of name resolution in type checkers derived from declarative specifications. Proceedings of the ACM on Programming Languages, 4, OOPSLA (2020), https://doi.org/10.1145/3428248
[18]
Bernhard Scholz, Herbert Jordan, Pavle Subotic, and Till Westmann. 2016. On fast large-scale program analysis in Datalog. In Proceedings of the 25th International Conference on Compiler Construction, CC 2016, Barcelona, Spain, March 12-18, 2016, Ayal Zaks and Manuel V. Hermenegildo (Eds.). ACM, 196–206. isbn:978-1-4503-4241-4 https://doi.org/10.1145/2892208.2892226
[19]
Michael Sipser. 2012. Introduction to the Theory of Computation (3rd ed.). Cengage Learning. isbn:978-1-133-18779-0
[20]
Yannis Smaragdakis and Martin Bravenboer. 2010. Using Datalog for Fast and Easy Program Analysis. In Datalog Reloaded - First International Workshop, Datalog 2010, Oxford, UK, March 16-19, 2010. Revised Selected Papers, Oege de Moor, Georg Gottlob, Tim Furche, and Andrew Jon Sellers (Eds.) (Lecture Notes in Computer Science, Vol. 6702). Springer, 245–251. isbn:978-3-642-24205-2 https://doi.org/10.1007/978-3-642-24206-9_14
[21]
Tamás Szabó, Gábor Bergmann, Sebastian Erdweg, and Markus Voelter. 2018. Incrementalizing lattice-based program analyses in Datalog. Proceedings of the ACM on Programming Languages, 2, OOPSLA (2018), https://doi.org/10.1145/3276509
[22]
Tamás Szabó, Edlira Kuci, Matthijs Bijman, Mira Mezini, and Sebastian Erdweg. 2018. Incremental overload resolution in object-oriented programming languages. In Companion Proceedings for the ISSTA/ECOOP 2018 Workshops, ISSTA 2018, Amsterdam, Netherlands, July 16-21, 2018, Julian Dolby, William G. J. Halfond, and Ashish Mishra (Eds.). ACM, 27–33. isbn:978-1-4503-5939-9 https://doi.org/10.1145/3236454.3236485
[23]
Scott Thibault, Charles Consel, Julia L. Lawall, Renaud Marlet, and Gilles Muller. 2000. Static and Dynamic Program Compilation by Interpreter Specialization. Higher-Order and Symbolic Computation, 13, 3 (2000), 161–178. https://doi.org/10.1023/A:1010078412711
[24]
Hendrik van Antwerpen, Pierre Néron, Andrew P. Tolmach, Eelco Visser, and Guido Wachsmuth. 2016. A constraint language for static semantic analysis based on scope graphs. In Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, Martin Erwig and Tiark Rompf (Eds.). ACM, 49–60. isbn:978-1-4503-4097-7 https://doi.org/10.1145/2847538.2847543
[25]
Hendrik van Antwerpen, Casper Bach Poulsen, Arjen Rouvoet, and Eelco Visser. 2018. Scopes as types. Proceedings of the ACM on Programming Languages, 2, OOPSLA (2018), https://doi.org/10.1145/3276484
[26]
Hendrik van Antwerpen and Eelco Visser. 2021. Scope States (Artifact). DARTS, 7, 2 (2021), https://doi.org/10.4230/DARTS.7.2.1
[27]
Hendrik van Antwerpen and Eelco Visser. 2021. Scope States: Guarding Safety of Name Resolution in Parallel Type Checkers. In 35th European Conference on Object-Oriented Programming, ECOOP 2021, July 11-17, 2021, Aarhus, Denmark (Virtual Conference), Anders Møller and Manu Sridharan (Eds.) (LIPIcs, Vol. 194). Schloss Dagstuhl - Leibniz-Zentrum für Informatik. isbn:978-3-95977-190-0 https://doi.org/10.4230/LIPIcs.ECOOP.2021.1
[28]
Loek Van der Gugten. 2022. Function Inlining as a Language Parametric Refactoring. Master’s thesis. Delft University of Technology. http://resolver.tudelft.nl/uuid:15057a42-f049-4321-b9ee-f62e7f1fda9f
[29]
Eric Van Wyk, Derek Bodin, Jimin Gao, and Lijesh Krishnan. 2010. Silver: An extensible attribute grammar system. Science of Computer Programming, 75, 1-2 (2010), 39–54. https://doi.org/10.1016/j.scico.2009.07.004
[30]
Vlad A. Vergu, Andrew P. Tolmach, and Eelco Visser. 2019. Scopes and Frames Improve Meta-Interpreter Specialization. In 33rd European Conference on Object-Oriented Programming, ECOOP 2019, July 15-19, 2019, London, United Kingdom, Alastair F. Donaldson (Ed.) (LIPIcs, Vol. 134). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik. isbn:978-3-95977-111-5 https://doi.org/10.4230/LIPIcs.ECOOP.2019.4
[31]
Aron Zwaan. 2022. Specializing Scope Graph Resolution Queries (Artifact). https://doi.org/10.5281/zenodo.7189413
[32]
Aron Zwaan. 2022. Specializing Scope Graph Resolution Queries: Extended Edition. https://doi.org/10.48550/arXiv.2210.06121

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SLE 2022: Proceedings of the 15th ACM SIGPLAN International Conference on Software Language Engineering
November 2022
278 pages
ISBN:9781450399197
DOI:10.1145/3567512
This work is licensed under a Creative Commons Attribution 4.0 International License.

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 December 2022

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. declarative languages
  2. graph query resolution
  3. partial evaluation
  4. scope graphs
  5. specialization

Qualifiers

  • Research-article

Conference

SLE '22
Sponsor:

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 204
    Total Downloads
  • Downloads (Last 12 months)100
  • Downloads (Last 6 weeks)15
Reflects downloads up to 03 Oct 2024

Other Metrics

Citations

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media