Skip to content

Commit

Permalink
Merge branch 'master' into zcb
Browse files Browse the repository at this point in the history
  • Loading branch information
robehn committed Jan 5, 2024
2 parents 4fa46f3 + 2a9c358 commit c30caa0
Show file tree
Hide file tree
Showing 323 changed files with 3,460 additions and 1,510 deletions.
4 changes: 1 addition & 3 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -1499,9 +1499,7 @@ <h4 id="using-debian-debootstrap">Using Debian debootstrap</h4>
--resolve-deps \
buster \
~/sysroot-arm64 \
https://httpredir.debian.org/debian/</code></pre>
<p>If the target architecture is <code>riscv64</code>, the path should
be <code>debian-ports</code> instead of <code>debian</code>.</p></li>
https://httpredir.debian.org/debian/</code></pre></li>
<li><p>To create an Ubuntu-based chroot:</p>
<pre><code>sudo debootstrap \
--arch=arm64 \
Expand Down
3 changes: 0 additions & 3 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -1316,9 +1316,6 @@ For example, cross-compiling to AArch64 from x86_64 could be done like this:
https://httpredir.debian.org/debian/
```

If the target architecture is `riscv64`, the path should be `debian-ports`
instead of `debian`.

* To create an Ubuntu-based chroot:

```
Expand Down
41 changes: 37 additions & 4 deletions make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024, 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
Expand Down Expand Up @@ -1289,25 +1289,58 @@ private static Map<Locale, String> coverageLevelsMap() throws Exception {
*/
private static void generateTZDBShortNamesMap() throws IOException {
Files.walk(Path.of(tzDataDir), 1, FileVisitOption.FOLLOW_LINKS)
.filter(p -> p.toFile().isFile())
.filter(p -> p.toFile().isFile() && !p.endsWith("jdk11_backward"))
.forEach(p -> {
try {
String zone = null;
String rule = null;
String format = null;
boolean inVanguard = false;
boolean inRearguard = false;
for (var line : Files.readAllLines(p)) {
if (line.contains("#STDOFF")) continue;
// Interpret the line in rearguard mode so that STD/DST
// correctly handles negative DST cases, such as "GMT/IST"
// vs. "IST/GMT" case for Europe/Dublin
if (inVanguard) {
if (line.startsWith("# Rearguard")) {
inVanguard = false;
inRearguard = true;
}
continue;
} else if (line.startsWith("# Vanguard")) {
inVanguard = true;
continue;
}
if (inRearguard) {
if (line.startsWith("# End of rearguard")) {
inRearguard = false;
continue;
} else {
if (line.startsWith("#\t")) {
line = line.substring(1); // omit #
}
}
}
if (line.isBlank() || line.matches("^[ \t]*#.*")) {
// ignore blank/comment lines
continue;
}
// remove comments in-line
line = line.replaceAll("[ \t]*#.*", "");

// Zone line
if (line.startsWith("Zone")) {
if (zone != null) {
tzdbShortNamesMap.put(zone, format + NBSP + rule);
}
var zl = line.split("[ \t]+", -1);
zone = zl[1];
rule = zl[3];
format = zl[4];
} else {
if (zone != null) {
if (line.isBlank()) {
if (line.startsWith("Rule") ||
line.startsWith("Link")) {
tzdbShortNamesMap.put(zone, format + NBSP + rule);
zone = null;
rule = null;
Expand Down
4 changes: 2 additions & 2 deletions make/modules/java.instrument/Lib.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, 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
Expand Down Expand Up @@ -47,7 +47,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \
LDFLAGS_macosx := -L$(call FindLibDirForModule, java.base), \
LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
LIBS := $(JDKLIB_LIBS), \
LIBS_unix := -ljava -ljvm $(LIBZ_LIBS), \
LIBS_unix := $(LIBZ_LIBS), \
LIBS_linux := -ljli $(LIBDL), \
LIBS_aix := -liconv -ljli_static $(LIBDL), \
LIBS_macosx := -ljli -liconv -framework Cocoa -framework Security \
Expand Down
4 changes: 2 additions & 2 deletions src/demo/share/jfc/J2Ddemo/java2d/Intro.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -1716,7 +1716,7 @@ public Contributors(int beg, int end, Surface surf) {
this.beginning = beg;
this.ending = end;
fm = surf.getMetrics(font);
java.util.Arrays.sort(members);
Arrays.sort(members);
cast.add("CONTRIBUTORS");
cast.add(" ");
cast.addAll(Arrays.asList(members));
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/aarch64/globalDefinitions_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ const bool CCallingConventionRequiresIntsAsLongs = false;
// and Operational Models for ARMv8"
#define CPU_MULTI_COPY_ATOMIC

// The expected size in bytes of a cache line.
#define DEFAULT_CACHE_LINE_SIZE 64

// The default padding size for data structures to avoid false sharing.
#define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE

// According to the ARMv8 ARM, "Concurrent modification and execution
// of instructions can lead to the resulting instruction performing
// any behavior that can be achieved by executing any sequence of
Expand Down
12 changes: 8 additions & 4 deletions src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,

uint int_args = 0;
uint fp_args = 0;
uint stk_args = 0; // inc by 2 each time
uint stk_args = 0;

for (int i = 0; i < total_args_passed; i++) {
switch (sig_bt[i]) {
Expand All @@ -322,8 +322,9 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
if (int_args < Argument::n_int_register_parameters_j) {
regs[i].set1(INT_ArgReg[int_args++]->as_VMReg());
} else {
stk_args = align_up(stk_args, 2);
regs[i].set1(VMRegImpl::stack2reg(stk_args));
stk_args += 2;
stk_args += 1;
}
break;
case T_VOID:
Expand All @@ -340,6 +341,7 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
if (int_args < Argument::n_int_register_parameters_j) {
regs[i].set2(INT_ArgReg[int_args++]->as_VMReg());
} else {
stk_args = align_up(stk_args, 2);
regs[i].set2(VMRegImpl::stack2reg(stk_args));
stk_args += 2;
}
Expand All @@ -348,15 +350,17 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
if (fp_args < Argument::n_float_register_parameters_j) {
regs[i].set1(FP_ArgReg[fp_args++]->as_VMReg());
} else {
stk_args = align_up(stk_args, 2);
regs[i].set1(VMRegImpl::stack2reg(stk_args));
stk_args += 2;
stk_args += 1;
}
break;
case T_DOUBLE:
assert((i + 1) < total_args_passed && sig_bt[i + 1] == T_VOID, "expecting half");
if (fp_args < Argument::n_float_register_parameters_j) {
regs[i].set2(FP_ArgReg[fp_args++]->as_VMReg());
} else {
stk_args = align_up(stk_args, 2);
regs[i].set2(VMRegImpl::stack2reg(stk_args));
stk_args += 2;
}
Expand All @@ -367,7 +371,7 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
}
}

return align_up(stk_args, 2);
return stk_args;
}

// Patch the callers callsite with entry to compiled code if it exists.
Expand Down
8 changes: 3 additions & 5 deletions src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3603,11 +3603,9 @@ void TemplateTable::_new() {
// get InstanceKlass
__ load_resolved_klass_at_offset(r4, r3, r4, rscratch1);

// make sure klass is initialized & doesn't have finalizer
// make sure klass is fully initialized
__ ldrb(rscratch1, Address(r4, InstanceKlass::init_state_offset()));
__ cmp(rscratch1, (u1)InstanceKlass::fully_initialized);
__ br(Assembler::NE, slow_case);
// make sure klass is initialized
assert(VM_Version::supports_fast_class_init_checks(), "Optimization requires support for fast class initialization checks");
__ clinit_barrier(r4, rscratch1, nullptr /*L_fast_path*/, &slow_case);

// get instance_size in InstanceKlass (scaled to a count of bytes)
__ ldrw(r3,
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/cpu/aarch64/vm_version_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ enum Ampere_CPU_Model {
static int dcache_line_size() { return _dcache_line_size; }
static int get_initial_sve_vector_length() { return _initial_sve_vector_length; };

// Aarch64 supports fast class initialization checks
static bool supports_fast_class_init_checks() { return true; }
constexpr static bool supports_stack_watermark_barrier() { return true; }

Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/arm/globalDefinitions_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ const bool HaveVFP = true;
// arm32 is not specified as multi-copy-atomic
// So we must not #define CPU_MULTI_COPY_ATOMIC

// The expected size in bytes of a cache line.
#define DEFAULT_CACHE_LINE_SIZE 64

// The default padding size for data structures to avoid false sharing.
#define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE

#define STUBROUTINES_MD_HPP "stubRoutines_arm.hpp"
#define INTERP_MASM_MD_HPP "interp_masm_arm.hpp"
#define TEMPLATETABLE_MD_HPP "templateTable_arm.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/arm/sharedRuntime_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
}
}

if (slot & 1) slot++;
return slot;
}

Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/cpu/ppc/globalDefinitions_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ const bool CCallingConventionRequiresIntsAsLongs = true;
// PPC64 is not specified as multi-copy-atomic
// So we must not #define CPU_MULTI_COPY_ATOMIC

// The expected size in bytes of a cache line, used to pad data structures.
// The expected size in bytes of a cache line.
#define DEFAULT_CACHE_LINE_SIZE 128

// The default padding size for data structures to avoid false sharing.
#define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE

#define SUPPORT_RESERVED_STACK_AREA

// If UseSIGTRAP is active, we only use the poll bit and no polling page.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
ShouldNotReachHere();
}
}
return align_up(stk, 2);
return stk;
}

#if defined(COMPILER1) || defined(COMPILER2)
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/vm_version_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class VM_Version: public Abstract_VM_Version {
// Override Abstract_VM_Version implementation
static void print_platform_virtualization_info(outputStream*);

// PPC64 supports fast class initialization checks for static methods.
// PPC64 supports fast class initialization checks
static bool supports_fast_class_init_checks() { return true; }
constexpr static bool supports_stack_watermark_barrier() { return true; }

Expand Down
11 changes: 11 additions & 0 deletions src/hotspot/cpu/riscv/assembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3184,6 +3184,17 @@ enum Nf {
return uabs(target - branch) < branch_range;
}

// Decode the given instruction, checking if it's a 16-bit compressed
// instruction and return the address of the next instruction.
static address locate_next_instruction(address inst) {
// Instruction wider than 16 bits has the two least-significant bits set.
if ((0x3 & *inst) == 0x3) {
return inst + instruction_size;
} else {
return inst + compressed_instruction_size;
}
}

Assembler(CodeBuffer* code) : AbstractAssembler(code), _in_compressible_region(true) {}
};

Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/riscv/globalDefinitions_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const bool CCallingConventionRequiresIntsAsLongs = false;

#define USE_POINTERS_TO_REGISTER_IMPL_ARRAY

// The expected size in bytes of a cache line.
#define DEFAULT_CACHE_LINE_SIZE 64

// The default padding size for data structures to avoid false sharing.
#define DEFAULT_PADDING_SIZE DEFAULT_CACHE_LINE_SIZE

#endif // CPU_RISCV_GLOBALDEFINITIONS_RISCV_HPP
51 changes: 51 additions & 0 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4481,6 +4481,57 @@ void MacroAssembler::zero_dcache_blocks(Register base, Register cnt, Register tm
bge(cnt, tmp1, loop);
}

// java.lang.Math.round(float a)
// Returns the closest int to the argument, with ties rounding to positive infinity.
void MacroAssembler::java_round_float(Register dst, FloatRegister src, FloatRegister ftmp) {
// this instructions calling sequence provides performance improvement on all tested devices;
// don't change it without re-verification
Label done;
mv(t0, jint_cast(0.5f));
fmv_w_x(ftmp, t0);

// dst = 0 if NaN
feq_s(t0, src, src); // replacing fclass with feq as performance optimization
mv(dst, zr);
beqz(t0, done);

// dst = (src + 0.5f) rounded down towards negative infinity
// Adding 0.5f to some floats exceeds the precision limits for a float and rounding takes place.
// RDN is required for fadd_s, RNE gives incorrect results:
// --------------------------------------------------------------------
// fadd.s rne (src + 0.5f): src = 8388609.000000 ftmp = 8388610.000000
// fcvt.w.s rdn: ftmp = 8388610.000000 dst = 8388610
// --------------------------------------------------------------------
// fadd.s rdn (src + 0.5f): src = 8388609.000000 ftmp = 8388609.000000
// fcvt.w.s rdn: ftmp = 8388609.000000 dst = 8388609
// --------------------------------------------------------------------
fadd_s(ftmp, src, ftmp, RoundingMode::rdn);
fcvt_w_s(dst, ftmp, RoundingMode::rdn);

bind(done);
}

// java.lang.Math.round(double a)
// Returns the closest long to the argument, with ties rounding to positive infinity.
void MacroAssembler::java_round_double(Register dst, FloatRegister src, FloatRegister ftmp) {
// this instructions calling sequence provides performance improvement on all tested devices;
// don't change it without re-verification
Label done;
mv(t0, julong_cast(0.5));
fmv_d_x(ftmp, t0);

// dst = 0 if NaN
feq_d(t0, src, src); // replacing fclass with feq as performance optimization
mv(dst, zr);
beqz(t0, done);

// dst = (src + 0.5) rounded down towards negative infinity
fadd_d(ftmp, src, ftmp, RoundingMode::rdn); // RDN is required here otherwise some inputs produce incorrect results
fcvt_l_d(dst, ftmp, RoundingMode::rdn);

bind(done);
}

#define FCVT_SAFE(FLOATCVT, FLOATSIG) \
void MacroAssembler::FLOATCVT##_safe(Register dst, FloatRegister src, Register tmp) { \
Label done; \
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/cpu/riscv/macroAssembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,9 @@ class MacroAssembler: public Assembler {
void fcvt_w_d_safe(Register dst, FloatRegister src, Register tmp = t0);
void fcvt_l_d_safe(Register dst, FloatRegister src, Register tmp = t0);

void java_round_float(Register dst, FloatRegister src, FloatRegister ftmp);
void java_round_double(Register dst, FloatRegister src, FloatRegister ftmp);

// vector load/store unit-stride instructions
void vlex_v(VectorRegister vd, Register base, Assembler::SEW sew, VectorMask vm = unmasked) {
switch (sew) {
Expand Down
28 changes: 28 additions & 0 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -8417,6 +8417,34 @@ instruct convN2I(iRegINoSp dst, iRegN src)
ins_pipe(ialu_reg);
%}

instruct round_double_reg(iRegLNoSp dst, fRegD src, fRegD ftmp) %{
match(Set dst (RoundD src));

ins_cost(XFER_COST + BRANCH_COST);
effect(TEMP ftmp);
format %{ "java_round_double $dst, $src\t#@round_double_reg" %}

ins_encode %{
__ java_round_double($dst$$Register, as_FloatRegister($src$$reg), as_FloatRegister($ftmp$$reg));
%}

ins_pipe(pipe_slow);
%}

instruct round_float_reg(iRegINoSp dst, fRegF src, fRegF ftmp) %{
match(Set dst (RoundF src));

ins_cost(XFER_COST + BRANCH_COST);
effect(TEMP ftmp);
format %{ "java_round_float $dst, $src\t#@round_float_reg" %}

ins_encode %{
__ java_round_float($dst$$Register, as_FloatRegister($src$$reg), as_FloatRegister($ftmp$$reg));
%}

ins_pipe(pipe_slow);
%}

// Convert oop pointer into compressed form
instruct encodeHeapOop(iRegNNoSp dst, iRegP src) %{
match(Set dst (EncodeP src));
Expand Down
Loading

0 comments on commit c30caa0

Please sign in to comment.