Skip to content

Commit 986a014

Browse files
author
Datadog Syncup Service
committed
Merge branch 'upstream-master'
2 parents 99ccfc8 + f735275 commit 986a014

File tree

57 files changed

+1066
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1066
-1110
lines changed

src/demo/share/java2d/J2DBench/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131

3232

3333
ifndef SOURCE
34-
export SOURCE := 7
34+
export SOURCE := 8
3535
endif
3636
ifndef TARGET
37-
export TARGET := 7
37+
export TARGET := 8
3838
endif
3939
ifndef JAVAC
4040
export JAVAC := javac

src/demo/share/java2d/J2DBench/build.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
<property name="dist" location="dist"/>
4040
<property name="resources" location="resources"/>
4141

42-
<condition property="source" value="7">
42+
<condition property="source" value="8">
4343
<not>
4444
<isset property="source"/>
4545
</not>
4646
</condition>
47-
<condition property="target" value="7">
47+
<condition property="target" value="8">
4848
<not>
4949
<isset property="target"/>
5050
</not>
@@ -54,11 +54,6 @@
5454
<isset property="java"/>
5555
</not>
5656
</condition>
57-
<condition property="javac" value="javac">
58-
<not>
59-
<isset property="javac"/>
60-
</not>
61-
</condition>
6257

6358
<target name="init">
6459
<!-- Create the time stamp -->
@@ -70,7 +65,7 @@
7065
<target name="compile" depends="init"
7166
description="compile the source " >
7267
<!-- Compile the java code from ${src} into ${build} -->
73-
<javac debug="off" source="${source}" target="${target}" srcdir="${src}" destdir="${build}" fork="true" executable="${javac}"/>
68+
<javac debug="off" source="${source}" target="${target}" srcdir="${src}" destdir="${build}"/>
7469
</target>
7570

7671
<target name="run" depends="dist"

src/hotspot/os/bsd/semaphore_bsd.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,23 @@
3131
#ifdef __APPLE__
3232
// OS X doesn't support unnamed POSIX semaphores, so the implementation in os_posix.cpp can't be used.
3333

