SuperStack: Superoptimization of Stack-Bytecode via Greedy, Constraint-Based, and SAT Techniques

Elvira Albert, Maria Garcia De La Banda, Alejandro Hernández-Cerezo, Alexey Ignatiev, Albert Rubio, Peter J. Stuckey

Research output: Chapter in Book/Report/Conference proceedingConference PaperResearchpeer-review

Abstract

Given a loop-free sequence of instructions, superoptimization techniques use a constraint solver to search for an equivalent sequence that is optimal for a desired objective. The complexity of the search grows exponentially with the length of the solution being constructed, and the problem becomes intractable for large sequences of instructions. This paper presents a new approach to superoptimizing stack-bytecode via three novel components: (1) a greedy algorithm to refine the bound on the length of the optimal solution; (2) a new representation of the optimization problem as a set of weighted soft clauses in MaxSAT; (3) a series of domain-specific dominance and redundant constraints to reduce the search space for optimal solutions. We have developed a tool, named SuperStack, which can be used to find optimal code translations of modern stack-based bytecode, namely WebAssembly or Ethereum bytecode. Experimental evaluation on more than 500,000 sequences shows the proposed greedy, constraint-based and SAT combination is able to greatly increase optimization gains achieved by existing superoptimizers and reduce to at least a fourth the optimization time.

Original languageEnglish
Title of host publicationProceedings of the ACM on Programming Languages
Subtitle of host publicationProgramming Languages Design and Implementation (PLDI 2024)
EditorsJohn Regehr
Place of PublicationNew York NY USA
PublisherAssociation for Computing Machinery (ACM)
Pages1437 - 1462
Number of pages26
Volume8
DOIs
Publication statusPublished - 2024
EventACM-SIGPLAN Conference on Programming Language Design and Implementation 2024 - Copenhagen, Denmark
Duration: 24 Jun 202428 Jun 2024
Conference number: 45th
https://pldi24.sigplan.org/ (Website)
https://dl.acm.org/toc/pacmpl/2024/8/PLDI (Proceedings)

Conference

ConferenceACM-SIGPLAN Conference on Programming Language Design and Implementation 2024
Abbreviated titlePLDI 2024
Country/TerritoryDenmark
CityCopenhagen
Period24/06/2428/06/24
Internet address

Keywords

  • EVM
  • Program Synthesis
  • SAT
  • Superoptimization
  • WebAssembly

Cite this