skip to main content
10.1145/3123569.3123572acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Structuring Erlang BEAM control flow

Published: 08 September 2017 Publication History

Abstract

As source code dependencies are usually stored in some precompiled executable representation like bytecode, static analysis frameworks for high-level languages have to be specifically adapted so they can meaningfully analyse these libraries too. This adaptation is not trivial, since compilation is in general not injective, the semantics of low-level instruction sets are often not specified adequately, and the structure of the high-level sources and the low-level target is considerably different. This is also true for the functional Erlang programming language and its assembly-like BEAM bytecode. In this paper, we present a structuring algorithm capable of recovering the Erlang syntax tree of functional branching expressions compiled to BEAM. The implementation of the presented algorithm is part of the RefactorErl static analyser framework. Therefore, the tool is able to represent the semantics of the BEAM programs with an Erlang syntax tree and perform further semantic analysis on it to discover the source dependencies.

References

[1]
A. V. Aho, R. Sethi, and J. D. Ullman. 1986. Compilers principles, techniques, and tools . Addison-Wesley, Reading, MA.
[2]
Andrew W. Appel. 1998. SSA is Functional Programming. ACM SIGPLAN NOTICES 33, 4 (1998), 17–20.
[3]
I. Bozó, D. Horpácsi, Z. Horváth, R. Kitlei, J. Köszegi, Tejfel. M., and M Tóth. 2011. RefactorErl - Source Code Analysis and Refactoring in Erlang. In Proc. of the 12th Symposium on Programming Languages and Software Tools . Tallin, Estonia, 138–148.
[4]
Manuel M.T. Chakravarty, Gabriele Keller, and Patryk Zadarnowski. 2004. A Functional Perspective on SSA Optimisation Algorithms. Electronic Notes in Theoretical Computer Science 82, 2 (2004), 347 – 361.
[5]
Cristina Cifuentes. 1994. Reverse Compilation Techniques. Ph.D. Dissertation. Queensland University of Technology. School of Computing Science.
[6]
Cristina Cifuentes. 1996. Structuring decompiled graphs. Springer Berlin Heidelberg, Berlin, Heidelberg, 91–105.
[7]
R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. 1989. An Efficient Method of Computing Static Single Assignment Form. In Proc. of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages . 25–35.
[8]
Edsger W. Dijkstra. 1968. Letters to the Editor: Go To Statement Considered Harmful. Commun. ACM 11, 3 (1968), 147–148.
[9]
H. Ehrig, M. Pfender, and H. J. Schneider. 1973. Graph-grammars: An Algebraic Approach. In Proc. of the 14th Annual Symposium on Switching and Automata Theory . IEEE Computer Society, 167–180.
[10]
Ericsson AB. 2017. Is there a "reverse compiler" for BEAM files? (The Erlang FAQ). http://erlang.org/faq/tools.html#idp32709584. (2017).
[11]
Ericsson AB. 2017. OTP 18.0 - Erlang Programming Language. https://www.erlang.org/downloads/18.0. (2017).
[12]
Ilfak Guilfanov. 2008. Decompilers and beyond. Presentation at Black Hat USA. (2008).
[13]
Plataformatec José Valim. 2017. Elixir Programming Language. h ttp://elixirlang.org/. (2017).
[14]
E. Gerhards-Padilla K. Yakdan, S. Eschweiler and M. Smith. 2015. No More Gotos: Decompilation Using Pattern-Independent Control-Flow Structuring and Semantics-Preserving Transformations. The 2015 Network and Distributed System Security Symposium, At San Diego, CA, USA. (2015).
[15]
M. Karácsonyi. 2010. BEAM fájlok elemzése. TDK Thesis, Faculty of Informatics, Eötvös Loránd University, Budapest, Hungary. (2010). (In Hungarian).
[16]
D Lukács. 2017. Recovering high-level control structures from Erlang source dependencies in BEAM bytecode. TDK Thesis, Faculty of Informatics, Eötvös Loránd University, Budapest, Hungary. (2017).
[17]
Eric Merrit. 2017. Joxa: A Full Featured Lisp on the Erlang VM. h ttps://vimeo.com/49116180, h ttp://joxa.org/. (2017).
[18]
Godfrey Nolan. 2004. Decompiling Java. Apress.
[19]
Simon Peyton Jones. 1987. The Implementation of Functional Programming Languages . Prentice Hall. https://www.microsoft.com/en-us/research/publication/ the-implementation-of-functional-programming-languages/
[20]
Rinus Plasmeijer and Marko Van Eekelen. 1993. Functional Programming and Parallel Graph Rewriting (1st ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.
[21]
M. Tóth and I. Bozó. 2012. Static Analysis of Complex Software Systems Implemented in Erlang. Central European Functional Programming Summer School, Revisited Selected Lectures, Lecture Notes in Computer Science (LNCS), Vol. 7241, pp. 451-514, Springer-Verlag, ISSN: 0302-9743. (2012).
[22]
Robert Virding. 2017. Lisp Flavored Erlang, LFE. h ttp://lfe.io/. (2017).

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
Erlang 2017: Proceedings of the 16th ACM SIGPLAN International Workshop on Erlang
September 2017
65 pages
ISBN:9781450351799
DOI:10.1145/3123569
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 08 September 2017

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. BEAM
  2. decompilation
  3. static analysis

Qualifiers

  • Research-article

Conference

ICFP '17
Sponsor:

Acceptance Rates

Overall Acceptance Rate 51 of 68 submissions, 75%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 85
    Total Downloads
  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 08 Mar 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media