Semi-Automatic Region-Based Memory Management for Real-Time Java - - PowerPoint PPT Presentation

semi automatic region based memory management for real
SMART_READER_LITE
LIVE PREVIEW

Semi-Automatic Region-Based Memory Management for Real-Time Java - - PowerPoint PPT Presentation

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems G. Salagnac, C. Rippert, S. Yovine Verimag Lab. Universit Joseph Fourier Grenoble, France http://www-verimag.imag.fr/~salagnac salagnac@imag.fr G. Salagnac


slide-1
SLIDE 1

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems

  • G. Salagnac, C. Rippert, S. Yovine

Verimag Lab. Université Joseph Fourier Grenoble, France http://www-verimag.imag.fr/~salagnac salagnac@imag.fr

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 1 / 16

slide-2
SLIDE 2

Motivation

The Java programming language

◮ Attractive language

◮ Automatic memory management

Implementation pitfalls

◮ Garbage Collection ⇒ pause times and fragmentation

= ⇒ Difficult to use in a real-time embedded context

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 2 / 16

slide-3
SLIDE 3

Our approach

Non-determinism of Garbage Collector pause times: the problem is in the JVM, not in the language! Proposition:

◮ Keep the language

◮ no manual memory management

◮ Change the implementation

◮ replace the GC by a predictable allocator ◮ use region-based memory management ◮ automatically compute object lifetimes at compilation ◮ undecidable problem ◮ find a reasonable over-approximation

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 3 / 16

slide-4
SLIDE 4

Our approach

Non-determinism of Garbage Collector pause times: the problem is in the JVM, not in the language! Proposition:

◮ Keep the language

◮ no manual memory management

◮ Change the implementation

◮ replace the GC by a predictable allocator ◮ use region-based memory management ◮ automatically compute object lifetimes at compilation ◮ undecidable problem ◮ find a reasonable over-approximation

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 3 / 16

slide-5
SLIDE 5

Outline

Introduction Region-Based Memory management Pointer Interference Analysis Experimental results Conclusion

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 4 / 16

slide-6
SLIDE 6

Memory management using regions

...organised in regions program variables region 1 region 2 a java heap...

Objects in a region will share the same (physical) lifetime

◮ Benefits: a more real-time-compatible behaviour

◮ objects allocated side by side ◮ no fragmentation, constant time ◮ region destroyed as a whole: predictable times

◮ Drawbacks: more difficult bookkeeping

◮ object placement issue: who decides? ◮ region destroyed as a whole: space overhead, risk of faults

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 5 / 16

slide-7
SLIDE 7

Memory management using regions

...organised in regions program variables region 1 region 2 a java heap...

Objects in a region will share the same (physical) lifetime

◮ Benefits: a more real-time-compatible behaviour

◮ objects allocated side by side ◮ no fragmentation, constant time ◮ region destroyed as a whole: predictable times

◮ Drawbacks: more difficult bookkeeping

◮ object placement issue: who decides? ◮ region destroyed as a whole: space overhead, risk of faults

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 5 / 16

slide-8
SLIDE 8

Memory management using regions

...organised in regions program variables region 1 region 2 a java heap...

Objects in a region will share the same (physical) lifetime

◮ Benefits: a more real-time-compatible behaviour

◮ objects allocated side by side ◮ no fragmentation, constant time ◮ region destroyed as a whole: predictable times

◮ Drawbacks: more difficult bookkeeping

◮ object placement issue: who decides? ◮ region destroyed as a whole: space overhead, risk of faults

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 5 / 16

slide-9
SLIDE 9

Outline

Introduction Region-Based Memory management Pointer Interference Analysis Experimental results Conclusion

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 6 / 16

slide-10
SLIDE 10

Region analysis and allocation policy

Hypothesis: Objects within the same data structure (i.e. connected together) will often have similar (logical) lifetimes = ⇒ one region for each data structure

◮ no inter-region pointer

Static analysis:

◮ identify variables that may point to connected objects

