< prev index next >

src/hotspot/share/code/codeCache.cpp

Print this page

        

@@ -643,10 +643,30 @@
     }
   }
   return NULL;
 }
 
+CodeBlob* CodeCache::patch_nop(NativePostCallNop* nop, void* pc, int& slot) {
+  CodeBlob* cb = CodeCache::find_blob(pc);
+  int oopmap_slot = cb->oop_maps()->find_slot_for_offset((intptr_t) pc - (intptr_t) cb->code_begin());
+  intptr_t cbaddr = (intptr_t) cb;
+  intptr_t offset = ((intptr_t) pc) - cbaddr;
+
+  if (((oopmap_slot & 0xff) == oopmap_slot) && ((offset & 0xffffff) == offset)) {
+    jint value = (oopmap_slot << 24) | (jint) offset;
+    nop->patch(value);
+    slot = oopmap_slot;
+  } else {
+    slot = -1;
+    log_debug(codecache)("failed to encode %d %d", oopmap_slot, (int) offset);
+  }
+#ifdef CONT_DOUBLE_NOP
+  assert (!nop->is_mode2(), "");
+#endif
+  return cb;
+}
+
 nmethod* CodeCache::find_nmethod(void* start) {
   CodeBlob* cb = find_blob(start);
   assert(cb->is_nmethod(), "did not find an nmethod");
   return (nmethod*)cb;
 }
< prev index next >