author | iklam |
Tue, 07 Aug 2018 15:45:07 -0700 | |
changeset 51329 | 9c68699bebe5 |
parent 49359 | 59f6547e151f |
permissions | -rw-r--r-- |
1 | 1 |
/* |
49359
59f6547e151f
8199264: Remove universe.inline.hpp to simplify include dependencies
stefank
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1999, 2018, 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:
4571
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4571
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:
4571
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/javaClasses.hpp" |
|
49359
59f6547e151f
8199264: Remove universe.inline.hpp to simplify include dependencies
stefank
parents:
47216
diff
changeset
|
27 |
#include "memory/universe.hpp" |
7397 | 28 |
#include "runtime/reflectionUtils.hpp" |
1 | 29 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
39275
diff
changeset
|
30 |
KlassStream::KlassStream(InstanceKlass* klass, bool local_only, |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
31 |
bool classes_only, bool walk_defaults) { |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
32 |
_klass = _base_klass = klass; |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
33 |
_base_class_search_defaults = false; |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
34 |
_defaults_checked = false; |
1 | 35 |
if (classes_only) { |
51329
9c68699bebe5
8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents:
49359
diff
changeset
|
36 |
_interfaces = Universe::the_empty_instance_klass_array(); |
1 | 37 |
} else { |
38 |
_interfaces = klass->transitive_interfaces(); |
|
39 |
} |
|
40 |
_interface_index = _interfaces->length(); |
|
41 |
_local_only = local_only; |
|
42 |
_classes_only = classes_only; |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
43 |
_walk_defaults = walk_defaults; |
1 | 44 |
} |
45 |
||
46 |
bool KlassStream::eos() { |
|
47 |
if (index() >= 0) return false; |
|
48 |
if (_local_only) return true; |
|
49 |
if (!_klass->is_interface() && _klass->super() != NULL) { |
|
50 |
// go up superclass chain (not for interfaces) |
|
51329
9c68699bebe5
8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents:
49359
diff
changeset
|
51 |
_klass = _klass->java_super(); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
52 |
// Next for method walks, walk default methods |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
53 |
} else if (_walk_defaults && (_defaults_checked == false) && (_base_klass->default_methods() != NULL)) { |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
54 |
_base_class_search_defaults = true; |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
55 |
_klass = _base_klass; |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
56 |
_defaults_checked = true; |
1 | 57 |
} else { |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
13728
diff
changeset
|
58 |
// Next walk transitive interfaces |
1 | 59 |
if (_interface_index > 0) { |
51329
9c68699bebe5
8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents:
49359
diff
changeset
|
60 |
_klass = _interfaces->at(--_interface_index); |
1 | 61 |
} else { |
62 |
return true; |
|
63 |
} |
|
64 |
} |
|
65 |
_index = length(); |
|
66 |
next(); |
|
67 |
return eos(); |
|
68 |
} |
|
69 |
||
70 |
||
71 |
GrowableArray<FilteredField*> *FilteredFieldsMap::_filtered_fields = |
|
13195 | 72 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<FilteredField*>(3,true); |
1 | 73 |
|
74 |
||
75 |
void FilteredFieldsMap::initialize() { |
|
39275
c6cea32506a4
8158237: JVMTI hides critical debug information for memory leak tracing
coleenp
parents:
37301
diff
changeset
|
76 |
int offset = reflect_ConstantPool::oop_offset(); |
25057 | 77 |
_filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset)); |
37301
a936b4e01afb
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
25057
diff
changeset
|
78 |
offset = reflect_UnsafeStaticFieldAccessorImpl::base_offset(); |
25057 | 79 |
_filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset)); |
1 | 80 |
} |
81 |
||
82 |
int FilteredFieldStream::field_count() { |
|
83 |
int numflds = 0; |
|
84 |
for (;!eos(); next()) { |
|
85 |
numflds++; |
|
86 |
} |
|
87 |
return numflds; |
|
88 |
} |