< prev index next >

src/share/vm/prims/jvmtiTagMap.cpp

Print this page
rev 10741 : [backport] JVMTI lacks a few GC barriers/hooks

@@ -164,10 +164,15 @@
 
   // hash a given key (oop) with the specified size
   static unsigned int hash(oop key, int size) {
     // shift right to get better distribution (as these bits will be zero
     // with aligned addresses)
+#if INCLUDE_ALL_GCS
+    if (UseShenandoahGC) {
+      key = oopDesc::bs()->write_barrier(key);
+    }
+#endif
     unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key));
 #ifdef _LP64
     return (addr >> 3) % size;
 #else
     return (addr >> 2) % size;

@@ -300,11 +305,11 @@
   // find an entry in the hashmap, returns NULL if not found.
   inline JvmtiTagHashmapEntry* find(oop key) {
     unsigned int h = hash(key);
     JvmtiTagHashmapEntry* entry = _table[h];
     while (entry != NULL) {
-      if (entry->object() == key) {
+      if (oopDesc::equals(entry->object(), key)) {
          return entry;
       }
       entry = entry->next();
     }
     return NULL;

@@ -342,11 +347,11 @@
   inline JvmtiTagHashmapEntry* remove(oop key) {
     unsigned int h = hash(key);
     JvmtiTagHashmapEntry* entry = _table[h];
     JvmtiTagHashmapEntry* prev = NULL;
     while (entry != NULL) {
-      if (key == entry->object()) {
+      if (oopDesc::equals(key, entry->object())) {
         break;
       }
       prev = entry;
       entry = entry->next();
     }
< prev index next >