没有合适的资源?快使用搜索试试~ 我知道了~
Program Analysis and Specialization for the c program language.p...
需积分: 0 17 下载量 135 浏览量
2008-06-04
00:22:14
上传
评论
收藏 1.15MB PDF 举报
温馨提示
试读
311页
Program Analysis and Specialization<br>for<br>the C Programming Language
资源推荐
资源详情
资源评论
Program Analysis and Specialization
for
the C Programming Language
Ph.D. Thesis
Lars Ole Andersen
DIKU, University of Copenhagen
Universitetsparken 1
DK-2100 Copenhagen Ø
Denmark
email: lars@diku.dk
May 1994
Abstract
Software engineers are faced with a dilemma. They want to write general and well-
structured programs that are flexible and easy to maintain. On the other hand, generality
has a price: efficiency. A specialized program solving a particular problem is often signif-
icantly faster than a general program. However, the development of specialized software
is time-consuming, and is likely to exceed the production of today’s programmers. New
techniques are required to solve this so-called software crisis.
Partial evaluation is a program specialization technique that reconciles the benefits
of generality with efficiency. This thesis presents an automatic partial evaluator for the
Ansi C programming language.
The content of this thesis is analysis and transformation of C programs. We develop
several analyses that support the transformation of a program into its generating ex-
tension. A generating extension is a program that produces specialized programs when
executed on parts of the input.
The thesis contains the following main results.
• We develop a generating-extension transformation, and describ e specialization of
the various parts of C, including pointers and structures.
• We develop constraint-based inter-procedural pointer and binding-time analysis.
Both analyses are specified via non-standard type inference systems, and imple-
mented by constraint solving.
• We develop a side-effect and an in-use analysis. These analyses are developed in
the classical monotone data-flow analysis framework. Some intriguing similarities
with constraint-based analysis are observed.
• We investigate separate and incremental program analysis and transformation. Re-
alistic programs are structured into modules, which break down inter-procedural
analyses that need global information about functions.
• We prove that partial evaluation at most can accomplish linear speedup, and develop
an automatic speedup analysis.
• We study the stronger transformation technique driving, and initiate the develop-
ment of generating super-extensions.
The developments in this thesis are supported by an implementation. Throughout the
chapters we present empirical results.
i
Preface
This thesis is submitted in fulfillment of the requirements for a Ph.D. degree in Com-
puter Science at DIKU, the department of Computer Science, University of Copen-
hagen. It reports work done between February 1992 and May 1994. Supervisor was
Prof. Neil D. Jones, DIKU, and external examiner was Dr. Peter Lee, Carnegie Mellon
University.
The thesis consists of eleven chapters where the first serves as an introduction, and the
last holds the conclusion. Several of the chapters are based on published papers, but they
have either been extensively revised or completely rewritten. The individual chapters are
almost self-contained, but Chapter 2 introduces notations used extensively in the rest of
the thesis.
An overview of the thesis can be found as Section 1.5.
Acknowledgements
I am grateful to my advisor Neil D. Jones for everything he has done for me and my
academic career. Without Neil I would probably not have written this thesis, and he has
always provided me with inspirations, comments, and insight — sometimes even without
being aware of it. Further, Neil has founded the TOPPS programming language group at
DIKU, and continues to enable contacts to many great people around the world. Without
the TOPPS group, DIKU would not be a place to be.
I would like to thank Peter Lee for his interest in the work, and for useful feedback,
many comments and discussions during his stay at DIKU.
Special thanks are due to Peter Holst Andersen. He has made several of the experimen-
tal results reproduced in this thesis, and spent many hours on correcting (embarrassing)
bugs in my code.
Olivier Danvy deserves thanks for his enthusiasm and the very useful feedback I re-
ceived while wrote the chapter to the Partial Evaluation book. His comments certainly
improved the book chapter, and have also influenced the presentation in this thesis, —-
and my view of computer science.
I would like to thank Robert Gl¨uck for his continued interest in this work, and for
many useful discussions about partial evaluation and optimization. Furthermore, I would
like to thank Carsten Gomard; the paper on speedup analysis was written together with
him.
Warm thanks go to the members of the TOPPS programming language group and its
ii
visitors for always providing a stimulating, enjoyable and also serious research environ-
ment. Its many active members are always ready to provide comments, share ideas and
interests, and have created several contacts to researcher at other universities. The many
“chokoladeboller”-mornings have clearly demonstrated that the TOPPS group is much
more than just a collection of individual persons.
From the undergraduate and graduate days I would especially like to thank Jens
Markussen. It was always fun to make written project, and later has many beers reminded
me that there also is a world outside TOPPS and DIKU.
Lars K. Lassen and Berit Søemosegaard have, luckily!, dragged me away from boring
work an uncountable number of times. It is always nice when they come by and suggest
a cup of coffee, a beer, a game of billiard . . .
Finally, I would like to thank my parents and the rest of my family for everything they
have done for me.
This research was supported by grant 16-5031 (“forskningsstipendium”) from the Dan-
ish Research Council STVF, and by the SNF research project DART, the EC ESPRIT
BRA “Semantique” and DIKU.
iii
Contents
Preface ii
Acknowledgements ii
1 Introduction 1
1.1 Software engineering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 From specification to deliverable . . . . . . . . . . . . . . . . . . . . 1
1.1.2 The problem of excess generality versus efficiency . . . . . . . . . . 2
1.1.3 Executable specifications . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.4 Generality in programs . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.5 Computation in stages . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.6 Specialization applied to software development . . . . . . . . . . . . 6
1.2 Program specialization and partial evaluation . . . . . . . . . . . . . . . . 7
1.2.1 Programs, semantics and representations . . . . . . . . . . . . . . . 7
1.2.2 The Futamura projections . . . . . . . . . . . . . . . . . . . . . . . 7
1.2.3 Generating extensions . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3 Program analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.1 Approximation and safety . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.2 Type-based analysis specifications . . . . . . . . . . . . . . . . . . . 10
1.3.3 Program analysis techniques . . . . . . . . . . . . . . . . . . . . . . 11
1.4 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.4.1 Overview of C-Mix . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.2 Main results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.3 How this work differs from other work . . . . . . . . . . . . . . . . 14
1.4.4 Why C? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 Overview of thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2 The C Programming Language 17
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.1 Design motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.2 Conforming and strictly-conforming programs . . . . . . . . . . . . 19
2.1.3 User feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.1.4 Program representation . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.1.5 Notation and terminology . . . . . . . . . . . . . . . . . . . . . . . 21
2.1.6 Overview of the chapter . . . . . . . . . . . . . . . . . . . . . . . . 21
iv
剩余310页未读,继续阅读
资源评论
liuxizhiyi
- 粉丝: 3
- 资源: 13
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功