1 Utilizing Field Usage Patterns for Java Heap Space Optimization Z. Guo, N. Amaral, D. Szafron and Y. Wang Department of Computing Science University of Alberta
2 Motivation Java has become a popular platform for mobile and embedded systems. Prediction: 1.8 billion by Mobile and embedded systems tend to be memory constrained: Physics: device size, weight, power consumption. Economics: price Applications: multimedia streams, video games…
3 Motivation Memory constraints make Java programs to execute slowly or even crash. Many researches have been done to reduce the memory footprint of Java: Runtime environment Code Data
4 Contribution A study of the characteristics of the field usage patterns using the SpecJVM 98 benchmark. New opportunities for space optimization. A design of a heap compression mechanism.
5 Field Usage Patterns A Java class has a set of fields with a fixed layout. However, not all fields need be stored: A number of fields have zero or null values. Used fields often have frequent field values. Optimization opportunities: Scheme-1: eliminating zero or null fields. Scheme-2: externalizing fields with frequent values.
6 Field-Usage Patterns Instances of the same class often exhibit different field-usage patterns. Definition: The field usage pattern of an object is the set of fields used by the object. Consider fields with frequent values: The field usage pattern of an object is the set of fields of the object that do not store frequent field values.
7 The SpecJVM 98 benchmark Field usage pattern distributions (Scheme-1):
8 The SpecJVM 98 benchmark Field usage pattern distributions (Scheme-2):
9 The SpecJVM 98 benchmark Field usage pattern distributions:
10 The SpecJVM 98 benchmark Summary: Except raytrace, 80% instances are compressible using field usage patterns. On average, each class is expected to have 2 to 3 fields with frequent values and its instances have 3 to 4 different field-usage patterns. The 1 st and 2 nd most frequent field usage patterns account for a significant portion of field usage pattern occurrences. Compressing non-zero frequent field values can dramatically benefit some programs, including jess and javac.
11 Existing Compression Mechanisms LCTES C. S. Ananian and M. Rinard. Use hash table to record non-frequent field values. VEE G. Chen, M. Kandemir and M. J. Irwin Only assume a single field-usage pattern for each class. Extra space (one word) required for objects that do not have the single field-usage pattern.
12 An Example In jess, a benchmark in the SpecJVM 98 suite, the class Value has four fields: _type, intval, floatval, and Objectval.
13 Our Mechanism Comprehensive: exploits opportunities associated with multiple field-usage patterns per class. Aggressive: eliminates all zero/null fields and fields with frequent values. Low space overhead: requires extra space per field usage pattern, rather than per object.
14 Our Mechanism Fields are classified into three levels: Level-0: fields with no frequent values. Level-1: fields with non-zero frequent values. Level-2: fields with zero/null frequent values.
15 Our Mechanism Bidirectional object layout
16 Our Mechanism Meta-class
17 Performance Evaluation Compression effectiveness (Scheme-1 max):
18 Performance Evaluation Compression effectiveness (Scheme-2 max):
19 Performance Evaluation Runtime overhead
20 Performance Evaluation Summary: Scheme-1 reduces the max heap space requirement by 12% on average. Scheme-2 reduces the max heap space requirement by 14% on average. A performance penalty 4.4% on average for scheme-2.
21 Thanks