mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
7098282: G1: assert(interval >= 0) failed: Sanity check, referencePolicy.cpp: 76
There is a race between one thread successfully forwarding and copying the klass mirror for the SoftReference class (including the static master clock) and another thread attempting to use the master clock while attempting to discover a soft reference object. Maintain a shadow copy of the soft reference master clock and use the shadow during reference discovery and reference processing. Reviewed-by: tonyp, brutisso, ysr
This commit is contained in:
parent
7fa7f8a597
commit
4738ed88a5
4 changed files with 75 additions and 33 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -41,8 +41,9 @@ void LRUCurrentHeapPolicy::setup() {
|
|||
|
||||
// The oop passed in is the SoftReference object, and not
|
||||
// the object the SoftReference points to.
|
||||
bool LRUCurrentHeapPolicy::should_clear_reference(oop p) {
|
||||
jlong interval = java_lang_ref_SoftReference::clock() - java_lang_ref_SoftReference::timestamp(p);
|
||||
bool LRUCurrentHeapPolicy::should_clear_reference(oop p,
|
||||
jlong timestamp_clock) {
|
||||
jlong interval = timestamp_clock - java_lang_ref_SoftReference::timestamp(p);
|
||||
assert(interval >= 0, "Sanity check");
|
||||
|
||||
// The interval will be zero if the ref was accessed since the last scavenge/gc.
|
||||
|
@ -71,8 +72,9 @@ void LRUMaxHeapPolicy::setup() {
|
|||
|
||||
// The oop passed in is the SoftReference object, and not
|
||||
// the object the SoftReference points to.
|
||||
bool LRUMaxHeapPolicy::should_clear_reference(oop p) {
|
||||
jlong interval = java_lang_ref_SoftReference::clock() - java_lang_ref_SoftReference::timestamp(p);
|
||||
bool LRUMaxHeapPolicy::should_clear_reference(oop p,
|
||||
jlong timestamp_clock) {
|
||||
jlong interval = timestamp_clock - java_lang_ref_SoftReference::timestamp(p);
|
||||
assert(interval >= 0, "Sanity check");
|
||||
|
||||
// The interval will be zero if the ref was accessed since the last scavenge/gc.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue