Abstract
A staged computation is a computation organized in a cascade of stages: each stage produces code for its successive stage; the final stage produces the desired output. An off-line procedure called binding time analysis (BTA) is often used to pre-convert unstaged code into staged code, i.e., code annotated with stage labels, which can guide online staged computation. For dynamic re-optimization purposes, it is advantageous for the order of stages in the cascade to change during runtime; however, the staged code may not support all permutations of stage sequences. Thus, it is both a and practical question to efficiently decide whether a specific stage sequence is valid for a staged code.
Our approach is to encode the set of valid stage sequences for a staged code off-line in a stage ordering language (SOL) to facilitate fast online decision. Contrary to the intuition that we only need a single generic SOL (such as the language of posets of stage labels) to sufficiently and efficiently encode the set of valid stage sequences for any staged code in any staged language, we may need different SOLs for different staged languages. We analyze several staged languages and then present a metatheory on validating a SOL for a given staged language. Our result reveals the relationship between SOLs and semantic properties of staged languages, and can influence the design of staged languages and BTA.
This material is based upon work supported by the National Science Foundation under Grant Nos. 0086116, 0085773, and 9817773.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Consel, C., Noël, F.: A general approach for run-time specialization and its application to C. In: Proc. of the 23th ACM Symposium on Principles of Programming Languages, pp. 145–156 (1996)
Glück, R., Jørgensen, J.: Efficient multi-level generating extensions for program specialization. In: Swierstra, S.D. (ed.) PLILP 1995. LNCS, vol. 982, pp. 259–278. Springer, Heidelberg (1995)
Grant, B., Mock, M., Philipose, M., Chambers, C., Eggers, S.: DyC: An expressive annotation-directed dynamic compiler for C. Theoretical Computer Science 248(1- 2), 147–199 (2000)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall International, Englewood Cliffs (1993)
Lee, P., Leone, M.: Optimizing ML with run-time code generation. In: Proc. of Programming Language Design and Implementation Conf., pp. 137–148 (1996)
Nielson, F., Nielson, H.R.: Two-Level Functional Languages. Cambridge University Press, Cambridge (1992)
Nielson, F., Nielson, H.R.: Multi-level lambda-calculi: an algebraic description. LNCS, pp. 338–354. Springer, Heidelberg (1996)
Nielson, F., Nielson, H.R.: A prescriptive framework for designing multi-level lambda-calculi. In: Proc. of the 1997 ACM Symposium on Partial Evaluation and Semantics-based Program Manipulation, pp. 193–202 (June 1997)
Taha, W.: Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology (November 1999)
Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Proc. of the 1997 ACM Symposium on Partial Evaluation and Semantics-based Program Manipulation, pp. 203–217 (June 1997)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2003 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Wang, Z., Muntz, R.R. (2003). On Stage Ordering in Staged Computation. In: Pfenning, F., Smaragdakis, Y. (eds) Generative Programming and Component Engineering. GPCE 2003. Lecture Notes in Computer Science, vol 2830. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-39815-8_5
Download citation
DOI: https://doi.org/10.1007/978-3-540-39815-8_5
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-20102-1
Online ISBN: 978-3-540-39815-8
eBook Packages: Springer Book Archive