Solving shape-analysis problems in languages with destructive updating

  • Authors:
  • Mooly Sagiv;Thomas Reps;Reinhard Wilhelm

  • Affiliations:
  • Tel-Aviv Univ., Tel-Aviv, Israel;Univ. of Wisconsin, Madison;Univ. des Saarlandes, Saarbrücken, Germany

  • Venue:
  • ACM Transactions on Programming Languages and Systems (TOPLAS)
  • Year:
  • 1998

Quantified Score

Hi-index 0.00

Visualization

Abstract

This article concerns the static analysis of programs that performdestructive updating on heap-allocated storage. We give an algorithmthat uses finite shape graphs to approximate conservatively thepossible “shapes” that heap-allocated structures in a program can take on. For certain programs, our technique is able to determinesuch properties as (1) when the input to the program is a list, the output is also a list and (2) when the input to the program is a tree, the output is also a tree. For example, the method can determine that “listness” is preserved by (1) a program that performs list reversalvia destructive updating of the input list and (2) a program that searches a list and splices a new element into the list. None of the previously known methods that use graphs to model theprogram's store are capable of determining that “listness” ispreserved on these examples (or examples of similar complexity).In contrast with most previous work, our shape analysis algorithm iseven accurate for certain programs that update cyclic data structures;that is, it is sometimes able to show that when the input to theprogram is a circular list, the output is also a circular list. Forexample, the shape-analysis algorithm can determine that an insertioninto a circular list preserves “circular listness.”