hotspot/src/share/vm/runtime/reflectionUtils.cpp
changeset 13728 882756847a04
parent 13195 be27e1b6a4b9
child 20391 7b146c5ebb18
equal deleted inserted replaced
13727:caf5eb7dd4a7 13728:882756847a04
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    28 #include "runtime/reflectionUtils.hpp"
    28 #include "runtime/reflectionUtils.hpp"
    29 
    29 
    30 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, bool classes_only) {
    30 KlassStream::KlassStream(instanceKlassHandle klass, bool local_only, bool classes_only) {
    31   _klass = klass;
    31   _klass = klass;
    32   if (classes_only) {
    32   if (classes_only) {
    33     _interfaces = Universe::the_empty_system_obj_array();
    33     _interfaces = Universe::the_empty_klass_array();
    34   } else {
    34   } else {
    35     _interfaces = klass->transitive_interfaces();
    35     _interfaces = klass->transitive_interfaces();
    36   }
    36   }
    37   _interface_index = _interfaces->length();
    37   _interface_index = _interfaces->length();
    38   _local_only = local_only;
    38   _local_only = local_only;
    45   if (!_klass->is_interface() && _klass->super() != NULL) {
    45   if (!_klass->is_interface() && _klass->super() != NULL) {
    46     // go up superclass chain (not for interfaces)
    46     // go up superclass chain (not for interfaces)
    47     _klass = _klass->super();
    47     _klass = _klass->super();
    48   } else {
    48   } else {
    49     if (_interface_index > 0) {
    49     if (_interface_index > 0) {
    50       _klass = klassOop(_interfaces->obj_at(--_interface_index));
    50       _klass = _interfaces->at(--_interface_index);
    51     } else {
    51     } else {
    52       return true;
    52       return true;
    53     }
    53     }
    54   }
    54   }
    55   _index = length();
    55   _index = length();
    68   _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
    68   _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
    69   // The latest version of vm may be used with old jdk.
    69   // The latest version of vm may be used with old jdk.
    70   if (JDK_Version::is_gte_jdk16x_version()) {
    70   if (JDK_Version::is_gte_jdk16x_version()) {
    71     // The following class fields do not exist in
    71     // The following class fields do not exist in
    72     // previous version of jdk.
    72     // previous version of jdk.
    73     offset = sun_reflect_ConstantPool::cp_oop_offset();
    73     offset = sun_reflect_ConstantPool::oop_offset();
    74     _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
    74     _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
    75     offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
    75     offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
    76     _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
    76     _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
    77   }
    77   }
    78 }
    78 }