Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added DONT_MERGE
Empty file.
12 changes: 12 additions & 0 deletions openjdk/mmtkUpcalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ static void mmtk_resume_mutators(void *tls) {
MutexLockerEx locker(MMTkHeap::heap()->gc_lock(), Mutex::_no_safepoint_check_flag);
MMTkHeap::heap()->gc_lock()->notify_all();
}

log_debug(gc)("Notifying mutators blocking on Heap_lock for reference pending list...");
// Note: That's the ReferenceHandler thread.
{
MutexLockerEx x(Heap_lock, Mutex::_no_safepoint_check_flag);
if (Universe::has_reference_pending_list()) {
Heap_lock->notify_all();
}
}
}

static const int GC_THREAD_KIND_WORKER = 1;
Expand Down Expand Up @@ -293,6 +302,8 @@ static void mmtk_enqueue_references(void** objects, size_t len) {
return;
}

MutexLocker x(Heap_lock);

oop first = (oop) objects[0]; // This points to the first node of the linked list.
oop last = first; // This points to the last node of the linked list.

Expand All @@ -313,6 +324,7 @@ static void mmtk_enqueue_references(void** objects, size_t len) {

oop old_first = Universe::swap_reference_pending_list(first);
HeapAccess<AS_NO_KEEPALIVE>::oop_store_at(last, java_lang_ref_Reference::discovered_offset, old_first);
assert(Universe::has_reference_pending_list(), "Reference pending list is empty after swap");
}

OpenJDK_Upcalls mmtk_upcalls = {
Expand Down
13 changes: 0 additions & 13 deletions openjdk/mmtkVMOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,8 @@ VM_MMTkSTWOperation::VM_MMTkSTWOperation(MMTkVMCompanionThread *companion_thread
_companion_thread(companion_thread) {
}

bool VM_MMTkSTWOperation::doit_prologue() {
Heap_lock->lock();
return true;
}

void VM_MMTkSTWOperation::doit() {
log_trace(vmthread)("Entered VM_MMTkSTWOperation::doit().");
_companion_thread->do_mmtk_stw_operation();
log_trace(vmthread)("Leaving VM_MMTkSTWOperation::doit()");
}

void VM_MMTkSTWOperation::doit_epilogue() {
// Notify the reference processing thread
if (Universe::has_reference_pending_list()) {
Heap_lock->notify_all();
}
Heap_lock->unlock();
}
2 changes: 0 additions & 2 deletions openjdk/mmtkVMOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ class VM_MMTkSTWOperation : public VM_MMTkOperation {

public:
VM_MMTkSTWOperation(MMTkVMCompanionThread *companion_thread);
virtual bool doit_prologue() override;
virtual void doit() override;
virtual void doit_epilogue() override;
};

#endif // MMTK_OPENJDK_MMTK_VM_OPERATION_HPP
Loading