src/share/vm/prims/jvmtiTagMap.hpp

Wed, 28 Nov 2012 17:50:21 -0500

author
coleenp
date
Wed, 28 Nov 2012 17:50:21 -0500
changeset 4295
59c790074993
parent 4167
9855b7e559ae
child 4492
8b46b0196eb0
permissions
-rw-r--r--

8003635: NPG: AsynchGetCallTrace broken by Method* virtual call
Summary: Make metaspace::contains be lock free and used to see if something is in metaspace, also compare Method* with vtbl pointer.
Reviewed-by: dholmes, sspitsyn, dcubed, jmasa

duke@435 1 /*
jprovino@4165 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
duke@435 25 // JvmtiTagMap
duke@435 26
stefank@2314 27 #ifndef SHARE_VM_PRIMS_JVMTITAGMAP_HPP
stefank@2314 28 #define SHARE_VM_PRIMS_JVMTITAGMAP_HPP
stefank@2314 29
stefank@2314 30 #ifndef JVMTI_KERNEL
stefank@2314 31 #include "gc_interface/collectedHeap.hpp"
stefank@2314 32 #include "jvmtifiles/jvmti.h"
stefank@2314 33 #include "jvmtifiles/jvmtiEnv.hpp"
stefank@2314 34 #include "memory/allocation.hpp"
stefank@2314 35 #include "memory/genCollectedHeap.hpp"
stefank@2314 36 #include "memory/universe.hpp"
stefank@2314 37 #endif
duke@435 38
duke@435 39 // forward references
duke@435 40 class JvmtiTagHashmap;
duke@435 41 class JvmtiTagHashmapEntry;
duke@435 42 class JvmtiTagHashmapEntryClosure;
duke@435 43
zgu@3900 44 class JvmtiTagMap : public CHeapObj<mtInternal> {
duke@435 45 private:
duke@435 46
duke@435 47 enum{
kamg@2445 48 max_free_entries = 4096 // maximum number of free entries per env
duke@435 49 };
duke@435 50
duke@435 51 JvmtiEnv* _env; // the jvmti environment
duke@435 52 Mutex _lock; // lock for this tag map
kamg@2445 53 JvmtiTagHashmap* _hashmap; // the hashmap
duke@435 54
duke@435 55 JvmtiTagHashmapEntry* _free_entries; // free list for this environment
duke@435 56 int _free_entries_count; // number of entries on the free list
duke@435 57
duke@435 58 // create a tag map
duke@435 59 JvmtiTagMap(JvmtiEnv* env);
duke@435 60
duke@435 61 // accessors
duke@435 62 inline Mutex* lock() { return &_lock; }
duke@435 63 inline JvmtiEnv* env() const { return _env; }
duke@435 64
kamg@2445 65 void do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f);
duke@435 66
duke@435 67 // iterate over all entries in this tag map
duke@435 68 void entry_iterate(JvmtiTagHashmapEntryClosure* closure);
duke@435 69
duke@435 70 public:
duke@435 71
duke@435 72 // indicates if this tag map is locked
duke@435 73 bool is_locked() { return lock()->is_locked(); }
duke@435 74
kamg@2445 75 JvmtiTagHashmap* hashmap() { return _hashmap; }
duke@435 76
duke@435 77 // create/destroy entries
kamg@2445 78 JvmtiTagHashmapEntry* create_entry(oop ref, jlong tag);
duke@435 79 void destroy_entry(JvmtiTagHashmapEntry* entry);
duke@435 80
duke@435 81 // returns true if the hashmaps are empty
duke@435 82 bool is_empty();
duke@435 83
duke@435 84 // return tag for the given environment
duke@435 85 static JvmtiTagMap* tag_map_for(JvmtiEnv* env);
duke@435 86
duke@435 87 // destroy tag map
duke@435 88 ~JvmtiTagMap();
duke@435 89
duke@435 90 // set/get tag
duke@435 91 void set_tag(jobject obj, jlong tag);
duke@435 92 jlong get_tag(jobject obj);
duke@435 93
duke@435 94 // deprecated heap iteration functions
duke@435 95 void iterate_over_heap(jvmtiHeapObjectFilter object_filter,
duke@435 96 KlassHandle klass,
duke@435 97 jvmtiHeapObjectCallback heap_object_callback,
duke@435 98 const void* user_data);
duke@435 99
duke@435 100 void iterate_over_reachable_objects(jvmtiHeapRootCallback heap_root_callback,
duke@435 101 jvmtiStackReferenceCallback stack_ref_callback,
duke@435 102 jvmtiObjectReferenceCallback object_ref_callback,
duke@435 103 const void* user_data);
duke@435 104
duke@435 105 void iterate_over_objects_reachable_from_object(jobject object,
duke@435 106 jvmtiObjectReferenceCallback object_reference_callback,
duke@435 107 const void* user_data);
duke@435 108
duke@435 109
duke@435 110 // advanced (JVMTI 1.1) heap iteration functions
duke@435 111 void iterate_through_heap(jint heap_filter,
duke@435 112 KlassHandle klass,
duke@435 113 const jvmtiHeapCallbacks* callbacks,
duke@435 114 const void* user_data);
duke@435 115
duke@435 116 void follow_references(jint heap_filter,
duke@435 117 KlassHandle klass,
duke@435 118 jobject initial_object,
duke@435 119 const jvmtiHeapCallbacks* callbacks,
duke@435 120 const void* user_data);
duke@435 121
duke@435 122 // get tagged objects
duke@435 123 jvmtiError get_objects_with_tags(const jlong* tags, jint count,
duke@435 124 jint* count_ptr, jobject** object_result_ptr,
duke@435 125 jlong** tag_result_ptr);
duke@435 126
kamg@2445 127 static void weak_oops_do(
jprovino@4165 128 BoolObjectClosure* is_alive, OopClosure* f) NOT_JVMTI_RETURN;
duke@435 129 };
duke@435 130
stefank@2314 131 #endif // SHARE_VM_PRIMS_JVMTITAGMAP_HPP

mercurial