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