skip to main content
research-article

Efficient context sensitivity for dynamic analyses via calling context uptrees and customized memory management

Published:29 October 2013Publication History
Skip Abstract Section

Abstract

State-of-the-art dynamic bug detectors such as data race and memory leak detectors report program locations that are likely causes of bugs. However, programmers need more than static program locations to understand the behavior of increasingly complex and concurrent software. Dynamic calling context provides additional information, but it is expensive to record calling context frequently, e.g., at every read and write. Context-sensitive dynamic analyses can build and maintain a calling context tree (CCT) to track calling context--but in order to reuse existing nodes, CCT-based approaches require an expensive lookup.

This paper introduces a new approach for context sensitivity that avoids this expensive lookup. The approach uses a new data structure called the calling context uptree (CCU) that adds low overhead by avoiding the lookup and instead allocating a new node for each context. A key contribution is that the approach can mitigate the costs of allocating many nodes by extending tracing garbage collection (GC): GC collects unused CCU nodes naturally and efficiently, and we extend GC to merge duplicate nodes lazily.

We implement our CCU-based approach in a high-performance Java virtual machine and integrate it with a staleness-based memory leak detector and happens-before data race detector, so they can report context-sensitive program locations that cause bugs. We show that the CCU-based approach, in concert with an extended GC, provides a compelling alternative to CCT-based approaches for adding context sensitivity to dynamic analyses.

