< prev index next >

src/share/vm/code/codeCache.cpp

Print this page
rev 13455 : 8166317: InterpreterCodeSize should be computed
Reviewed-by: kvn

@@ -567,10 +567,24 @@
   get_code_heap(cb)->deallocate(cb);
 
   assert(heap->blob_count() >= 0, "sanity check");
 }
 
+void CodeCache::free_unused_tail(CodeBlob* cb, size_t used) {
+  assert_locked_or_safepoint(CodeCache_lock);
+  guarantee(cb->is_buffer_blob() && strncmp("Interpreter", cb->name(), 11) == 0, "Only possible for interpreter!");
+  print_trace("free_unused_tail", cb);
+
+  // Get heap for given CodeBlob and deallocate its unused tail
+  get_code_heap(cb)->deallocate_tail(cb, used);
+  // Adjust the sizes of the CodeBlob
+  cb->_size = used;
+  cb->_data_offset = used;
+  cb->_code_end = (address)cb + used;
+  cb->_data_end = (address)cb + used;
+}
+
 void CodeCache::commit(CodeBlob* cb) {
   // this is called by nmethod::nmethod, which must already own CodeCache_lock
   assert_locked_or_safepoint(CodeCache_lock);
   CodeHeap* heap = get_code_heap(cb);
   if (cb->is_nmethod()) {
< prev index next >