src/hotspot/share/prims/jvmtiTagMap.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 49734 f946776e9354
child 54786 ebf733a324d4
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49734
diff changeset
     2
 * Copyright (c) 2003, 2019, 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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
// JvmtiTagMap
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49734
diff changeset
    27
#ifndef SHARE_PRIMS_JVMTITAGMAP_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49734
diff changeset
    28
#define SHARE_PRIMS_JVMTITAGMAP_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 15432
diff changeset
    30
#include "gc/shared/collectedHeap.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "jvmtifiles/jvmti.h"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "jvmtifiles/jvmtiEnv.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "memory/universe.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// forward references
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class JvmtiTagHashmap;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class JvmtiTagHashmapEntry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class JvmtiTagHashmapEntryClosure;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 8921
diff changeset
    41
class JvmtiTagMap :  public CHeapObj<mtInternal> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  enum{
7896
08aadd7aa3ee 6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents: 7397
diff changeset
    45
    max_free_entries = 4096         // maximum number of free entries per env
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  JvmtiEnv*             _env;                       // the jvmti environment
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  Mutex                 _lock;                      // lock for this tag map
7896
08aadd7aa3ee 6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents: 7397
diff changeset
    50
  JvmtiTagHashmap*      _hashmap;                   // the hashmap
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  JvmtiTagHashmapEntry* _free_entries;              // free list for this environment
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  int _free_entries_count;                          // number of entries on the free list
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  // create a tag map
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  JvmtiTagMap(JvmtiEnv* env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  inline Mutex* lock()                      { return &_lock; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  inline JvmtiEnv* env() const              { return _env; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
32817
acc2744fd84b 8136627: Backout JDK-8133818 Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
kbarrett
parents: 32607
diff changeset
    62
  void do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // iterate over all entries in this tag map
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  void entry_iterate(JvmtiTagHashmapEntryClosure* closure);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // indicates if this tag map is locked
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  bool is_locked()                          { return lock()->is_locked(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
7896
08aadd7aa3ee 6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents: 7397
diff changeset
    72
  JvmtiTagHashmap* hashmap() { return _hashmap; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // create/destroy entries
7896
08aadd7aa3ee 6458402: 3 jvmti tests fail with CMS and +ExplicitGCInvokesConcurrent
kamg
parents: 7397
diff changeset
    75
  JvmtiTagHashmapEntry* create_entry(oop ref, jlong tag);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  void destroy_entry(JvmtiTagHashmapEntry* entry);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // returns true if the hashmaps are empty
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  bool is_empty();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  // return tag for the given environment
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  static JvmtiTagMap* tag_map_for(JvmtiEnv* env);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  // destroy tag map
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  ~JvmtiTagMap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // set/get tag
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  void set_tag(jobject obj, jlong tag);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  jlong get_tag(jobject obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  // deprecated heap iteration functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  void iterate_over_heap(jvmtiHeapObjectFilter object_filter,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 32817
diff changeset
    93
                         Klass* klass,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                         jvmtiHeapObjectCallback heap_object_callback,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
                         const void* user_data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  void iterate_over_reachable_objects(jvmtiHeapRootCallback heap_root_callback,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
                                      jvmtiStackReferenceCallback stack_ref_callback,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
                                      jvmtiObjectReferenceCallback object_ref_callback,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
                                      const void* user_data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  void iterate_over_objects_reachable_from_object(jobject object,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                                                  jvmtiObjectReferenceCallback object_reference_callback,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
                                                  const void* user_data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  // advanced (JVMTI 1.1) heap iteration functions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  void iterate_through_heap(jint heap_filter,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 32817
diff changeset
   109
                            Klass* klass,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                            const jvmtiHeapCallbacks* callbacks,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
                            const void* user_data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  void follow_references(jint heap_filter,
46329
53ccc37bda19 8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents: 32817
diff changeset
   114
                         Klass* klass,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
                         jobject initial_object,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
                         const jvmtiHeapCallbacks* callbacks,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
                         const void* user_data);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  // get tagged objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  jvmtiError get_objects_with_tags(const jlong* tags, jint count,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
                                   jint* count_ptr, jobject** object_result_ptr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
                                   jlong** tag_result_ptr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
32817
acc2744fd84b 8136627: Backout JDK-8133818 Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
kbarrett
parents: 32607
diff changeset
   124
  static void weak_oops_do(
acc2744fd84b 8136627: Backout JDK-8133818 Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
kbarrett
parents: 32607
diff changeset
   125
      BoolObjectClosure* is_alive, OopClosure* f) NOT_JVMTI_RETURN;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49734
diff changeset
   128
#endif // SHARE_PRIMS_JVMTITAGMAP_HPP