I3BSM0: backport 8231841 8254078 8168996 8140597 8214418 8259886

This commit is contained in:
DataAndOperation 2021-03-19 10:05:05 +08:00
parent 0b5ee58496
commit 0f5a44dc5e
11 changed files with 875 additions and 2 deletions

View File

@ -0,0 +1,116 @@
From c0bd92ca26dc2979f8be2f0a0477b1a945fe84ea Mon Sep 17 00:00:00 2001
Date: Mon, 8 Feb 2021 09:47:28 +0800
Subject: 8140597: Postpone the initial mark request until the
current mixed GC phase has finished.
DTS/AR: DTS202102030LAZOBP1G00
Summary: <g1>: <Postpone the initial mark request until the current mixed GC phase has finished.>
LLT: jtreg
Patch Type: backport
Bug url: https://dts-szv.clouddragon.huawei.com/DTSPortal/ticket/DTS202102030LAZOBP1G00
---
.../gc_implementation/g1/g1CollectedHeap.cpp | 1 -
.../g1/g1CollectorPolicy.cpp | 37 +++++++------------
.../g1/g1CollectorPolicy.hpp | 2 +
3 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 722e59857..47d8000a0 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2564,7 +2564,6 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
return;
} else {
if (cause == GCCause::_gc_locker || cause == GCCause::_wb_young_gc
- || cause == GCCause::_g1_periodic_collection
DEBUG_ONLY(|| cause == GCCause::_scavenge_alot)) {
// Schedule a standard evacuation pause. We're setting word_size
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index 05a270d26..ebf2619f9 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -921,8 +921,12 @@ void G1CollectorPolicy::record_concurrent_pause() {
}
}
+bool G1CollectorPolicy::about_to_start_mixed_phase() const {
+ return _g1->concurrent_mark()->cmThread()->during_cycle() || _last_young_gc;
+}
+
bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) {
- if (_g1->concurrent_mark()->cmThread()->during_cycle()) {
+ if (about_to_start_mixed_phase()) {
return false;
}
@@ -1068,16 +1072,10 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, Evacua
if (_last_young_gc) {
// This is supposed to to be the "last young GC" before we start
// doing mixed GCs. Here we decide whether to start mixed GCs or not.
-
- if (!last_pause_included_initial_mark) {
- if (next_gc_should_be_mixed("start mixed GCs",
+ assert(!last_pause_included_initial_mark, "The last young GC is not allowed to be an initial mark GC");
+ if (next_gc_should_be_mixed("start mixed GCs",
"do not start mixed GCs")) {
- set_gcs_are_young(false);
- }
- } else {
- ergo_verbose0(ErgoMixedGCs,
- "do not start mixed GCs",
- ergo_format_reason("concurrent cycle is about to start"));
+ set_gcs_are_young(false);
}
_last_young_gc = false;
}
@@ -1488,6 +1486,9 @@ void G1CollectorPolicy::update_survivors_policy(GCTracer &tracer) {
bool G1CollectorPolicy::force_initial_mark_if_outside_cycle(
GCCause::Cause gc_cause) {
+ // We actually check whether we are marking here and not if we are in a
+ // reclamation phase. This means that we will schedule a concurrent mark
+ // even while we are still in the process of reclaiming memory.
bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle();
if (!during_cycle) {
ergo_verbose1(ErgoConcCycles,
@@ -1523,20 +1524,10 @@ G1CollectorPolicy::decide_on_conc_mark_initiation() {
// gone over the initiating threshold and we should start a
// concurrent marking cycle. So we might initiate one.
- bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle();
- if (!during_cycle) {
- // The concurrent marking thread is not "during a cycle", i.e.,
- // it has completed the last one. So we can go ahead and
- // initiate a new cycle.
-
+ if (!about_to_start_mixed_phase() && gcs_are_young()) {
+ // Initiate a new initial mark only if there is no marking or reclamation going
+ // on.
set_during_initial_mark_pause();
- // We do not allow mixed GCs during marking.
- if (!gcs_are_young()) {
- set_gcs_are_young(true);
- ergo_verbose0(ErgoMixedGCs,
- "end mixed GCs",
- ergo_format_reason("concurrent cycle is about to start"));
- }
// And we can now clear initiate_conc_mark_if_possible() as
// we've already acted on it.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index 1c9180704..6438e5e90 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -706,6 +706,8 @@ public:
bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0);
+ bool about_to_start_mixed_phase() const;
+
// Record the start and end of an evacuation pause.
void record_collection_pause_start(double start_time_sec, GCTracer &tracer);
void record_collection_pause_end(double pause_time_ms, EvacuationInfo& evacuation_info);
--
2.19.0

View File

@ -0,0 +1,32 @@
From 9b140509c32b5878c1abdc16ec0edfd3e9f2f600 Mon Sep 17 00:00:00 2001
Date: Fri, 29 Jan 2021 09:34:07 +0800
Subject: 8168996: backport of C2 crash at postaloc.cpp:140 :
assert(false) failed: unexpected yanked node
DTS/AR: DTS2021012903VX2SP0H00
Summary: <C2>: Prevent MemBarAcquire from keeping a LoadNNode alive by adding it to the worklist if it is the only user of a DecodeNNode.
LLT: NA
Patch Type: backport
Bug url: https://bugs.openjdk.java.net/browse/JDK-8168996
---
hotspot/src/share/vm/opto/node.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp
index 60b390c09..a0d9acca4 100644
--- a/hotspot/src/share/vm/opto/node.cpp
+++ b/hotspot/src/share/vm/opto/node.cpp
@@ -1168,8 +1168,8 @@ bool Node::has_special_unique_user() const {
if( this->is_Store() ) {
// Condition for back-to-back stores folding.
return n->Opcode() == op && n->in(MemNode::Memory) == this;
- } else if (this->is_Load()) {
- // Condition for removing an unused LoadNode from the MemBarAcquire precedence input
+ } else if (this->is_Load() || this->is_DecodeN()) {
+ // Condition for removing an unused LoadNode or DecodeNNode from the MemBarAcquire precedence input
return n->Opcode() == Op_MemBarAcquire;
} else if( op == Op_AddL ) {
// Condition for convL2I(addL(x,y)) ==> addI(convL2I(x),convL2I(y))
--
2.19.0

View File

@ -0,0 +1,84 @@
From 7419e8c4fd5b858c43378cffc55b45845f845191 Mon Sep 17 00:00:00 2001
Date: Mon, 8 Mar 2021 09:28:45 +0800
Subject: 8214418: half-closed SSLEngine status may cause
application dead loop
DTS/AR: DTS20210308033J8XP0F00
Summary: <javax>: half-closed SSLEngine status may cause application dead loop
LLT: NA
Patch Type: backport
Bug url: https://hg.openjdk.java.net/jdk-updates/jdk11u-dev/rev/6852be0de227
---
.../classes/sun/security/ssl/Ciphertext.java | 2 --
.../classes/sun/security/ssl/SSLEngineImpl.java | 15 ++++++++++++++-
.../sun/security/ssl/TransportContext.java | 8 +-------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/jdk/src/share/classes/sun/security/ssl/Ciphertext.java b/jdk/src/share/classes/sun/security/ssl/Ciphertext.java
index 842db23af..5f95102b4 100644
--- a/jdk/src/share/classes/sun/security/ssl/Ciphertext.java
+++ b/jdk/src/share/classes/sun/security/ssl/Ciphertext.java
@@ -31,8 +31,6 @@ import javax.net.ssl.SSLEngineResult.HandshakeStatus;
* Ciphertext
*/
final class Ciphertext {
- static final Ciphertext CIPHERTEXT_NULL = new Ciphertext();
-
final byte contentType;
final byte handshakeType;
final long recordSN;
diff --git a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
index 7906e5181..ef64c7b4e 100644
--- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
+++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
@@ -227,6 +227,19 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport {
hsStatus = ciphertext.handshakeStatus;
} else {
hsStatus = getHandshakeStatus();
+ if (ciphertext == null && !conContext.isNegotiated &&
+ conContext.isInboundClosed() &&
+ hsStatus == HandshakeStatus.NEED_WRAP) {
+ // Even the outboud is open, no futher data could be wrapped as:
+ // 1. the outbound is empty
+ // 2. no negotiated connection
+ // 3. the inbound has closed, cannot complete the handshake
+ //
+ // Mark the engine as closed if the handshake status is
+ // NEED_WRAP. Otherwise, it could lead to dead loops in
+ // applications.
+ status = Status.CLOSED;
+ }
}
int deltaSrcs = srcsRemains;
@@ -258,7 +271,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport {
}
if (ciphertext == null) {
- return Ciphertext.CIPHERTEXT_NULL;
+ return null;
}
// Is the handshake completed?
diff --git a/jdk/src/share/classes/sun/security/ssl/TransportContext.java b/jdk/src/share/classes/sun/security/ssl/TransportContext.java
index e9ffb3802..77a3c3bd5 100644
--- a/jdk/src/share/classes/sun/security/ssl/TransportContext.java
+++ b/jdk/src/share/classes/sun/security/ssl/TransportContext.java
@@ -576,13 +576,7 @@ class TransportContext implements ConnectionContext {
} else if (!isOutboundClosed()) {
// Special case that the inbound was closed, but outbound open.
return HandshakeStatus.NEED_WRAP;
- }
- } else if (isOutboundClosed() && !isInboundClosed()) {
- // Special case that the outbound was closed, but inbound open.
- return HandshakeStatus.NEED_UNWRAP;
- } else if (!isOutboundClosed() && isInboundClosed()) {
- // Special case that the inbound was closed, but outbound open.
- return HandshakeStatus.NEED_WRAP;
+ } // Otherwise, both inbound and outbound are closed.
}
return HandshakeStatus.NOT_HANDSHAKING;
--
2.19.0

View File

@ -0,0 +1,29 @@
From b271a27e0a3742705b1515976ad63ffa791a6a79 Mon Sep 17 00:00:00 2001
Date: Fri, 18 Dec 2020 11:18:19 +0800
Subject: 8231841: debug.cpp help() is missing an AArch64 line
for pns
DTS/AR: AR.SR.IREQ02373832.002.001
Summary: < hotspot> : debug.cpp help() is missing an AArch64 line for pns
LLT: NA
Patch Type: backport
Bug url: https://bugs.openjdk.java.net/browse/JDK-8231841
---
hotspot/src/share/vm/utilities/debug.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp
index 4f7cbddcd..7ba3a4c83 100644
--- a/hotspot/src/share/vm/utilities/debug.cpp
+++ b/hotspot/src/share/vm/utilities/debug.cpp
@@ -687,6 +687,7 @@ void help() {
tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g.");
tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or");
tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or");
+ tty->print_cr(" pns($sp, $fp, $pc) on Linux/AArch64 or");
tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or");
tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC");
tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()");
--
2.19.0

View File

@ -0,0 +1,92 @@
From 4deae815b41e9dd02eb49bae3148f774c346e8a5 Mon Sep 17 00:00:00 2001
Date: Mon, 25 Jan 2021 15:48:35 +0800
Subject: 8254078: DataOutputStream is very slow post-disabling
of Biased Locking
DTS/AR: DTS202101180520BWP1D00
Summary: <JDK> : DataOutputStream is very slow post-disabling of Biased Locking
LLT: jtreg
Patch Type: backport
Bug url: https://bugs.openjdk.java.net/browse/JDK-8254078
---
.../classes/java/io/DataInputStream.java | 7 +++---
.../classes/java/io/DataOutputStream.java | 24 ++++++++++++-------
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/jdk/src/share/classes/java/io/DataInputStream.java b/jdk/src/share/classes/java/io/DataInputStream.java
index 7b24b74de..9516d0a7d 100644
--- a/jdk/src/share/classes/java/io/DataInputStream.java
+++ b/jdk/src/share/classes/java/io/DataInputStream.java
@@ -31,9 +31,10 @@ package java.io;
* way. An application uses a data output stream to write data that
* can later be read by a data input stream.
* <p>
- * DataInputStream is not necessarily safe for multithreaded access.
- * Thread safety is optional and is the responsibility of users of
- * methods in this class.
+ * A DataInputStream is not safe for use by multiple concurrent
+ * threads. If a DataInputStream is to be used by more than one
+ * thread then access to the data input stream should be controlled
+ * by appropriate synchronization.
*
* @author Arthur van Hoff
* @see java.io.DataOutputStream
diff --git a/jdk/src/share/classes/java/io/DataOutputStream.java b/jdk/src/share/classes/java/io/DataOutputStream.java
index 99fafed84..7628fb916 100644
--- a/jdk/src/share/classes/java/io/DataOutputStream.java
+++ b/jdk/src/share/classes/java/io/DataOutputStream.java
@@ -29,6 +29,11 @@ package java.io;
* A data output stream lets an application write primitive Java data
* types to an output stream in a portable way. An application can
* then use a data input stream to read the data back in.
+ * <p>
+ * A DataOutputStream is not safe for use by multiple concurrent
+ * threads. If a DataOutputStream is to be used by more than one
+ * thread then access to the data output stream should be controlled
+ * by appropriate synchronization.
*
* @author unascribed
* @see java.io.DataInputStream
@@ -164,8 +169,9 @@ class DataOutputStream extends FilterOutputStream implements DataOutput {
* @see java.io.FilterOutputStream#out
*/
public final void writeShort(int v) throws IOException {
- out.write((v >>> 8) & 0xFF);
- out.write((v >>> 0) & 0xFF);
+ writeBuffer[0] = (byte)(v >>> 8);
+ writeBuffer[1] = (byte)(v >>> 0);
+ out.write(writeBuffer, 0, 2);
incCount(2);
}
@@ -179,8 +185,9 @@ class DataOutputStream extends FilterOutputStream implements DataOutput {
* @see java.io.FilterOutputStream#out
*/
public final void writeChar(int v) throws IOException {
- out.write((v >>> 8) & 0xFF);
- out.write((v >>> 0) & 0xFF);
+ writeBuffer[0] = (byte)(v >>> 8);
+ writeBuffer[1] = (byte)(v >>> 0);
+ out.write(writeBuffer, 0, 2);
incCount(2);
}
@@ -194,10 +201,11 @@ class DataOutputStream extends FilterOutputStream implements DataOutput {
* @see java.io.FilterOutputStream#out
*/
public final void writeInt(int v) throws IOException {
- out.write((v >>> 24) & 0xFF);
- out.write((v >>> 16) & 0xFF);
- out.write((v >>> 8) & 0xFF);
- out.write((v >>> 0) & 0xFF);
+ writeBuffer[0] = (byte)(v >>> 24);
+ writeBuffer[1] = (byte)(v >>> 16);
+ writeBuffer[2] = (byte)(v >>> 8);
+ writeBuffer[3] = (byte)(v >>> 0);
+ out.write(writeBuffer, 0, 4);
incCount(4);
}
--
2.19.0

View File

@ -0,0 +1,95 @@
From c30e6789e2406ef5085978458c1342505f0eeb0b Mon Sep 17 00:00:00 2001
Date: Thu, 11 Mar 2021 14:34:12 +0800
Subject: 8259886: Improve SSL session cache performance and
scalability
DTS/AR: DTS202103110E0APCP0H00
Summary: <javax.net.ssl>: Improve SSL session cache performance and scalability
LLT: NA
Patch Type: backport
Bug url: https://bugs.openjdk.java.net/browse/JDK-8259886
---
.../classes/sun/security/util/Cache.java | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/sun/security/util/Cache.java b/jdk/src/share/classes/sun/security/util/Cache.java
index 7a2e6f394..1ba64a2c7 100644
--- a/jdk/src/share/classes/sun/security/util/Cache.java
+++ b/jdk/src/share/classes/sun/security/util/Cache.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2021, 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
@@ -252,6 +252,7 @@ class MemoryCache<K,V> extends Cache<K,V> {
private final Map<K, CacheEntry<K,V>> cacheMap;
private int maxSize;
private long lifetime;
+ private long nextExpirationTime = Long.MAX_VALUE;
// ReferenceQueue is of type V instead of Cache<K,V>
// to allow SoftCacheEntry to extend SoftReference<V>
@@ -321,12 +322,18 @@ class MemoryCache<K,V> extends Cache<K,V> {
}
int cnt = 0;
long time = System.currentTimeMillis();
+ if (nextExpirationTime > time) {
+ return;
+ }
+ nextExpirationTime = Long.MAX_VALUE;
for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator();
t.hasNext(); ) {
CacheEntry<K,V> entry = t.next();
if (entry.isValid(time) == false) {
t.remove();
cnt++;
+ } else if (nextExpirationTime > entry.getExpirationTime()) {
+ nextExpirationTime = entry.getExpirationTime();
}
}
if (DEBUG) {
@@ -360,6 +367,9 @@ class MemoryCache<K,V> extends Cache<K,V> {
emptyQueue();
long expirationTime = (lifetime == 0) ? 0 :
System.currentTimeMillis() + lifetime;
+ if (expirationTime < nextExpirationTime) {
+ nextExpirationTime = expirationTime;
+ }
CacheEntry<K,V> newEntry = newEntry(key, value, expirationTime, queue);
CacheEntry<K,V> oldEntry = cacheMap.put(key, newEntry);
if (oldEntry != null) {
@@ -474,6 +484,7 @@ class MemoryCache<K,V> extends Cache<K,V> {
V getValue();
+ long getExpirationTime();
}
private static class HardCacheEntry<K,V> implements CacheEntry<K,V> {
@@ -496,6 +507,10 @@ class MemoryCache<K,V> extends Cache<K,V> {
return value;
}
+ public long getExpirationTime() {
+ return expirationTime;
+ }
+
public boolean isValid(long currentTime) {
boolean valid = (currentTime <= expirationTime);
if (valid == false) {
@@ -533,6 +548,10 @@ class MemoryCache<K,V> extends Cache<K,V> {
return get();
}
+ public long getExpirationTime() {
+ return expirationTime;
+ }
+
public boolean isValid(long currentTime) {
boolean valid = (currentTime <= expirationTime) && (get() != null);
if (valid == false) {
--
2.19.0

121
C1-typos-repair.patch Executable file
View File

@ -0,0 +1,121 @@
From 693b5eed765417ab055a19cbd5fd392cb052b06f Mon Sep 17 00:00:00 2001
Date: Sat, 27 Feb 2021 17:06:24 +0800
Subject: C1 typos repair
DTS/AR: DTS202102240GWU4QP1O00
Summary: <hotspot>: <C1 typos repair>
LLT: NA
Patch Type: huawei
Bug url: NA
---
.../src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp | 6 +++---
.../src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp | 3 +--
hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 7 +++----
hotspot/src/share/vm/c1/c1_LIR.hpp | 12 ++++++------
hotspot/src/share/vm/c1/c1_LIRGenerator.hpp | 1 -
5 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
index 2df587d96..60b67494c 100644
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
@@ -1004,7 +1004,7 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
if (UseCompressedOops && !wide) {
__ ldrw(dest->as_register(), as_Address(from_addr));
} else {
- __ ldr(dest->as_register(), as_Address(from_addr));
+ __ ldr(dest->as_register(), as_Address(from_addr));
}
break;
case T_METADATA:
@@ -1020,9 +1020,9 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
// address that matches klass_offset_in_bytes() will be loaded
// as a word, not a long.
if (UseCompressedClassPointers && addr->disp() == oopDesc::klass_offset_in_bytes()) {
- __ ldrw(dest->as_register(), as_Address(from_addr));
+ __ ldrw(dest->as_register(), as_Address(from_addr));
} else {
- __ ldr(dest->as_register(), as_Address(from_addr));
+ __ ldr(dest->as_register(), as_Address(from_addr));
}
break;
case T_INT:
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
index cee0730d9..6d0b4acbd 100644
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
@@ -965,7 +965,6 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) {
assert(UseCRC32Intrinsics, "why are we here?");
// Make all state_for calls early since they can emit code
LIR_Opr result = rlock_result(x);
- int flags = 0;
switch (x->id()) {
case vmIntrinsics::_updateCRC32: {
LIRItem crc(x->argument_at(0), this);
@@ -992,7 +991,7 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) {
int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
if(off.result()->is_constant()) {
index = LIR_OprFact::illegalOpr;
- offset += off.result()->as_jint();
+ offset += off.result()->as_jint();
}
LIR_Opr base_op = buf.result();
diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
index 174e59436..459315cb7 100644
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
@@ -3243,10 +3243,9 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope)
// Compiles where the root method is an intrinsic need a special
// compilation environment because the bytecodes for the method
// shouldn't be parsed during the compilation, only the special
- // Intrinsic node should be emitted. If this isn't done the the
- // code for the inlined version will be different than the root
- // compiled version which could lead to monotonicity problems on
- // intel.
+ // Intrinsic node should be emitted. If this isn't done the code
+ // for the inlined version will be different than the root compiled
+ // version which could lead to monotonicity problems on intel.
// Set up a stream so that appending instructions works properly.
ciBytecodeStream s(scope->method());
diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp
index 37232b9ba..cde709684 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp
@@ -200,14 +200,14 @@ class LIR_Const: public LIR_OprPtr {
class LIR_OprDesc: public CompilationResourceObj {
public:
// value structure:
- // data opr-type opr-kind
- // +--------------+-------+-------+
- // [max...........|7 6 5 4|3 2 1 0]
- // ^
- // is_pointer bit
+ // data opr-type opr-kind
+ // +-----------+----------+-------+
+ // [max........|6 5 4 3|2 1 0]
+ // ^
+ // is_pointer bit
//
// lowest bit cleared, means it is a structure pointer
- // we need 4 bits to represent types
+ // we need 4 bits to represent types
private:
friend class LIR_OprFact;
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
index 0ae48924a..24d072b36 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
@@ -611,7 +611,6 @@ class LIRItem: public CompilationResourceObj {
} else {
return _result;
}
- return _result;
}
void set_result(LIR_Opr opr);
--
2.19.0

133
Use-Mutex-when-G1Uncommit.patch Executable file
View File

@ -0,0 +1,133 @@
From 120ea606bc94b68e8a8d7d8c2cfc41bf472b5742 Mon Sep 17 00:00:00 2001
Date: Mon, 8 Feb 2021 10:32:10 +0800
Subject: Use Mutex when G1Uncommit
DTS/AR: DTS2021021804F2O5P0H00
Summary: <g1>: <Use Mutex when G1Uncommit>
LLT: jtreg
Patch Type: huawei
Bug url: https://dts-szv.clouddragon.huawei.com/DTSPortal/ticket/DTS2021021804F2O5P0H00
---
.../g1/g1PageBasedVirtualSpace.cpp | 8 +++----
.../g1/g1RegionToSpaceMapper.cpp | 22 +++++++++++++------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
index 1a22af82a..075217d60 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
@@ -211,12 +211,12 @@ bool G1PageBasedVirtualSpace::commit(size_t start_page, size_t size_in_pages) {
// Check for dirty pages and update zero_filled if any found.
if (_dirty.get_next_one_offset(start_page, end_page) < end_page) {
zero_filled = false;
- _dirty.clear_range(start_page, end_page);
+ _dirty.par_clear_range(start_page, end_page, BitMap::unknown_range);
}
} else {
commit_internal(start_page, end_page);
}
- _committed.set_range(start_page, end_page);
+ _committed.par_set_range(start_page, end_page, BitMap::unknown_range);
if (AlwaysPreTouch) {
pretouch_internal(start_page, end_page);
@@ -239,12 +239,12 @@ void G1PageBasedVirtualSpace::uncommit(size_t start_page, size_t size_in_pages)
if (_special) {
// Mark that memory is dirty. If committed again the memory might
// need to be cleared explicitly.
- _dirty.set_range(start_page, end_page);
+ _dirty.par_set_range(start_page, end_page, BitMap::unknown_range);
} else {
uncommit_internal(start_page, end_page);
}
- _committed.clear_range(start_page, end_page);
+ _committed.par_clear_range(start_page, end_page, BitMap::unknown_range);
}
bool G1PageBasedVirtualSpace::contains(const void* p) const {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
index 51b2bd8ad..f07c27107 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
@@ -26,6 +26,8 @@
#include "gc_implementation/g1/g1BiasedArray.hpp"
#include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
#include "memory/allocation.inline.hpp"
+#include "runtime/mutex.hpp"
+#include "runtime/mutexLocker.hpp"
#include "runtime/virtualspace.hpp"
#include "services/memTracker.hpp"
#include "utilities/bitMap.inline.hpp"
@@ -68,13 +70,13 @@ class G1RegionsLargerThanCommitSizeMapper : public G1RegionToSpaceMapper {
virtual void commit_regions(uint start_idx, size_t num_regions) {
bool zero_filled = _storage.commit((size_t)start_idx * _pages_per_region, num_regions * _pages_per_region);
- _commit_map.set_range(start_idx, start_idx + num_regions);
+ _commit_map.par_set_range(start_idx, start_idx + num_regions, BitMap::unknown_range);
fire_on_commit(start_idx, num_regions, zero_filled);
}
virtual void uncommit_regions(uint start_idx, size_t num_regions) {
_storage.uncommit((size_t)start_idx * _pages_per_region, num_regions * _pages_per_region);
- _commit_map.clear_range(start_idx, start_idx + num_regions);
+ _commit_map.par_clear_range(start_idx, start_idx + num_regions, BitMap::unknown_range);
}
};
@@ -89,7 +91,7 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
};
size_t _regions_per_page;
-
+ Mutex _par_lock;
CommitRefcountArray _refcounts;
uintptr_t region_idx_to_page_idx(uint region) const {
@@ -104,6 +106,7 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
size_t commit_factor,
MemoryType type) :
G1RegionToSpaceMapper(rs, actual_size, page_size, alloc_granularity, type),
+ _par_lock(Mutex::leaf, "G1RegionsSmallerThanCommitSizeMapper par lock"),
_regions_per_page((page_size * commit_factor) / alloc_granularity), _refcounts() {
guarantee((page_size * commit_factor) >= alloc_granularity, "allocation granularity smaller than commit granularity");
@@ -113,13 +116,15 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
virtual void commit_regions(uint start_idx, size_t num_regions) {
for (uint i = start_idx; i < start_idx + num_regions; i++) {
+ MutexLockerEx x(&_par_lock);
assert(!_commit_map.at(i), err_msg("Trying to commit storage at region %u that is already committed", i));
size_t idx = region_idx_to_page_idx(i);
- uint new_refcount = Atomic::add(1, (volatile jint*)_refcounts.get_address_by_index(idx));
+ uint old_refcount = _refcounts.get_by_index(idx);
bool zero_filled = false;
- if (new_refcount == 1) {
+ if (old_refcount == 0) {
zero_filled = _storage.commit(idx, 1);
}
+ _refcounts.set_by_index(idx, old_refcount + 1);
_commit_map.set_bit(i);
fire_on_commit(i, 1, zero_filled);
}
@@ -127,12 +132,15 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
virtual void uncommit_regions(uint start_idx, size_t num_regions) {
for (uint i = start_idx; i < start_idx + num_regions; i++) {
+ MutexLockerEx x(&_par_lock);
assert(_commit_map.at(i), err_msg("Trying to uncommit storage at region %u that is not committed", i));
size_t idx = region_idx_to_page_idx(i);
- uint new_refcount = Atomic::add(-1, (volatile jint*)_refcounts.get_address_by_index(idx));
- if (new_refcount == 0) {
+ uint old_refcount = _refcounts.get_by_index(idx);
+ assert(old_refcount > 0, "must be");
+ if (old_refcount == 1) {
_storage.uncommit(idx, 1);
}
+ _refcounts.set_by_index(idx, old_refcount - 1);
_commit_map.clear_bit(i);
}
}
--
2.19.0

View File

@ -0,0 +1,110 @@
From bdff9eab4eb0bc16ebdbe908cc6237e0a70d53e6 Mon Sep 17 00:00:00 2001
Date: Sat, 26 Dec 2020 11:22:37 +0800
Subject: Use atomic operation when G1Uncommit
DTS/AR: DTS2021012207P2X7P0E00
Summary: <g1>: <Use atomic operation when G1Uncommit>
LLT: jtreg
Patch Type: huawei
Bug url: https://dts-szv.clouddragon.huawei.com/DTSPortal/ticket/DTS2021012207P2X7P0E00
---
.../vm/gc_implementation/g1/g1BiasedArray.hpp | 5 ++++
.../g1/g1RegionToSpaceMapper.cpp | 11 ++++-----
.../vm/gc_implementation/g1/heapRegion.cpp | 24 +++++++++++++++++++
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp
index 88a673574..e13c3fe8d 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp
@@ -109,6 +109,11 @@ public:
return this->base()[index];
}
+ T* get_address_by_index(idx_t index) const {
+ verify_index(index);
+ return this->base() + index;
+ }
+
// Set the element of the given array at the given index to the
// given value. Assume the index is valid. This is a convenience
// method that does sanity checking on the index.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
index 0c26b783e..51b2bd8ad 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp
@@ -115,12 +115,11 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
for (uint i = start_idx; i < start_idx + num_regions; i++) {
assert(!_commit_map.at(i), err_msg("Trying to commit storage at region %u that is already committed", i));
size_t idx = region_idx_to_page_idx(i);
- uint old_refcount = _refcounts.get_by_index(idx);
+ uint new_refcount = Atomic::add(1, (volatile jint*)_refcounts.get_address_by_index(idx));
bool zero_filled = false;
- if (old_refcount == 0) {
+ if (new_refcount == 1) {
zero_filled = _storage.commit(idx, 1);
}
- _refcounts.set_by_index(idx, old_refcount + 1);
_commit_map.set_bit(i);
fire_on_commit(i, 1, zero_filled);
}
@@ -130,12 +129,10 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper {
for (uint i = start_idx; i < start_idx + num_regions; i++) {
assert(_commit_map.at(i), err_msg("Trying to uncommit storage at region %u that is not committed", i));
size_t idx = region_idx_to_page_idx(i);
- uint old_refcount = _refcounts.get_by_index(idx);
- assert(old_refcount > 0, "must be");
- if (old_refcount == 1) {
+ uint new_refcount = Atomic::add(-1, (volatile jint*)_refcounts.get_address_by_index(idx));
+ if (new_refcount == 0) {
_storage.uncommit(idx, 1);
}
- _refcounts.set_by_index(idx, old_refcount - 1);
_commit_map.clear_bit(i);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 32f8b1985..987d2c138 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -322,6 +322,29 @@ HeapRegion::HeapRegion(uint hrm_index,
}
void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
+ _humongous_start_region = NULL;
+ _in_collection_set = false;
+ _next_in_special_set = NULL;
+ _orig_end = NULL;
+ _claimed = InitialClaimValue;
+ _evacuation_failed = false;
+ _prev_marked_bytes = 0;
+ _next_marked_bytes = 0;
+ _gc_efficiency = 0.0;
+ _next_young_region = NULL;
+ _next_dirty_cards_region = NULL;
+ _next = NULL;
+ _prev = NULL;
+#ifdef ASSERT
+ _containing_set = NULL;
+#endif // ASSERT
+ _in_uncommit_list = false;
+ _young_index_in_cset = -1;
+ _surv_rate_group = NULL;
+ _age_index = -1;
+ _recorded_rs_length = 0;
+ _predicted_elapsed_time_ms = 0;
+ _predicted_bytes_to_copy = 0;
assert(_rem_set->is_empty(), "Remembered set must be empty");
G1OffsetTableContigSpace::initialize(mr, clear_space, mangle_space);
@@ -1161,6 +1184,7 @@ G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
CompactibleSpace::initialize(mr, clear_space, mangle_space);
+ _gc_time_stamp = 0;
_top = bottom();
_scan_top = bottom();
set_saved_mark_word(NULL);
--
2.19.0

View File

@ -0,0 +1,29 @@
From 00c58142616a05509f005a676f786edaad88bfb4 Mon Sep 17 00:00:00 2001
Date: Thu, 24 Dec 2020 16:12:02 +0800
Subject: initialized value should be 0 in perfInit()
DTS/AR: AR.SR.IREQ02517150.001.001
Summary: <g1>: <initialized value should be 0 in perfInit()>
LLT:
Patch Type: huawei
Bug url:
---
hotspot/src/os/linux/vm/process_load.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hotspot/src/os/linux/vm/process_load.hpp b/hotspot/src/os/linux/vm/process_load.hpp
index 83800b199..896754d5e 100644
--- a/hotspot/src/os/linux/vm/process_load.hpp
+++ b/hotspot/src/os/linux/vm/process_load.hpp
@@ -197,7 +197,7 @@ static int get_jvmticks(ticks *pticks) {
* This method must be called first, before any data can be gathererd.
*/
int perfInit() {
- static int initialized=1;
+ static int initialized = 0;
if (!initialized) {
int i;
--
2.19.0

View File

@ -921,7 +921,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
Name: java-%{javaver}-%{origin} Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver} Version: %{javaver}.%{updatever}.%{buildver}
Release: 6 Release: 7
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages # and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a # also included the epoch in their virtual provides. This created a
@ -1080,6 +1080,16 @@ Patch150: 8240353.patch
# 8u292 # 8u292
Patch151: kae-phase1.patch Patch151: kae-phase1.patch
Patch152: 8231841-debug.cpp-help-is-missing-an-AArch64-line-fo.patch
Patch153: initialized-value-should-be-0-in-perfInit.patch
Patch154: 8254078-DataOutputStream-is-very-slow-post-disabling.patch
Patch155: Use-atomic-operation-when-G1Uncommit.patch
Patch156: 8168996-backport-of-C2-crash-at-postaloc.cpp-140-ass.patch
Patch157: 8140597-Postpone-the-initial-mark-request-until-the-.patch
Patch158: Use-Mutex-when-G1Uncommit.patch
Patch159: C1-typos-repair.patch
Patch160: 8214418-half-closed-SSLEngine-status-may-cause-appli.patch
Patch161: 8259886-Improve-SSL-session-cache-performance-and-sc.patch
############################################# #############################################
# #
@ -1506,6 +1516,16 @@ pushd %{top_level_dir_name}
%patch149 -p1 %patch149 -p1
%patch150 -p1 %patch150 -p1
%patch151 -p1 %patch151 -p1
%patch152 -p1
%patch153 -p1
%patch154 -p1
%patch155 -p1
%patch156 -p1
%patch157 -p1
%patch158 -p1
%patch159 -p1
%patch160 -p1
%patch161 -p1
popd popd
@ -2122,7 +2142,19 @@ require "copy_jdk_configs.lua"
%endif %endif
%changelog %changelog
* Wed Mar 17 2021 noah <hedongbo@huawei.com> - 1:1.8.0.292-b01.1 * Fri Mar 19 2021 DataAndOperation <mashoubing1@huawei.com> - 1:1.8.0.282-b08.7
- add 8231841-debug.cpp-help-is-missing-an-AArch64-line-fo.patch
- add initialized-value-should-be-0-in-perfInit.patch
- add 8254078-DataOutputStream-is-very-slow-post-disabling.patch
- add Use-atomic-operation-when-G1Uncommit.patch
- add 8168996-backport-of-C2-crash-at-postaloc.cpp-140-ass.patch
- add 8140597-Postpone-the-initial-mark-request-until-the-.patch
- add Use-Mutex-when-G1Uncommit.patch
- add C1-typos-repair.patch
- add 8214418-half-closed-SSLEngine-status-may-cause-appli.patch
- add 8259886-Improve-SSL-session-cache-performance-and-sc.patch
* Wed Mar 17 2021 noah <hedongbo@huawei.com> - 1:1.8.0.282-b08.6
- add kae-phase1.patch - add kae-phase1.patch
* Fri Feb 5 2021 noah <hedongbo@huawei.com> - 1:1.8.0.282-b08.5 * Fri Feb 5 2021 noah <hedongbo@huawei.com> - 1:1.8.0.282-b08.5