Mercurial > hg > truffle
annotate src/share/vm/runtime/reflectionUtils.cpp @ 4237:30b6720604d2
Undid expected failure for EscapeAnalysisTest.testMonitor2().
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 06 Jan 2012 15:35:52 +0100 |
parents | a59727158259 |
children | f400f9554f09 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1999, 2010, 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" | |
3706
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
29 #ifdef GRAAL |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
30 #include "graal/graalJavaAccess.hpp" |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
31 #endif |
0 | 32 |
33 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, bool classes_only) { | |
34 _klass = klass; | |
35 if (classes_only) { | |
36 _interfaces = Universe::the_empty_system_obj_array(); | |
37 } else { | |
38 _interfaces = klass->transitive_interfaces(); | |
39 } | |
40 _interface_index = _interfaces->length(); | |
41 _local_only = local_only; | |
42 _classes_only = classes_only; | |
43 } | |
44 | |
45 bool KlassStream::eos() { | |
46 if (index() >= 0) return false; | |
47 if (_local_only) return true; | |
48 if (!_klass->is_interface() && _klass->super() != NULL) { | |
49 // go up superclass chain (not for interfaces) | |
50 _klass = _klass->super(); | |
51 } else { | |
52 if (_interface_index > 0) { | |
53 _klass = klassOop(_interfaces->obj_at(--_interface_index)); | |
54 } else { | |
55 return true; | |
56 } | |
57 } | |
58 _index = length(); | |
59 next(); | |
60 return eos(); | |
61 } | |
62 | |
63 | |
64 GrowableArray<FilteredField*> *FilteredFieldsMap::_filtered_fields = | |
65 new (ResourceObj::C_HEAP) GrowableArray<FilteredField*>(3,true); | |
66 | |
67 | |
68 void FilteredFieldsMap::initialize() { | |
69 int offset; | |
70 offset = java_lang_Throwable::get_backtrace_offset(); | |
1142 | 71 _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset)); |
0 | 72 // The latest version of vm may be used with old jdk. |
73 if (JDK_Version::is_gte_jdk16x_version()) { | |
74 // The following class fields do not exist in | |
75 // previous version of jdk. | |
76 offset = sun_reflect_ConstantPool::cp_oop_offset(); | |
1142 | 77 _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset)); |
0 | 78 offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset(); |
1142 | 79 _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset)); |
0 | 80 } |
3706
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
81 #ifdef GRAAL |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
82 if (UseGraal) { |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
83 compute_offset(offset, SystemDictionary::HotSpotMethodResolved_klass(), "javaMirror", "Ljava/lang/Object;", false); |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
84 _filtered_fields->append(new FilteredField(SystemDictionary::HotSpotMethodResolved_klass(), offset)); |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
85 } |
a59727158259
hide HotSpotMethodResolvedImpl.javaMirror field in debuggers
Lukas Stadler <lukas.stadler@jku.at>
parents:
1972
diff
changeset
|
86 #endif |
0 | 87 } |
88 | |
89 int FilteredFieldStream::field_count() { | |
90 int numflds = 0; | |
91 for (;!eos(); next()) { | |
92 numflds++; | |
93 } | |
94 return numflds; | |
95 } |