Allocation Policy:

◮ place objects so that each structure is grouped in a region

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 7 / 16

slide-11
SLIDE 11

Region analysis and allocation policy

Hypothesis: Objects within the same data structure (i.e. connected together) will often have similar (logical) lifetimes = ⇒ one region for each data structure

◮ no inter-region pointer

Static analysis:

◮ identify variables that may point to connected objects

Allocation Policy:

◮ place objects so that each structure is grouped in a region

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 7 / 16

slide-12
SLIDE 12

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-13
SLIDE 13

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

for all methods, main() <init>() add()

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-14
SLIDE 14

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

identify local variables main()

list

  • 1
  • 2

<init>() add()

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-15
SLIDE 15

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

identify local variables main()

list

  • 1
  • 2

<init>()

this tmp

add()

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-16
SLIDE 16

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

identify local variables main()

list

  • 1
  • 2

<init>()

this tmp

add()

this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-17
SLIDE 17

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

local interference: v1.f=v2 = ⇒ v1∼v2 main()

list

  • 1
  • 2

<init>()

this ∼ tmp

add()

this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-18
SLIDE 18

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

local interference: v1.f=v2 = ⇒ v1∼v2 main()

list

  • 1
  • 2

<init>()

this ∼ tmp

add()

this ∼ o

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-19
SLIDE 19

Example: pointer interference analysis

main() { ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) { this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) { this.data[this.index] = o; this.index ++; } }

  • interproc. interference:

p1∼p2 = ⇒ a1∼a2 main()

list ∼ o1

  • 2

<init>()

this ∼ tmp

add()

this ∼ o

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-20
SLIDE 20

Example: pointer interference analysis

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

results: main()

list ∼ o1

  • 2

<init>()

this ∼ tmp

add()

this ∼ o

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 8 / 16

slide-21
SLIDE 21

Example: allocation policy

  • main()

{//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-22
SLIDE 22

Example: allocation policy

main() {//list∼o1

  • 2
  • ArrayList list =

new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-23
SLIDE 23

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;• list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-24
SLIDE 24

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-25
SLIDE 25

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp

  • this.index = 0;

tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2

this tmp

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-26
SLIDE 26

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0;• tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2

this tmp

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-27
SLIDE 27

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0;

  • tmp = new Object[capacity];

this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2

this tmp

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-28
SLIDE 28

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity];• this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2

this tmp

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-29
SLIDE 29

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity];

  • this.data = tmp;

} void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2

this tmp

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-30
SLIDE 30

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList;

  • list.<init>(3);

Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp;• } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2

this tmp

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-31
SLIDE 31

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3);• Object o1=new Object; Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-32
SLIDE 32

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3);

  • Object o1=new Object;

Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-33
SLIDE 33

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object;• Object o2=new Object; list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-34
SLIDE 34

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object;

  • Object o2=new Object;

list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-35
SLIDE 35

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object;• list.add(o1); } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-36
SLIDE 36

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object;

  • list.add(o1);

} class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-37
SLIDE 37

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object;

  • list.add(o1);

} class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o

  • this.data[this.index] = o;

this.index ++; } }

  • 1

list

  • 2

this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-38
SLIDE 38

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object;

  • list.add(o1);

} class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o;• this.index ++; } }

  • 1

list

  • 2

this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-39
SLIDE 39

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object;

  • list.add(o1);

} class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o;

  • this.index ++;

} }

  • 1

list

  • 2

this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-40
SLIDE 40

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object;

  • list.add(o1);

} class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++;• } }

  • 1

list

  • 2

this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-41
SLIDE 41

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1);• } class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • 1

list

  • 2
  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-42
SLIDE 42

Example: allocation policy

