# HG changeset patch # User kbarrett # Date 1612293619 0 # Node ID a4312636c0f70a04d536788bdd39006340fef9c2 # Parent bc32046eef898e8a83f9f5fb1bb77e5f10f467ea 8260704: ParallelGC: oldgen expansion needs release-store for _end Summary: Move JDK-8257999 barrier to correct location. Reviewed-by: tschatzl, sjohanss diff -r bc32046eef89 -r a4312636c0f7 src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp --- 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); diff -r bc32046eef89 -r a4312636c0f7 src/share/vm/gc_implementation/shared/mutableSpace.cpp --- 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);