References

  1. H. Agrawal and J. R. Horgan. Dynamic Program Slicing. In ACM Conference on Programming Language Design and Implementation, pages 246--256, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B. Alpern, S. Augart, S. M. Blackburn, M. Butrico, A. Cocchi, P. Cheng, J. Dolby, S. Fink, D. Grove, M. Hind, K. S. McKinley, M. Mergen, J. E. B. Moss, T. Ngo, and V. Sarkar. The Jikes Research Virtual Machine Project: Building an Open-Source Research Community. IBM Systems Journal, 44:399--417, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. G. Ammons, T. Ball, and J. R. Larus. Exploiting Hardware Performance Counters with Flow and Context Sensitive Profiling. In ACM Conference on Programming Language Design and Implementation, pages 85--96, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. W. Appel and M. J. R. Goncalves. Hash-Consing Garbage Collection. Technical Report TR-412-93, Princeton University, 1993.Google ScholarGoogle Scholar
  5. M. Arnold, S. J. Fink, D. Grove, M. Hind, and P. F. Sweeney. Adaptive Optimization in the Jalapeño JVM. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 47--65, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. G. Ausiello, C. Demetrescu, I. Finocchi, and D. Firmani. k-Calling Context Profiling. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 867--878, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. T. Ball and J. R. Larus. Efficient Path Profiling. In IEEE/ACM International Symposium on Microarchitecture, pages 46--57, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. S. M. Blackburn, P. Cheng, and K. S. McKinley. Myths and Realities: The Performance Impact of Garbage Collection. In ACM SIGMETRICS Joint International Conference on Measurement and Modeling of Computer Systems, pages 25--36, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo Benchmarks: Java Benchmarking Development and Analysis. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 169--190, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. M. Blackburn and A. L. Hosking. Barriers: Friend or Foe? In ACM International Symposium on Memory Management, pages 143--151, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. M. Blackburn and K. S. McKinley. Ulterior Reference Counting: Fast Garbage Collection Without a Long Wait. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 344--358, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. M. Blackburn and K. S. McKinley. Immix: A Mark-Region Garbage Collector with Space Efficiency, Fast Collection, and Mutator Performance. In ACM Conference on Programming Language Design and Implementation, pages 22--32, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. D. Bond, G. Z. Baker, and S. Z. Guyer. Breadcrumbs: Efficient Context Sensitivity for Dynamic Bug Detection Analyses. In ACM Conference on Programming Language Design and Implementation, pages 13--24, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. M. D. Bond, K. E. Coons, and K. S. McKinley. Pacer: Proportional Detection of Data Races. In ACM Conference on Programming Language Design and Implementation, pages 255--268, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. D. Bond and K. S. McKinley. Bell: Bit-Encoding Online Memory Leak Detection. In ACM International Conference on Architectural Support for Programming Languages and Operating Systems, pages 61--72, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. D. Bond and K. S. McKinley. Probabilistic Calling Context. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 97--112, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. D. Bond and K. S. McKinley. Leak Pruning. In ACM International Conference on Architectural Support for Programming Languages and Operating Systems, pages 277--288, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. T. M. Chilimbi and M. Hauswirth. Low-Overhead Memory Leak Detection Using Adaptive Statistical Profiling. In ACM International Conference on Architectural Support for Programming Languages and Operating Systems, pages 156--164, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. J.-D. Choi, K. Lee, A. Loginov, R. O'Callahan, V. Sarkar, and M. Sridharan. Efficient and Precise Datarace Detection for Multithreaded Object-Oriented Programs. In ACM Conference on Programming Language Design and Implementation, pages 258--269, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. C. D'Elia, C. Demetrescu, and I. Finocchi. Mining Hot Calling Contexts in Small Space. In ACM Conference on Programming Language Design and Implementation, pages 516--527, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. T. Elmas, S. Qadeer, and S. Tasiran. Goldilocks: A Race and Transaction-Aware Java Runtime. In ACM Conference on Programming Language Design and Implementation, pages 245--255, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. C. Flanagan and S. N. Freund. FastTrack: Efficient and Precise Dynamic Race Detection. In ACM Conference on Programming Language Design and Implementation, pages 121--133, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. C. Flanagan, S. N. Freund, and J. Yi. Velodrome: A Sound and Complete Dynamic Atomicity Checker for Multithreaded Programs. In ACM Conference on Programming Language Design and Implementation, pages 293--303, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. N. Froyd, J. Mellor-Crummey, and R. Fowler. Low-Overhead Call Path Profiling of Unmodified, Optimized Code. In ACM International Conference on Supercomputing, pages 81--90, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. R. Garner, S. M. Blackburn, and D. Frampton. Effective Prefetch for Mark-Sweep Garbage Collection. In ACM International Symposium on Memory Management, pages 43--54, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. B. Goetz. Plugging memory leaks with weak references, 2005. http://www-128.ibm.com/developerworks/java/library/j-jtp11225/.Google ScholarGoogle Scholar
  27. K. Hazelwood and D. Grove. Adaptive Online Context-Sensitive Inlining. In IEEE/ACM International Symposium on Code Generation and Optimization, pages 253--264, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. H. Inoue and T. Nakatani. How a Java VM can get more from a Hardware Performance Monitor. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 137--154, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. D. F. Jerding, J. T. Stasko, and T. Ball. Visualizing Interactions in Program Executions. In ACM International Conference on Software Engineering, pages 360--370, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. R. Jones and R. Lins. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. John Wiley & Sons, Inc., New York, NY, USA, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. M. Jump and K. S. McKinley. Cork: Dynamic Memory Leak Detection for Garbage-Collected Languages. In ACM Symposium on Principles of Programming Languages, pages 31--38, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. S. Lu, J. Tucek, F. Qin, and Y. Zhou. AVIO: Detecting Atomicity Violations via Access-Interleaving Invariants. In ACM International Conference on Architectural Support for Programming Languages and Operating Systems, pages 37--48, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. D. Marino, M. Musuvathi, and S. Narayanasamy. LiteRace: Effective Sampling for Lightweight Data-Race Detection. In ACM Conference on Programming Language Design and Implementation, pages 134--143, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. A. Milanova, A. Rountev, and B. G. Ryder. Parameterized Object Sensitivity for Points-to and Side-Effect Analyses for Java. In ACM International Symposium on Software Testing and Analysis, pages 1--11, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. T. Mytkowicz, D. Coughlin, and A. Diwan. Inferred Call Path Profiling. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 175--190, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. N. Nethercote and J. Seward. How to Shadow Every Byte of Memory Used by a Program. In ACM/USENIX International Conference on Virtual Execution Environments, pages 65--74, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. N. Nethercote and J. Seward. Valgrind: A Framework for Heavyweight Dynamic Binary Instrumentation. In ACM Conference on Programming Language Design and Implementation, pages 89--100, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. G. Novark, E. D. Berger, and B. G. Zorn. Efficiently and Precisely Locating Memory Leaks and Bloat. In ACM Conference on Programming Language Design and Implementation, pages 397--407, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. E. Pozniansky and A. Schuster. MultiRace: Efficient On-the-Fly Data Race Detection in Multithreaded C++ Programs. Concurrency and Computation: Practice & Experience, 19(3):327--340, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. F. Qian and L. Hendren. Towards Dynamic Interprocedural Analysis in JVMs. In USENIX Symposium on Virtual Machine Research and Technology, pages 139--150, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. F. Qin, S. Lu, and Y. Zhou. SafeMem: Exploiting ECC-Memory for Detecting Memory Leaks and Memory Corruption During Production Runs. In International Symposium on High-Performance Computer Architecture, pages 291--302, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. A. Sarimbekov, A. Sewe, W. Binder, P. Moret, M. Schoeberl, and M. Mezini. Portable and Accurate Collection of Calling-Context-Sensitive Bytecode Metrics for the Java Virtual Machine. In ACM International Conference on Principles and Practice of Programming in Java, pages 11--20, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson. Eraser: A Dynamic Data Race Detector for Multi-Threaded Programs. In ACM Symposium on Operating Systems Principles, pages 27--37, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. J. Seward and N. Nethercote. Using Valgrind to Detect Undefined Value Errors with Bit-Precision. In USENIX Annual Technical Conference, pages 17--30, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Y. Smaragdakis, M. Bravenboer, and O. Lhoták. Pick Your Contexts Well: Understanding Object-Sensitivity. In ACM Symposium on Principles of Programming Languages, pages 17--30, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. J. M. Spivey. Fast, Accurate Call Graph Profiling. Softw. Pract. Exper., 34(3):249--264, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Standard Performance Evaluation Corporation. SPECjbb2000 Documentation, release 1.01 edition, 2001.Google ScholarGoogle Scholar
  48. W. N. Sumner, Y. Zheng, D. Weeratunge, and X. Zhang. Precise Calling Context Encoding. In ACM International Conference on Software Engineering, pages 525--534, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. C. von Praun and T. R. Gross. Object Race Detection. In ACM Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 70--82, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. J. Whaley. A Portable Sampling-Based Profiler for Java Virtual Machines. In ACM Conference on Java Grande, pages 78--87, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. B. Wiedermann. Know your Place: Selectively Executing Statements Based on Context. Technical Report TR-07-38, University of Texas at Austin, 2007.Google ScholarGoogle Scholar
  52. G. Xu and A. Rountev. Precise Memory Leak Detection for Java Software Using Container Profiling. In ACM International Conference on Software Engineering, pages 151--160, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. X. Yang, S. M. Blackburn, D. Frampton, and A. L. Hosking. Barriers Reconsidered, Friendlier Still! In ACM International Symposium on Memory Management, pages 37--48, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Y. Yu, T. Rodeheffer, and W. Chen. RaceTrack: Efficient Detection of Data Race Conditions via Adaptive Tracking. In ACM Symposium on Operating Systems Principles, pages 221--234, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. X. Zhang, N. Gupta, and R. Gupta. Pruning Dynamic Slices with Confidence. In ACM Conference on Programming Language Design and Implementation, pages 169--180, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. X. Zhuang, M. J. Serrano, H. W. Cain, and J.-D. Choi. Accurate, Efficient, and Adaptive Calling Context Profiling. In ACM Conference on Programming Language Design and Implementation, pages 263--271, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Efficient context sensitivity for dynamic analyses via calling context uptrees and customized memory management

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!