Skip to content

Commit 8255e76

Browse files
committed
Merge
2 parents 1567859 + 7704eb1 commit 8255e76

File tree

212 files changed

+4829
-2647
lines changed

Some content is hidden

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

212 files changed

+4829
-2647
lines changed

make/autoconf/flags-cflags.m4

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
457457
ALWAYS_DEFINES_JVM="-D_REENTRANT"
458458
ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
459459
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
460-
ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \
460+
# Access APIs for Windows 8 and above
461+
# see https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
462+
ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0602 -D_CRT_SECURE_NO_DEPRECATE \
461463
-D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL"
462-
ALWAYS_DEFINES_JVM="-DNOMINMAX -DWIN32_LEAN_AND_MEAN"
464+
ALWAYS_DEFINES_JVM="-DNOMINMAX -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0602"
463465
fi
464466
465467
###############################################################################

make/common/modules/LauncherCommon.gmk

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ endef
197197
################################################################################
198198
# Create man pages for jmod to pick up. There should be a one-to-one
199199
# relationship between executables and man pages (even if this is not always
200-
# the case), so piggyback man page generation on the launcher compilation.
200+
# the case), so piggyback man page generation on the launcher compilation. This
201+
# file may be included from other places as well, so only process man pages
202+
# when called from <module>/Launcher.gmk.
201203

202-
ifeq ($(call isTargetOsType, unix), true)
204+
ifeq ($(call isTargetOsType, unix)+$(MAKEFILE_PREFIX), true+Launcher)
203205
# Only build manpages on unix systems.
204206
# We assume all our man pages should reside in section 1.
205207

@@ -243,9 +245,9 @@ ifeq ($(call isTargetOsType, unix), true)
243245
FILTER := $(PANDOC_TROFF_MANPAGE_FILTER), \
244246
POST_PROCESS := $(MAN_POST_PROCESS), \
245247
REPLACEMENTS := \
246-
@@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
247-
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
248-
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
248+
@@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
249+
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
250+
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
249251
EXTRA_DEPS := $(PANDOC_TROFF_MANPAGE_FILTER) \
250252
$(PANDOC_TROFF_MANPAGE_FILTER_SOURCE), \
251253
))

make/jdk/src/classes/build/tools/intpoly/FieldGen.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,12 @@ private String generate(FieldParams params) throws IOException {
632632
result.appendLine("private static final int LIMB_MASK = -1 "
633633
+ ">>> (64 - BITS_PER_LIMB);");
634634
}
635-
int termIndex = 0;
636635

