Mercurial > hg > truffle
annotate src/share/vm/runtime/reflectionUtils.cpp @ 1768:6ee479178066
6979444: add command line option to print command line flags descriptions
Summary: Implementation of a nonproduct boolean flag XX:PrintFlagsWithComments
Reviewed-by: kamg, dholmes, dsamersoff
author | ikrylov |
---|---|
date | Tue, 31 Aug 2010 03:14:00 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
2 * Copyright (c) 1999, 2006, 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 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_reflectionUtils.cpp.incl" | |
27 | |
28 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, bool classes_only) { | |
29 _klass = klass; | |
30 if (classes_only) { | |
31 _interfaces = Universe::the_empty_system_obj_array(); | |
32 } else { | |
33 _interfaces = klass->transitive_interfaces(); | |
34 } | |
35 _interface_index = _interfaces->length(); | |
36 _local_only = local_only; | |
37 _classes_only = classes_only; | |
38 } | |
39 | |
40 bool KlassStream::eos() { | |
41 if (index() >= 0) return false; | |
42 if (_local_only) return true; | |
43 if (!_klass->is_interface() && _klass->super() != NULL) { | |
44 // go up superclass chain (not for interfaces) | |
45 _klass = _klass->super(); | |
46 } else { | |
47 if (_interface_index > 0) { | |
48 _klass = klassOop(_interfaces->obj_at(--_interface_index)); | |
49 } else { | |
50 return true; | |
51 } | |
52 } | |
53 _index = length(); | |
54 next(); | |
55 return eos(); | |
56 } | |
57 | |
58 | |
59 GrowableArray<FilteredField*> *FilteredFieldsMap::_filtered_fields = | |
60 new (ResourceObj::C_HEAP) GrowableArray<FilteredField*>(3,true); | |
61 | |
62 | |
63 void FilteredFieldsMap::initialize() { | |
64 int offset; | |
65 offset = java_lang_Throwable::get_backtrace_offset(); | |
1142 | 66 _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset)); |
0 | 67 // The latest version of vm may be used with old jdk. |
68 if (JDK_Version::is_gte_jdk16x_version()) { | |
69 // The following class fields do not exist in | |
70 // previous version of jdk. | |
71 offset = sun_reflect_ConstantPool::cp_oop_offset(); | |
1142 | 72 _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset)); |
0 | 73 offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset(); |
1142 | 74 _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset)); |
0 | 75 } |
76 } | |
77 | |
78 int FilteredFieldStream::field_count() { | |
79 int numflds = 0; | |
80 for (;!eos(); next()) { | |
81 numflds++; | |
82 } | |
83 return numflds; | |
84 } |