Chapter

Compiler Construction

Volume 4420 of the series Lecture Notes in Computer Science pp 218-232

A Declarative Framework for Analysis and Optimization

  • Henry FalconerAffiliated withDepartment of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ
  • , Paul H. J. KellyAffiliated withDepartment of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ
  • , David M. IngramAffiliated withDepartment of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ
  • , Michael R. MellorAffiliated withDepartment of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ
  • , Tony FieldAffiliated withDepartment of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ
  • , Olav BeckmannAffiliated withDepartment of Computing, Imperial College London, 180 Queen’s Gate, London SW7 2BZ

Abstract

DeepWeaver-1 is a tool supporting cross-cutting program analysis and transformation components, called “weaves”. Like an aspect, a DeepWeaver weave consists of a query part, and a part which may modify code. DeepWeaver’s query language is based on Prolog, and provides access to data-flow and control-flow reachability analyses. DeepWeaver provides a declarative way to access the internal structure of methods, and supports cross-cutting weaves which operate on code blocks from different parts of the codebase simultaneously. DeepWeaver operates at the level of bytecode, but offers predicates to extract structured control flow constructs. This paper motivates the design, and demonstrates some of its power, using a sequence of examples including performance profiling and domain-specific performance optimisations for database access and remote method invocation.