changeset 9416:a4312636c0f7

8260704: ParallelGC: oldgen expansion needs release-store for _end Summary: Move JDK-8257999 barrier to correct location. Reviewed-by: tschatzl, sjohanss
author kbarrett
date Tue, 02 Feb 2021 19:20:19 +0000
parents bc32046eef89
children 39bed844f69e
files src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp src/share/vm/gc_implementation/shared/mutableSpace.cpp
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Fri Jan 22 11:20:52 2021 +0000
+++ b/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Tue Feb 02 19:20:19 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, 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
@@ -32,7 +32,6 @@
 #include "memory/gcLocker.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
-#include "runtime/orderAccess.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
@@ -402,9 +401,9 @@
   start_array()->set_covered_region(new_memregion);
   Universe::heap()->barrier_set()->resize_covered_region(new_memregion);
 
-  // Ensure the space bounds are updated and made visible to other
-  // threads after the other data structures have been resized.
-  OrderAccess::storestore();
+  // The update of the space's end is done by this call.  As that
+  // makes the new space available for concurrent allocation, this
+  // must be the last step when expanding.
   object_space()->initialize(new_memregion,
                              SpaceDecorator::DontClear,
                              SpaceDecorator::DontMangle);
--- a/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Fri Jan 22 11:20:52 2021 +0000
+++ b/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Tue Feb 02 19:20:19 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2021, 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
@@ -125,7 +125,11 @@
   }
 
   set_bottom(mr.start());
-  set_end(mr.end());
+  // When expanding concurrently with callers of cas_allocate, setting end
+  // makes the new space available for allocation by other threads.  So this
+  // assignment must follow all other configuration and initialization that
+  // might be done for expansion.
+  OrderAccess::release_store_ptr(end_addr(), mr.end());
 
   if (clear_space) {
     clear(mangle_space);