637-
result.appendLine("public " + params.getClassName() + "() {");
636+
result.appendLine();
637+
result.appendLine("public static final " + params.getClassName() + " ONE = new "
638+
+ params.getClassName() + "();");
639+
result.appendLine();
640+
result.appendLine("private " + params.getClassName() + "() {");
638641
result.appendLine();
639642
result.appendLine(" super(BITS_PER_LIMB, NUM_LIMBS, MAX_ADDS, MODULUS);");
640643
result.appendLine();
@@ -822,6 +825,16 @@ private String generate(FieldParams params) throws IOException {
822825
result.decrIndent();
823826
result.appendLine("}");
824827

828+
// Use grade-school multiplication with a simple squaring optimization.
829+
// Multiply into primitives to avoid the temporary array allocation.
830+
// This is equivalent to the following code:
831+
// long[] c = new long[2 * NUM_LIMBS - 1];
832+
// for(int i = 0; i < NUM_LIMBS; i++) {
833+
// c[2 * i] = a[i] * a[i];
834+
// for(int j = i + 1; j < NUM_LIMBS; j++) {
835+
// c[i + j] += 2 * a[i] * a[j]
836+
// }
837+
// }
825838
result.appendLine("@Override");
826839
result.appendLine("protected void square(long[] a, long[] r) {");
827840
result.incrIndent();

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,35 +2251,39 @@ void MacroAssembler::_assert_asm(Assembler::Condition cc, const char* msg) {
22512251

22522252
// If a constant does not fit in an immediate field, generate some
22532253
// number of MOV instructions and then perform the operation.
2254-
void MacroAssembler::wrap_add_sub_imm_insn(Register Rd, Register Rn, unsigned imm,
2254+
void MacroAssembler::wrap_add_sub_imm_insn(Register Rd, Register Rn, uint64_t imm,
22552255
add_sub_imm_insn insn1,
2256-
add_sub_reg_insn insn2) {
2256+
add_sub_reg_insn insn2,
2257+
bool is32) {
22572258
assert(Rd != zr, "Rd = zr and not setting flags?");
2258-
if (operand_valid_for_add_sub_immediate((int)imm)) {
2259+
bool fits = operand_valid_for_add_sub_immediate(is32 ? (int32_t)imm : imm);
2260+
if (fits) {
22592261
(this->*insn1)(Rd, Rn, imm);
22602262
} else {
22612263
if (uabs(imm) < (1 << 24)) {
22622264
(this->*insn1)(Rd, Rn, imm & -(1 << 12));
22632265
(this->*insn1)(Rd, Rd, imm & ((1 << 12)-1));
22642266
} else {
22652267
assert_different_registers(Rd, Rn);
2266-
mov(Rd, (uint64_t)imm);
2268+
mov(Rd, imm);
22672269
(this->*insn2)(Rd, Rn, Rd, LSL, 0);
22682270
}
22692271
}
22702272
}
22712273

22722274
// Separate vsn which sets the flags. Optimisations are more restricted
22732275
// because we must set the flags correctly.
2274-
void MacroAssembler::wrap_adds_subs_imm_insn(Register Rd, Register Rn, unsigned imm,
2275-
add_sub_imm_insn insn1,
2276-
add_sub_reg_insn insn2) {
2277-
if (operand_valid_for_add_sub_immediate((int)imm)) {
2276+
void MacroAssembler::wrap_adds_subs_imm_insn(Register Rd, Register Rn, uint64_t imm,
2277+
add_sub_imm_insn insn1,
2278+
add_sub_reg_insn insn2,
2279+
bool is32) {
2280+
bool fits = operand_valid_for_add_sub_immediate(is32 ? (int32_t)imm : imm);
2281+
if (fits) {
22782282
(this->*insn1)(Rd, Rn, imm);
22792283
} else {
22802284
assert_different_registers(Rd, Rn);
22812285
assert(Rd != zr, "overflow in immediate operand");
2282-
mov(Rd, (uint64_t)imm);
2286+
mov(Rd, imm);
22832287
(this->*insn2)(Rd, Rn, Rd, LSL, 0);
22842288
}
22852289
}

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class MacroAssembler: public Assembler {
212212

213213
inline void movw(Register Rd, Register Rn) {
214214
if (Rd == sp || Rn == sp) {
215-
addw(Rd, Rn, 0U);
215+
Assembler::addw(Rd, Rn, 0U);
216216
} else {
217217
orrw(Rd, zr, Rn);
218218
}
@@ -221,7 +221,7 @@ class MacroAssembler: public Assembler {
221221
assert(Rd != r31_sp && Rn != r31_sp, "should be");
222222
if (Rd == Rn) {
223223
} else if (Rd == sp || Rn == sp) {
224-
add(Rd, Rn, 0U);
224+
Assembler::add(Rd, Rn, 0U);
225225
} else {
226226
orr(Rd, zr, Rn);
227227
}
@@ -1169,17 +1169,17 @@ class MacroAssembler: public Assembler {
11691169

11701170
// If a constant does not fit in an immediate field, generate some
11711171
// number of MOV instructions and then perform the operation
1172-
void wrap_add_sub_imm_insn(Register Rd, Register Rn, unsigned imm,
1172+
void wrap_add_sub_imm_insn(Register Rd, Register Rn, uint64_t imm,
11731173
add_sub_imm_insn insn1,
1174-
add_sub_reg_insn insn2);
1174+
add_sub_reg_insn insn2, bool is32);
11751175
// Separate vsn which sets the flags
1176-
void wrap_adds_subs_imm_insn(Register Rd, Register Rn, unsigned imm,
1177-
add_sub_imm_insn insn1,
1178-
add_sub_reg_insn insn2);
1176+
void wrap_adds_subs_imm_insn(Register Rd, Register Rn, uint64_t imm,
1177+
add_sub_imm_insn insn1,
1178+
add_sub_reg_insn insn2, bool is32);
11791179

1180-
#define WRAP(INSN) \
1181-
void INSN(Register Rd, Register Rn, unsigned imm) { \
1182-
wrap_add_sub_imm_insn(Rd, Rn, imm, &Assembler::INSN, &Assembler::INSN); \
1180+
#define WRAP(INSN, is32) \
1181+
void INSN(Register Rd, Register Rn, uint64_t imm) { \
1182+
wrap_add_sub_imm_insn(Rd, Rn, imm, &Assembler::INSN, &Assembler::INSN, is32); \
11831183
} \
11841184
\
11851185
void INSN(Register Rd, Register Rn, Register Rm, \
@@ -1196,12 +1196,12 @@ class MacroAssembler: public Assembler {
11961196
Assembler::INSN(Rd, Rn, Rm, option, amount); \
11971197
}
11981198

1199-
WRAP(add) WRAP(addw) WRAP(sub) WRAP(subw)
1199+
WRAP(add, false) WRAP(addw, true) WRAP(sub, false) WRAP(subw, true)
12001200

12011201
#undef WRAP
1202-
#define WRAP(INSN) \
1203-
void INSN(Register Rd, Register Rn, unsigned imm) { \
1204-
wrap_adds_subs_imm_insn(Rd, Rn, imm, &Assembler::INSN, &Assembler::INSN); \
1202+
#define WRAP(INSN, is32) \
1203+
void INSN(Register Rd, Register Rn, uint64_t imm) { \
1204+
wrap_adds_subs_imm_insn(Rd, Rn, imm, &Assembler::INSN, &Assembler::INSN, is32); \
12051205
} \
12061206
\
12071207
void INSN(Register Rd, Register Rn, Register Rm, \
@@ -1218,7 +1218,7 @@ class MacroAssembler: public Assembler {
12181218
Assembler::INSN(Rd, Rn, Rm, option, amount); \
12191219
}
12201220

1221-
WRAP(adds) WRAP(addsw) WRAP(subs) WRAP(subsw)
1221+
WRAP(adds, false) WRAP(addsw, true) WRAP(subs, false) WRAP(subsw, true)
12221222

12231223
void add(Register Rd, Register Rn, RegisterOrConstant increment);
12241224
void addw(Register Rd, Register Rn, RegisterOrConstant increment);

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6697,8 +6697,10 @@ class StubGenerator: public StubCodeGenerator {
66976697
__ bind(null_jobject);
66986698
}
66996699

6700-
static RuntimeStub* generate_jfr_stub(const char* name, address entrypoint) {
6701-
6700+
// For c2: c_rarg0 is junk, call to runtime to write a checkpoint.
6701+
// It returns a jobject handle to the event writer.
6702+
// The handle is dereferenced and the return value is the event writer oop.
6703+
static RuntimeStub* generate_jfr_write_checkpoint() {
67026704
enum layout {
67036705
rbp_off,
67046706
rbpH_off,
@@ -6709,7 +6711,7 @@ class StubGenerator: public StubCodeGenerator {
67096711

67106712
int insts_size = 512;
67116713
int locs_size = 64;
6712-
CodeBuffer code(name, insts_size, locs_size);
6714+
CodeBuffer code("jfr_write_checkpoint", insts_size, locs_size);
67136715
OopMapSet* oop_maps = new OopMapSet();
67146716
MacroAssembler* masm = new MacroAssembler(&code);
67156717
MacroAssembler* _masm = masm;
@@ -6719,7 +6721,7 @@ class StubGenerator: public StubCodeGenerator {
67196721
int frame_complete = __ pc() - start;
67206722
address the_pc = __ pc();
67216723
jfr_prologue(the_pc, _masm, rthread);
6722-
__ call_VM_leaf(entrypoint, 1);
6724+
__ call_VM_leaf(CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::write_checkpoint), 1);
67236725
jfr_epilogue(_masm, rthread);
67246726
__ leave();
67256727
__ ret(lr);
@@ -6728,27 +6730,12 @@ class StubGenerator: public StubCodeGenerator {
67286730
oop_maps->add_gc_map(the_pc - start, map);
67296731

67306732
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
6731-
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
6733+
RuntimeStub::new_runtime_stub("jfr_write_checkpoint", &code, frame_complete,
67326734
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
67336735
oop_maps, false);
67346736
return stub;
67356737
}
67366738

6737-
// For c2: c_rarg0 is junk, call to runtime to write a checkpoint.
6738-
// It returns a jobject handle to the event writer.
6739-
// The handle is dereferenced and the return value is the event writer oop.
6740-
RuntimeStub* generate_jfr_write_checkpoint() {
6741-
return generate_jfr_stub("jfr_write_checkpoint",
6742-
CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::write_checkpoint));
6743-
}
6744-
6745-
// For c1: call the corresponding runtime routine, it returns a jobject handle to the event writer.
6746-
// The handle is dereferenced and the return value is the event writer oop.
6747-
RuntimeStub* generate_jfr_get_event_writer() {
6748-
return generate_jfr_stub("jfr_get_event_writer",
6749-
CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::event_writer));
6750-
}
6751-
67526739
#endif // INCLUDE_JFR
67536740

67546741
// Continuation point for throwing of implicit exceptions that are
@@ -6806,7 +6793,7 @@ class StubGenerator: public StubCodeGenerator {
68066793
assert(is_even(framesize/2), "sp not 16-byte aligned");
68076794

68086795
// lr and fp are already in place
6809-
__ sub(sp, rfp, ((unsigned)framesize-4) << LogBytesPerInt); // prolog
6796+
__ sub(sp, rfp, ((uint64_t)framesize-4) << LogBytesPerInt); // prolog
68106797

68116798
int frame_complete = __ pc() - start;
68126799

@@ -7746,8 +7733,6 @@ class StubGenerator: public StubCodeGenerator {
77467733

77477734
JFR_ONLY(StubRoutines::_jfr_write_checkpoint_stub = generate_jfr_write_checkpoint();)
77487735
JFR_ONLY(StubRoutines::_jfr_write_checkpoint = StubRoutines::_jfr_write_checkpoint_stub->entry_point();)
7749-
JFR_ONLY(StubRoutines::_jfr_get_event_writer_stub = generate_jfr_get_event_writer();)
7750-
JFR_ONLY(StubRoutines::_jfr_get_event_writer = StubRoutines::_jfr_get_event_writer_stub->entry_point();)
77517736
}
77527737

77537738
void generate_all() {

src/hotspot/cpu/riscv/continuationHelper_riscv.inline.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ inline void ContinuationHelper::InterpretedFrame::patch_sender_sp(frame& f, intp
9393
}
9494

9595
inline address* ContinuationHelper::Frame::return_pc_address(const frame& f) {
96-
Unimplemented();
97-
return NULL;
96+
return (address*)(f.real_fp() - 1);
9897
}
9998

10099
inline address ContinuationHelper::Frame::real_pc(const frame& f) {

src/hotspot/cpu/riscv/frame_riscv.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,25 @@ bool frame::safe_for_sender(JavaThread *thread) {
259259
void frame::patch_pc(Thread* thread, address pc) {
260260
assert(_cb == CodeCache::find_blob(pc), "unexpected pc");
261261
address* pc_addr = &(((address*) sp())[-1]);
262+
262263
if (TracePcPatching) {
263264
tty->print_cr("patch_pc at address " INTPTR_FORMAT " [" INTPTR_FORMAT " -> " INTPTR_FORMAT "]",
264265
p2i(pc_addr), p2i(*pc_addr), p2i(pc));
265266
}
267+
266268
// Either the return address is the original one or we are going to
267269
// patch in the same address that's already there.
268-
assert(_pc == *pc_addr || pc == *pc_addr, "must be");
270+
assert(_pc == *pc_addr || pc == *pc_addr || *pc_addr == 0, "must be");
271+
DEBUG_ONLY(address old_pc = _pc;)
269272
*pc_addr = pc;
273+
_pc = pc; // must be set before call to get_deopt_original_pc
270274
address original_pc = CompiledMethod::get_deopt_original_pc(this);
271275
if (original_pc != NULL) {
272-
assert(original_pc == _pc, "expected original PC to be stored before patching");
276+
assert(original_pc == old_pc, "expected original PC to be stored before patching");
273277
_deopt_state = is_deoptimized;
274-
// leave _pc as is
278+
_pc = original_pc;
275279
} else {
276280
_deopt_state = not_deoptimized;
277-
_pc = pc;
278281
}
279282
}
280283

@@ -378,6 +381,7 @@ void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp
378381

379382
//------------------------------------------------------------------------------
380383
// frame::adjust_unextended_sp
384+
#ifdef ASSERT
381385
void frame::adjust_unextended_sp() {
382386
// On riscv, sites calling method handle intrinsics and lambda forms are treated
383387
// as any other call site. Therefore, no special action is needed when we are
@@ -394,6 +398,8 @@ void frame::adjust_unextended_sp() {
394398
}
395399
}
396400
}
401+
#endif
402+
397403

398404
//------------------------------------------------------------------------------
399405
// frame::sender_for_interpreter_frame

src/hotspot/cpu/riscv/frame_riscv.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
// original sp we use that convention.
167167

168168
intptr_t* _unextended_sp;
169-
void adjust_unextended_sp();
169+
void adjust_unextended_sp() NOT_DEBUG_RETURN;
170170

171171
intptr_t* ptr_at_addr(int offset) const {
172172
return (intptr_t*) addr_at(offset);
@@ -189,6 +189,7 @@
189189
frame(intptr_t* ptr_sp, intptr_t* ptr_fp);
190190

191191
void init(intptr_t* ptr_sp, intptr_t* ptr_fp, address pc);
192+
void setup(address pc);
192193

193194
// accessors for the instance variables
194195
// Note: not necessarily the real 'frame pointer' (see real_fp)

0 commit comments

Comments
 (0)