--- old/src/share/vm/runtime/thread.cpp 2017-06-20 16:28:52.498348779 -0400 +++ new/src/share/vm/runtime/thread.cpp 2017-06-20 16:28:51.894345784 -0400 @@ -840,6 +840,16 @@ } } +void JavaThread::print_vt_buffer_stats_on(outputStream* st) const { + st->print_cr("%s:", this->name()); + st->print_cr("\tChunks in use : %d", vtchunk_in_use()); + st->print_cr("\tCached chunk : %d", local_free_chunk() == NULL ? 0 : 1); + st->print_cr("\tMax chunks : %d", vtchunk_max()); + st->print_cr("\tReturned chunks: %d", vtchunk_total_returned()); + st->print_cr("\tMemory buffered: %ld", vtchunk_total_memory_buffered()); + st->print_cr(""); +} + #ifdef ASSERT void Thread::print_owned_locks_on(outputStream* st) const { Monitor *cur = _owned_locks; @@ -1511,6 +1521,16 @@ _popframe_preserved_args_size = 0; _frames_to_pop_failed_realloc = 0; + // Buffered value types support + _vt_alloc_ptr = NULL; + _vt_alloc_limit = NULL; + _local_free_chunk = NULL; + // Buffered value types instrumentation support + _vtchunk_in_use = 0; + _vtchunk_max = 0; + _vtchunk_total_returned = 0; + _vtchunk_total_memory_buffered = 0; + pd_initialize(); } @@ -2821,7 +2841,10 @@ // Traverse instance variables at the end since the GC may be moving things // around using this function f->do_oop((oop*) &_threadObj); - f->do_oop((oop*) &_vm_result); + // if (Universe::heap()->is_in_reserved_or_null((void*)_vm_result)) { + if (!VTBufferChunk::check_buffered(&_vm_result)) { + f->do_oop((oop*) &_vm_result); + } f->do_oop((oop*) &_exception_oop); f->do_oop((oop*) &_pending_async_exception); @@ -4877,3 +4900,9 @@ VMThread* thread = VMThread::vm_thread(); if (thread != NULL) thread->verify(); } + +void Threads::print_vt_buffer_stats_on(outputStream* st) { + ALL_JAVA_THREADS(p) { + p->print_vt_buffer_stats_on(st); + } +}