Higher-Order and Symbolic Computation

, Volume 19, Issue 1, pp 101–124

Dynamic state restoration using versioning exceptions

Article

Abstract

We explore the semantics and analysis of a new kind of control structure called a versioning exception that ensures the state of the program, at the point when an exception handler is invoked, reflects the program state at the point when the handler is installed. Versioning exceptions provide a transaction-like versioning semantics to the code protected by a handler: modifications performed within the dynamic context of the corresponding handler are versioned, and committed to the store only if the computation completes normally. Similar to the role of backtracking in logic programming, this facility allows unwanted effects of computations to be discarded when exceptional or undesirable conditions are detected.

We define a novel points-to analysis to efficiently track changes to the store within handler-protected scopes. The role of the analysis is to facilitate optimizations that minimize the number of locations which must be restored when a versioning exception is raised. The analysis is defined by a reachability approximation over locations that indicates which objects have been potentially modified within a handler scope. The analysis is defined for programs which support first-class procedures, locations, and exceptions.

Keywords

Exceptions Versioning Rollback Transactions Program analysis Points to analysis 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    1. Agbaria, A., Friedman, R.: Virtual-machine-based Heterogeneous Checkpointing. Software Practice and Experience 32(12), 1175–1192 (2002)MATHCrossRefGoogle Scholar
  2. 2.
    2. Andersen, L.O.: Program Analysis and Specialization for the C programming language. PhD thesis, DIKU, University of Copenhagen (1994)Google Scholar
  3. 3.
    3. Appel, A. Compiling with Continuations. Cambridge University Press (1992)Google Scholar
  4. 4.
    4. Atkinson, M., Chisholm, K., Cockshott, P.: PS-ALGOL: An Algol with a Persistent Heap. SIGPLAN Notices 17(7), 24–31 (1982)CrossRefGoogle Scholar
  5. 5.
    5. Atkinson, M.P., Daynes, L., Jordan, M.J.: Tony Printezis and Susan Spence, An Orthogonally Persistent Java. ACM SIGMOD record 25(4), 68–75 (1996)CrossRefGoogle Scholar
  6. 6.
    6. Chase, D., Wegman, M.N., Zadeck, F.K.: Analysis of Pointers and Structures. In: Proceedings of the Conference on Programming Language Design and Implementation 25(6), 296–310 (1990)Google Scholar
  7. 7.
    7. Consel, C.: Polyvariant Binding-time Analysis for Applicative Languages. In: Proceedings of the Symposium on Partial Evaluation and Semantics-based Program Manipulation, pp. 66–77 (1993)Google Scholar
  8. 8.
    8. Driscoll, J.R., Sleator, D.D., Tarjan, R.E.: Making Data Structures Persistent. Journal of Computer and System Sciences 38(1), 86–124 (1989)MATHMathSciNetCrossRefGoogle Scholar
  9. 9.
    9. Driscoll, J.R., Sleator, D.D., Tarjan, R.E.: Fully persistent lists with catenation. Journal of ACM 41(5), 943–959 (1994)CrossRefGoogle Scholar
  10. 10.
    10. Emami, M., Ghiya, R., Hendren, L.J.: Context-sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers. In: Proceedings of the Conference on Programming Language Design and Implementation 29(6), 242–256 (1994)Google Scholar
  11. 11.
    11. Felleisen, M., Friedman, D.P.: A Calculus for Assignments in Higher-order Languages. In: Proceedings of the Symposium on Principles of Programming Languages, pp. 314–325 (1987)Google Scholar
  12. 12.
    12. Flanagan, C., Sabry, A., Duba, B.F., Felleisen, M.: The Essence of Compiling with Continuations. In: Proceedings of the Conference on Programming Language Design and Implementation 28(6), 237–247 (1993)Google Scholar
  13. 13.
    13. Flatt, M., Krishnamurthi, S., Felleisen, M.: A Programmer’s Reduction Semantics for Classes and Mixins. In: Proceedings of the Symposium on on Formal Syntax and Semantics of Java. Vol. LNCS 1523, pp. 241–269, Springer (1999)Google Scholar
  14. 14.
    14. Foster, J.S., Fähndrich, M. Aiken, A.: Polymorphic versus Monomorphic Flow-Insensitive Points-to Analysis for C. In: International Symposium on Static Analysis, pp. 175–198 (2000)Google Scholar
  15. 15.
    15. Garey, M.R., Johnson, D.S.: Computers and intractability: A Guide to the Theory of NPCompleteness. Freeman (1979)Google Scholar
  16. 16.
    16. Gay, D., Aiken, A.: Language Support for Regions. In: Proceedings of the Conference on Programming Language Design and Implementation 36(5), 70–80 (2001)Google Scholar
  17. 17.
    17. Harris, T., Marlow, S., Jones, S.P., Herlihy, M.: Composable Memory Transactions. In: ACM Conference on Principles and Practice of Parallel Programming. To appear.Google Scholar
  18. 18.
    18. Harris, T., Fraser, K.: Language Support for Lightweight Transactions. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications pp. 338–402 (2003)Google Scholar
  19. 19.
    19. Heintze, N.: Set-based Analysis of ML programs. In: Proceedings of ACM Conference on LISP and Functional Programming, pp. 306–317 (1994)Google Scholar
  20. 20.
    20. Herlihy, M.: Apologizing Versus Asking Permission: Optimistic Concurrency Control for Abstract Data Types. ACM Transactions on Database Systems 15(1), 96–124 (1990)MathSciNetCrossRefGoogle Scholar
  21. 21.
    21. Horwitz, S.: Precise Flow-insensitive May-alias Analysis is NP-hard. ACM Transactions on Progamming Languages and Systems 19(1), 1–6 (1997)CrossRefGoogle Scholar
  22. 22.
    22. Jagannathan, S., Thiemann, P., Weeks, S., Wright, A.: Single and loving it: Must-alias analysis for higher-order languages. In: Proceedings of the Symposium on Principles of Programming Languages, pp. 329–341 (1998)Google Scholar
  23. 23.
    23. Jagannathan, S., Weeks, S.: A Unified Treatment of Flow Analysis in Higher-Order Languages. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 393–407 (1995)Google Scholar
  24. 24.
    24. Kelsey, R., Hudak, P.: Realistic Compilation by Program Transformation. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 281–293 (1989)Google Scholar
  25. 25.
    25. Jones, S.L.P., Reid, A., Henderson, F., Hoare, T., Marlow, S.: A Semantics for Imprecise Exceptions. In: Proceedings of the Conference on Programming Language Design and Implementation, pp. 25–36 (1999)Google Scholar
  26. 26.
    26. Kung, H.T., Robinson, J.T.: On Optimistic Methods for Concurrency Control. ACM Transactions on Database Systems 6(2), 213–226 (1981)CrossRefGoogle Scholar
  27. 27.
    27. Landi W., Ryder, B.G.: A Safe Approximate Algorithm for Interprocedural Pointer Aliasing. In: Proceedings of the Conference on Programming Language Design and Implementation 27(7), 235–248 (1992)Google Scholar
  28. 28.
    28. Liskov, B., Scheifler, R.: Guardians and actions: Linguistic Support for Robust Distributed Programs. ACM Transactions on Progamming Languages and Systems 5(3), 381–404 (1983)MATHCrossRefGoogle Scholar
  29. 29.
    29. Marlow, S., Jones, S.P., Moran A., Reppy, J.: Asynchronous exceptions in Haskell. In: Proceedings of the Conference on Programming Language Design and Implementation, pp. 274–285 (2001)Google Scholar
  30. 30.
    30. Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML. MIT Press (1997)Google Scholar
  31. 31.
    31. Palsberg, J.: Closure Analysis in Constraint Form. ACM Transactions on Progamming Languages and Systems 17(1), 47–62 (1995)CrossRefGoogle Scholar
  32. 32.
    32. Sagiv, M., Reps, T., Wilhelm, R.: Solving Shape-analysis Problems in Languages with Destructive Updating. Transactions on Progamming Languages and Systems 20(1), 1–50 (1998)CrossRefGoogle Scholar
  33. 33.
    33. Sagiv, M., Reps, T., Wilhelm, R.: Parametric Shape Analysis via 3-valued Logic. ACM Transactions on Progamming Languages and Systems 24(3) 217–298 (2002)CrossRefGoogle Scholar
  34. 34.
    34. Shapiro II, M., Horwitz, S.: Fast and Accurate Flow-insensitive Points-to Analysis. In: Proceedings of the 24th Symposium on Principles of Programming Languages, pp. 1–14 (1997)Google Scholar
  35. 35.
    35. Sinnar, A., Tarditi, D., Plesko, M., Steensgard, B.: Integrating Support for Undo with Exception Handling. Microsoft Research Technical Report MSR-TR-2004-140 (2004)Google Scholar
  36. 36.
    36. Steensgaard, B.: Points-to analysis in almost linear time. In: Proceedings of Symposium on Principles of Programming Languages, pp. 32–41 (1996)Google Scholar
  37. 37.
    37. Stonebraker, M., Hellerstein, J.: Readings in Database Systems, 3rd edn. Morgan-Kaufmann (1998)Google Scholar
  38. 38.
    38. Talpin, J.-P.: Theoretical and Practical Aspects of Type and Effect Inference. PhD thesis, University of Paris (1993)Google Scholar
  39. 39.
    39. Talpin, J.-P., Jouvelot, P.: Polymorphic Type, Region and Effect Inference. Journal of Functional Programming 2(3), 245–271 (1992)MATHMathSciNetCrossRefGoogle Scholar
  40. 40.
    40. Tofte, M., Birkedal, L.: A Region Inference Algorithm. ACM Transactions on Progamming Languages and Systems 20(4), 724–767 (1998)CrossRefGoogle Scholar
  41. 41.
    41. Tofte, M., Talpin, J.-P.: Region-Based Memory Management. Information and Computation 132(2): 109–176 (1997)MATHMathSciNetCrossRefGoogle Scholar
  42. 42.
    42. Chakaravarthy, V.T., Horwitz, S.: On The Non Approximability of Points-to Analysis. Acta Informatica 38(8), 587–598 (2001)MathSciNetCrossRefGoogle Scholar
  43. 43.
    43. Wilson, R.P., Lam, M.S.: Efficient Context-Sensitive Pointer Analysis for C programs. In: Proceedings of the Conference on Programming Language Design and Implementation Vol. 30, no. 6, pp. 1–12 (1995)Google Scholar
  44. 44.
    44. Smolka, G.: The Oz Programming Model. In: Current Trends in Computer Science. LNCS 1000 Springer (1995)Google Scholar
  45. 45.
    45. Hanus, M., Kuchen, H., Moreno-Navarro, J.J.: Curry: A Truly Functional Logic Language. In: Proc. ILPS, Workshop on Visions for the Future of Logic Programming (1995)Google Scholar
  46. 46.
    46. Shavit, N., Touitou, D.: Software Transactional Memory. In: ACM Symposium on Principles of Distributed Computing, pp. 204–213 (1995)Google Scholar
  47. 47.
    47. Welc, A., Jagannathan, S., Hosking, A.L.: Transactional Monitors for Concurrent Objects. European Conference on Object-Oriented Programming, pp. 519–542 (2004)Google Scholar
  48. 48.
    48. Vitek, J., Jagannathan, S., Welc, A., Hosking, A.L.: A Semantic Framework for Designer Transactions. European Symposium on Programming, pp. 249–263 (2004)Google Scholar
  49. 49.
    49. Flanagan,C., Qadeer, S.: A Type and Effect System for Atomicity. ACM SIGPLAN Confererence on Programming Language Design and Implementation, pp. 338–349 (2004)Google Scholar
  50. 50.
    50. Rajwar, R., Goodman, J.R.: Transactional Lock-free Execution of Lock-Based Programs. In: ACM Conference on Architectural Support for Programming Languages and Systems Vol. 37, no. 10, pp. 5–17 (2002)CrossRefGoogle Scholar
  51. 51.
    51. Weimer, W., Necula, G.C.: Finding and Preventing Run-Time Error Handling Mistakes. In: 19th Annual ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications,1 pp. 419–431 (2004)CrossRefGoogle Scholar

Copyright information

© Springer Science + Business Media, LLC 2006

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of CaliforniaLos Angeles
  2. 2.Department of Computer SciencePurdue UniversityWest Lafayette

Personalised recommendations