18
1 © 1999 Citrix Systems Inc C ITR IX Using type information in garbage collection Tim Harris

1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

Embed Size (px)

Citation preview

Page 1: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

1 © 1999 Citrix Systems Inc

CITRIX

Using type information ingarbage collection

Tim Harris

Page 2: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

2 © 1999 Citrix Systems Inc

CITRIXTraditional heap organization

Reg

iste

rsSt

ack

Heap

Page 3: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

3 © 1999 Citrix Systems Inc

CITRIXBaker’s treadmill collector

Page 4: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

4 © 1999 Citrix Systems Inc

CITRIXProblem : reclamation is very bursty

Time

Hea

p si

ze

The whole heap has to be checked before any storage can be reclaimed.

Page 5: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

5 © 1999 Citrix Systems Inc

CITRIXGenerational collection

Idea: separate newly created objects Evidence that they are likely to soon become garbage

Scan and reclaim space used by new objects without examining the entire heap How are references from old to new objects handled? When does an object become ‘old’?

How else could the heap be divided?

Page 6: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

6 © 1999 Citrix Systems Inc

CITRIXAlternative : use type information

Reg

iste

rsSt

ack

Page 7: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

7 © 1999 Citrix Systems Inc

CITRIXPotential benefits

Some storage can be reclaimed after each section of the heap has been scanned

Different sections can be scanned with different algorithms and maybe concurrently by different threads

Some sections can be scanned more frequently than others

Page 8: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

8 © 1999 Citrix Systems Inc

CITRIXSegregating the heap - example 1

Page 9: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

9 © 1999 Citrix Systems Inc

CITRIXSegregating the heap - example 2

Page 10: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

10 © 1999 Citrix Systems Inc

CITRIXSegregating the heap - example 3

Page 11: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

11 © 1999 Citrix Systems Inc

CITRIXImplementation

Page 12: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

12 © 1999 Citrix Systems Inc

CITRIXResults - Delta Blue

Page 13: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

13 © 1999 Citrix Systems Inc

CITRIXResults - Jar

Page 14: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

14 © 1999 Citrix Systems Inc

CITRIXResults - Javac

Page 15: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

15 © 1999 Citrix Systems Inc

CITRIXRemaining problems

Can new class definitions be handled efficiently at run-time?

Can the classes for non-trivial applications be effectively divided into these sections?

How is the success of the approach affected by different programming styles?

Page 16: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

16 © 1999 Citrix Systems Inc

CITRIXNative-code compiler - original

Page 17: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

17 © 1999 Citrix Systems Inc

CITRIXNative-code compiler - revised

Page 18: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris

18 © 1999 Citrix Systems Inc

CITRIXFuture work: parametric polymorphism

How are ‘generic’ references handled?

public class List

{

Object data;

List next;

}

public class List<T>

{

T data;

List next;

}