Mercurial > hg > graal-compiler
annotate src/share/vm/runtime/reflectionUtils.cpp @ 15046:5c71dcf0915d
use hotspot static stubs for call sites
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 09 Apr 2014 16:33:37 -0700 |
parents | 096c224171c4 |
children |
rev | line source |
---|---|
0 | 1 /* |
12823
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | |
27 #include "memory/universe.inline.hpp" | |
28 #include "runtime/reflectionUtils.hpp" | |
0 | 29 |
12823
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
30 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
31 bool classes_only, bool walk_defaults) { |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
32 _klass = _base_klass = klass; |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
33 _base_class_search_defaults = false; |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
34 _defaults_checked = false; |
0 | 35 if (classes_only) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
36 _interfaces = Universe::the_empty_klass_array(); |
0 | 37 } else { |
38 _interfaces = klass->transitive_interfaces(); | |
39 } | |
40 _interface_index = _interfaces->length(); | |
41 _local_only = local_only; | |
42 _classes_only = classes_only; | |
12823
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
43 _walk_defaults = walk_defaults; |
0 | 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) | |
51 _klass = _klass->super(); | |
12823
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
52 // Next for method walks, walk default methods |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
53 } else if (_walk_defaults && (_defaults_checked == false) && (_base_klass->default_methods() != NULL)) { |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
54 _base_class_search_defaults = true; |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
55 _klass = _base_klass; |
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
56 _defaults_checked = true; |
0 | 57 } else { |
12823
ac9cb1d5a202
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
6725
diff
changeset
|
58 // Next walk transitive interfaces |
0 | 59 if (_interface_index > 0) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
60 _klass = _interfaces->at(--_interface_index); |
0 | 61 } else { |
62 return true; | |
63 } | |
64 } | |
65 _index = length(); | |
66 next(); | |
67 return eos(); | |
68 } | |
69 | |
70 | |
71 GrowableArray<FilteredField*> *FilteredFieldsMap::_filtered_fields = | |
6197 | 72 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<FilteredField*>(3,true); |
0 | 73 |
74 | |
75 void FilteredFieldsMap::initialize() { | |
76 int offset; | |
77 offset = java_lang_Throwable::get_backtrace_offset(); | |
1142 | 78 _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset)); |
0 | 79 // The latest version of vm may be used with old jdk. |
80 if (JDK_Version::is_gte_jdk16x_version()) { | |
81 // The following class fields do not exist in | |
82 // previous version of jdk. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6197
diff
changeset
|
83 offset = sun_reflect_ConstantPool::oop_offset(); |
1142 | 84 _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset)); |
0 | 85 offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset(); |
1142 | 86 _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset)); |
0 | 87 } |
88 } | |
89 | |
90 int FilteredFieldStream::field_count() { | |
91 int numflds = 0; | |
92 for (;!eos(); next()) { | |
93 numflds++; | |
94 } | |
95 return numflds; | |
96 } |