src/share/vm/services/serviceUtil.hpp

Mon, 31 Mar 2014 13:09:35 -0700

author
minqi
date
Mon, 31 Mar 2014 13:09:35 -0700
changeset 6535
f42c10a3d4b1
parent 4278
070d523b96a7
child 6876
710a3c8b516e
permissions
-rw-r--r--

7090324: gclog rotation via external tool
Summary: GC log rotation can be set via java command line, but customer sometime need to sync with OS level rotation setting.
Reviewed-by: sla, minqi, ehelin
Contributed-by: suenaga.yasumasa@lab.ntt.co.jp

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_SERVICES_SERVICEUTIL_HPP
stefank@2314 26 #define SHARE_VM_SERVICES_SERVICEUTIL_HPP
stefank@2314 27
stefank@2314 28 #include "classfile/systemDictionary.hpp"
stefank@2314 29 #include "oops/objArrayOop.hpp"
stefank@2314 30
duke@435 31 //
duke@435 32 // Serviceability utility functions.
duke@435 33 // (Shared by MM and JVMTI).
duke@435 34 //
duke@435 35 class ServiceUtil : public AllStatic {
duke@435 36 public:
duke@435 37
duke@435 38 // Return true if oop represents an object that is "visible"
duke@435 39 // to the java world.
duke@435 40 static inline bool visible_oop(oop o) {
duke@435 41 // the sentinel for deleted handles isn't visible
duke@435 42 if (o == JNIHandles::deleted_handle()) {
duke@435 43 return false;
duke@435 44 }
duke@435 45
duke@435 46 // instance
duke@435 47 if (o->is_instance()) {
duke@435 48 // instance objects are visible
never@1577 49 if (o->klass() != SystemDictionary::Class_klass()) {
duke@435 50 return true;
duke@435 51 }
duke@435 52 if (java_lang_Class::is_primitive(o)) {
duke@435 53 return true;
duke@435 54 }
duke@435 55 // java.lang.Classes are visible
coleenp@4037 56 Klass* k = java_lang_Class::as_Klass(o);
coleenp@4037 57 if (k->is_klass()) {
duke@435 58 // if it's a class for an object, an object array, or
duke@435 59 // primitive (type) array then it's visible.
hseigel@4278 60 if (k->oop_is_instance()) {
duke@435 61 return true;
duke@435 62 }
hseigel@4278 63 if (k->oop_is_objArray()) {
duke@435 64 return true;
duke@435 65 }
hseigel@4278 66 if (k->oop_is_typeArray()) {
duke@435 67 return true;
duke@435 68 }
duke@435 69 }
duke@435 70 return false;
duke@435 71 }
duke@435 72 // object arrays are visible if they aren't system object arrays
duke@435 73 if (o->is_objArray()) {
duke@435 74 return true;
duke@435 75 }
duke@435 76 // type arrays are visible
duke@435 77 if (o->is_typeArray()) {
duke@435 78 return true;
duke@435 79 }
coleenp@4037 80 // everything else (Method*s, ...) aren't visible
duke@435 81 return false;
duke@435 82 }; // end of visible_oop()
duke@435 83
duke@435 84 };
stefank@2314 85
stefank@2314 86 #endif // SHARE_VM_SERVICES_SERVICEUTIL_HPP

mercurial