Skip to content

Commit dc923e2

Browse files
author
Fei Yang
committed
Merge branch 'master' into riscv-port
2 parents c1c0833 + 09cf5f1 commit dc923e2

File tree

19 files changed

+407
-253
lines changed

19 files changed

+407
-253
lines changed

.jcheck/conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[general]
22
project=riscv-port
33
jbs=JDK
4+
version=19
45

56
[checks]
67
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists

src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,8 +1823,8 @@ void LIR_Assembler::comp_op(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2,
18231823
__ teq(xhi, yhi);
18241824
__ teq(xlo, ylo, eq);
18251825
} else {
1826-
__ subs(xlo, xlo, ylo);
1827-
__ sbcs(xhi, xhi, yhi);
1826+
__ subs(Rtemp, xlo, ylo);
1827+
__ sbcs(Rtemp, xhi, yhi);
18281828
}
18291829
} else {
18301830
ShouldNotReachHere();

src/hotspot/share/cds/dumpTimeClassInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "precompiled.hpp"
2626
#include "cds/archiveBuilder.hpp"
27-
#include "cds/dumpTimeClassInfo.hpp"
27+
#include "cds/dumpTimeClassInfo.inline.hpp"
2828
#include "classfile/classLoader.hpp"
2929
#include "classfile/classLoaderData.inline.hpp"
3030
#include "classfile/systemDictionaryShared.hpp"

src/hotspot/share/cds/dumpTimeClassInfo.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,15 @@ inline unsigned DumpTimeSharedClassTable_hash(InstanceKlass* const& k) {
168168
}
169169
}
170170

171-
class DumpTimeSharedClassTable: public ResourceHashtable<
171+
using DumpTimeSharedClassTableBaseType = ResourceHashtable<
172172
InstanceKlass*,
173173
DumpTimeClassInfo,
174174
15889, // prime number
175175
ResourceObj::C_HEAP,
176176
mtClassShared,
177-
&DumpTimeSharedClassTable_hash>
177+
&DumpTimeSharedClassTable_hash>;
178+
179+
class DumpTimeSharedClassTable: public DumpTimeSharedClassTableBaseType
178180
{
179181
int _builtin_count;
180182
int _unregistered_count;
@@ -194,6 +196,11 @@ class DumpTimeSharedClassTable: public ResourceHashtable<
194196
return _unregistered_count;
195197
}
196198
}
199+
200+
// Overrides ResourceHashtable<>::iterate(ITER*)
201+
template<class ITER> void iterate(ITER* iter) const;
202+
private:
203+
template<class ITER> class IterationHelper;
197204
};
198205

199206
#endif // SHARED_CDS_DUMPTIMESHAREDCLASSINFO_HPP
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
/*
3+
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
4+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5+
*
6+
* This code is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License version 2 only, as
8+
* published by the Free Software Foundation.
9+
*
10+
* This code is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* version 2 for more details (a copy is included in the LICENSE file that
14+
* accompanied this code).
15+
*
16+
* You should have received a copy of the GNU General Public License version
17+
* 2 along with this work; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19+
*
20+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21+
* or visit www.oracle.com if you need additional information or have any
22+
* questions.
23+
*
24+
*/
25+
26+
#ifndef SHARED_CDS_DUMPTIMESHAREDCLASSINFO_INLINE_HPP
27+
#define SHARED_CDS_DUMPTIMESHAREDCLASSINFO_INLINE_HPP
28+
29+
#include "cds/dumpTimeClassInfo.hpp"
30+
#include "classfile/systemDictionaryShared.hpp"
31+
#include "classfile/classLoaderData.inline.hpp"
32+
#include "oops/instanceKlass.hpp"
33+
#include "oops/klass.inline.hpp"
34+
#include "runtime/safepoint.hpp"
35+
36+
#if INCLUDE_CDS
37+
38+
// For safety, only iterate over a class if it loader is alive.
39+
// IterationHelper and DumpTimeSharedClassTable::iterate
40+
// must be used only inside a safepoint, where the value of
41+
// k->is_loader_alive() will not change.
42+
template<class ITER>
43+
class DumpTimeSharedClassTable::IterationHelper {
44+
ITER* _iter;
45+
public:
46+
IterationHelper(ITER* iter) {
47+
_iter = iter;
48+
}
49+
bool do_entry(InstanceKlass* k, DumpTimeClassInfo& info) {
50+
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
51+
assert_lock_strong(DumpTimeTable_lock);
52+
if (k->is_loader_alive()) {
53+
bool result = _iter->do_entry(k, info);
54+
assert(k->is_loader_alive(), "must not change");
55+
return result;
56+
} else {
57+
if (!SystemDictionaryShared::is_excluded_class(k)) {
58+
SystemDictionaryShared::warn_excluded(k, "Class loader not alive");
59+
SystemDictionaryShared::set_excluded_locked(k);
60+
}
61+
return true;
62+
}
63+
}
64+
};
65+
66+
template<class ITER>
67+
void DumpTimeSharedClassTable::iterate(ITER* iter) const {
68+
IterationHelper<ITER> helper(iter);
69+
DumpTimeSharedClassTableBaseType::iterate(&helper);
70+
}
71+
72+
#endif // INCLUDE_CDS
73+
74+
#endif // SHARED_CDS_DUMPTIMESHAREDCLASSINFO_INLINE_HPP

