1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.
-
Upload
nikolas-colson -
Category
Documents
-
view
214 -
download
1
Transcript of 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.
![Page 1: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/1.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/2.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/3.jpg)
3 © 1999 Citrix Systems Inc
CITRIXBaker’s treadmill collector
![Page 4: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/4.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/5.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/6.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/7.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/8.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/9.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/10.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/11.jpg)
11 © 1999 Citrix Systems Inc
CITRIXImplementation
![Page 12: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/12.jpg)
12 © 1999 Citrix Systems Inc
CITRIXResults - Delta Blue
![Page 13: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/13.jpg)
13 © 1999 Citrix Systems Inc
CITRIXResults - Jar
![Page 14: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/14.jpg)
14 © 1999 Citrix Systems Inc
CITRIXResults - Javac
![Page 15: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/15.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/16.jpg)
16 © 1999 Citrix Systems Inc
CITRIXNative-code compiler - original
![Page 17: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/17.jpg)
17 © 1999 Citrix Systems Inc
CITRIXNative-code compiler - revised
![Page 18: 1 © 1999 Citrix Systems Inc Using type information in garbage collection Tim Harris.](https://reader036.fdocuments.us/reader036/viewer/2022070307/551ae612550346b2288b65af/html5/thumbnails/18.jpg)
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;
}