Replacing function parameters by global variables

Replacing function parameters by global variables
复制标题

用全局变量替换函数参数

DOI:
10.1145/99370.99374
复制
发表时间:
1989
影响因子:
2.5
通讯作者:
P. Sestoft
P. Sestoft
中科院分区:
生物学3区
文献类型:
--
作者:
P. Sestoft

文献摘要

被引文献

相似文献

我们研究函数参数何时可以安全地被全局变量替换。这种替代被称为全球化。全球化的目标是尽可能减少函数参数的堆栈(或堆)分配的时间和空间成本。我们提出了一个自动干扰分析,决定是否一个给定的函数参数可以安全地全球化。分析是基于形式化的操作语义,以方便正确性证明。这项工作的主要贡献是介绍定义使用路径,路径语义,干扰和定义使用语法的概念。定义使用路径是计算期间变量定义和使用的线性记录。语言的路径语义规定了计算的路径,是操作语义的扩展。路径中的干扰意味着变量的值在最后一次使用之前被修改(通过重新定义)。非干扰变量是可全局化的。定义使用语法是从程序和路径语义构造的,并导出程序的所有可能路径的超集。干扰分析是D。一个是通过语法分析,它安全地近似于程序中的“精确”干扰。最后,对全球化转型的影响因素进行了分析。这些技术适用于具有严格(即按值调用)语义的一阶和高阶语言以及具有非复合数据值的变量。我们将我们的技术与文献中报道的相关工作中所使用的技术进行比较。允许免费复制本材料的全部或部分,前提是复制品不是为了直接的商业利益而制作或分发的,ACM版权声明和出版物的标题及其日期出现,并声明复制是经过计算机协会许可的。复制或重新发布,需要付费和/或特定许可。
We investigate when function parameters can be safely replaced by global variables. This replacement is called globalization. The objective of globalization is to reduce the time and space cost of stack (or heap) allocation of function parameters when possible. We present an automatic interference analysis that decides whether a given function parameter may safely be globalized. The analysis is based on formal operational semantics to facilitate correctness proofs. The main contribution of this work is to introduce the concepts of definition-use path, path semantics, interference, and definition-use grammar. A definition-use path is a linear recording of the definitions and uses of variables during a computation. The path semantics of a language prescribes the path for a computation and is an extension of the operational semantics. Interference in a path means that the value of a variable becomes modified (by a redefinition) before its last use. A non-interfering variable is globalizable. A definition-use grammar is constructed from a program and the path semantics, and derives a superset of all possible paths for the program. The interference analysis is d. one by an analysis of the grammar, and it safely approximates the “exact” interference in the program. Finally, the globalization transformation uses the results of the interference analysis. The techniques apply to both first order and higher order languages with strict (ie, call by value) semantics and variables with non-composite data values. We compare our technique to those used in related work reported in the litertitnre.Permission to copy without fee a11 or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission.