comparison src/share/vm/memory/referencePolicy.hpp @ 453:c96030fff130

6684579: SoftReference processing can be made more efficient Summary: For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not. Reviewed-by: jmasa
author ysr
date Thu, 20 Nov 2008 16:56:09 -0800
parents a61af66fc99e
children 27a80744a83b
comparison
equal deleted inserted replaced
452:00b023ae2d78 453:c96030fff130
24 24
25 // referencePolicy is used to determine when soft reference objects 25 // referencePolicy is used to determine when soft reference objects
26 // should be cleared. 26 // should be cleared.
27 27
28 28
29 class ReferencePolicy : public ResourceObj { 29 class ReferencePolicy : public CHeapObj {
30 public: 30 public:
31 virtual bool should_clear_reference(oop p) { ShouldNotReachHere(); return true; } 31 virtual bool should_clear_reference(oop p) { ShouldNotReachHere(); return true; }
32 // Capture state (of-the-VM) information needed to evaluate the policy
33 virtual void snap() { /* do nothing */ }
32 }; 34 };
33 35
34 class NeverClearPolicy : public ReferencePolicy { 36 class NeverClearPolicy : public ReferencePolicy {
35 public: 37 public:
36 bool should_clear_reference(oop p) { return false; } 38 bool should_clear_reference(oop p) { return false; }
46 jlong _max_interval; 48 jlong _max_interval;
47 49
48 public: 50 public:
49 LRUCurrentHeapPolicy(); 51 LRUCurrentHeapPolicy();
50 52
53 // Capture state (of-the-VM) information needed to evaluate the policy
54 void snap();
51 bool should_clear_reference(oop p); 55 bool should_clear_reference(oop p);
52 }; 56 };
53 57
54 class LRUMaxHeapPolicy : public ReferencePolicy { 58 class LRUMaxHeapPolicy : public ReferencePolicy {
55 private: 59 private:
56 jlong _max_interval; 60 jlong _max_interval;
57 61
58 public: 62 public:
59 LRUMaxHeapPolicy(); 63 LRUMaxHeapPolicy();
60 64
65 // Capture state (of-the-VM) information needed to evaluate the policy
66 void snap();
61 bool should_clear_reference(oop p); 67 bool should_clear_reference(oop p);
62 }; 68 };