author | ehelin |
Mon, 12 Aug 2013 17:37:02 +0200 | |
changeset 19979 | ebe1dbb6e1aa |
parent 15482 | 470d0b0c09f1 |
child 22234 | da823d78ad65 |
permissions | -rw-r--r-- |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
1 |
/* |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7397
diff
changeset
|
2 |
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
4 |
* |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
8 |
* |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
13 |
* accompanied this code). |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
14 |
* |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
18 |
* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
21 |
* questions. |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
22 |
* |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
23 |
*/ |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
24 |
|
7397 | 25 |
#ifndef SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP |
26 |
#define SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP |
|
27 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
7397
diff
changeset
|
28 |
#include "gc_implementation/shared/markSweep.inline.hpp" |
7397 | 29 |
#include "oops/objArrayKlass.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13952
diff
changeset
|
30 |
#include "utilities/macros.hpp" |
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13952
diff
changeset
|
31 |
#if INCLUDE_ALL_GCS |
7397 | 32 |
#include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp" |
33 |
#include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13952
diff
changeset
|
34 |
#endif // INCLUDE_ALL_GCS |
7397 | 35 |
|
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
36 |
void ObjArrayKlass::oop_follow_contents(oop obj, int index) { |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
37 |
if (UseCompressedOops) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
38 |
objarray_follow_contents<narrowOop>(obj, index); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
39 |
} else { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
40 |
objarray_follow_contents<oop>(obj, index); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
41 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
42 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
43 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
44 |
template <class T> |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
45 |
void ObjArrayKlass::objarray_follow_contents(oop obj, int index) { |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
46 |
objArrayOop a = objArrayOop(obj); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
47 |
const size_t len = size_t(a->length()); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
48 |
const size_t beg_index = size_t(index); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
49 |
assert(beg_index < len || len == 0, "index too large"); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
50 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
51 |
const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
52 |
const size_t end_index = beg_index + stride; |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
53 |
T* const base = (T*)a->base(); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
54 |
T* const beg = base + beg_index; |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
55 |
T* const end = base + end_index; |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
56 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
57 |
// Push the non-NULL elements of the next stride on the marking stack. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
58 |
for (T* e = beg; e < end; e++) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
59 |
MarkSweep::mark_and_push<T>(e); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
60 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
61 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
62 |
if (end_index < len) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
63 |
MarkSweep::push_objarray(a, end_index); // Push the continuation. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
64 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
65 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
66 |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13952
diff
changeset
|
67 |
#if INCLUDE_ALL_GCS |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
68 |
void ObjArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj, |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
69 |
int index) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
70 |
if (UseCompressedOops) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
71 |
objarray_follow_contents<narrowOop>(cm, obj, index); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
72 |
} else { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
73 |
objarray_follow_contents<oop>(cm, obj, index); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
74 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
75 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
76 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
77 |
template <class T> |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
78 |
void ObjArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj, |
5076
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
79 |
int index) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
80 |
objArrayOop a = objArrayOop(obj); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
81 |
const size_t len = size_t(a->length()); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
82 |
const size_t beg_index = size_t(index); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
83 |
assert(beg_index < len || len == 0, "index too large"); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
84 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
85 |
const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
86 |
const size_t end_index = beg_index + stride; |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
87 |
T* const base = (T*)a->base(); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
88 |
T* const beg = base + beg_index; |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
89 |
T* const end = base + end_index; |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
90 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
91 |
// Push the non-NULL elements of the next stride on the marking stack. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
92 |
for (T* e = beg; e < end; e++) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
93 |
PSParallelCompact::mark_and_push<T>(cm, e); |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
94 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
95 |
|
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
96 |
if (end_index < len) { |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
97 |
cm->push_objarray(a, end_index); // Push the continuation. |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
98 |
} |
8b74a4b60b31
4396719: Mark Sweep stack overflow on deeply nested Object arrays
jcoomes
parents:
diff
changeset
|
99 |
} |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13952
diff
changeset
|
100 |
#endif // INCLUDE_ALL_GCS |
7397 | 101 |
|
102 |
#endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP |