equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
39 assert(_max_interval >= 0,"Sanity check"); |
39 assert(_max_interval >= 0,"Sanity check"); |
40 } |
40 } |
41 |
41 |
42 // The oop passed in is the SoftReference object, and not |
42 // The oop passed in is the SoftReference object, and not |
43 // the object the SoftReference points to. |
43 // the object the SoftReference points to. |
44 bool LRUCurrentHeapPolicy::should_clear_reference(oop p) { |
44 bool LRUCurrentHeapPolicy::should_clear_reference(oop p, |
45 jlong interval = java_lang_ref_SoftReference::clock() - java_lang_ref_SoftReference::timestamp(p); |
45 jlong timestamp_clock) { |
|
46 jlong interval = timestamp_clock - java_lang_ref_SoftReference::timestamp(p); |
46 assert(interval >= 0, "Sanity check"); |
47 assert(interval >= 0, "Sanity check"); |
47 |
48 |
48 // The interval will be zero if the ref was accessed since the last scavenge/gc. |
49 // The interval will be zero if the ref was accessed since the last scavenge/gc. |
49 if(interval <= _max_interval) { |
50 if(interval <= _max_interval) { |
50 return false; |
51 return false; |
69 assert(_max_interval >= 0,"Sanity check"); |
70 assert(_max_interval >= 0,"Sanity check"); |
70 } |
71 } |
71 |
72 |
72 // The oop passed in is the SoftReference object, and not |
73 // The oop passed in is the SoftReference object, and not |
73 // the object the SoftReference points to. |
74 // the object the SoftReference points to. |
74 bool LRUMaxHeapPolicy::should_clear_reference(oop p) { |
75 bool LRUMaxHeapPolicy::should_clear_reference(oop p, |
75 jlong interval = java_lang_ref_SoftReference::clock() - java_lang_ref_SoftReference::timestamp(p); |
76 jlong timestamp_clock) { |
|
77 jlong interval = timestamp_clock - java_lang_ref_SoftReference::timestamp(p); |
76 assert(interval >= 0, "Sanity check"); |
78 assert(interval >= 0, "Sanity check"); |
77 |
79 |
78 // The interval will be zero if the ref was accessed since the last scavenge/gc. |
80 // The interval will be zero if the ref was accessed since the last scavenge/gc. |
79 if(interval <= _max_interval) { |
81 if(interval <= _max_interval) { |
80 return false; |
82 return false; |