Type specialisation is an approach to program specialisation that works with both a program and its type to produce specialised versions of each. As it combines many powerful features,it appears to be a good framework for automatic program production, -- despite the fact that it was designed originally to express optimal specialisation for interpreters written in typed languages.The original specification of type specialisation used a system of rules expressing it as a generalised type system, rather than the usual view of specialisation as generalised evaluation. That system, while powerful, has some weaknesses not widely recognized -- the most important being the inability to express principal type specialisations (a principal specialisation is one that is "more general" than any other for a given specialisable term, and from which those can be obtained by a suitable notion of instantiation). This inability is a problem when extending type specialisation to deal with polymorphism or modules.This work presents a different formulation of the system specifying type specialisation capturing the notion of principal specialisation for a language with static constructions and polyvariance. It is a step forward in the study of type specialisation for polymorphic languages and lazy languages, and also permits modularity of specialisation, and better implementations.
{"title":"Principal type specialisation","authors":"P. E. M. López, John Hughes","doi":"10.1145/568173.568184","DOIUrl":"https://doi.org/10.1145/568173.568184","url":null,"abstract":"Type specialisation is an approach to program specialisation that works with both a program and its type to produce specialised versions of each. As it combines many powerful features,it appears to be a good framework for automatic program production, -- despite the fact that it was designed originally to express optimal specialisation for interpreters written in typed languages.The original specification of type specialisation used a system of rules expressing it as a generalised type system, rather than the usual view of specialisation as generalised evaluation. That system, while powerful, has some weaknesses not widely recognized -- the most important being the inability to express principal type specialisations (a principal specialisation is one that is \"more general\" than any other for a given specialisable term, and from which those can be obtained by a suitable notion of instantiation). This inability is a problem when extending type specialisation to deal with polymorphism or modules.This work presents a different formulation of the system specifying type specialisation capturing the notion of principal specialisation for a language with static constructions and polyvariance. It is a step forward in the study of type specialisation for polymorphic languages and lazy languages, and also permits modularity of specialisation, and better implementations.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"73 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"128890645","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Automatic program transformation, such as specialization, often introduces intermediate recursions that compute partial functions on parameters that are directly defined by simple recursive definitions. Replacing these recursive definitions by one-step definitions not only simplifies the residual program, but also allows more useful information to be propagated to remaining parts of the program, for continuing specialization.We give an easily recognized characterization of a class of recursive definitions, called syntactical monomials, that can be transformed to one-step definitions. We show our transformation is meaningful for specialization of interpreters and self-application of specializers.
{"title":"A note on elimination of simplest recursions","authors":"A. Nemytykh","doi":"10.1145/568173.568188","DOIUrl":"https://doi.org/10.1145/568173.568188","url":null,"abstract":"Automatic program transformation, such as specialization, often introduces intermediate recursions that compute partial functions on parameters that are directly defined by simple recursive definitions. Replacing these recursive definitions by one-step definitions not only simplifies the residual program, but also allows more useful information to be propagated to remaining parts of the program, for continuing specialization.We give an easily recognized characterization of a class of recursive definitions, called syntactical monomials, that can be transformed to one-step definitions. We show our transformation is meaningful for specialization of interpreters and self-application of specializers.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131310854","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Reynald Affeldt, H. Masuhara, Eijiro Sumii, A. Yonezawa
This paper describes a run-time specialization system for the Java language. One of the main difficulties of supporting the full Java language resides in a sound yet effective management of references to objects. This is because the specialization process may share references with the running application that executes the residual code, and because side-effects through those references by the specialization process could easily break the semantics of the running application. To cope with these difficulties, we elaborate requirements that ensure sound run-time specialization. Based on them, we design and implement a run-time specialization system for the Java language, which exhibits, for instance, approximately 20-25% speed-up factor for a ray-tracing application.
{"title":"Supporting objects in run-time bytecode specialization","authors":"Reynald Affeldt, H. Masuhara, Eijiro Sumii, A. Yonezawa","doi":"10.1145/568173.568179","DOIUrl":"https://doi.org/10.1145/568173.568179","url":null,"abstract":"This paper describes a run-time specialization system for the Java language. One of the main difficulties of supporting the full Java language resides in a sound yet effective management of references to objects. This is because the specialization process may share references with the running application that executes the residual code, and because side-effects through those references by the specialization process could easily break the semantics of the running application. To cope with these difficulties, we elaborate requirements that ensure sound run-time specialization. Based on them, we design and implement a run-time specialization system for the Java language, which exhibits, for instance, approximately 20-25% speed-up factor for a ray-tracing application.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"52 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"132834578","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
In component-based software development, gluing of two software components are usually achieved by defining an interface specification, and creating wrappers on the components to support the interface. We believe that interface specification provides useful information for specializing components. However, an interface may define constraints on a component's inputs, as well as on its outputs. In this paper, we propose a novel concept of program specialization with respect to output constraints. We define how an ideal specialized program should behave after such specialization, and consider a variant of partial evaluation to achieve it. In the process, we translate an output constraint into a characterization function for a component's input, and define a specializer that uses this characterization to guide the specialization process. We believe this work will broaden the scope of program specialization, and provide a framework for building more generic and versatile program adaptation techniques.
{"title":"Output-constraint specialization","authors":"Siau-Cheng Khoo, Kun Shi","doi":"10.1145/568173.568185","DOIUrl":"https://doi.org/10.1145/568173.568185","url":null,"abstract":"In component-based software development, gluing of two software components are usually achieved by defining an interface specification, and creating wrappers on the components to support the interface. We believe that interface specification provides useful information for specializing components. However, an interface may define constraints on a component's inputs, as well as on its outputs. In this paper, we propose a novel concept of program specialization with respect to output constraints. We define how an ideal specialized program should behave after such specialization, and consider a variant of partial evaluation to achieve it. In the process, we translate an output constraint into a characterization function for a component's input, and define a specializer that uses this characterization to guide the specialization process. We believe this work will broaden the scope of program specialization, and provide a framework for building more generic and versatile program adaptation techniques.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"11 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"131641434","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
The wide practice of object-oriented programming in current software construction is evident. Despite extensive studies on typing programming objects, it is still undeniably a challenging research task to design a type system for object-oriented programming that is both effective in capturing program errors and unobtrusive to program construction. In this paper, we present a novel approach to typing objects that makes use of a recently invented notion of guarded dependent datatypes. We show that our approach can address various difficult issues (e.g., handling "self" type, typing binary methods, etc.) in a simple and natural type-theoretical manner, remedying the deficiencies in many existing approaches to typing objects.
{"title":"Unifying object-oriented programming with typed functional programming","authors":"H. Xi","doi":"10.1145/568173.568186","DOIUrl":"https://doi.org/10.1145/568173.568186","url":null,"abstract":"The wide practice of object-oriented programming in current software construction is evident. Despite extensive studies on typing programming objects, it is still undeniably a challenging research task to design a type system for object-oriented programming that is both effective in capturing program errors and unobtrusive to program construction. In this paper, we present a novel approach to typing objects that makes use of a recently invented notion of guarded dependent datatypes. We show that our approach can address various difficult issues (e.g., handling \"self\" type, typing binary methods, etc.) in a simple and natural type-theoretical manner, remedying the deficiencies in many existing approaches to typing objects.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"68 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125520575","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
We introduce a new way of performing binding time analysis. Rather than analyzing the program using constraint solving or abstract interpretation, we use a method based on search. The search is guided by type information which significantly prunes the size of the search space, making the algorithm practical. Our claim is not that we compute new, or better information, but that we compute it in a new and novel way, which clarifies the process involved.The method is based upon a novel use of higher-order multi-stage types as a rich and expressive medium for the expression of binding-time specifications. Such types could be used as the starting point in any BTA. A goal of our work is to demonstrate that a single unified system which seamlessly integrates both manual staging and automatic BTA-based staging is possible.
{"title":"Search-based binding time analysis using type-directed pruning","authors":"T. Sheard, Nathan Mishra-Linger","doi":"10.1145/568173.568176","DOIUrl":"https://doi.org/10.1145/568173.568176","url":null,"abstract":"We introduce a new way of performing binding time analysis. Rather than analyzing the program using constraint solving or abstract interpretation, we use a method based on search. The search is guided by type information which significantly prunes the size of the search space, making the algorithm practical. Our claim is not that we compute new, or better information, but that we compute it in a new and novel way, which clarifies the process involved.The method is based upon a novel use of higher-order multi-stage types as a rich and expressive medium for the expression of binding-time specifications. Such types could be used as the starting point in any BTA. A goal of our work is to demonstrate that a single unified system which seamlessly integrates both manual staging and automatic BTA-based staging is possible.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125475203","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
This paper shows that Generalized Partial Computation (GPC) can automatically generate efficient string matching algorithms. GPC is a program transformation method utilizing partial information about input data and auxiliary functions as well as the logical structure of a source program. GPC uses both a classical partial evaluator and an inference engine such as a theorem prover to optimize programs. First, we show that a Boyer-Moore (BM) type pattern matcher without the bad-character heuristic can be generated from a simple non-linear backward matcher by GPC. This sort of problems has already been discussed in the literature using offline partial evaluators. However, there was no proof that every generated matcher runs in the same way as the BM. In this paper we prove that the problem can be solved starting from a simple non-linear pattern matcher as a source program. We also prove that a Knuth-Morris-Pratt (KMP) type linear string matcher can be generated from a naive non-linear forward matcher by GPC.
{"title":"Automatic generation of efficient string matching algorithms by generalized partial computation","authors":"Y. Futamura, Z. Konishi, R. Glück","doi":"10.1145/568173.568174","DOIUrl":"https://doi.org/10.1145/568173.568174","url":null,"abstract":"This paper shows that Generalized Partial Computation (GPC) can automatically generate efficient string matching algorithms. GPC is a program transformation method utilizing partial information about input data and auxiliary functions as well as the logical structure of a source program. GPC uses both a classical partial evaluator and an inference engine such as a theorem prover to optimize programs. First, we show that a Boyer-Moore (BM) type pattern matcher without the bad-character heuristic can be generated from a simple non-linear backward matcher by GPC. This sort of problems has already been discussed in the literature using offline partial evaluators. However, there was no proof that every generated matcher runs in the same way as the BM. In this paper we prove that the problem can be solved starting from a simple non-linear pattern matcher as a source program. We also prove that a Knuth-Morris-Pratt (KMP) type linear string matcher can be generated from a naive non-linear forward matcher by GPC.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"10 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"115506447","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
With the increasing miniaturization of transistors, wire delays are becoming a dominant factor in microprocessor performance. To address this issue, a number of emerging architectures contain replicated processing units with software-exposed communication between one unit and another (e.g., Raw, SmartMemories, TRIPS). However, for them to be effective, it is necessary to use languages that circumvent the von Neumann bottleneck, inherent in current programming languages such as C, C++ and Java.In the first part of the talk, I will introduce StreamIt, a streaming language that is ideally suited for wire-exposed architectures. StreamIt provides novel high-level representations to improve programmer productivity and program robustness within the streaming domain. At the same time, StreamIt exposes the inherent communication pattern of the program, allowing the compiler to aggressively optimize and effectively utilize wire-exposed architectures. .In the second part of the talk, I will describe our compiler from StreamIt to the Raw processor. Though StreamIt exposes the parallelism and communication patterns of stream programs, much analysis is needed to adapt a stream program to a wire-exposed processor. These include fission and fusion transformations that is used to adjust the granularity of a stream graph, a layout algorithm for mapping a stream graph to a given network topology, and a scheduling algorithm for generating a fine-grained static communication pattern for each computational element.
{"title":"Defying the speed of light:: a spatially-aware compiler for wire-exposed architectures","authors":"Saman P. Amarasinghe","doi":"10.1145/568173.568181","DOIUrl":"https://doi.org/10.1145/568173.568181","url":null,"abstract":"With the increasing miniaturization of transistors, wire delays are becoming a dominant factor in microprocessor performance. To address this issue, a number of emerging architectures contain replicated processing units with software-exposed communication between one unit and another (e.g., Raw, SmartMemories, TRIPS). However, for them to be effective, it is necessary to use languages that circumvent the von Neumann bottleneck, inherent in current programming languages such as C, C++ and Java.In the first part of the talk, I will introduce StreamIt, a streaming language that is ideally suited for wire-exposed architectures. StreamIt provides novel high-level representations to improve programmer productivity and program robustness within the streaming domain. At the same time, StreamIt exposes the inherent communication pattern of the program, allowing the compiler to aggressively optimize and effectively utilize wire-exposed architectures. .In the second part of the talk, I will describe our compiler from StreamIt to the Raw processor. Though StreamIt exposes the parallelism and communication patterns of stream programs, much analysis is needed to adapt a stream program to a wire-exposed processor. These include fission and fusion transformations that is used to adjust the granularity of a stream graph, a layout algorithm for mapping a stream graph to a given network topology, and a scheduling algorithm for generating a fine-grained static communication pattern for each computational element.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"83 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"122937772","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Most of the past languages for reactive systems are based on synchronous dataflow. Recently, a new reactive language, called Real-Time Functional Reactive Programming (RT-FRP) [18] , has been proposed based on the functional paradigm. The unique feature of this language is the high-level abstraction provided in the form of behaviors for conti-nuous-time signals, and events for discrete-time signals. RT-FRP also features some performance guarantees in the form of bounded runtime and space usage for each reactive computation step.In this paper, we propose a new compilation scheme for RT-FRP. Our compilation scheme is based on two key stages. In the first stage, we translate RT-FRP program to an intermediate functional code. This code is deliberately kept at high level for two reasons. First, it is easier for us to validate its correctness. Second, it allows us to apply high-level source-to-source transformation to achieve further optimization. The second stage attempts to compile the intermediate code to a corresponding automata code. Our main novelty is the use of two high-level transformation techniques for this compilation. The first technique, partial evaluation, attempts to propagate constant values (wherever feasible) in order to perform more aggressive specialization. The second technique, tupling, combines mutually dependent automata together into a composite automaton whenever possible. Both techniques are needed for generating fast target code for RT-FRP.
{"title":"Compiling real time functional reactive programming","authors":"Dana N. Xu, Siau-Cheng Khoo","doi":"10.1145/568173.568183","DOIUrl":"https://doi.org/10.1145/568173.568183","url":null,"abstract":"Most of the past languages for reactive systems are based on synchronous dataflow. Recently, a new reactive language, called Real-Time Functional Reactive Programming (RT-FRP) [18] , has been proposed based on the functional paradigm. The unique feature of this language is the high-level abstraction provided in the form of behaviors for conti-nuous-time signals, and events for discrete-time signals. RT-FRP also features some performance guarantees in the form of bounded runtime and space usage for each reactive computation step.In this paper, we propose a new compilation scheme for RT-FRP. Our compilation scheme is based on two key stages. In the first stage, we translate RT-FRP program to an intermediate functional code. This code is deliberately kept at high level for two reasons. First, it is easier for us to validate its correctness. Second, it allows us to apply high-level source-to-source transformation to achieve further optimization. The second stage attempts to compile the intermediate code to a corresponding automata code. Our main novelty is the use of two high-level transformation techniques for this compilation. The first technique, partial evaluation, attempts to propagate constant values (wherever feasible) in order to perform more aggressive specialization. The second technique, tupling, combines mutually dependent automata together into a composite automaton whenever possible. Both techniques are needed for generating fast target code for RT-FRP.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"9 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"117062631","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
Given a program and values of static (fixed) inputs, program specialization generates an optimized version of the program that only requires dynamic (run-time) inputs. It has been an useful tool for such areas as operating systems, multimedia applications, and scientific applications. However, the size of specialized code may grow up exponentially which makes program specialization impractical for many applications. In this paper, we present a mechanism to address this problem by using indexed data structures. Unlike traditional program specialization, which encodes the result of specialization only into run-time code, our method encodes the values of multi-valued static expressions into indexed data structures and single-valued static expressions into run-time code. Because the sizes of the indexed data structures are much smaller than that of program code, we can overcome the size problem of program specialization. With a preliminary implementation for Java, we achieved improvement in performance up to a factor of 3 with very low memory and space requirements and overheads.
{"title":"Using indexed data structures for program specialization","authors":"J. Park, Myong-Soon Park","doi":"10.1145/568173.568180","DOIUrl":"https://doi.org/10.1145/568173.568180","url":null,"abstract":"Given a program and values of static (fixed) inputs, program specialization generates an optimized version of the program that only requires dynamic (run-time) inputs. It has been an useful tool for such areas as operating systems, multimedia applications, and scientific applications. However, the size of specialized code may grow up exponentially which makes program specialization impractical for many applications. In this paper, we present a mechanism to address this problem by using indexed data structures. Unlike traditional program specialization, which encodes the result of specialization only into run-time code, our method encodes the values of multi-valued static expressions into indexed data structures and single-valued static expressions into run-time code. Because the sizes of the indexed data structures are much smaller than that of program code, we can overcome the size problem of program specialization. With a preliminary implementation for Java, we achieved improvement in performance up to a factor of 3 with very low memory and space requirements and overheads.","PeriodicalId":187828,"journal":{"name":"ASIA-PEPM '02","volume":"5 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2002-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"116173597","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}