changeset 12822:4a443796f6f5 jdk-9+181

8185133: Reference pending list root might not get marked Summary: Ensure that pending list head is marked by initial mark Reviewed-by: eosterlund, kbarrett, tschatzl
author mgerdin
date Tue, 01 Aug 2017 11:03:05 +0200
parents 7571d12745bc
children b756e7a2ec33
files src/share/vm/gc/g1/g1CollectedHeap.cpp src/share/vm/memory/universe.cpp
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Jul 27 18:04:47 2017 +0000
+++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp	Tue Aug 01 11:03:05 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2017, 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
@@ -4389,6 +4389,15 @@
   rp->verify_no_references_recorded();
   assert(!rp->discovery_enabled(), "should have been disabled");
 
+  // If during an initial mark pause we install a pending list head which is not otherwise reachable
+  // ensure that it is marked in the bitmap for concurrent marking to discover.
+  if (collector_state()->during_initial_mark_pause()) {
+    oop pll_head = Universe::reference_pending_list();
+    if (pll_head != NULL) {
+      _cm->grayRoot(pll_head);
+    }
+  }
+
   // FIXME
   // CM's reference processing also cleans up the string and symbol tables.
   // Should we do that here also? We could, but it is a serial operation
--- a/src/share/vm/memory/universe.cpp	Thu Jul 27 18:04:47 2017 +0000
+++ b/src/share/vm/memory/universe.cpp	Tue Aug 01 11:03:05 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -497,7 +497,11 @@
 #define assert_pll_ownership() assert_pll_locked(owned_by_self)
 
 oop Universe::reference_pending_list() {
-  assert_pll_ownership();
+  if (Thread::current()->is_VM_thread()) {
+    assert_pll_locked(is_locked);
+  } else {
+    assert_pll_ownership();
+  }
   return _reference_pending_list;
 }