author | hseigel |
Fri, 15 Dec 2017 11:23:50 -0500 | |
changeset 48463 | 474cec233fb2 |
parent 47216 | 71c04702a3d5 |
child 50277 | f84ae8aa5d88 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
37129
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4573
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4573
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:
4573
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/javaClasses.hpp" |
|
27 |
#include "classfile/systemDictionary.hpp" |
|
30150
d9c940aa42ef
8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution
stefank
parents:
29792
diff
changeset
|
28 |
#include "oops/instanceRefKlass.inline.hpp" |
7397 | 29 |
#include "oops/oop.inline.hpp" |
1 | 30 |
|
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
31 |
void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) { |
1 | 32 |
// Clear the nonstatic oop-map entries corresponding to referent |
33 |
// and nextPending field. They are treated specially by the |
|
34 |
// garbage collector. |
|
35 |
// The discovered field is used only by the garbage collector |
|
36 |
// and is also treated specially. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12780
diff
changeset
|
37 |
InstanceKlass* ik = InstanceKlass::cast(k); |
1 | 38 |
|
39 |
// Check that we have the right class |
|
40 |
debug_only(static bool first_time = true); |
|
4571 | 41 |
assert(k == SystemDictionary::Reference_klass() && first_time, |
1 | 42 |
"Invalid update of maps"); |
43 |
debug_only(first_time = false); |
|
3693 | 44 |
assert(ik->nonstatic_oop_map_count() == 1, "just checking"); |
1 | 45 |
|
46 |
OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); |
|
47 |
||
48 |
// Check that the current map is (2,4) - currently points at field with |
|
49 |
// offset 2 (words) and has 4 map entries. |
|
50 |
debug_only(int offset = java_lang_ref_Reference::referent_offset); |
|
3694
942b7bc7f28c
6845368: large objects cause a crash or unexpected exception
jcoomes
parents:
3693
diff
changeset
|
51 |
debug_only(unsigned int count = ((java_lang_ref_Reference::discovered_offset - |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
52 |
java_lang_ref_Reference::referent_offset)/heapOopSize) + 1); |
1 | 53 |
|
54 |
if (UseSharedSpaces) { |
|
55 |
assert(map->offset() == java_lang_ref_Reference::queue_offset && |
|
3693 | 56 |
map->count() == 1, "just checking"); |
1 | 57 |
} else { |
3693 | 58 |
assert(map->offset() == offset && map->count() == count, |
1 | 59 |
"just checking"); |
60 |
||
61 |
// Update map to (3,1) - point to offset of 3 (words) with 1 map entry. |
|
62 |
map->set_offset(java_lang_ref_Reference::queue_offset); |
|
3693 | 63 |
map->set_count(1); |
1 | 64 |
} |
65 |
} |
|
66 |
||
67 |
||
68 |
// Verification |
|
69 |
||
13738
d67be49a5beb
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
13728
diff
changeset
|
70 |
void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12780
diff
changeset
|
71 |
InstanceKlass::oop_verify_on(obj, st); |
1 | 72 |
// Verify referent field |
73 |
oop referent = java_lang_ref_Reference::referent(obj); |
|
74 |
if (referent != NULL) { |
|
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
37129
diff
changeset
|
75 |
guarantee(oopDesc::is_oop(referent), "referent field heap failed"); |
1 | 76 |
} |
77 |
// Verify next field |
|
78 |
oop next = java_lang_ref_Reference::next(obj); |
|
79 |
if (next != NULL) { |
|
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
37129
diff
changeset
|
80 |
guarantee(oopDesc::is_oop(next), "next field should be an oop"); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33148
diff
changeset
|
81 |
guarantee(next->is_instance(), "next field should be an instance"); |
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33148
diff
changeset
|
82 |
guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed"); |
1 | 83 |
} |
84 |
} |