Skip to content

Commit e2cce14

Browse files
Merge remote-tracking branch 'upstream/master' into 8359760-rm-jsobject
2 parents fad709a + eceb3bb commit e2cce14

File tree

91 files changed

+1284
-413
lines changed

Some content is hidden

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

91 files changed

+1284
-413
lines changed

.github/actions/build-jtreg/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ runs:
6565
with:
6666
name: bundles-jtreg-${{ steps.version.outputs.value }}
6767
path: jtreg/installed
68-
retention-days: 1
68+
retention-days: 5

.github/actions/upload-bundles/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,5 @@ runs:
9191
with:
9292
name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }}${{ inputs.static-suffix }}${{ inputs.bundle-suffix }}
9393
path: bundles
94-
retention-days: 1
94+
retention-days: 5
9595
if: steps.bundles.outputs.bundles-found == 'true'

src/hotspot/cpu/x86/vm_version_x86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, };
4949

5050
#define DECLARE_CPU_FEATURE_NAME(id, name, bit) name,
5151
const char* VM_Version::_features_names[] = { CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_NAME)};
52-
#undef DECLARE_CPU_FEATURE_FLAG
52+
#undef DECLARE_CPU_FEATURE_NAME
5353

5454
// Address of instruction which causes SEGV
5555
address VM_Version::_cpuinfo_segv_addr = nullptr;

src/hotspot/share/asm/codeBuffer.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ csize_t CodeBuffer::total_relocation_size() const {
626626
return (csize_t) align_up(total, HeapWordSize);
627627
}
628628

