--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Tue Jun 21 15:02:45 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Wed Jun 22 10:49:23 2016 +0200
@@ -137,7 +137,9 @@
do {
// Drain the overflow stack first, so other threads can steal.
while (_refs->pop_overflow(ref)) {
- dispatch_reference(ref);
+ if (!_refs->try_push_to_taskqueue(ref)) {
+ dispatch_reference(ref);
+ }
}
while (_refs->pop_local(ref)) {
--- a/hotspot/src/share/vm/gc/shared/taskqueue.hpp Tue Jun 21 15:02:45 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.hpp Wed Jun 22 10:49:23 2016 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -330,6 +330,8 @@
// Push task t onto the queue or onto the overflow stack. Return true.
inline bool push(E t);
+ // Try to push task t onto the queue only. Returns true if successful, false otherwise.
+ inline bool try_push_to_taskqueue(E t);
// Attempt to pop from the overflow stack; return true if anything was popped.
inline bool pop_overflow(E& t);
--- a/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp Tue Jun 21 15:02:45 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp Wed Jun 22 10:49:23 2016 +0200
@@ -103,6 +103,11 @@
return true;
}
+template <class E, MEMFLAGS F, unsigned int N>
+inline bool OverflowTaskQueue<E, F, N>::try_push_to_taskqueue(E t) {
+ return taskqueue_t::push(t);
+}
+
// pop_local_slow() is done by the owning thread and is trying to
// get the last task in the queue. It will compete with pop_global()
// that will be used by other threads. The tag age is incremented