src/share/vm/services/serviceUtil.hpp

Mon, 05 Nov 2012 15:30:22 -0500

author
zgu
date
Mon, 05 Nov 2012 15:30:22 -0500
changeset 4248
69ad7823b1ca
parent 4037
da91efe96a93
child 4278
070d523b96a7
permissions
-rw-r--r--

8001591: NMT: assertion failed: assert(rec->addr() + rec->size() <= cur->base()) failed: Can not overlap in memSnapshot.cpp
Summary: NMT should allow overlapping committed regions as long as they belong to the same reserved region
Reviewed-by: dholmes, coleenp

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.
coleenp@4037 60 Klass* klass = k;
duke@435 61 if (Klass::cast(klass)->oop_is_instance()) {
duke@435 62 return true;
duke@435 63 }
duke@435 64 if (Klass::cast(klass)->oop_is_objArray()) {
duke@435 65 return true;
duke@435 66 }
duke@435 67 if (Klass::cast(klass)->oop_is_typeArray()) {
duke@435 68 return true;
duke@435 69 }
duke@435 70 }
duke@435 71 return false;
duke@435 72 }
duke@435 73 // object arrays are visible if they aren't system object arrays
duke@435 74 if (o->is_objArray()) {
duke@435 75 return true;
duke@435 76 }
duke@435 77 // type arrays are visible
duke@435 78 if (o->is_typeArray()) {
duke@435 79 return true;
duke@435 80 }
coleenp@4037 81 // everything else (Method*s, ...) aren't visible
duke@435 82 return false;
duke@435 83 }; // end of visible_oop()
duke@435 84
duke@435 85 };
stefank@2314 86
stefank@2314 87 #endif // SHARE_VM_SERVICES_SERVICEUTIL_HPP

mercurial