src/hotspot/share/services/serviceUtil.hpp
author kbarrett
Tue, 21 Nov 2017 09:47:55 -0500
changeset 48787 7638bf98a312
parent 47216 71c04702a3d5
child 49063 c21904b367f4
permissions -rw-r--r--
8194312: Support parallel and concurrent JNI global handle processing Summary: Add OopStorage, change JNI gloabl/weak to use OopStorage. Reviewed-by: coleenp, sspitsyn, eosterlund
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
48787
7638bf98a312 8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4571
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4571
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4571
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_SERVICES_SERVICEUTIL_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_SERVICES_SERVICEUTIL_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "classfile/systemDictionary.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "oops/objArrayOop.hpp"
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 33611
diff changeset
    30
#include "oops/oop.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// Serviceability utility functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// (Shared by MM and JVMTI).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class ServiceUtil : public AllStatic {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  // Return true if oop represents an object that is "visible"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // to the java world.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  static inline bool visible_oop(oop o) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    // instance
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    if (o->is_instance()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
      // instance objects are visible
4571
80b553bddc26 6914300: ciEnv should export all well known classes
never
parents: 1
diff changeset
    45
      if (o->klass() != SystemDictionary::Class_klass()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
        return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      if (java_lang_Class::is_primitive(o)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
        return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
      // java.lang.Classes are visible
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    52
      Klass* k = java_lang_Class::as_Klass(o);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    53
      if (k->is_klass()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        // if it's a class for an object, an object array, or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        // primitive (type) array then it's visible.
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 14488
diff changeset
    56
        if (k->is_instance_klass()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
          return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
        }
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 14488
diff changeset
    59
        if (k->is_objArray_klass()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
          return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
        }
33611
9abd65805e19 8139203: Consistent naming for klass type predicates
coleenp
parents: 14488
diff changeset
    62
        if (k->is_typeArray_klass()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
          return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    // object arrays are visible if they aren't system object arrays
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    if (o->is_objArray()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    // type arrays are visible
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    if (o->is_typeArray()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    76
    // everything else (Method*s, ...) aren't visible
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  };   // end of visible_oop()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    81
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    82
#endif // SHARE_VM_SERVICES_SERVICEUTIL_HPP