run time evaluation of opportunities for object inlining
play

Run-time Evaluation of Opportunities for Object Inlining in Java - PowerPoint PPT Presentation

Run-time Evaluation of Opportunities for Object Inlining in Java Ond rej Lhot ak and Laurie Hendren Sable Research Group McGill University November 5th, 2002 p. 1/30 Motivation Java allows only references to objects as fields,


  1. Run-time Evaluation of Opportunities for Object Inlining in Java Ondˇ rej Lhot´ ak and Laurie Hendren Sable Research Group McGill University November 5th, 2002 – p. 1/30

  2. Motivation Java allows only references to objects as fields, not the objects themselves. Object Inlining has been studied as a method to implement languages with this restriction efficiently. Complex re ComplexPair ComplexPair x_re im x x_im y y_re Complex y_im re im – p. 2/30

  3. Motivation Java allows only references to objects as fields, not the objects themselves. Object Inlining has been studied as a method to implement languages with this restriction efficiently. How would Object Inlining affect typical Java programs? – p. 3/30

  4. Contributions Classification scheme for fields according to how they can be inlined. Empirical limit study of the potential effects of object inlining (upper bound on improvements achievable by object inlining optimization). Technique for determining which inlinable fields are important to optimize — could be useful to programmers. Observation of complex interactions between object inlining and other optimizations: effect of “pointer chasing” is minor in comparison. – p. 4/30

  5. Outline Object Inlining and Related Work Definitions Experiments and Results Conclusion and Future Work – p. 5/30

  6. � ✁ � � ✁ ✁ Object Inlining class Complex double re, im; NormFinder z class NormFinder Complex z; double normSq() Complex return re z.re*z.re + z.im*z.im; im – p. 6/30

  7. � � � ✁ ✁ ✁ Object Inlining class Complex double re, im; NormFinder z class NormFinder z_re Complex z; double z re, z im; z_im double normSq() Complex return re z.re*z.re + im z.im*z.im; – p. 7/30

  8. � � � ✁ ✁ ✁ Object Inlining class Complex double re, im; NormFinder z class NormFinder z_re Complex z; double z re, z im; z_im double normSq() Complex return re z re*z re + im z im*z im; – p. 8/30

  9. � � � ✁ ✁ ✁ Object Inlining class Complex double re, im; NormFinder z class NormFinder z_re Complex z; double z re, z im; z_im double normSq() Complex return re z re*z re + im z im*z im; – p. 9/30

  10. Related Work Dolby, Chien. PLDI ’97. Automatic Inline Allocation of Objects. OOPSLA ’98. An Evaluation of Automatic Object Inline Allocation Techniques. PLDI ’00. An Automatic Object Inlining Optimization and its Evaluation. Laud. JOSES ’01 (ETAPS). Analysis for Object Inlining in Java. – p. 10/30

  11. Related Work Ghemawat, Randall, Scales. PLDI ’00. Field Analysis: Getting Useful and Low-Cost Interprocedural Information. Budimli´ c. Ph.D. thesis, 2001. Compiling Java for High Performance and the Internet. – p. 11/30

  12. Predicates [contains-unique] Every container having f refers to only one contained object through f . p.f = c; p.f = d; p f f c d – p. 12/30

  13. Predicates [unique-container-same-field] No object stored into field f is stored into field f of any other container. p.f = c; r.f = c; p r f f c – p. 13/30

  14. Predicates [unique-container-different-field] No object stored into field f is stored into any field g of any other container. p.f = c; q.g = c; p f g q c – p. 14/30

  15. Predicates [not-globally-reachable] No object contained in f is ever stored into an array or static field. p.f = c; Class.g = c; a[i] = c; p f c Global – p. 15/30

  16. Field Classification [contains-unique] [unique-container-same-field] [unique-container-different-field] [not-globally-reachable] Field-sensitive All 4 predicates Unique-store one-to-one Simply [Dolby, Chien] one-to-one [Laud] Move fields to container Copy fields to container Remove contained Keep contained object object – p. 16/30

  17. Field Classification [contains-unique] [unique-container-same-field] [unique-container-different-field] [not-globally-reachable] Field-sensitive All 4 predicates Unique-store one-to-one Simply [Dolby, Chien] one-to-one [Laud] Move fields to container Copy fields to container Remove contained Keep contained object object – p. 17/30

  18. Field Classification [contains-unique] [unique-container-same-field] [unique-container-different-field] [not-globally-reachable] Field-sensitive All 4 predicates Unique-store one-to-one Simply [Dolby, Chien] one-to-one [Laud] Move fields to container Copy fields to container Remove contained Keep contained object object – p. 18/30

  19. Field Classification [contains-unique] [unique-container-same-field] [unique-container-different-field] [not-globally-reachable] Field-sensitive All 4 predicates Unique-store one-to-one Simply [Dolby, Chien] one-to-one [Laud] Move fields to container Copy fields to container Remove contained Keep contained object object – p. 19/30

  20. � Experiments Instrument benchmarks using Soot to record getfield , putfield , putstatic and aastore . For each field, look for violations of each predicate in the traces. eg. . . . p.f = c; . . [contains-unique]( f ) . p.f = d; . . . – p. 20/30

  21. � Experiments Instrument benchmarks using Soot to record getfield , putfield , putstatic and aastore . For each field, look for violations of each predicate in the traces. eg. . . . p.f = c; . . [unique-container-same-field]( f ) . q.f = c; . . . – p. 21/30

  22. Benchmarks compress javasrc-p (Java to HTML) db kawa-c (Scheme compiler) jack rhino-a (Javascript interp.) javac sablecc-j (Parser generator) jess sablecc-w mpegaudio schroeder-m (Audio editor) mtrt schroeder-s raytrace soot-c (Bytecode optimizer) toba-s (Java native compiler) – p. 22/30

  23. Fraction of Field Reads Inlinable 100 80 60 Percent 40 20 0 compress javac mtrt kawa-c sablecc-w soot-c db jess raytrace rhino-a schroeder-m toba-s jack mpegaudio javasrc-p sablecc-j schroeder-s Field-spec. one-to-one Unique-store Simply one-to-one – p. 23/30

  24. How Many Inlinable Fields are Important? Fields accounting for 90% of inlinable field reads compress 6 javasrc-p 6 db 1 kawa-c 20 jack 7 rhino-a 3 javac 8 sablecc-j 12 jess 5 sablecc-w 8 mpegaudio 4 schroeder-m 4 mtrt 5 schroeder-s 4 raytrace 5 soot-c 20 toba-s 6 – p. 24/30

  25. Inlinable Field Reads per Second 8.3e+06 1e+06 Number of reads per second 800000 600000 400000 200000 0 compress javac mtrt kawa-c sablecc-w soot-c db jess raytrace rhino-a schroeder-m toba-s jack mpegaudio javasrc-p sablecc-j schroeder-s Field-spec. one-to-one Unique-store Simply one-to-one – p. 25/30

  26. Speedup from Hand-Inlining compress Speedup 7.8% to 10.8% db Speedup up to 10.6% from one field javasrc-p No significant change – p. 26/30

  27. Loop Invariant Hoisting Fields satisfying [contains-unique] predicate are loop invariant. Hoisting loop invariants should give similar benefit. In compress, benefit from loop invariant hoisting is about half the benefit of object inlining. – p. 27/30

  28. Bytes of Allocations Saved 10 8 6 Percent 4 2 0 compress javac mtrt kawa-c sablecc-w soot-c db jess raytrace rhino-a schroeder-m toba-s jack mpegaudio javasrc-p sablecc-j schroeder-s Field-spec. one-to-one Simply one-to-one – p. 28/30

  29. Object Allocations Saved 25 20 15 Percent 10 5 0 compress javac mtrt kawa-c sablecc-w soot-c db jess raytrace rhino-a schroeder-m toba-s jack mpegaudio javasrc-p sablecc-j schroeder-s Field-spec. one-to-one Simply one-to-one – p. 29/30

  30. Conclusions Object inlining can produce speedups of up to 10%, but highly dependent on individual benchmark. Complex interactions with other optimizations; cost of “pointer chasing” insignificant in comparison. Inlining field-specific one-to-one fields can yield savings of up to 7% of bytes, 21.6% of objects allocated. Small number of fields are important could be hand-optimized. – p. 30/30

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend