comparison src/share/vm/memory/referencePolicy.cpp @ 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 # include "incls/_precompiled.incl" 25 # include "incls/_precompiled.incl"
26 # include "incls/_referencePolicy.cpp.incl" 26 # include "incls/_referencePolicy.cpp.incl"
27 27
28 LRUCurrentHeapPolicy::LRUCurrentHeapPolicy() { 28 LRUCurrentHeapPolicy::LRUCurrentHeapPolicy() {
29 snap();
30 }
31
32 // Capture state (of-the-VM) information needed to evaluate the policy
33 void LRUCurrentHeapPolicy::snap() {
29 _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; 34 _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB;
30 assert(_max_interval >= 0,"Sanity check"); 35 assert(_max_interval >= 0,"Sanity check");
31 } 36 }
32 37
33 // The oop passed in is the SoftReference object, and not 38 // The oop passed in is the SoftReference object, and not
45 } 50 }
46 51
47 /////////////////////// MaxHeap ////////////////////// 52 /////////////////////// MaxHeap //////////////////////
48 53
49 LRUMaxHeapPolicy::LRUMaxHeapPolicy() { 54 LRUMaxHeapPolicy::LRUMaxHeapPolicy() {
55 snap();
56 }
57
58 // Capture state (of-the-VM) information needed to evaluate the policy
59 void LRUMaxHeapPolicy::snap() {
50 size_t max_heap = MaxHeapSize; 60 size_t max_heap = MaxHeapSize;
51 max_heap -= Universe::get_heap_used_at_last_gc(); 61 max_heap -= Universe::get_heap_used_at_last_gc();
52 max_heap /= M; 62 max_heap /= M;
53 63
54 _max_interval = max_heap * SoftRefLRUPolicyMSPerMB; 64 _max_interval = max_heap * SoftRefLRUPolicyMSPerMB;