Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed May 14, 2024
2 parents ee173e5 + 5a4415a commit 4d5a043
Show file tree
Hide file tree
Showing 24 changed files with 654 additions and 284 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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 @@ -312,9 +312,6 @@ private static int makeSpecialCaseEntry(String currencyInfo) throws Exception {
checkCurrencyCode(newCurrency);
String timeString = currencyInfo.substring(4, length - 4);
long time = format.parse(timeString).getTime();
if (Math.abs(time - System.currentTimeMillis()) > ((long) 10) * 365 * 24 * 60 * 60 * 1000) {
throw new RuntimeException("time is more than 10 years from present: " + time);
}
specialCaseCutOverTimes[specialCaseCount] = time;
specialCaseOldCurrencies[specialCaseCount] = oldCurrency;
specialCaseOldCurrenciesDefaultFractionDigits[specialCaseCount] = getDefaultFractionDigits(oldCurrency);
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/riscv/assembler_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,15 +1869,10 @@ enum Nf {

// Vector Bit-manipulation used in Cryptography (Zvkb) Extension
INSN(vandn_vv, 0b1010111, 0b000, 0b000001);
INSN(vandn_vx, 0b1010111, 0b100, 0b000001);
INSN(vclmul_vv, 0b1010111, 0b010, 0b001100);
INSN(vclmul_vx, 0b1010111, 0b110, 0b001100);
INSN(vclmulh_vv, 0b1010111, 0b010, 0b001101);
INSN(vclmulh_vx, 0b1010111, 0b110, 0b001101);
INSN(vror_vv, 0b1010111, 0b000, 0b010100);
INSN(vror_vx, 0b1010111, 0b100, 0b010100);
INSN(vrol_vv, 0b1010111, 0b000, 0b010101);
INSN(vrol_vx, 0b1010111, 0b100, 0b010101);

#undef INSN

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/gc_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
product(bool, UseZGC, false, \
"Use the Z garbage collector") \
\
product(bool, ZGenerational, false, \
product(bool, ZGenerational, true, \
"Use the generational version of ZGC") \
\
product(bool, UseShenandoahGC, false, \
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/x/xArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ void XArguments::initialize_heap_flags_and_sizes() {
}

void XArguments::initialize() {
warning("Non-generational ZGC is deprecated.");

// Check mark stack size
const size_t mark_stack_space_limit = XAddressSpaceLimit::mark_stack();
if (ZMarkStackSpaceLimit > mark_stack_space_limit) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/x/xInitialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ XInitialize::XInitialize(XBarrierSet* barrier_set) {
log_info(gc, init)("Version: %s (%s)",
VM_Version::vm_release(),
VM_Version::jdk_debug_level());
log_info(gc, init)("Using legacy single-generation mode");
log_info(gc, init)("Using deprecated non-generational mode");

// Early initialization
XAddress::initialize();
Expand Down
19 changes: 12 additions & 7 deletions src/hotspot/share/nmt/memTracker.cpp
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.
* Copyright (c) 2020, 2023 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -146,12 +146,17 @@ void MemTracker::report(bool summary_only, outputStream* output, size_t scale) {
void MemTracker::tuning_statistics(outputStream* out) {
// NMT statistics
out->print_cr("Native Memory Tracking Statistics:");
out->print_cr("State: %s", NMTUtil::tracking_level_to_string(_tracking_level));
out->print_cr("Malloc allocation site table size: %d", MallocSiteTable::hash_buckets());
out->print_cr(" Tracking stack depth: %d", NMT_TrackingStackDepth);
out->cr();
MallocSiteTable::print_tuning_statistics(out);
out->cr();
out->print_cr("State: %s",
NMTUtil::tracking_level_to_string(_tracking_level));
if (_tracking_level == NMT_detail) {
out->print_cr("Malloc allocation site table size: %d",
MallocSiteTable::hash_buckets());
out->print_cr(" Tracking stack depth: %d",
NMT_TrackingStackDepth);
out->cr();
MallocSiteTable::print_tuning_statistics(out);
out->cr();
}
out->print_cr("Preinit state:");
NMTPreInit::print_state(out);
MallocLimitHandler::print_on(out);
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/nmt/nmtDCmd.cpp
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 @@ -137,8 +137,10 @@ void NMTDCmd::execute(DCmdSource source, TRAPS) {
output()->print_cr("No detail baseline for comparison");
}
} else if (_statistics.value()) {
if (check_detail_tracking_level(output())) {
if (MemTracker::enabled()) {
MemTracker::tuning_statistics(output());
} else {
output()->print_cr("Native memory tracking is not enabled");
}
} else {
ShouldNotReachHere();
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ static SpecialFlag const special_jvm_flags[] = {
// --- Non-alias flags - sorted by obsolete_in then expired_in:
{ "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "ZGenerational", JDK_Version::jdk(23), JDK_Version::undefined(), JDK_Version::undefined() },
{ "DumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "DynamicDumpSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
Expand Down
61 changes: 5 additions & 56 deletions src/java.base/share/classes/java/math/BigDecimal.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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 @@ -5680,18 +5680,8 @@ private static BigDecimal divideAndRound128(final long dividendHi, final long di

tmp = (dividendHi << shift) | (dividendLo >>> 64 - shift);
long u2 = tmp & LONG_MASK;
long q1, r_tmp;
if (v1 == 1) {
q1 = tmp;
r_tmp = 0;
} else if (tmp >= 0) {
q1 = tmp / v1;
r_tmp = tmp - q1 * v1;
} else {
long[] rq = divRemNegativeLong(tmp, v1);
q1 = rq[1];
r_tmp = rq[0];
}
long q1 = Long.divideUnsigned(tmp, v1);
long r_tmp = Long.remainderUnsigned(tmp, v1);

while(q1 >= DIV_NUM_BASE || unsignedLongCompare(q1*v0, make64(r_tmp, u1))) {
q1--;
Expand All @@ -5702,18 +5692,8 @@ private static BigDecimal divideAndRound128(final long dividendHi, final long di

tmp = mulsub(u2,u1,v1,v0,q1);
u1 = tmp & LONG_MASK;
long q0;
if (v1 == 1) {
q0 = tmp;
r_tmp = 0;
} else if (tmp >= 0) {
q0 = tmp / v1;
r_tmp = tmp - q0 * v1;
} else {
long[] rq = divRemNegativeLong(tmp, v1);
q0 = rq[1];
r_tmp = rq[0];
}
long q0 = Long.divideUnsigned(tmp, v1);
r_tmp = Long.remainderUnsigned(tmp, v1);

while(q0 >= DIV_NUM_BASE || unsignedLongCompare(q0*v0,make64(r_tmp,u0))) {
q0--;
Expand Down Expand Up @@ -5793,37 +5773,6 @@ static BigDecimal scaledTenPow(int n, int sign, int scale) {
}
}

/**
* Calculate the quotient and remainder of dividing a negative long by
* another long.
*
* @param n the numerator; must be negative
* @param d the denominator; must not be unity
* @return a two-element {@code long} array with the remainder and quotient in
* the initial and final elements, respectively
*/
private static long[] divRemNegativeLong(long n, long d) {
assert n < 0 : "Non-negative numerator " + n;
assert d != 1 : "Unity denominator";

// Approximate the quotient and remainder
long q = (n >>> 1) / (d >>> 1);
long r = n - q * d;

// Correct the approximation
while (r < 0) {
r += d;
q--;
}
while (r >= d) {
r -= d;
q++;
}

// n - q*d == r && 0 <= r < d, hence we're done.
return new long[] {r, q};
}

private static long make64(long hi, long lo) {
return hi<<32 | lo;
}
Expand Down
108 changes: 16 additions & 92 deletions src/java.base/share/classes/java/math/MutableBigInteger.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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 @@ -1092,9 +1092,9 @@ int divideOneWord(int divisor, MutableBigInteger quotient) {

// Special case of one word dividend
if (intLen == 1) {
long dividendValue = value[offset] & LONG_MASK;
int q = (int) (dividendValue / divisorLong);
int r = (int) (dividendValue - q * divisorLong);
int dividendValue = value[offset];
int q = Integer.divideUnsigned(dividendValue, divisor);
int r = Integer.remainderUnsigned(dividendValue, divisor);
quotient.value[0] = q;
quotient.intLen = (q == 0) ? 0 : 1;
quotient.offset = 0;
Expand All @@ -1106,41 +1106,17 @@ int divideOneWord(int divisor, MutableBigInteger quotient) {
quotient.offset = 0;
quotient.intLen = intLen;

// Normalize the divisor
int shift = Integer.numberOfLeadingZeros(divisor);

int rem = value[offset];
long remLong = rem & LONG_MASK;
if (remLong < divisorLong) {
quotient.value[0] = 0;
} else {
quotient.value[0] = (int)(remLong / divisorLong);
rem = (int) (remLong - (quotient.value[0] * divisorLong));
remLong = rem & LONG_MASK;
}
int xlen = intLen;
while (--xlen > 0) {
long dividendEstimate = (remLong << 32) |
long rem = 0;
for (int xlen = intLen; xlen > 0; xlen--) {
long dividendEstimate = (rem << 32) |
(value[offset + intLen - xlen] & LONG_MASK);
int q;
if (dividendEstimate >= 0) {
q = (int) (dividendEstimate / divisorLong);
rem = (int) (dividendEstimate - q * divisorLong);
} else {
long tmp = divWord(dividendEstimate, divisor);
q = (int) (tmp & LONG_MASK);
rem = (int) (tmp >>> 32);
}
int q = (int) Long.divideUnsigned(dividendEstimate, divisorLong);
rem = Long.remainderUnsigned(dividendEstimate, divisorLong);
quotient.value[intLen - xlen] = q;
remLong = rem & LONG_MASK;
}

quotient.normalize();
// Unnormalize
if (shift > 0)
return rem % divisor;
else
return rem;
return (int)rem;
}

/**
Expand Down Expand Up @@ -1557,14 +1533,8 @@ private MutableBigInteger divideMagnitude(MutableBigInteger div,
skipCorrection = qrem + 0x80000000 < nh2;
} else {
long nChunk = (((long)nh) << 32) | (nm & LONG_MASK);
if (nChunk >= 0) {
qhat = (int) (nChunk / dhLong);
qrem = (int) (nChunk - (qhat * dhLong));
} else {
long tmp = divWord(nChunk, dh);
qhat = (int) (tmp & LONG_MASK);
qrem = (int) (tmp >>> 32);
}
qhat = (int) Long.divideUnsigned(nChunk, dhLong);
qrem = (int) Long.remainderUnsigned(nChunk, dhLong);
}

if (qhat == 0)
Expand Down Expand Up @@ -1616,14 +1586,8 @@ private MutableBigInteger divideMagnitude(MutableBigInteger div,
skipCorrection = qrem + 0x80000000 < nh2;
} else {
long nChunk = (((long) nh) << 32) | (nm & LONG_MASK);
if (nChunk >= 0) {
qhat = (int) (nChunk / dhLong);
qrem = (int) (nChunk - (qhat * dhLong));
} else {
long tmp = divWord(nChunk, dh);
qhat = (int) (tmp & LONG_MASK);
qrem = (int) (tmp >>> 32);
}
qhat = (int) Long.divideUnsigned(nChunk, dhLong);
qrem = (int) Long.remainderUnsigned(nChunk, dhLong);
}
if (qhat != 0) {
if (!skipCorrection) { // Correct qhat
Expand Down Expand Up @@ -1732,14 +1696,8 @@ private MutableBigInteger divideLongMagnitude(long ldivisor, MutableBigInteger q
skipCorrection = qrem + 0x80000000 < nh2;
} else {
long nChunk = (((long) nh) << 32) | (nm & LONG_MASK);
if (nChunk >= 0) {
qhat = (int) (nChunk / dhLong);
qrem = (int) (nChunk - (qhat * dhLong));
} else {
long tmp = divWord(nChunk, dh);
qhat =(int)(tmp & LONG_MASK);
qrem = (int)(tmp>>>32);
}
qhat = (int) Long.divideUnsigned(nChunk, dhLong);
qrem = (int) Long.remainderUnsigned(nChunk, dhLong);
}

if (qhat == 0)
Expand Down Expand Up @@ -1834,40 +1792,6 @@ private boolean unsignedLongCompare(long one, long two) {
return (one+Long.MIN_VALUE) > (two+Long.MIN_VALUE);
}

/**
* This method divides a long quantity by an int to estimate
* qhat for two multi precision numbers. It is used when
* the signed value of n is less than zero.
* Returns long value where high 32 bits contain remainder value and
* low 32 bits contain quotient value.
*/
static long divWord(long n, int d) {
long dLong = d & LONG_MASK;
long r;
long q;
if (dLong == 1) {
q = (int)n;
r = 0;
return (r << 32) | (q & LONG_MASK);
}

// Approximate the quotient and remainder
q = (n >>> 1) / (dLong >>> 1);
r = n - q*dLong;

// Correct the approximation
while (r < 0) {
r += dLong;
q--;
}
while (r >= dLong) {
r -= dLong;
q++;
}
// n - q*dlong == r && 0 <= r <dLong, hence we're done.
return (r << 32) | (q & LONG_MASK);
}

/**
* Calculate the integer square root {@code floor(sqrt(this))} where
* {@code sqrt(.)} denotes the mathematical square root. The contents of
Expand Down
Loading

0 comments on commit 4d5a043

Please sign in to comment.