annotate hotspot/src/share/vm/gc/g1/g1ConcurrentMarkObjArrayProcessor.hpp @ 42597:a9611bab7578

8057003: Large reference arrays cause extremely long synchronization times Summary: Slice large object arrays into parts so that the synchronization of marking threads with an STW pause request does not take long. Reviewed-by: ehelin, pliden
author tschatzl
date Thu, 24 Nov 2016 11:27:57 +0100
parents
children 6061df52d610
rev   line source
tschatzl@42597 1 /*
tschatzl@42597 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
tschatzl@42597 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
tschatzl@42597 4 *
tschatzl@42597 5 * This code is free software; you can redistribute it and/or modify it
tschatzl@42597 6 * under the terms of the GNU General Public License version 2 only, as
tschatzl@42597 7 * published by the Free Software Foundation.
tschatzl@42597 8 *
tschatzl@42597 9 * This code is distributed in the hope that it will be useful, but WITHOUT
tschatzl@42597 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
tschatzl@42597 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
tschatzl@42597 12 * version 2 for more details (a copy is included in the LICENSE file that
tschatzl@42597 13 * accompanied this code).
tschatzl@42597 14 *
tschatzl@42597 15 * You should have received a copy of the GNU General Public License version
tschatzl@42597 16 * 2 along with this work; if not, write to the Free Software Foundation,
tschatzl@42597 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
tschatzl@42597 18 *
tschatzl@42597 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
tschatzl@42597 20 * or visit www.oracle.com if you need additional information or have any
tschatzl@42597 21 * questions.
tschatzl@42597 22 *
tschatzl@42597 23 */
tschatzl@42597 24
tschatzl@42597 25 #ifndef SHARE_VM_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_HPP
tschatzl@42597 26 #define SHARE_VM_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_HPP
tschatzl@42597 27
tschatzl@42597 28 #include "oops/oopsHierarchy.hpp"
tschatzl@42597 29 #include "memory/allocation.hpp"
tschatzl@42597 30
tschatzl@42597 31 class G1CMTask;
tschatzl@42597 32
tschatzl@42597 33 // Helper class to mark through large objArrays during marking in an efficient way.
tschatzl@42597 34 // Instead of pushing large object arrays, we push continuations onto the
tschatzl@42597 35 // mark stack. These continuations are identified by having their LSB set.
tschatzl@42597 36 // This allows incremental processing of large objects.
tschatzl@42597 37 class G1CMObjArrayProcessor VALUE_OBJ_CLASS_SPEC {
tschatzl@42597 38 private:
tschatzl@42597 39 // The bit mask for the continuation indicator of elements on the mark stack.
tschatzl@42597 40 static const size_t ArraySliceBit = 1;
tschatzl@42597 41
tschatzl@42597 42 // Reference to the task for doing the actual work.
tschatzl@42597 43 G1CMTask* _task;
tschatzl@42597 44
tschatzl@42597 45 // Encodes the given address as a continuation "oop".
tschatzl@42597 46 oop encode_array_slice(HeapWord* addr);
tschatzl@42597 47 // Remove the continuation marker from the given oop from the mark stack.
tschatzl@42597 48 HeapWord* decode_array_slice(oop value);
tschatzl@42597 49
tschatzl@42597 50 // Push the continuation at the given address onto the mark stack.
tschatzl@42597 51 void push_array_slice(HeapWord* addr);
tschatzl@42597 52
tschatzl@42597 53 // Process (apply the closure) on the given continuation of the given objArray.
tschatzl@42597 54 size_t process_array_slice(objArrayOop const obj, HeapWord* start_from, size_t remaining);
tschatzl@42597 55 public:
tschatzl@42597 56 static bool is_array_slice(void* obj) { return ((uintptr_t)obj & ArraySliceBit) != 0; }
tschatzl@42597 57
tschatzl@42597 58 static bool should_be_sliced(oop obj);
tschatzl@42597 59
tschatzl@42597 60 G1CMObjArrayProcessor(G1CMTask* task) : _task(task) {
tschatzl@42597 61 }
tschatzl@42597 62
tschatzl@42597 63 // Process the given continuation "oop". Returns the number of words scanned.
tschatzl@42597 64 size_t process_slice(oop obj);
tschatzl@42597 65 // Start processing the given objArrayOop by scanning the header and pushing its
tschatzl@42597 66 // continuation.
tschatzl@42597 67 size_t process_obj(oop obj);
tschatzl@42597 68 };
tschatzl@42597 69
tschatzl@42597 70 #endif /* SHARE_VM_GC_G1_G1CONCURRENTMARKOBJARRAYPROCESSOR_HPP */