< prev index next >
src/hotspot/share/runtime/thread.cpp
Print this page
*** 48,57 ****
--- 48,58 ----
#include "memory/universe.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/objArrayOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
+ #include "oops/valueKlass.hpp"
#include "oops/verifyOopClosure.hpp"
#include "prims/jvm.h"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
*** 277,286 ****
--- 278,289 ----
_ParkEvent = ParkEvent::Allocate(this);
_SleepEvent = ParkEvent::Allocate(this);
_MutexEvent = ParkEvent::Allocate(this);
_MuxEvent = ParkEvent::Allocate(this);
+ _buffered_values_dealiaser = NULL;
+
#ifdef CHECK_UNHANDLED_OOPS
if (CheckUnhandledOops) {
_unhandled_oops = new UnhandledOops(this);
}
#endif // CHECK_UNHANDLED_OOPS
*** 1434,1443 ****
--- 1437,1447 ----
set_entry_point(NULL);
set_jni_functions(jni_functions());
set_callee_target(NULL);
set_vm_result(NULL);
set_vm_result_2(NULL);
+ set_return_buffered_value(NULL);
set_vframe_array_head(NULL);
set_vframe_array_last(NULL);
set_deferred_locals(NULL);
set_deopt_mark(NULL);
set_deopt_compiled_method(NULL);
*** 1507,1516 ****
--- 1511,1521 ----
// Buffered value types support
_vt_alloc_ptr = NULL;
_vt_alloc_limit = NULL;
_local_free_chunk = NULL;
+ _current_vtbuffer_mark = VTBuffer::mark_A;
// Buffered value types instrumentation support
_vtchunk_in_use = 0;
_vtchunk_max = 0;
_vtchunk_total_returned = 0;
_vtchunk_total_failed = 0;
*** 1650,1659 ****
--- 1655,1675 ----
// All Java related clean up happens in exit
ThreadSafepointState::destroy(this);
if (_thread_stat != NULL) delete _thread_stat;
+ if (_vt_alloc_ptr != NULL) {
+ VTBufferChunk* chunk = VTBufferChunk::chunk(_vt_alloc_ptr);
+ while (chunk != NULL) {
+ VTBufferChunk* temp = chunk->prev();
+ VTBuffer::recycle_chunk(this, chunk);
+ chunk = temp;
+ }
+ _vt_alloc_ptr = NULL;
+ _vt_alloc_limit = NULL;
+ }
+
#if INCLUDE_JVMCI
if (JVMCICounterSize > 0) {
if (jvmci_counters_include(this)) {
for (int i = 0; i < JVMCICounterSize; i++) {
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
*** 2648,2657 ****
--- 2664,2677 ----
}
void JavaThread::frames_do(void f(frame*, const RegisterMap* map)) {
// ignore is there is no stack
if (!has_last_Java_frame()) return;
+ // Because this method is used to verify oops, it must support
+ // oops in buffered values
+ BufferedValuesDealiaser dealiaser(this);
+
// traverse the stack frames. Starts from top frame.
for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
frame* fr = fst.current();
f(fr, fst.register_map());
}
*** 2760,2769 ****
--- 2780,2791 ----
void JavaThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
// Verify that the deferred card marks have been flushed.
assert(deferred_card_mark().is_empty(), "Should be empty during GC");
+ BufferedValuesDealiaser dealiaser(this);
+
// Traverse the GCHandles
Thread::oops_do(f, cf);
JVMCI_ONLY(f->do_oop((oop*)&_pending_failed_speculation);)
*** 2780,2790 ****
--- 2802,2818 ----
}
// traverse the registered growable array
if (_array_for_gc != NULL) {
for (int index = 0; index < _array_for_gc->length(); index++) {
+ if (!VTBuffer::is_in_vt_buffer(_array_for_gc->at(index))) {
f->do_oop(_array_for_gc->adr_at(index));
+ } else {
+ oop value = _array_for_gc->at(index);
+ assert(value->is_value(), "Sanity check");
+ dealiaser.oops_do(f, value);
+ }
}
}
// Traverse the monitor chunks
for (MonitorChunk* chunk = monitor_chunks(); chunk != NULL; chunk = chunk->next()) {
*** 2813,2825 ****
}
// Traverse instance variables at the end since the GC may be moving things
// around using this function
f->do_oop((oop*) &_threadObj);
! // 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);
if (jvmti_thread_state() != NULL) {
--- 2841,2855 ----
}
// Traverse instance variables at the end since the GC may be moving things
// around using this function
f->do_oop((oop*) &_threadObj);
! if (!VTBuffer::is_in_vt_buffer(_vm_result)) {
f->do_oop((oop*) &_vm_result);
+ } else {
+ assert(_vm_result->is_value(), "Must be a value");
+ dealiaser.oops_do(f, _vm_result);
}
f->do_oop((oop*) &_exception_oop);
f->do_oop((oop*) &_pending_async_exception);
if (jvmti_thread_state() != NULL) {
< prev index next >