Lightweight Lexical Closures for Legitimate Execution Stack Access

  • Masahiro Yasugi
  • Tasuku Hiraishi
  • Taiichi Yuasa
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)


We propose a new language concept called “L-closures” for a running program to legitimately inspect/modify the contents of its execution stack. L-closures are lightweight lexical closures created by evaluating nested function definitions. A lexical closure can access the lexically-scoped variables in the creation-time environment and indirect calls to it provide legitimate stack access. By using an intermediate language extended with L-closures in high-level compilers, high-level services such as garbage collection, check-pointing, multithreading and load balancing can be implemented elegantly and efficiently. Each variable accessed by an L-closure uses private and shared locations for giving the private location a chance to get a register. Operations to keep coherency with shared locations as well as operations to initialize L-closures are delayed until an L-closure is actually invoked. Because most high-level services create L-closures very frequently but call them infrequently (e.g., to scan roots in garbage collection), the total overhead can be reduced significantly. Since the GNU C compiler provides nested functions, we enhanced GCC at relatively low implementation costs. The results of performance measurements exhibit quite low costs of creating and maintaining L-closures.


Load Balance Garbage Collection Static Chain Pointer Pair Private Location 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Boehm, H.J., Weiser, M.: Garbage collection in an uncooperative environment. Software Practice & Experience 18(9), 807–820 (1988)CrossRefGoogle Scholar
  2. 2.
    Hanson, D.R., Raghavachari, M.: A machine-independent debugger. Software – Practice & Experience 26(11), 1277–1299 (1996)CrossRefGoogle Scholar
  3. 3.
    Henderson, F.: Accurate garbage collection in an uncooperative environment. In: Proc. of the 3rd International Symposium on Memory Management, pp. 150–156 (2002)Google Scholar
  4. 4.
    Jones, S.P., Ramsey, N., Reig, F.: C–: a portable assembly language that supports garbage collection. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  5. 5.
    Ramsey, N., Jones, S.P.: A single intermediate language that supports multiple implementations of exceptions. In: Proc. of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, pp. 285–298 (2000)Google Scholar
  6. 6.
    Stallman, R.M.: Using the GNU Compiler Collection. Free Software Foundation, Inc. for gcc-3.2 edn. (2002)Google Scholar
  7. 7.
    Breuel, T.M.: Lexical closures for C++. In: Usenix Proceedings, C++ Conference (1988)Google Scholar
  8. 8.
    Yasugi, M., Komiya, T., Yuasa, T.: An efficient load-balancing framework based on lazy partitioning of sequential programs. In: Proceedings of Workshop on New Approaches to Software Construction, pp. 65–84 (2004)Google Scholar
  9. 9.
    Taura, K., Yonezawa, A.: Fine-grain multithreading with minimal compiler support – a cost effective approach to implementing efficient multithreading languages. In: Proc. of Conference on Programming Language Design and Implementation, pp. 320–333 (1997)Google Scholar
  10. 10.
    Strumpen, V.: Compiler technology for portable checkpoints (1998),
  11. 11.
    Plevyak, J., Karamcheti, V., Zhang, X., Chien, A.A.: A hybrid execution model for fine-grained languages on distributed memory multicomputers. In: Supercomputing (1995)Google Scholar
  12. 12.
    Umatani, S., Yasugi, M., Komiya, T., Yuasa, T.: Pursuing laziness for efficient implementation of modern multithreaded languages. In: Veidenbaum, A., Joe, K., Amano, H., Aiso, H. (eds.) ISHPC 2003. LNCS, vol. 2858, pp. 174–188. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  13. 13.
    Frigo, M., Leiserson, C.E., Randall, K.H.: The implementation of the Cilk-5 multithreaded language. ACM SIGPLAN Notices (PLDI 1998) 33(5), 212–223 (1998)CrossRefGoogle Scholar
  14. 14.
    Taura, K., Tabata, K., Yonezawa, A.: StackThreads/MP: Integrating futures into calling standards. In: Proceedings of ACM SIGPLAN Symposium on Principles & Practice of Parallel Programming (PPoPP), pp. 60–71 (1999)Google Scholar
  15. 15.
    Goldstein, S.C., Schauser, K.E., Culler, D.E.: Lazy Threads: Implementing a fast parallel call. Journal of Parallel and Distributed Computing 3(1), 5–20 (1996)CrossRefGoogle Scholar
  16. 16.
    Mohr, E., Kranz, D.A., Halstead Jr., R.H.: Lazy task creation: A technique for increasing the granularity of parallel programs. IEEE Transactions on Parallel and Distributed Systems 2(3), 264–280 (1991)CrossRefGoogle Scholar
  17. 17.
    Feeley, M.: A message passing implementation of lazy task creation. In: Halstead Jr., R.H., Ito, T. (eds.) US/Japan WS 1992. LNCS, vol. 748, pp. 94–107. Springer, Heidelberg (1993)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Masahiro Yasugi
    • 1
  • Tasuku Hiraishi
    • 1
  • Taiichi Yuasa
    • 1
  1. 1.Graduate School of InformaticsKyoto UniversityJapan

Personalised recommendations