Skip to main content

Building SSA in a Compiler for PHP

  • Chapter
  • First Online:
SSA-based Compiler Design
  • 842 Accesses

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.

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 69.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 89.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 119.99
Price excludes VAT (USA)
  • Durable hardcover 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

Notes

  1. 1.

    The analysis is actually based on a variation, conditional constant propagation.

  2. 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

Authors

Corresponding author

Correspondence to Paul Biggar .

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 chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics