src/share/vm/services/serviceUtil.hpp

Tue, 24 Jul 2012 10:51:00 -0700

author
twisti
date
Tue, 24 Jul 2012 10:51:00 -0700
changeset 3969
1d7922586cf6
parent 2314
f95d63e2154a
child 4037
da91efe96a93
permissions
-rw-r--r--

7023639: JSR 292 method handle invocation needs a fast path for compiled code
6984705: JSR 292 method handle creation should not go through JNI
Summary: remove assembly code for JDK 7 chained method handles
Reviewed-by: jrose, twisti, kvn, mhaupt
Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>

duke@435 1 /*
stefank@2314 2 * Copyright (c) 2003, 2010, 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 // ignore KlassKlass
duke@435 47 if (o->is_klass()) {
duke@435 48 return false;
duke@435 49 }
duke@435 50
duke@435 51 // instance
duke@435 52 if (o->is_instance()) {
duke@435 53 // instance objects are visible
never@1577 54 if (o->klass() != SystemDictionary::Class_klass()) {
duke@435 55 return true;
duke@435 56 }
duke@435 57 if (java_lang_Class::is_primitive(o)) {
duke@435 58 return true;
duke@435 59 }
duke@435 60 // java.lang.Classes are visible
duke@435 61 o = java_lang_Class::as_klassOop(o);
duke@435 62 if (o->is_klass()) {
duke@435 63 // if it's a class for an object, an object array, or
duke@435 64 // primitive (type) array then it's visible.
duke@435 65 klassOop klass = (klassOop)o;
duke@435 66 if (Klass::cast(klass)->oop_is_instance()) {
duke@435 67 return true;
duke@435 68 }
duke@435 69 if (Klass::cast(klass)->oop_is_objArray()) {
duke@435 70 return true;
duke@435 71 }
duke@435 72 if (Klass::cast(klass)->oop_is_typeArray()) {
duke@435 73 return true;
duke@435 74 }
duke@435 75 }
duke@435 76 return false;
duke@435 77 }
duke@435 78 // object arrays are visible if they aren't system object arrays
duke@435 79 if (o->is_objArray()) {
duke@435 80 objArrayOop array = (objArrayOop)o;
duke@435 81 if (array->klass() != Universe::systemObjArrayKlassObj()) {
duke@435 82 return true;
duke@435 83 } else {
duke@435 84 return false;
duke@435 85 }
duke@435 86 }
duke@435 87 // type arrays are visible
duke@435 88 if (o->is_typeArray()) {
duke@435 89 return true;
duke@435 90 }
duke@435 91 // everything else (methodOops, ...) aren't visible
duke@435 92 return false;
duke@435 93 }; // end of visible_oop()
duke@435 94
duke@435 95 };
stefank@2314 96
stefank@2314 97 #endif // SHARE_VM_SERVICES_SERVICEUTIL_HPP

mercurial