src/hotspot/share/cds/dynamicArchive.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
115115
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
116116
SystemDictionaryShared::check_excluded_classes();
117117

118+
if (SystemDictionaryShared::is_dumptime_table_empty()) {
119+
log_warning(cds, dynamic)("There is no class to be included in the dynamic archive.");
120+
SystemDictionaryShared::stop_dumping();
121+
return;
122+
}
123+
118124
// save dumptime tables
119125
SystemDictionaryShared::clone_dumptime_tables();
120126

@@ -171,6 +177,7 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
171177

172178
assert(_num_dump_regions_used == _total_dump_regions, "must be");
173179
verify_universe("After CDS dynamic dump");
180+
SystemDictionaryShared::stop_dumping();
174181
}
175182

176183
virtual void iterate_roots(MetaspaceClosure* it, bool is_relocating_pointers) {
@@ -342,10 +349,6 @@ class VM_PopulateDynamicDumpSharedSpace: public VM_GC_Sync_Operation {
342349
VMOp_Type type() const { return VMOp_PopulateDumpSharedSpace; }
343350
void doit() {
344351
ResourceMark rm;
345-
if (SystemDictionaryShared::is_dumptime_table_empty()) {
346-
log_warning(cds, dynamic)("There is no class to be included in the dynamic archive.");
347-
return;
348-
}
349352
if (AllowArchivingWithJavaAgent) {
350353
warning("This archive was created with AllowArchivingWithJavaAgent. It should be used "
351354
"for testing purposes only and should not be used in a production environment");

src/hotspot/share/classfile/systemDictionaryShared.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "cds/filemap.hpp"
3232
#include "cds/heapShared.hpp"
3333
#include "cds/cdsProtectionDomain.hpp"
34-
#include "cds/dumpTimeClassInfo.hpp"
34+
#include "cds/dumpTimeClassInfo.inline.hpp"
3535
#include "cds/metaspaceShared.hpp"
3636
#include "cds/runTimeClassInfo.hpp"
3737
#include "classfile/classFileStream.hpp"
@@ -187,6 +187,11 @@ void SystemDictionaryShared::start_dumping() {
187187
_dump_in_progress = true;
188188
}
189189

190+
void SystemDictionaryShared::stop_dumping() {
191+
assert_lock_strong(DumpTimeTable_lock);
192+
_dump_in_progress = false;
193+
}
194+
190195
DumpTimeClassInfo* SystemDictionaryShared::find_or_allocate_info_for(InstanceKlass* k) {
191196
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
192197
return find_or_allocate_info_for_locked(k);
@@ -1528,6 +1533,7 @@ void SystemDictionaryShared::print_table_statistics(outputStream* st) {
15281533
}
15291534

15301535
bool SystemDictionaryShared::is_dumptime_table_empty() {
1536+
assert_lock_strong(DumpTimeTable_lock);
15311537
if (_dumptime_table == NULL) {
15321538
return true;
15331539
}

src/hotspot/share/classfile/systemDictionaryShared.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ class SystemDictionaryShared: public SystemDictionary {
300300
static void print_table_statistics(outputStream* st) NOT_CDS_RETURN;
301301
static bool is_dumptime_table_empty() NOT_CDS_RETURN_(true);
302302
static void start_dumping() NOT_CDS_RETURN;
303+
static void stop_dumping() NOT_CDS_RETURN;
303304
static bool is_supported_invokedynamic(BootstrapInfo* bsi) NOT_CDS_RETURN_(false);
304305
DEBUG_ONLY(static bool no_class_loading_should_happen() {return _no_class_loading_should_happen;})
305306

src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,6 @@ G1ConcurrentMarkThread::G1ConcurrentMarkThread(G1ConcurrentMark* cm) :
5656
create_and_start();
5757
}
5858

59-
class CMRemark : public VoidClosure {
60-
G1ConcurrentMark* _cm;
61-
public:
62-
CMRemark(G1ConcurrentMark* cm) : _cm(cm) {}
63-
64-
void do_void(){
65-
_cm->remark();
66-
}
67-
};
68-
69-
class CMCleanup : public VoidClosure {
70-
G1ConcurrentMark* _cm;
71-
public:
72-
CMCleanup(G1ConcurrentMark* cm) : _cm(cm) {}
73-
74-
void do_void(){
75-
_cm->cleanup();
76-
}
77-
};
78-
7959
double G1ConcurrentMarkThread::mmu_delay_end(G1Policy* policy, bool remark) {
8060
// There are 3 reasons to use SuspendibleThreadSetJoiner.
8161
// 1. To avoid concurrency problem.
@@ -239,8 +219,7 @@ bool G1ConcurrentMarkThread::subphase_delay_to_keep_mmu_before_remark() {
239219

240220
bool G1ConcurrentMarkThread::subphase_remark() {
241221
ConcurrentGCBreakpoints::at("BEFORE MARKING COMPLETED");
242-
CMRemark cl(_cm);
243-
VM_G1Concurrent op(&cl, "Pause Remark");
222+
VM_G1PauseRemark op;
244223
VMThread::execute(&op);
245224
return _cm->has_aborted();
246225
}
@@ -257,8 +236,7 @@ bool G1ConcurrentMarkThread::phase_delay_to_keep_mmu_before_cleanup() {
257236
}
258237

259238
bool G1ConcurrentMarkThread::phase_cleanup() {
260-
CMCleanup cl(_cm);
261-
VM_G1Concurrent op(&cl, "Pause Cleanup");
239+
VM_G1PauseCleanup op;
262240
VMThread::execute(&op);
263241
return _cm->has_aborted();
264242
}

src/hotspot/share/gc/g1/g1VMOperations.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void VM_G1CollectForAllocation::doit() {
170170
}
171171
}
172172

173-
void VM_G1Concurrent::doit() {
173+
void VM_G1PauseConcurrent::doit() {
174174
GCIdMark gc_id_mark(_gc_id);
175175
GCTraceCPUTime tcpu;
176176
G1CollectedHeap* g1h = G1CollectedHeap::heap();
@@ -184,17 +184,28 @@ void VM_G1Concurrent::doit() {
184184
TraceCollectorStats tcs(g1h->monitoring_support()->conc_collection_counters());
185185
SvcGCMarker sgcm(SvcGCMarker::CONCURRENT);
186186
IsGCActiveMark x;
187-
_cl->do_void();
187+
188+
work();
188189
}
189190

190-
bool VM_G1Concurrent::doit_prologue() {
191+
bool VM_G1PauseConcurrent::doit_prologue() {
191192
Heap_lock->lock();
192193
return true;
193194
}
194195

195-
void VM_G1Concurrent::doit_epilogue() {
196+
void VM_G1PauseConcurrent::doit_epilogue() {
196197
if (Universe::has_reference_pending_list()) {
197198
Heap_lock->notify_all();
198199
}
199200
Heap_lock->unlock();
200201
}
202+
203+
void VM_G1PauseRemark::work() {
204+
G1CollectedHeap* g1h = G1CollectedHeap::heap();
205+
g1h->concurrent_mark()->remark();
206+
}
207+
208+
void VM_G1PauseCleanup::work() {
209+
G1CollectedHeap* g1h = G1CollectedHeap::heap();
210+
g1h->concurrent_mark()->cleanup();
211+
}

0 commit comments

Comments
 (0)