Abstract
Constructing SSA form for static languages such as C/C++ and Java is a well-understood task. Dynamic scripting languages, such as PHP, Python, and JavaScript, present a much greater challenge.
The information required to build SSA form is not available directly from the program source and cannot be derived from a simple analysis. Instead, we find a litany of features whose presence makes analysis difficult such as runtime generation of source code and variable-variables.
Ruling out the presence of these features requires precise, inter-procedural, whole-program analysis. We discuss the futility of the pessimistic solution, the analyses required to provide a precise SSA form, and how the presence of variables of unknown types affects the precision of SSA.
We identify the features of PHP that make building SSA difficult, outline the solutions we found to some of these challenges, and draw some lessons about the use of SSA in analysis frameworks for PHP.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The analysis is actually based on a variation, conditional constant propagation.
- 2.
Or more precisely, a may-definition means that there exists at least one possible execution of the program where the variable is defined at that point. Our algorithm computes a conservative approximation of may-definition information. Therefore, our algorithm reports a may-definition in any case where the algorithm cannot prove that no such definition can exist on any possible execution.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this chapter
Cite this chapter
Biggar, P., Gregg, D. (2022). Building SSA in a Compiler for PHP. In: Rastello, F., Bouchez Tichadou, F. (eds) SSA-based Compiler Design. Springer, Cham. https://doi.org/10.1007/978-3-030-80515-9_24
Download citation
DOI: https://doi.org/10.1007/978-3-030-80515-9_24
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-80514-2
Online ISBN: 978-3-030-80515-9
eBook Packages: Computer ScienceComputer Science (R0)