main() {//list∼o1

  • 2

ArrayList list = new ArrayList; list.<init>(3); Object o1=new Object; Object o2=new Object; list.add(o1); }• class ArrayList { Object[] data; int index; <init>(int capacity) {//this∼tmp this.index = 0; tmp = new Object[capacity]; this.data = tmp; } void add(Object o) {//this∼o this.data[this.index] = o; this.index ++; } }

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 9 / 16

slide-43
SLIDE 43

Outline

Introduction Region-Based Memory management Pointer Interference Analysis Experimental results Conclusion

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 10 / 16

slide-44
SLIDE 44

Experimental setup

Static analysis implemented with the Soot infrastructure Memory manager implemented in the JITS virtual machine JITS = Java In The Small (LIFL, France)

◮ a J2SE JavaOS for resource-constrained systems

Comparison of memory occupancy:

◮ with the default GC (mark & sweep) ◮ with static analysis + regions

JOlden benchmark suite

◮ lots of allocations ◮ different memory usage patterns

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 11 / 16

slide-45
SLIDE 45

Experimental setup

Static analysis implemented with the Soot infrastructure Memory manager implemented in the JITS virtual machine JITS = Java In The Small (LIFL, France)

◮ a J2SE JavaOS for resource-constrained systems

Comparison of memory occupancy:

◮ with the default GC (mark & sweep) ◮ with static analysis + regions

JOlden benchmark suite

◮ lots of allocations ◮ different memory usage patterns

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 11 / 16

slide-46
SLIDE 46

Experimental results (1)

1x107 2x107 3x107 4x107 5x107

VMTime (cycles)

400000 500000 600000 700000 800000 900000 1x106

Heap Size (bytes)

Garbage Collector Regions + Static Analysis

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 12 / 16

slide-47
SLIDE 47

Experimental results (1)

1x107 2x107 3x107 4x107 5x107

VMTime (cycles)

400000 500000 600000 700000 800000 900000 1x106

Heap Size (bytes)

Garbage Collector Regions + Static Analysis

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 12 / 16

slide-48
SLIDE 48

Experimental results (2)

5x106 1x107 1.5x107 2x107

VMTime (cycles)

400000 500000 600000 700000 800000 900000 1x106

Heap Size (bytes)

Garbage Collector Regions + Static Analysis

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 13 / 16

slide-49
SLIDE 49

Region explosion syndrome

class RefObject { Object f; foo() { Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } }

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-50
SLIDE 50

Region explosion syndrome

class RefObject { Object f; foo() { Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } }

Pointer interference analysis:

foo()

this∼bar

main()

r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-51
SLIDE 51

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } }

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-52
SLIDE 52

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-53
SLIDE 53

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-54
SLIDE 54

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-55
SLIDE 55

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-56
SLIDE 56

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-57
SLIDE 57

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-58
SLIDE 58

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-59
SLIDE 59

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-60
SLIDE 60

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-61
SLIDE 61

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-62
SLIDE 62

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-63
SLIDE 63

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-64
SLIDE 64

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-65
SLIDE 65

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-66
SLIDE 66

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-67
SLIDE 67

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r bar this

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-68
SLIDE 68

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-69
SLIDE 69

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } } r

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-70
SLIDE 70

Region explosion syndrome

class RefObject { Object f; foo() {//this∼bar Object bar=new Object; this.f=bar; } } main() { RefObject r=new RefObject(); while(true) { r.foo(); } }

Region behaviour analysis: search for bad paths in the call+interference graph...

call site within loop body

main() foo()

this∼bar r allocation site

...and report them to the programmer

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 14 / 16

slide-71
SLIDE 71

Outline

Introduction Region-Based Memory management Pointer Interference Analysis Experimental results Conclusion

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 15 / 16

slide-72
SLIDE 72

Conclusion and perspectives

Results:

◮ a new region inference algorithm ◮ regions work fine for most programming patterns ◮ compile-time feedback to the programmer otherwise

Work in progress:

◮ improvement of the allocation policy

◮ combination with a reference counting GC

Perspectives:

◮ extension to concurrency

  • G. Salagnac (Verimag)

Semi-Automatic Region-Based Memory Management for Real-Time Java Embedded Systems 16 / 16