34-
static const char* sem_init_strerror(kern_return_t value) {
34+
static const char* sem_strerror(kern_return_t value) {
3535
switch (value) {
36-
case KERN_INVALID_ARGUMENT: return "Invalid argument";
37-
case KERN_RESOURCE_SHORTAGE: return "Resource shortage";
38-
default: return "Unknown";
36+
case KERN_INVALID_ARGUMENT: return "Invalid argument";
37+
case KERN_RESOURCE_SHORTAGE: return "Resource shortage";
38+
case KERN_TERMINATED: return "Resource has been destroyed";
39+
case KERN_ABORTED: return "Operation was aborted";
40+
case KERN_INVALID_VALUE: return "Invalid time specified";
41+
case KERN_OPERATION_TIMED_OUT: return "Operation timed-out";
42+
default: return "Unknown";
3943
}
4044
}
4145

4246
OSXSemaphore::OSXSemaphore(uint value) {
4347
kern_return_t ret = semaphore_create(mach_task_self(), &_semaphore, SYNC_POLICY_FIFO, value);
4448

45-
guarantee(ret == KERN_SUCCESS, "Failed to create semaphore: %s", sem_init_strerror(ret));
49+
guarantee(ret == KERN_SUCCESS, "Failed to create semaphore: %s (0x%x)",
50+
sem_strerror(ret), (uint)ret);
4651
}
4752

4853
OSXSemaphore::~OSXSemaphore() {
@@ -53,7 +58,8 @@ void OSXSemaphore::signal(uint count) {
5358
for (uint i = 0; i < count; i++) {
5459
kern_return_t ret = semaphore_signal(_semaphore);
5560

56-
assert(ret == KERN_SUCCESS, "Failed to signal semaphore");
61+
assert(ret == KERN_SUCCESS, "Failed to signal semaphore: %s (0x%x)",
62+
sem_strerror(ret), (uint)ret);
5763
}
5864
}
5965

@@ -62,7 +68,8 @@ void OSXSemaphore::wait() {
6268
while ((ret = semaphore_wait(_semaphore)) == KERN_ABORTED) {
6369
// Semaphore was interrupted. Retry.
6470
}
65-
assert(ret == KERN_SUCCESS, "Failed to wait on semaphore");
71+
assert(ret == KERN_SUCCESS, "Failed to wait on semaphore: %s (0x%x)",
72+
sem_strerror(ret), (uint)ret);
6673
}
6774

6875
bool OSXSemaphore::trywait() {
@@ -100,6 +107,10 @@ bool OSXSemaphore::timedwait(int64_t millis) {
100107
kr = semaphore_timedwait(_semaphore, waitspec);
101108
}
102109

110+
assert(kr == KERN_SUCCESS || kr == KERN_OPERATION_TIMED_OUT,
111+
"Failed to timed-wait on semaphore: %s (0x%x)",
112+
sem_strerror(kr), (uint)kr);
113+
103114
return kr == KERN_SUCCESS;
104115
}
105116
#endif // __APPLE__

src/hotspot/share/code/nmethod.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,10 +1936,7 @@ void nmethod::inc_decompile_count() {
19361936
if (!is_compiled_by_c2() && !is_compiled_by_jvmci()) return;
19371937
// Could be gated by ProfileTraps, but do not bother...
19381938
#if INCLUDE_JVMCI
1939-
// Deoptimization count is used by the CompileBroker to reason about compilations
1940-
// it requests so do not pollute the count for deoptimizations in non-default (i.e.
1941-
// non-CompilerBroker) compilations.
1942-
if (is_jvmci_hosted()) {
1939+
if (jvmci_skip_profile_deopt()) {
19431940
return;
19441941
}
19451942
#endif
@@ -4066,7 +4063,7 @@ const char* nmethod::jvmci_name() {
40664063
return nullptr;
40674064
}
40684065

4069-
bool nmethod::is_jvmci_hosted() const {
4070-
return jvmci_nmethod_data() != nullptr && !jvmci_nmethod_data()->is_default();
4066+
bool nmethod::jvmci_skip_profile_deopt() const {
4067+
return jvmci_nmethod_data() != nullptr && !jvmci_nmethod_data()->profile_deopt();
40714068
}
40724069
#endif

src/hotspot/share/code/nmethod.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,9 @@ class nmethod : public CodeBlob {
914914
return jvmci_data_size() == 0 ? nullptr : (JVMCINMethodData*) jvmci_data_begin();
915915
}
916916

917-
// Returns true if a JVMCI compiled method is non-default,
918-
// i.e., not triggered by CompilerBroker
919-
bool is_jvmci_hosted() const;
917+
// Returns true if the runtime should NOT collect deoptimization profile for a JVMCI
918+
// compiled method
919+
bool jvmci_skip_profile_deopt() const;
920920
#endif
921921

922922
void oops_do(OopClosure* f) { oops_do(f, false); }

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ CompileTaskWrapper::~CompileTaskWrapper() {
236236
#if INCLUDE_JVMCI
237237
if (CompileBroker::compiler(task->comp_level())->is_jvmci()) {
238238
if (!task->has_waiter()) {
239-
// The waiting thread timed out and thus did not free the task.
239+
// The waiting thread timed out and thus did not delete the task.
240240
free_task = true;
241241
}
242242
task->set_blocking_jvmci_compile_state(nullptr);
@@ -249,15 +249,15 @@ CompileTaskWrapper::~CompileTaskWrapper() {
249249
}
250250
}
251251
if (free_task) {
252-
// The task can only be freed once the task lock is released.
253-
CompileTask::free(task);
252+
// The task can only be deleted once the task lock is released.
253+
delete task;
254254
}
255255
} else {
256256
task->mark_complete();
257257

258-
// By convention, the compiling thread is responsible for
259-
// recycling a non-blocking CompileTask.
260-
CompileTask::free(task);
258+
// By convention, the compiling thread is responsible for deleting
259+
// a non-blocking CompileTask.
260+
delete task;
261261
}
262262
}
263263

@@ -360,12 +360,12 @@ void CompileQueue::add(CompileTask* task) {
360360
}
361361

362362
/**
363-
* Empties compilation queue by putting all compilation tasks onto
364-
* a freelist. Furthermore, the method wakes up all threads that are
365-
* waiting on a compilation task to finish. This can happen if background
363+
* Empties compilation queue by deleting all compilation tasks.
364+
* Furthermore, the method wakes up all threads that are waiting
365+
* on a compilation task to finish. This can happen if background
366366
* compilation is disabled.
367367
*/
368-
void CompileQueue::free_all() {
368+
void CompileQueue::delete_all() {
369369
MutexLocker mu(MethodCompileQueue_lock);
370370
CompileTask* next = _first;
371371

@@ -385,11 +385,10 @@ void CompileQueue::free_all() {
385385
}
386386
}
387387
if (!found_waiter) {
388-
// If no one was waiting for this task, we need to free it ourselves. In this case, the task
389-
// is also certainly unlocked, because, again, there is no waiter.
390-
// Otherwise, by convention, it's the waiters responsibility to free the task.
391-
// Put the task back on the freelist.
392-
CompileTask::free(current);
388+
// If no one was waiting for this task, we need to delete it ourselves.
389+
// In this case, the task is also certainly unlocked, because, again, there is no waiter.
390+
// Otherwise, by convention, it's the waiters responsibility to delete the task.
391+
delete current;
393392
}
394393
}
395394
_first = nullptr;
@@ -1627,10 +1626,8 @@ CompileTask* CompileBroker::create_compile_task(CompileQueue* queue,
16271626
int hot_count,
16281627
CompileTask::CompileReason compile_reason,
16291628
bool blocking) {
1630-
CompileTask* new_task = CompileTask::allocate();
1631-
new_task->initialize(compile_id, method, osr_bci, comp_level,
1632-
hot_count, compile_reason,
1633-
blocking);
1629+
CompileTask* new_task = new CompileTask(compile_id, method, osr_bci, comp_level,
1630+
hot_count, compile_reason, blocking);
16341631
queue->add(new_task);
16351632
return new_task;
16361633
}
@@ -1651,7 +1648,7 @@ static const int JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS = 10;
16511648
* JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE *
16521649
* JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS.
16531650
*
1654-
* @return true if this thread needs to free/recycle the task
1651+
* @return true if this thread needs to delete the task
16551652
*/
16561653
bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask* task, JavaThread* thread) {
16571654
assert(UseJVMCICompiler, "sanity");
@@ -1734,19 +1731,19 @@ void CompileBroker::wait_for_completion(CompileTask* task) {
17341731

17351732
if (free_task) {
17361733
if (is_compilation_disabled_forever()) {
1737-
CompileTask::free(task);
1734+
delete task;
17381735
return;
17391736
}
17401737

17411738
// It is harmless to check this status without the lock, because
1742-
// completion is a stable property (until the task object is recycled).
1739+
// completion is a stable property (until the task object is deleted).
17431740
assert(task->is_complete(), "Compilation should have completed");
17441741

1745-
// By convention, the waiter is responsible for recycling a
1742+
// By convention, the waiter is responsible for deleting a
17461743
// blocking CompileTask. Since there is only one waiter ever
17471744
// waiting on a CompileTask, we know that no one else will
1748-
// be using this CompileTask; we can free it.
1749-
CompileTask::free(task);
1745+
// be using this CompileTask; we can delete it.
1746+
delete task;
17501747
}
17511748
}
17521749

@@ -1827,11 +1824,11 @@ void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerTh
18271824

18281825
// Delete all queued compilation tasks to make compiler threads exit faster.
18291826
if (_c1_compile_queue != nullptr) {
1830-
_c1_compile_queue->free_all();
1827+
_c1_compile_queue->delete_all();
18311828
}
18321829

18331830
if (_c2_compile_queue != nullptr) {
1834-
_c2_compile_queue->free_all();
1831+
_c2_compile_queue->delete_all();
18351832
}
18361833

18371834
// Set flags so that we continue execution with using interpreter only.

src/hotspot/share/compiler/compileBroker.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class CompileQueue : public CHeapObj<mtCompiler> {
140140

141141
// Redefine Classes support
142142
void mark_on_stack();
143-
void free_all();
143+
void delete_all();
144144
void print_tty();
145145
void print(outputStream* st = tty);
146146

src/hotspot/share/compiler/compileTask.cpp

Lines changed: 34 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -36,72 +36,15 @@
3636
#include "runtime/jniHandles.hpp"
3737
#include "runtime/mutexLocker.hpp"
3838

39-
CompileTask* CompileTask::_task_free_list = nullptr;
4039
int CompileTask::_active_tasks = 0;
4140

42-
/**
43-
* Allocate a CompileTask, from the free list if possible.
44-
*/
45-
CompileTask* CompileTask::allocate() {
46-
MonitorLocker locker(CompileTaskAlloc_lock);
47-
CompileTask* task = nullptr;
48-
49-
if (_task_free_list != nullptr) {
50-
task = _task_free_list;
51-
_task_free_list = task->next();
52-
task->set_next(nullptr);
53-
} else {
54-
task = new CompileTask();
55-
task->set_next(nullptr);
56-
task->set_is_free(true);
57-
}
58-
assert(task->is_free(), "Task must be free.");
59-
task->set_is_free(false);
60-
_active_tasks++;
61-
return task;
62-
}
63-
64-
/**
65-
* Add a task to the free list.
66-
*/
67-
void CompileTask::free(CompileTask* task) {
68-
MonitorLocker locker(CompileTaskAlloc_lock);
69-
if (!task->is_free()) {
70-
if ((task->_method_holder != nullptr && JNIHandles::is_weak_global_handle(task->_method_holder))) {
71-
JNIHandles::destroy_weak_global(task->_method_holder);
72-
} else {
73-
JNIHandles::destroy_global(task->_method_holder);
74-
}
75-
if (task->_failure_reason_on_C_heap && task->_failure_reason != nullptr) {
76-
os::free((void*) task->_failure_reason);
77-
}
78-
task->_failure_reason = nullptr;
79-
task->_failure_reason_on_C_heap = false;
80-
81-
task->set_is_free(true);
82-
task->set_next(_task_free_list);
83-
_task_free_list = task;
84-
_active_tasks--;
85-
if (_active_tasks == 0) {
86-
locker.notify_all();
87-
}
88-
}
89-
}
90-
91-
void CompileTask::wait_for_no_active_tasks() {
92-
MonitorLocker locker(CompileTaskAlloc_lock);
93-
while (_active_tasks > 0) {
94-
locker.wait();
95-
}
96-
}
97-
98-
void CompileTask::initialize(int compile_id,
99-
const methodHandle& method,
100-
int osr_bci,
101-
int comp_level,
102-
int hot_count,
103-
CompileTask::CompileReason compile_reason,
104-
bool is_blocking) {
41+
CompileTask::CompileTask(int compile_id,
42+
const methodHandle& method,
43+
int osr_bci,
44+
int comp_level,
45+
int hot_count,
46+
CompileReason compile_reason,
47+
bool is_blocking) {
10548
Thread* thread = Thread::current();
10649
_compile_id = compile_id;
10750
_method = method();
@@ -133,6 +76,33 @@ void CompileTask::initialize(int compile_id,
13376
_arena_bytes = 0;
13477

13578
_next = nullptr;
79+
80+
Atomic::add(&_active_tasks, 1, memory_order_relaxed);
81+
}
82+
83+
CompileTask::~CompileTask() {
84+
if (_method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder)) {
85+
JNIHandles::destroy_weak_global(_method_holder);
86+
} else {
87+
JNIHandles::destroy_global(_method_holder);
88+
}
89+
if (_failure_reason_on_C_heap && _failure_reason != nullptr) {
90+
os::free((void*) _failure_reason);
91+
_failure_reason = nullptr;
92+
_failure_reason_on_C_heap = false;
93+
}
94+
95+
if (Atomic::sub(&_active_tasks, 1, memory_order_relaxed) == 0) {
96+
MonitorLocker wait_ml(CompileTaskWait_lock);
97+
wait_ml.notify_all();
98+
}
99+
}
100+
101+
void CompileTask::wait_for_no_active_tasks() {
102+
MonitorLocker locker(CompileTaskWait_lock);
103+
while (Atomic::load(&_active_tasks) > 0) {
104+
locker.wait();
105+
}
136106
}
137107

138108
/**

0 commit comments

Comments
 (0)