629-
csize_t CodeBuffer::copy_relocations_to(address buf, csize_t buf_limit, bool only_inst) const {
629+
csize_t CodeBuffer::copy_relocations_to(address buf, csize_t buf_limit) const {
630630
csize_t buf_offset = 0;
631631
csize_t code_end_so_far = 0;
632632
csize_t code_point_so_far = 0;
@@ -635,10 +635,6 @@ csize_t CodeBuffer::copy_relocations_to(address buf, csize_t buf_limit, bool onl
635635
assert(buf_limit % HeapWordSize == 0, "buf must be evenly sized");
636636

637637
for (int n = (int) SECT_FIRST; n < (int)SECT_LIMIT; n++) {
638-
if (only_inst && (n != (int)SECT_INSTS)) {
639-
// Need only relocation info for code.
640-
continue;
641-
}
642638
// pull relocs out of each section
643639
const CodeSection* cs = code_section(n);
644640
assert(!(cs->is_empty() && cs->locs_count() > 0), "sanity");
@@ -705,7 +701,7 @@ csize_t CodeBuffer::copy_relocations_to(address buf, csize_t buf_limit, bool onl
705701
buf_offset += sizeof(relocInfo);
706702
}
707703

708-
assert(only_inst || code_end_so_far == total_content_size(), "sanity");
704+
assert(code_end_so_far == total_content_size(), "sanity");
709705

710706
return buf_offset;
711707
}
@@ -721,7 +717,7 @@ csize_t CodeBuffer::copy_relocations_to(CodeBlob* dest) const {
721717
}
722718
// if dest is null, this is just the sizing pass
723719
//
724-
buf_offset = copy_relocations_to(buf, buf_limit, false);
720+
buf_offset = copy_relocations_to(buf, buf_limit);
725721

726722
return buf_offset;
727723
}

src/hotspot/share/asm/codeBuffer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
641641
// copies combined relocations to the blob, returns bytes copied
642642
// (if target is null, it is a dry run only, just for sizing)
643643
csize_t copy_relocations_to(CodeBlob* blob) const;
644+
csize_t copy_relocations_to(address buf, csize_t buf_limit) const;
644645

645646
// copies combined code to the blob (assumes relocs are already in there)
646647
void copy_code_to(CodeBlob* blob);
@@ -791,8 +792,6 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
791792

792793
int total_skipped_instructions_size() const;
793794

794-
csize_t copy_relocations_to(address buf, csize_t buf_limit, bool only_inst) const;
795-
796795
// allocated size of any and all recorded oops
797796
csize_t total_oop_size() const {
798797
OopRecorder* recorder = oop_recorder();

src/hotspot/share/cds/cdsConfig.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ void CDSConfig::check_aotmode_create() {
598598
//
599599
// Since application is not executed in the assembly phase, there's no need to load
600600
// the agents anyway -- no one will notice that the agents are not loaded.
601+
log_info(aot)("Disabled all JVMTI agents during -XX:AOTMode=create");
601602
JvmtiAgentList::disable_agent_list();
602603
}
603604

@@ -702,6 +703,13 @@ bool CDSConfig::check_vm_args_consistency(bool patch_mod_javabase, bool mode_fla
702703
}
703704
}
704705

706+
if (is_dumping_classic_static_archive() && AOTClassLinking) {
707+
if (JvmtiAgentList::disable_agent_list()) {
708+
FLAG_SET_ERGO(AllowArchivingWithJavaAgent, false);
709+
log_warning(cds)("Disabled all JVMTI agents with -Xshare:dump -XX:+AOTClassLinking");
710+
}
711+
}
712+
705713
return true;
706714
}
707715

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -367,33 +367,31 @@ void CompileQueue::add(CompileTask* task) {
367367
*/
368368
void CompileQueue::delete_all() {
369369
MutexLocker mu(MethodCompileQueue_lock);
370-
CompileTask* next = _first;
370+
CompileTask* current = _first;
371371

372372
// Iterate over all tasks in the compile queue
373-
while (next != nullptr) {
374-
CompileTask* current = next;
375-
next = current->next();
376-
bool found_waiter = false;
377-
{
378-
MutexLocker ct_lock(CompileTaskWait_lock);
379-
assert(current->waiting_for_completion_count() <= 1, "more than one thread are waiting for task");
380-
if (current->waiting_for_completion_count() > 0) {
381-
// If another thread waits for this task, we must wake them up
382-
// so they will stop waiting and free the task.
383-
CompileTaskWait_lock->notify_all();
384-
found_waiter = true;
385-
}
386-
}
387-
if (!found_waiter) {
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.
373+
while (current != nullptr) {
374+
if (!current->is_blocking()) {
375+
// Non-blocking task. No one is waiting for it, delete it now.
391376
delete current;
377+
} else {
378+
// Blocking task. By convention, it is the waiters responsibility
379+
// to delete the task. We cannot delete it here, because we do not
380+
// coordinate with waiters. We will notify the waiters later.
392381
}
382+
current = current->next();
393383
}
394384
_first = nullptr;
395385
_last = nullptr;
396386

387+
// Wake up all blocking task waiters to deal with remaining blocking
388+
// tasks. This is not a performance sensitive path, so we do this
389+
// unconditionally to simplify coding/testing.
390+
{
391+
MonitorLocker ml(Thread::current(), CompileTaskWait_lock);
392+
ml.notify_all();
393+
}
394+
397395
// Wake up all threads that block on the queue.
398396
MethodCompileQueue_lock->notify_all();
399397
}
@@ -1720,23 +1718,26 @@ void CompileBroker::wait_for_completion(CompileTask* task) {
17201718
} else
17211719
#endif
17221720
{
1723-
MonitorLocker ml(thread, CompileTaskWait_lock);
17241721
free_task = true;
1725-
task->inc_waiting_for_completion();
1722+
// Wait until the task is complete or compilation is shut down.
1723+
MonitorLocker ml(thread, CompileTaskWait_lock);
17261724
while (!task->is_complete() && !is_compilation_disabled_forever()) {
17271725
ml.wait();
17281726
}
1729-
task->dec_waiting_for_completion();
17301727
}
17311728

1732-
if (free_task) {
1733-
if (is_compilation_disabled_forever()) {
1734-
delete task;
1735-
return;
1736-
}
1729+
// It is harmless to check this status without the lock, because
1730+
// completion is a stable property.
1731+
if (!task->is_complete() && is_compilation_disabled_forever()) {
1732+
// Task is not complete, and we are exiting for compilation shutdown.
1733+
// The task can still be executed by some compiler thread, therefore
1734+
// we cannot delete it. This will leave task allocated, which leaks it.
1735+
// At this (degraded) point, it is less risky to abandon the task,
1736+
// rather than attempting a more complicated deletion protocol.
1737+
free_task = false;
1738+
}
17371739

1738-
// It is harmless to check this status without the lock, because
1739-
// completion is a stable property (until the task object is deleted).
1740+
if (free_task) {
17401741
assert(task->is_complete(), "Compilation should have completed");
17411742

17421743
// By convention, the waiter is responsible for deleting a

src/hotspot/share/compiler/compileBroker.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class CompileBroker: AllStatic {
381381
}
382382

383383
static bool is_compilation_disabled_forever() {
384-
return _should_compile_new_jobs == shutdown_compilation;
384+
return Atomic::load(&_should_compile_new_jobs) == shutdown_compilation;
385385
}
386386

387387
static void wait_for_no_active_tasks();

src/hotspot/share/compiler/compileTask.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ CompileTask::CompileTask(int compile_id,
5656
_comp_level = comp_level;
5757
_num_inlined_bytecodes = 0;
5858

59-
_waiting_count = 0;
60-
6159
_is_complete = false;
6260
_is_success = false;
6361

src/hotspot/share/compiler/compileTask.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ class CompileTask : public CHeapObj<mtCompiler> {
9999
// Compilation state for a blocking JVMCI compilation
100100
JVMCICompileState* _blocking_jvmci_compile_state;
101101
#endif
102-
int _waiting_count; // See waiting_for_completion_count()
103102
int _comp_level;
104103
int _num_inlined_bytecodes;
105104
CompileTask* _next, *_prev;
@@ -164,23 +163,6 @@ class CompileTask : public CHeapObj<mtCompiler> {
164163
}
165164
#endif
166165

167-
// See how many threads are waiting for this task. Must have lock to read this.
168-
int waiting_for_completion_count() {
169-
assert(CompileTaskWait_lock->owned_by_self(), "must have lock to use waiting_for_completion_count()");
170-
return _waiting_count;
171-
}
172-
// Indicates that a thread is waiting for this task to complete. Must have lock to use this.
173-
void inc_waiting_for_completion() {
174-
assert(CompileTaskWait_lock->owned_by_self(), "must have lock to use inc_waiting_for_completion()");
175-
_waiting_count++;
176-
}
177-
// Indicates that a thread stopped waiting for this task to complete. Must have lock to use this.
178-
void dec_waiting_for_completion() {
179-
assert(CompileTaskWait_lock->owned_by_self(), "must have lock to use dec_waiting_for_completion()");
180-
assert(_waiting_count > 0, "waiting count is not positive");
181-
_waiting_count--;
182-
}
183-
184166
void mark_complete() { _is_complete = true; }
185167
void mark_success() { _is_success = true; }
186168
void mark_started(jlong time) { _time_started = time; }

0 commit comments

Comments
 (0)