1 / 36

ECE 750 Topic 8

ECE 750 Topic 8. Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel June 29, 2004 Presented by Shimin Li ECE750 University of waterloo. Paper Overview. Contents: Overview. Roughly six parts:

ranita
Télécharger la présentation

ECE 750 Topic 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for Java – U. P. Schultz, J. L. Lawall, C. Consel June 29, 2004 Presented by Shimin Li ECE750University of waterloo

  2. Paper Overview

  3. Contents: Overview Roughly six parts: • Introduction to Automatic Program Specialization(APS) • How OO programs can be specialized automatically • Outline of JSpec • Case studies • Experimental study • Related work, conclusion, and future work

  4. Contents: Detail • Automatic Program Specialization - Definition - Approach to APS » Off-line partial evaluation - Important features of partial evaluation - Means to declare the specialization context

  5. Contents: Detail • Specialization of OO Programs - How specialization transforms a program - How to express the specialized program - Example - Program specializer features » Analysis precision - Compare to compilation - Compare to inheritance

  6. Contents: Detail • JSpec Specializer - Overview of JSpec • Features • Specialization process - How JSpec specializes Java programs • Methods in concrete classes • Methods in abstract classes and interfaces - Limitations

  7. Contents: Detail • Case Studies - Specialization of the program written using visitor design pattern • Visitor Specialization Pattern - Specialization of OoLALA Linear Algebra Library • Bridge Specialization Pattern • Iterator Specialization Pattern

  8. Contents: Detail • Experimental Study - Benchmark programs to be experimented - Experiments - Results

  9. Related Work • A run-time specializer, Masuhara, Yonezawa, 2002 • An on-line partial evaluator, Jones et al. 1993 • C++ specialization, Fujinami, 1998 • C++ specialization, Veldhuizen, 1999 • Dynamic partial evaluation, Sullivan, 2001 • Manual specialization, Lujan et al, 2001 • JaMake • Jax • Some compiler optimization techniques • AOP

  10. Future Work • Support exception handlers in JSpec • Support run-time specialization for Java

  11. Contributions and Novelties • Apply automatic program specialization to OO programs • Java program specializer – JSpec • Experimental study - Selection of benchmark programs - Achievement of JSpec - Comparison of specialization and compiler optimization

  12. What I like • Techniques to eliminate overheads due to the use of OO abstractions • Re-using existing tools to develop JSpec - Tempo for C programs - AspectJ • Concrete examples - illustrate the approaches to specialization for OO programs • Experimental study - JSpec can produce significant speedups - JSpec and compiler optimization are complementary

  13. What I don’t like • To ensure that a program will specialize, some restrictions must be imposed on its implementation • Lack explanation of JSpec alias and bind time analysis • Paper can be shorter

  14. Discuss

  15. Question 1 What is program specialization?

  16. Answer Program specialization is a program transformation technique that optimizes a program fragment with respect to information about a context in which it is used, by generating an implementation dedicated to this usage context One approach to automatic program specialization is partial evaluation

  17. Question 2 How does the program specialization eliminate the genericness of OO programs?

  18. Answer • Eliminate virtual calls • Bypass encapsulation in a safe manner • Simplify invariant computations

  19. Question 3 What is binding-time analysis? How does it assist to perform partial evaluation?

  20. Answer The process to identify the static and dynamic computations in a program based on information about which inputs can be considered static in the execution context. Based on the results of the binding-time analysis, the partial evaluator can specialize the program with respect to any concrete context that provides values for the static inputs.

  21. Question 4 Compare the automatic program specialization to the compiler optimization

  22. Answer • CO and APS are complementary • APS can significantly optimizes programs beyond the capabilities of compilers

  23. Question 5 How does specializing a method optimize the use of encapsulated date?

  24. Answer Accessing an encapsulated value is implemented in terms of a sequence of pointer dereferences whose cost depends on the embedding depth of the object structure. Specialization replaces a reference to a field containing a static value by the value itself. This transformation eliminates memory references and improves performance.

  25. Question 6 How does specializing a method optimize the use of virtual dispatches?

  26. Answer The choice of which method is invoked by a Java method call depends on the type of the receiver object. When definition of the invoked method cannot be determined at compile time, the method call is said to be virtual and is typically implemented using a table and a pointer dereference. If the type of the receiver object can be determined based on extra information available during specialization, then specialization replaces a virtual method call by an ordinary procedure call. Such a procedure call can be inlined, leading to further optimizations.

  27. Question 7 Why it is appropriate to express the specialized program as an aspect-oriented program( i.e. encapsulate the specialized methods into an aspect)?

  28. Answer • Separates the specialized method definition from the source program • Inserts these definitions into the right scope at compilation time • Specialized methods always are called from a safe context • Specialized code can be removed easily

  29. Question 8 Describe the two important aspects of the precision of the analysis for a program specializer.

  30. Answer • Granularity(What kinds of values are given individual binding times) – class ployvariance – method ployvariance • The number of descriptions assigned to each analyzed value – use sensitivity(static and dynamic)

  31. Question 9 What does JSpec use C as an intermediate language?

  32. Answer In order to use Tempo, a mature specializer for C Programs? Or other reasons?

  33. Question 10 How do the visitor, bridge, and iterator specialization patterns perform specialization?

  34. Answer Visitor specialization pattern: The visitor specialization pattern suggests that when the choice of the visitor is fixed, automatic program specialization can eliminate the double dispatching that takes place between the visitor and the objects that it traverses.

  35. Bridge specialization pattern: The bridge specialization pattern suggests that when the representation is known, automatic program specialization can eliminate virtual dispatches between the interface object and the representation object.

  36. Iterator specialization pattern: The iterator specialization pattern suggests that when the structure that the iterator traverses is known and the program manipulates the iterator in a fixed way, then automatic program specialization can replace uses of the iterator method by direct manipulation of the structure.

More Related