src/share/vm/prims/jvmtiTagMap.hpp

Tue, 06 Jan 2009 07:05:05 -0800

author
jmasa
date
Tue, 06 Jan 2009 07:05:05 -0800
changeset 952
e9be0e04635a
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6689653: JMapPerm fails with UseConcMarkSweepIncGC and compressed oops off
Summary: Added safe_object_iterate() for use by JMapPerm.
Reviewed-by: tonyp

duke@435 1 /*
duke@435 2 * Copyright 2003-2005 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // JvmtiTagMap
duke@435 26
duke@435 27 #ifndef _JAVA_JVMTI_TAG_MAP_H_
duke@435 28 #define _JAVA_JVMTI_TAG_MAP_H_
duke@435 29
duke@435 30 // forward references
duke@435 31 class JvmtiTagHashmap;
duke@435 32 class JvmtiTagHashmapEntry;
duke@435 33 class JvmtiTagHashmapEntryClosure;
duke@435 34
duke@435 35 class JvmtiTagMap : public CHeapObj {
duke@435 36 private:
duke@435 37
duke@435 38 enum{
duke@435 39 n_hashmaps = 2, // encapsulates 2 hashmaps
duke@435 40 max_free_entries = 4096 // maximum number of free entries per env
duke@435 41 };
duke@435 42
duke@435 43 // memory region for young generation
duke@435 44 static MemRegion _young_gen;
duke@435 45 static void get_young_generation();
duke@435 46
duke@435 47 JvmtiEnv* _env; // the jvmti environment
duke@435 48 Mutex _lock; // lock for this tag map
duke@435 49 JvmtiTagHashmap* _hashmap[n_hashmaps]; // the hashmaps
duke@435 50
duke@435 51 JvmtiTagHashmapEntry* _free_entries; // free list for this environment
duke@435 52 int _free_entries_count; // number of entries on the free list
duke@435 53
duke@435 54 // create a tag map
duke@435 55 JvmtiTagMap(JvmtiEnv* env);
duke@435 56
duke@435 57 // accessors
duke@435 58 inline Mutex* lock() { return &_lock; }
duke@435 59 inline JvmtiEnv* env() const { return _env; }
duke@435 60
duke@435 61 // rehash tags maps for generation start to end
duke@435 62 void rehash(int start, int end);
duke@435 63
duke@435 64 // indicates if the object is in the young generation
duke@435 65 static bool is_in_young(oop o);
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
duke@435 75 // return the appropriate hashmap for a given object
duke@435 76 JvmtiTagHashmap* hashmap_for(oop o);
duke@435 77
duke@435 78 // create/destroy entries
duke@435 79 JvmtiTagHashmapEntry* create_entry(jweak ref, jlong tag);
duke@435 80 void destroy_entry(JvmtiTagHashmapEntry* entry);
duke@435 81
duke@435 82 // returns true if the hashmaps are empty
duke@435 83 bool is_empty();
duke@435 84
duke@435 85 // return tag for the given environment
duke@435 86 static JvmtiTagMap* tag_map_for(JvmtiEnv* env);
duke@435 87
duke@435 88 // destroy tag map
duke@435 89 ~JvmtiTagMap();
duke@435 90
duke@435 91 // set/get tag
duke@435 92 void set_tag(jobject obj, jlong tag);
duke@435 93 jlong get_tag(jobject obj);
duke@435 94
duke@435 95 // deprecated heap iteration functions
duke@435 96 void iterate_over_heap(jvmtiHeapObjectFilter object_filter,
duke@435 97 KlassHandle klass,
duke@435 98 jvmtiHeapObjectCallback heap_object_callback,
duke@435 99 const void* user_data);
duke@435 100
duke@435 101 void iterate_over_reachable_objects(jvmtiHeapRootCallback heap_root_callback,
duke@435 102 jvmtiStackReferenceCallback stack_ref_callback,
duke@435 103 jvmtiObjectReferenceCallback object_ref_callback,
duke@435 104 const void* user_data);
duke@435 105
duke@435 106 void iterate_over_objects_reachable_from_object(jobject object,
duke@435 107 jvmtiObjectReferenceCallback object_reference_callback,
duke@435 108 const void* user_data);
duke@435 109
duke@435 110
duke@435 111 // advanced (JVMTI 1.1) heap iteration functions
duke@435 112 void iterate_through_heap(jint heap_filter,
duke@435 113 KlassHandle klass,
duke@435 114 const jvmtiHeapCallbacks* callbacks,
duke@435 115 const void* user_data);
duke@435 116
duke@435 117 void follow_references(jint heap_filter,
duke@435 118 KlassHandle klass,
duke@435 119 jobject initial_object,
duke@435 120 const jvmtiHeapCallbacks* callbacks,
duke@435 121 const void* user_data);
duke@435 122
duke@435 123 // get tagged objects
duke@435 124 jvmtiError get_objects_with_tags(const jlong* tags, jint count,
duke@435 125 jint* count_ptr, jobject** object_result_ptr,
duke@435 126 jlong** tag_result_ptr);
duke@435 127
duke@435 128 // call post-GC to rehash the tag maps.
duke@435 129 static void gc_epilogue(bool full);
duke@435 130
duke@435 131 // call after referencing processing has completed (CMS)
duke@435 132 static void cms_ref_processing_epilogue();
duke@435 133 };
duke@435 134
duke@435 135 #endif /* _JAVA_JVMTI_TAG_MAP_H_ */

mercurial