!10 Update to jdk8u-shenandoah-8u262-b02

Merge pull request !10 from jdkboy/master
This commit is contained in:
openeuler-ci-bot 2020-05-23 09:55:28 +08:00 committed by Gitee
commit 6bcdbfa914
13 changed files with 527 additions and 4308 deletions

View File

@ -0,0 +1,33 @@
From 49a2e9b6736355ccf7a836784f8fc214458c16bc Mon Sep 17 00:00:00 2001
Date: Wed, 22 Apr 2020 17:51:21 +0000
Subject: [PATCH] 6858051: Add a switch for the dynamic thread related log
Summary: <gc>: Add a switch for the dynamic thread related log
LLT: hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java
Bug url: https://bugs.openjdk.java.net/browse/JDK-6858051
---
hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp b/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp
index 1a840cf2b..d48d60f3e 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp
@@ -67,9 +67,11 @@ class WorkerManager : public AllStatic {
os::start_thread(new_worker);
}
- gclog_or_tty->print_cr("AdaptiveSizePolicy::add_workers() : "
- "active_workers: %u created_workers: %u",
- active_workers, created_workers);
+ if (TraceDynamicGCThreads) {
+ gclog_or_tty->print_cr("AdaptiveSizePolicy::add_workers() : "
+ "active_workers: %u created_workers: %u",
+ active_workers, created_workers);
+ }
return created_workers;
}
--
2.12.3

View File

@ -0,0 +1,458 @@
From 4ebab5f80152a4f807206f9464a261a75341c97c Mon Sep 17 00:00:00 2001
Date: Fri, 3 Apr 2020 14:14:31 +0000
Subject: [PATCH] 6858051: Create GC worker threads dynamically
Summary: <gc>: Create GC worker threads dynamically
LLT: hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java
Bug url: https://bugs.openjdk.java.net/browse/JDK-6858051
---
.../parallelScavenge/gcTaskManager.cpp | 70 ++++++++++++++------
.../parallelScavenge/gcTaskManager.hpp | 12 +++-
.../parallelScavenge/gcTaskThread.cpp | 7 --
.../parallelScavenge/gcTaskThread.hpp | 6 +-
.../shared/adaptiveSizePolicy.cpp | 9 +--
.../shared/adaptiveSizePolicy.hpp | 2 +-
.../vm/gc_implementation/shared/workerManager.hpp | 77 ++++++++++++++++++++++
7 files changed, 144 insertions(+), 39 deletions(-)
create mode 100644 hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
index 153e5bd86..3efeab85d 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
@@ -25,12 +25,13 @@
#include "precompiled.hpp"
#include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
#include "gc_implementation/parallelScavenge/gcTaskThread.hpp"
-#include "gc_implementation/shared/adaptiveSizePolicy.hpp"
+#include "gc_implementation/shared/workerManager.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/mutex.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/orderAccess.inline.hpp"
+#include "runtime/os.hpp"
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -381,6 +382,7 @@ GCTaskManager::GCTaskManager(uint workers) :
_workers(workers),
_active_workers(0),
_idle_workers(0),
+ _created_workers(0),
_ndc(NULL) {
initialize();
}
@@ -389,10 +391,28 @@ GCTaskManager::GCTaskManager(uint workers, NotifyDoneClosure* ndc) :
_workers(workers),
_active_workers(0),
_idle_workers(0),
+ _created_workers(0),
_ndc(ndc) {
initialize();
}
+GCTaskThread* GCTaskManager::install_worker(uint t) {
+ GCTaskThread* new_worker = GCTaskThread::create(this, t, _processor_assignment[t]);
+ set_thread(t, new_worker);
+ return new_worker;
+}
+
+void GCTaskManager::add_workers(bool initializing) {
+ os::ThreadType worker_type = os::pgc_thread;
+ _created_workers = WorkerManager::add_workers(this,
+ _active_workers,
+ (uint) _workers,
+ _created_workers,
+ worker_type,
+ initializing);
+ _active_workers = MIN2(_created_workers, _active_workers);
+}
+
void GCTaskManager::initialize() {
if (TraceGCTaskManager) {
tty->print_cr("GCTaskManager::initialize: workers: %u", workers());
@@ -411,25 +431,27 @@ void GCTaskManager::initialize() {
// Set up worker threads.
// Distribute the workers among the available processors,
// unless we were told not to, or if the os doesn't want to.
- uint* processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC);
+ _processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC);
if (!BindGCTaskThreadsToCPUs ||
- !os::distribute_processes(workers(), processor_assignment)) {
+ !os::distribute_processes(workers(), _processor_assignment)) {
for (uint a = 0; a < workers(); a += 1) {
- processor_assignment[a] = sentinel_worker();
+ _processor_assignment[a] = sentinel_worker();
}
}
+
_thread = NEW_C_HEAP_ARRAY(GCTaskThread*, workers(), mtGC);
- for (uint t = 0; t < workers(); t += 1) {
- set_thread(t, GCTaskThread::create(this, t, processor_assignment[t]));
+ _active_workers = ParallelGCThreads;
+ if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) {
+ _active_workers = 1U;
}
+
if (TraceGCTaskThread) {
tty->print("GCTaskManager::initialize: distribution:");
for (uint t = 0; t < workers(); t += 1) {
- tty->print(" %u", processor_assignment[t]);
+ tty->print(" %u", _processor_assignment[t]);
}
tty->cr();
}
- FREE_C_HEAP_ARRAY(uint, processor_assignment, mtGC);
}
reset_busy_workers();
set_unblocked();
@@ -441,9 +463,8 @@ void GCTaskManager::initialize() {
reset_noop_tasks();
reset_barriers();
reset_emptied_queue();
- for (uint s = 0; s < workers(); s += 1) {
- thread(s)->start();
- }
+
+ add_workers(true);
}
GCTaskManager::~GCTaskManager() {
@@ -454,13 +475,17 @@ GCTaskManager::~GCTaskManager() {
WaitForBarrierGCTask::destroy(_idle_inactive_task);
_idle_inactive_task = NULL;
if (_thread != NULL) {
- for (uint i = 0; i < workers(); i += 1) {
+ for (uint i = 0; i < created_workers(); i += 1) {
GCTaskThread::destroy(thread(i));
set_thread(i, NULL);
}
FREE_C_HEAP_ARRAY(GCTaskThread*, _thread, mtGC);
_thread = NULL;
}
+ if (_processor_assignment != NULL) {
+ FREE_C_HEAP_ARRAY(uint, _processor_assignment, mtGC);
+ _processor_assignment = NULL;
+ }
if (_resource_flag != NULL) {
FREE_C_HEAP_ARRAY(bool, _resource_flag, mtGC);
_resource_flag = NULL;
@@ -487,6 +512,9 @@ void GCTaskManager::set_active_gang() {
err_msg("all_workers_active() is incorrect: "
"active %d ParallelGCThreads %d", active_workers(),
ParallelGCThreads));
+ _active_workers = MIN2(_active_workers, _workers);
+ // "add_workers" does not guarantee any additional workers
+ add_workers(false);
if (TraceDynamicGCThreads) {
gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): "
"all_workers_active() %d workers %d "
@@ -518,7 +546,7 @@ void GCTaskManager::task_idle_workers() {
// is starting). Try later to release enough idle_workers
// to allow the desired number of active_workers.
more_inactive_workers =
- workers() - active_workers() - idle_workers();
+ created_workers() - active_workers() - idle_workers();
if (more_inactive_workers < 0) {
int reduced_active_workers = active_workers() + more_inactive_workers;
set_active_workers(reduced_active_workers);
@@ -528,7 +556,7 @@ void GCTaskManager::task_idle_workers() {
gclog_or_tty->print_cr("JT: %d workers %d active %d "
"idle %d more %d",
Threads::number_of_non_daemon_threads(),
- workers(),
+ created_workers(),
active_workers(),
idle_workers(),
more_inactive_workers);
@@ -539,7 +567,7 @@ void GCTaskManager::task_idle_workers() {
q->enqueue(IdleGCTask::create_on_c_heap());
increment_idle_workers();
}
- assert(workers() == active_workers() + idle_workers(),
+ assert(created_workers() == active_workers() + idle_workers(),
"total workers should equal active + inactive");
add_list(q);
// GCTaskQueue* q was created in a ResourceArea so a
@@ -558,14 +586,15 @@ void GCTaskManager::release_idle_workers() {
}
void GCTaskManager::print_task_time_stamps() {
- for(uint i=0; i<ParallelGCThreads; i++) {
+ uint num_thr = created_workers();
+ for(uint i=0; i < num_thr; i++) {
GCTaskThread* t = thread(i);
t->print_task_time_stamps();
}
}
void GCTaskManager::print_threads_on(outputStream* st) {
- uint num_thr = workers();
+ uint num_thr = created_workers();
for (uint i = 0; i < num_thr; i++) {
thread(i)->print_on(st);
st->cr();
@@ -574,19 +603,20 @@ void GCTaskManager::print_threads_on(outputStream* st) {
void GCTaskManager::threads_do(ThreadClosure* tc) {
assert(tc != NULL, "Null ThreadClosure");
- uint num_thr = workers();
+ uint num_thr = created_workers();
for (uint i = 0; i < num_thr; i++) {
tc->do_thread(thread(i));
}
}
GCTaskThread* GCTaskManager::thread(uint which) {
- assert(which < workers(), "index out of bounds");
+ assert(which < created_workers(), "index out of bounds");
assert(_thread[which] != NULL, "shouldn't have null thread");
return _thread[which];
}
void GCTaskManager::set_thread(uint which, GCTaskThread* value) {
+ // "_created_workers" may not have been updated yet so use workers()
assert(which < workers(), "index out of bounds");
assert(value != NULL, "shouldn't have null thread");
_thread[which] = value;
@@ -753,7 +783,7 @@ uint GCTaskManager::decrement_busy_workers() {
void GCTaskManager::release_all_resources() {
// If you want this to be done atomically, do it in a BarrierGCTask.
- for (uint i = 0; i < workers(); i += 1) {
+ for (uint i = 0; i < created_workers(); i += 1) {
set_resource_flag(i, true);
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.hpp
index 76b0ec92d..91d0cd3e6 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, 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
@@ -370,6 +370,7 @@ private:
Monitor* _monitor; // Notification of changes.
SynchronizedGCTaskQueue* _queue; // Queue of tasks.
GCTaskThread** _thread; // Array of worker threads.
+ uint _created_workers; // Number of workers created.
uint _active_workers; // Number of active workers.
uint _busy_workers; // Number of busy workers.
uint _blocking_worker; // The worker that's blocking.
@@ -382,6 +383,8 @@ private:
uint _noop_tasks; // Count of noop tasks.
WaitForBarrierGCTask* _idle_inactive_task;// Task for inactive workers
volatile uint _idle_workers; // Number of idled workers
+ uint* _processor_assignment; // Worker to cpu mappings. May
+ // be used lazily
public:
// Factory create and destroy methods.
static GCTaskManager* create(uint workers) {
@@ -566,6 +569,13 @@ protected:
uint active_workers() const {
return _active_workers;
}
+ uint created_workers() const {
+ return _created_workers;
+ }
+ // Create a GC worker and install into GCTaskManager
+ GCTaskThread* install_worker(uint worker_id);
+ // Add GC workers as needed.
+ void add_workers(bool initializing);
};
//
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
index 4454cd18d..e9813d7c1 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
@@ -44,9 +44,6 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager,
_time_stamps(NULL),
_time_stamp_index(0)
{
- if (!os::create_thread(this, os::pgc_thread))
- vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GC thread. Out of system resources.");
-
if (PrintGCTaskTimeStamps) {
_time_stamps = NEW_C_HEAP_ARRAY(GCTaskTimeStamp, GCTaskTimeStampEntries, mtGC);
@@ -62,10 +59,6 @@ GCTaskThread::~GCTaskThread() {
}
}
-void GCTaskThread::start() {
- os::start_thread(this);
-}
-
GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp
index 7f8aff2bd..b4e69025f 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, 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
@@ -48,13 +48,13 @@ private:
bool _is_working; // True if participating in GC tasks
- public:
// Factory create and destroy methods.
static GCTaskThread* create(GCTaskManager* manager,
uint which,
uint processor_id) {
return new GCTaskThread(manager, which, processor_id);
}
+ public:
static void destroy(GCTaskThread* manager) {
if (manager != NULL) {
delete manager;
@@ -65,8 +65,6 @@ private:
return true;
}
virtual void run();
- // Methods.
- void start();
void print_task_time_stamps();
void print_on(outputStream* st) const;
diff --git a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp
index 3bfbddcb5..1e99e73e4 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
@@ -129,10 +129,7 @@ int AdaptiveSizePolicy::calc_default_active_workers(uintx total_workers,
uintx max_active_workers =
MAX2(active_workers_by_JT, active_workers_by_heap_size);
- // Limit the number of workers to the the number created,
- // (workers()).
- new_active_workers = MIN2(max_active_workers,
- (uintx) total_workers);
+ new_active_workers = MIN2(max_active_workers, (uintx) total_workers);
// Increase GC workers instantly but decrease them more
// slowly.
@@ -167,7 +164,7 @@ int AdaptiveSizePolicy::calc_default_active_workers(uintx total_workers,
}
if (TraceDynamicGCThreads) {
- gclog_or_tty->print_cr("GCTaskManager::calc_default_active_workers() : "
+ gclog_or_tty->print_cr("GCTaskManager::calc_default_active_workers() : "
"active_workers(): %d new_active_workers: %d "
"prev_active_workers: %d\n"
" active_workers_by_JT: %d active_workers_by_heap_size: %d",
diff --git a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp
index 2fca75fce..e0d160ac6 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, 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
diff --git a/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp b/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp
new file mode 100644
index 000000000..1a840cf2b
--- /dev/null
+++ b/hotspot/src/share/vm/gc_implementation/shared/workerManager.hpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
+#define SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
+
+#include "gc_implementation/shared/adaptiveSizePolicy.hpp"
+
+class WorkerManager : public AllStatic {
+ public:
+ // Create additional workers as needed.
+ // active_workers - number of workers being requested for an upcoming
+ // parallel task.
+ // total_workers - total number of workers. This is the maximum
+ // number possible.
+ // created_workers - number of workers already created. This maybe
+ // less than, equal to, or greater than active workers. If greater than
+ // or equal to active_workers, nothing is done.
+ // worker_type - type of thread.
+ // initializing - true if this is called to get the initial number of
+ // GC workers.
+ // If initializing is true, do a vm exit if the workers cannot be created.
+ // The initializing = true case is for JVM start up and failing to
+ // create all the worker at start should considered a problem so exit.
+ // If initializing = false, there are already some number of worker
+ // threads and a failure would not be optimal but should not be fatal.
+ template <class WorkerType>
+ static uint add_workers (WorkerType* holder,
+ uint active_workers,
+ uint total_workers,
+ uint created_workers,
+ os::ThreadType worker_type,
+ bool initializing) {
+ uint start = created_workers;
+ uint end = MIN2(active_workers, total_workers);
+ for (uint worker_id = start; worker_id < end; worker_id += 1) {
+ WorkerThread* new_worker = holder->install_worker(worker_id);
+ assert(new_worker != NULL, "Failed to allocate GangWorker");
+ if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) {
+ if(initializing) {
+ vm_exit_out_of_memory(0, OOM_MALLOC_ERROR,
+ "Cannot create worker GC thread. Out of system resources.");
+ }
+ }
+ created_workers++;
+ os::start_thread(new_worker);
+ }
+
+ gclog_or_tty->print_cr("AdaptiveSizePolicy::add_workers() : "
+ "active_workers: %u created_workers: %u",
+ active_workers, created_workers);
+
+ return created_workers;
+ }
+};
+#endif // SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
--
2.12.3

View File

@ -1,268 +0,0 @@
From 752e6b3d3747194e9ebc2a57c06403a3ed6fccc0 Mon Sep 17 00:00:00 2001
Date: Sat, 24 Aug 2019 17:39:22 +0000
Subject: [PATCH] Backport of JDK-8047212
summary: Fix race between ObjectMonitor alloc and verification code; teach SA about "static pointer volatile" fields
LLT:
Bug url: https://bugs.openjdk.java.net/browse/JDK-8047212
---
hotspot/src/share/vm/runtime/synchronizer.cpp | 94 ++++++++++++++-------------
hotspot/src/share/vm/runtime/synchronizer.hpp | 2 +-
hotspot/src/share/vm/runtime/vmStructs.cpp | 19 +++++-
3 files changed, 68 insertions(+), 47 deletions(-)
diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp
index 53341523c8..6e9c1da6bb 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp
@@ -149,7 +149,7 @@ int dtrace_waited_probe(ObjectMonitor* monitor, Handle obj, Thread* thr) {
#define NINFLATIONLOCKS 256
static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ;
-ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ;
+ObjectMonitor * volatile ObjectSynchronizer::gBlockList = NULL;
ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL ;
ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL ;
int ObjectSynchronizer::gOmInUseCount = 0;
@@ -830,18 +830,18 @@ JavaThread* ObjectSynchronizer::get_lock_owner(Handle h_obj, bool doLock) {
// Visitors ...
void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) {
- ObjectMonitor* block = gBlockList;
- ObjectMonitor* mid;
- while (block) {
+ ObjectMonitor* block =
+ (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
+ while (block != NULL) {
assert(block->object() == CHAINMARKER, "must be a block header");
for (int i = _BLOCKSIZE - 1; i > 0; i--) {
- mid = block + i;
- oop object = (oop) mid->object();
+ ObjectMonitor* mid = (ObjectMonitor *)(block + i);
+ oop object = (oop)mid->object();
if (object != NULL) {
closure->do_monitor(mid);
}
}
- block = (ObjectMonitor*) block->FreeNext;
+ block = (ObjectMonitor*)block->FreeNext;
}
}
@@ -867,7 +867,9 @@ void ObjectSynchronizer::oops_do(OopClosure* f) {
void ObjectSynchronizer::oops_do(OopClosure* f) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
- for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) {
+ ObjectMonitor* block =
+ (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
+ for (; block != NULL; block = (ObjectMonitor *)next(block)) {
assert(block->object() == CHAINMARKER, "must be a block header");
for (int i = 1; i < _BLOCKSIZE; i++) {
ObjectMonitor* mid = &block[i];
@@ -1090,7 +1092,9 @@ ObjectMonitor * ATTR ObjectSynchronizer::omAlloc (Thread * Self) {
// The very first objectMonitor in a block is reserved and dedicated.
// It serves as blocklist "next" linkage.
temp[0].FreeNext = gBlockList;
- gBlockList = temp;
+ // There are lock-free uses of gBlockList so make sure that
+ // the previous stores happen before we update gBlockList.
+ OrderAccess::release_store_ptr(&gBlockList, temp);
// Add the new string of objectMonitors to the global free list
temp[_BLOCKSIZE - 1].FreeNext = gFreeList ;
@@ -1569,29 +1573,31 @@ void ObjectSynchronizer::deflate_idle_monitors() {
nInuse += gOmInUseCount;
}
- } else for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) {
- // Iterate over all extant monitors - Scavenge all idle monitors.
- assert(block->object() == CHAINMARKER, "must be a block header");
- nInCirculation += _BLOCKSIZE ;
- for (int i = 1 ; i < _BLOCKSIZE; i++) {
- ObjectMonitor* mid = &block[i];
- oop obj = (oop) mid->object();
-
- if (obj == NULL) {
- // The monitor is not associated with an object.
- // The monitor should either be a thread-specific private
- // free list or the global free list.
- // obj == NULL IMPLIES mid->is_busy() == 0
- guarantee (!mid->is_busy(), "invariant") ;
- continue ;
- }
- deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
-
- if (deflated) {
- mid->FreeNext = NULL ;
- nScavenged ++ ;
- } else {
- nInuse ++;
+ } else {
+ ObjectMonitor* block =
+ (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
+ for (; block != NULL; block = (ObjectMonitor*)next(block)) {
+ // Iterate over all extant monitors - Scavenge all idle monitors.
+ assert(block->object() == CHAINMARKER, "must be a block header");
+ nInCirculation += _BLOCKSIZE;
+ for (int i = 1; i < _BLOCKSIZE; i++) {
+ ObjectMonitor* mid = (ObjectMonitor*)&block[i];
+ oop obj = (oop)mid->object();
+ if (obj == NULL) {
+ // The monitor is not associated with an object.
+ // The monitor should either be a thread-specific private
+ // free list or the global free list.
+ // obj == NULL IMPLIES mid->is_busy() == 0
+ guarantee(!mid->is_busy(), "invariant");
+ continue;
+ }
+ deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail);
+ if (deflated) {
+ mid->FreeNext = NULL;
+ nScavenged++;
+ } else {
+ nInuse++;
+ }
}
}
}
@@ -1726,13 +1732,13 @@ void ObjectSynchronizer::sanity_checks(const bool verbose,
// Verify all monitors in the monitor cache, the verification is weak.
void ObjectSynchronizer::verify() {
- ObjectMonitor* block = gBlockList;
- ObjectMonitor* mid;
- while (block) {
+ ObjectMonitor* block =
+ (ObjectMonitor *)OrderAccess::load_ptr_acquire(&gBlockList);
+ while (block != NULL) {
assert(block->object() == CHAINMARKER, "must be a block header");
for (int i = 1; i < _BLOCKSIZE; i++) {
- mid = block + i;
- oop object = (oop) mid->object();
+ ObjectMonitor* mid = (ObjectMonitor *)(block + i);
+ oop object = (oop)mid->object();
if (object != NULL) {
mid->verify();
}
@@ -1746,18 +1752,18 @@ void ObjectSynchronizer::verify() {
// the list of extant blocks without taking a lock.
int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) {
- ObjectMonitor* block = gBlockList;
-
- while (block) {
+ ObjectMonitor* block =
+ (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList);
+ while (block != NULL) {
assert(block->object() == CHAINMARKER, "must be a block header");
if (monitor > &block[0] && monitor < &block[_BLOCKSIZE]) {
- address mon = (address) monitor;
- address blk = (address) block;
+ address mon = (address)monitor;
+ address blk = (address)block;
size_t diff = mon - blk;
- assert((diff % sizeof(ObjectMonitor)) == 0, "check");
+ assert((diff % sizeof(ObjectMonitor)) == 0, "must be aligned");
return 1;
}
- block = (ObjectMonitor*) block->FreeNext;
+ block = (ObjectMonitor*)block->FreeNext;
}
return 0;
}
diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp
index 3247776b74..4c4a7155af 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp
@@ -151,7 +151,7 @@ class ObjectSynchronizer : AllStatic {
private:
enum { _BLOCKSIZE = 128 };
- static ObjectMonitor* gBlockList;
+ static ObjectMonitor * volatile gBlockList;
static ObjectMonitor * volatile gFreeList;
static ObjectMonitor * volatile gOmInUseList; // for moribund thread, so monitors they inflated still get scanned
static int gOmInUseCount;
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 5b5282e38e..7935f8cb47 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -267,6 +267,7 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
#define VM_STRUCTS(nonstatic_field, \
static_field, \
+ static_ptr_volatile_field, \
unchecked_nonstatic_field, \
volatile_nonstatic_field, \
nonproduct_nonstatic_field, \
@@ -1091,7 +1092,7 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
volatile_nonstatic_field(BasicLock, _displaced_header, markOop) \
nonstatic_field(BasicObjectLock, _lock, BasicLock) \
nonstatic_field(BasicObjectLock, _obj, oop) \
- static_field(ObjectSynchronizer, gBlockList, ObjectMonitor*) \
+ static_ptr_volatile_field(ObjectSynchronizer,gBlockList, ObjectMonitor*) \
\
/*********************/ \
/* Matcher (C2 only) */ \
@@ -2682,6 +2683,11 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
#define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{ QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
+// This macro generates a VMStructEntry line for a static pointer volatile field,
+// e.g.: "static ObjectMonitor * volatile gBlockList;"
+#define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
+ { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void*)&typeName::fieldName },
+
// This macro generates a VMStructEntry line for an unchecked
// nonstatic field, in which the size of the type is also specified.
// The type string is given as NULL, indicating an "opaque" type.
@@ -2707,10 +2713,15 @@ typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
#define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
-// This macro checks the type of a VMStructEntry by comparing pointer types
+// This macro checks the type of a static VMStructEntry by comparing pointer types
#define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{type* dummy = &typeName::fieldName; }
+// This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
+// e.g.: "static ObjectMonitor * volatile gBlockList;"
+#define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \
+ {type volatile * dummy = &typeName::fieldName; }
+
// This macro ensures the type of a field and its containing type are
// present in the type table. The assertion string is shorter than
// preferable because (incredibly) of a bug in Solstice NFS client
@@ -2904,6 +2915,7 @@ VMStructEntry VMStructs::localHotSpotVMStructs[] = {
VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY,
+ GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
@@ -3074,6 +3086,7 @@ void
VMStructs::init() {
VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_STATIC_VM_STRUCT_ENTRY,
+ CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY,
CHECK_NO_OP,
CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
@@ -3196,9 +3209,11 @@ VMStructs::init() {
CHECK_NO_OP,
CHECK_NO_OP,
CHECK_NO_OP,
+ CHECK_NO_OP,
CHECK_NO_OP));
debug_only(VM_STRUCTS(CHECK_NO_OP,
ENSURE_FIELD_TYPE_PRESENT,
+ ENSURE_FIELD_TYPE_PRESENT,
CHECK_NO_OP,
ENSURE_FIELD_TYPE_PRESENT,
ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
--
2.12.3

View File

@ -1,32 +0,0 @@
From ab0474ea0dae399dcd256aa520089450a3363f33 Mon Sep 17 00:00:00 2001
Date: Wed, 19 Jun 2019 19:38:37 +0000
Subject: [PATCH] JDK-8135318 backport
Summary: CMS: wrong max_eden_size for check_gc_overhead_limit
LLT:
Bug url: https://bugs.openjdk.java.net/browse/JDK-8135318
---
.../concurrentMarkSweep/concurrentMarkSweepGeneration.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index 1872e72e36..2d7791138c 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -1924,9 +1924,10 @@ NOT_PRODUCT(
// Has the GC time limit been exceeded?
DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
- size_t max_eden_size = young_gen->max_capacity() -
- young_gen->to()->capacity() -
- young_gen->from()->capacity();
+
+ //PR JDK-8135318 back port
+ size_t max_eden_size = young_gen->max_eden_size();
+
GenCollectedHeap* gch = GenCollectedHeap::heap();
GCCause::Cause gc_cause = gch->gc_cause();
size_policy()->check_gc_overhead_limit(_young_gen->used(),
--
2.12.3

View File

@ -1,51 +0,0 @@
From 81b3011925783d6eb1effec9b858e1d0e162d378 Mon Sep 17 00:00:00 2001
Date: Tue, 20 Aug 2019 21:09:30 +0000
Subject: [PATCH] Backport of JDK-8146792
summary: Predicate moved after partial peel may lead to broken
LLT:
Bug url: https://bugs.openjdk.java.net/browse/JDK-8146792
---
hotspot/src/share/vm/opto/loopPredicate.cpp | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/hotspot/src/share/vm/opto/loopPredicate.cpp b/hotspot/src/share/vm/opto/loopPredicate.cpp
index db3447dc6e..f216fd9d1e 100644
--- a/hotspot/src/share/vm/opto/loopPredicate.cpp
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp
@@ -505,7 +505,31 @@ class Invariance : public StackObj {
_lpt(lpt), _phase(lpt->_phase),
_visited(area), _invariant(area), _stack(area, 10 /* guess */),
_clone_visited(area), _old_new(area)
- {}
+ {
+ Node* head = _lpt->_head;
+ Node* entry = head->in(LoopNode::EntryControl);
+ if (entry->outcnt() != 1) {
+ // If a node is pinned between the predicates and the loop
+ // entry, we won't be able to move any node in the loop that
+ // depends on it above it in a predicate. Mark all those nodes
+ // as non loop invariatnt.
+ Unique_Node_List wq;
+ wq.push(entry);
+ for (uint next = 0; next < wq.size(); ++next) {
+ Node *n = wq.at(next);
+ for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
+ Node* u = n->fast_out(i);
+ if (!u->is_CFG()) {
+ Node* c = _phase->get_ctrl(u);
+ if (_lpt->is_member(_phase->get_loop(c)) || _phase->is_dominator(c, head)) {
+ _visited.set(u->_idx);
+ wq.push(u);
+ }
+ }
+ }
+ }
+ }
+ }
// Map old to n for invariance computation and clone
void map_ctrl(Node* old, Node* n) {
--
2.12.3

View File

@ -1,120 +0,0 @@
From de7d96bd84ba81580e36f556587496e497ec1daf Mon Sep 17 00:00:00 2001
Date: Mon, 24 Jun 2019 16:39:29 +0000
Subject: [PATCH] 8167409: Invalid value passed to critical JNI function
summary: Invalid value passed to critical JNI function
LLT: hotspot/test/compiler/runtime/CheckLongArgs.java
Bug url: https://bugs.openjdk.java.net/browse/JDK-8167409
---
hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp | 2 +-
.../argumentcorruption/CheckLongArgs.java | 46 +++++++++++++++++++++
.../argumentcorruption/libCNCheckLongArgs.c | 30 ++++++++++++++
3 files changed, 77 insertions(+), 1 deletion(-)
create mode 100644 hotspot/test/runtime/criticalnatives/argumentcorruption/CheckLongArgs.java
create mode 100644 hotspot/test/runtime/criticalnatives/argumentcorruption/libCNCheckLongArgs.c
diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
index 5c62d7180b..22c90a59d8 100644
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
@@ -2198,7 +2198,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
int pinned_slot = oop_handle_offset;
VMRegPair tmp_vmreg;
- tmp_vmreg.set1(rbx->as_VMReg());
+ tmp_vmreg.set2(rbx->as_VMReg());
if (!is_critical_native) {
for (int i = total_in_args - 1, c_arg = total_c_args - 1; i >= 0; i--, c_arg--) {
diff --git a/hotspot/test/runtime/criticalnatives/argumentcorruption/CheckLongArgs.java b/hotspot/test/runtime/criticalnatives/argumentcorruption/CheckLongArgs.java
new file mode 100644
index 0000000000..15d7c04977
--- /dev/null
+++ b/hotspot/test/runtime/criticalnatives/argumentcorruption/CheckLongArgs.java
@@ -0,0 +1,46 @@
+/*
+ * @test
+ * @author yansendao
+ * @requires os.arch != "aarch64"
+ * @run main/othervm -Xcomp -XX:+CriticalJNINatives compiler.runtime.criticalnatives.argumentcorruption.CheckLongArgs
+ */
+package compiler.runtime.criticalnatives.argumentcorruption;
+public class CheckLongArgs {
+ static {
+ String path = System.getProperty("test.src");
+ String arch = System.getProperty("os.arch");
+ String name = System.getProperty("os.name");
+ if (path == null)
+ System.loadLibrary("CNCheckLongArgs");
+ else if (name.indexOf("Linux") != -1 && path != null)
+ System.load(path + "/lib/" + arch + "/libCNCheckLongArgs.so");
+ else
+ throw new RuntimeException("unsupport arch or os!");
+ }
+ static native void m1(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, byte[] result);
+ static native void m2(long a1, int[] a2, long a3, int[] a4, long a5, int[] a6, long a7, int[] a8, long a9, byte[] result);
+ public static void main(String args[]) throws Exception {
+ test();
+ }
+ private static void test() throws Exception {
+ int[] l1 = { 1111, 2222, 3333 };
+ int[] l2 = { 4444, 5555, 6666 };
+ int[] l3 = { 7777, 8888, 9999 };
+ int[] l4 = { 1010, 2020, 3030 };
+ byte[] result = { -1 };
+ m1(1111111122222222L, 3333333344444444L, 5555555566666666L, 7777777788888888L, 9999999900000000L, 1212121234343434L,
+ 5656565678787878L, 9090909012121212L, result);
+ check(result[0]);
+ result[0] = -1;
+ m2(1111111122222222L, l1, 3333333344444444L, l2, 5555555566666666L, l3, 7777777788888888L, l4, 9999999900000000L, result);
+ check(result[0]);
+ }
+ private static void check(byte result) throws Exception {
+ if (result != 2) {
+ if (result == 1) {
+ throw new Exception("critical native arguments mismatch");
+ }
+ throw new Exception("critical native lookup failed");
+ }
+ }
+}
diff --git a/hotspot/test/runtime/criticalnatives/argumentcorruption/libCNCheckLongArgs.c b/hotspot/test/runtime/criticalnatives/argumentcorruption/libCNCheckLongArgs.c
new file mode 100644
index 0000000000..c805d75af3
--- /dev/null
+++ b/hotspot/test/runtime/criticalnatives/argumentcorruption/libCNCheckLongArgs.c
@@ -0,0 +1,30 @@
+#include "jni.h"
+JNIEXPORT void JNICALL JavaCritical_compiler_runtime_criticalnatives_argumentcorruption_CheckLongArgs_m1
+ (jlong a1, jlong a2, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8,jint result_length,jbyte* result) {
+
+ if (a1 != 1111111122222222LL || a2 != 3333333344444444LL || a3 != 5555555566666666LL || a4 != 7777777788888888LL ||
+ a5 != 9999999900000000LL || a6 != 1212121234343434LL || a7 != 5656565678787878LL || a8 != 9090909012121212LL ||
+ result_length != 1 || result[0] != -1) {
+ result[0] = 1;
+ } else {
+ result[0] = 2;
+ }
+}
+
+JNIEXPORT void JNICALL JavaCritical_compiler_runtime_criticalnatives_argumentcorruption_CheckLongArgs_m2
+ (jlong a1, jint a2_length, jint* a2, jlong a3, jint a4_length, jint* a4, jlong a5, jint a6_length, jint* a6, jlong a7,
+ jint a8_length, jint* a8, jlong a9, jint result_length, jbyte* result) {
+ if (a1 != 1111111122222222LL || a2_length != 3 || a2[0] != 1111 || a3 != 3333333344444444LL || a4_length != 3 || a4[0] != 4444 ||
+ a5 != 5555555566666666LL || a6_length != 3 || a6[0] != 7777 || a7 != 7777777788888888LL || a8_length != 3 || a8[0] != 1010 || a9 != 9999999900000000LL ||
+ result_length != 1 || result[0] != -1) {
+ result[0] = 1;
+ } else {
+ result[0] = 2;
+ }
+}
+
+JNIEXPORT void JNICALL Java_compiler_runtime_criticalnatives_argumentcorruption_CheckLongArgs_m1
+ (JNIEnv * env, jclass jclazz, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8, jlong a9, jlong a10, jbyteArray result) {}
+
+JNIEXPORT void JNICALL Java_compiler_runtime_criticalnatives_argumentcorruption_CheckLongArgs_m2
+ (JNIEnv * env, jclass jclazz, jlong a3, jintArray a4, jlong a5, jintArray a6, jlong a7, jintArray a8, jlong a9, jintArray a10, jlong a11, jbyteArray result) {}
--
2.12.3

File diff suppressed because it is too large Load Diff

View File

@ -1,84 +0,0 @@
From df8278f141b2fa1ea2a685fb1352428ecf84d50b Mon Sep 17 00:00:00 2001
Date: Thu, 13 Feb 2020 17:32:14 +0000
Subject: [PATCH] 8227662: freetype seeks to index at the end of the font data
Summary: <freetype>: freetype seeks to index at the end of the font data
LLT: jdk/test/java/awt/FontMetrics/SpaceAdvance.java
Bug url: https://bugs.openjdk.java.net/browse/JDK-8237400
---
jdk/src/share/native/sun/font/freetypeScaler.c | 2 +-
jdk/test/java/awt/FontMetrics/SpaceAdvance.java | 49 +++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 jdk/test/java/awt/FontMetrics/SpaceAdvance.java
diff --git a/jdk/src/share/native/sun/font/freetypeScaler.c b/jdk/src/share/native/sun/font/freetypeScaler.c
index 48a024a3df..36a2b86271 100644
--- a/jdk/src/share/native/sun/font/freetypeScaler.c
+++ b/jdk/src/share/native/sun/font/freetypeScaler.c
@@ -163,7 +163,7 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream,
*/
if (numBytes == 0) {
- if (offset >= scalerInfo->fileSize) {
+ if (offset > scalerInfo->fileSize) {
return -1;
} else {
return 0;
diff --git a/jdk/test/java/awt/FontMetrics/SpaceAdvance.java b/jdk/test/java/awt/FontMetrics/SpaceAdvance.java
new file mode 100644
index 0000000000..e2c7acb6f9
--- /dev/null
+++ b/jdk/test/java/awt/FontMetrics/SpaceAdvance.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8227662
+ */
+
+import java.awt.Font;
+import java.awt.FontMetrics ;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+public class SpaceAdvance {
+ public static void main(String[] args) throws Exception {
+
+ BufferedImage bi = new BufferedImage(1,1,1);
+ Graphics2D g2d = bi.createGraphics();
+ Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
+ if (!font.canDisplay(' ')) {
+ return;
+ }
+ g2d.setFont(font);
+ FontMetrics fm = g2d.getFontMetrics();
+ if (fm.charWidth(' ') == 0) {
+ throw new RuntimeException("Space has char width of 0");
+ }
+ }
+}
--
2.12.3

View File

@ -1,36 +0,0 @@
From 8af05a28e8856fb9a05e87e9199b1c9c21ab1c17 Mon Sep 17 00:00:00 2001
Date: Thu, 14 Nov 2019 14:26:22 +0000
Subject: [PATCH] 8234264: Incorrect 8047434 JDK 8 backport in 8219677
Summary: Runtime: community backport from JDK12 to JDK8 about this issue is not correctly implemented.
LLT: NA
Bug url: https://bugs.openjdk.java.net/browse/JDK-8234264
---
hotspot/src/share/vm/utilities/vmError.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp
index ef3bb5cee5..49b978a025 100644
--- a/hotspot/src/share/vm/utilities/vmError.cpp
+++ b/hotspot/src/share/vm/utilities/vmError.cpp
@@ -1060,7 +1060,7 @@ void VMError::report_and_die() {
out.print_raw (cmd);
out.print_raw_cr("\" ...");
- if (os::fork_and_exec(cmd, true) < 0) {
+ if (os::fork_and_exec(cmd) < 0) {
out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
}
}
@@ -1147,7 +1147,7 @@ void VM_ReportJavaOutOfMemory::doit() {
#endif
tty->print_cr("\"%s\"...", cmd);
- if (os::fork_and_exec(cmd) < 0) {
+ if (os::fork_and_exec(cmd, true) < 0) {
tty->print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
}
}
--
2.12.3

View File

@ -0,0 +1,14 @@
diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make
index 92b8b9b3..a24f9184 100644
--- a/hotspot/make/linux/makefiles/adlc.make
+++ b/hotspot/make/linux/makefiles/adlc.make
@@ -64,6 +64,9 @@ CXXFLAGS = $(SYSDEFS) $(INCLUDES)
# Force assertions on.
CXXFLAGS += -DASSERT
+# Introduced in GCC 8.X
+CXXFLAGS += -Wno-error=stringop-overflow=
+
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
# Compiler warnings are treated as errors
CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)

View File

@ -1,6 +1,6 @@
From f2833457ae8419c099bf167693c602911413257c Mon Sep 17 00:00:00 2001 From f2833457ae8419c099bf167693c602911413257c Mon Sep 17 00:00:00 2001
Date: Sat, 25 May 2019 10:36:33 +0000 Date: Sat, 25 May 2019 10:36:33 +0000
Subject: [PATCH] modify vendor to Huawei Technologies Co., LTD Subject: [PATCH] change vendor to openEuler Community
--- ---
hotspot/src/share/vm/runtime/vm_version.cpp | 7 +------ hotspot/src/share/vm/runtime/vm_version.cpp | 7 +------
@ -21,7 +21,7 @@ index c7d34aac64..fa721facea 100644
- return JDK_Version::is_gte_jdk17x_version() ? - return JDK_Version::is_gte_jdk17x_version() ?
- "Oracle Corporation" : "Sun Microsystems Inc."; - "Oracle Corporation" : "Sun Microsystems Inc.";
-#endif -#endif
+ return "Huawei Technologies Co., Ltd"; + return "openEuler Community";
} }
@ -34,15 +34,15 @@ index ff80b0abdd..758cfabb39 100644
/* Third party may overwrite these values. */ /* Third party may overwrite these values. */
#ifndef VENDOR #ifndef VENDOR
-#define VENDOR "Oracle Corporation" -#define VENDOR "Oracle Corporation"
+#define VENDOR "Huawei Technologies Co., Ltd" +#define VENDOR "openEuler Community"
#endif #endif
#ifndef VENDOR_URL #ifndef VENDOR_URL
-#define VENDOR_URL "http://java.oracle.com/" -#define VENDOR_URL "http://java.oracle.com/"
+#define VENDOR_URL "http://jdk.rnd.huawei.com/" +#define VENDOR_URL "https://gitee.com/src-openeuler/openjdk-1.8.0/"
#endif #endif
#ifndef VENDOR_URL_BUG #ifndef VENDOR_URL_BUG
-#define VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/" -#define VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/"
+#define VENDOR_URL_BUG "http://jdk.rnd.huawei.com/" +#define VENDOR_URL_BUG "https://gitee.com/src-openeuler/openjdk-1.8.0/issues"
#endif #endif
#define JAVA_MAX_SUPPORTED_VERSION 52 #define JAVA_MAX_SUPPORTED_VERSION 52

View File

@ -167,7 +167,7 @@
# note, following three variables are sedded from update_sources if used correctly. Hardcode them rather there. # note, following three variables are sedded from update_sources if used correctly. Hardcode them rather there.
%global shenandoah_project aarch64-port %global shenandoah_project aarch64-port
%global shenandoah_repo jdk8u-shenandoah %global shenandoah_repo jdk8u-shenandoah
%global shenandoah_revision aarch64-shenandoah-jdk8u242-b08 %global shenandoah_revision aarch64-shenandoah-jdk8u262-b02
# Define old aarch64/jdk8u tree variables for compatibility # Define old aarch64/jdk8u tree variables for compatibility
%global project %{shenandoah_project} %global project %{shenandoah_project}
%global repo %{shenandoah_repo} %global repo %{shenandoah_repo}
@ -190,7 +190,7 @@
# images stub # images stub
%global jdkimage j2sdk-image %global jdkimage j2sdk-image
# output dir stub # output dir stub
%define buildoutputdir() %{expand:aarch64-shenandoah-jdk8u242-b08/build/jdk8.build%{?1}} %define buildoutputdir() %{expand:aarch64-shenandoah-jdk8u262-b02/build/jdk8.build%{?1}}
# we can copy the javadoc to not arched dir, or make it not noarch # we can copy the javadoc to not arched dir, or make it not noarch
%define uniquejavadocdir() %{expand:%{fullversion}%{?1}} %define uniquejavadocdir() %{expand:%{fullversion}%{?1}}
# main id and dir of this jdk # main id and dir of this jdk
@ -799,7 +799,7 @@ Provides: java-%{javaver}-%{origin}-src%{?1} = %{epoch}:%{version}-%{release}
Name: java-%{javaver}-%{origin} Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver} Version: %{javaver}.%{updatever}.%{buildver}
Release: 1.h5 Release: 6
Epoch: 1 Epoch: 1
Summary: %{origin_nice} Runtime Environment %{majorver} Summary: %{origin_nice} Runtime Environment %{majorver}
Group: Development/Languages Group: Development/Languages
@ -846,7 +846,6 @@ Patch13: 8171537.patch
Patch18: fix-vendor-info.patch Patch18: fix-vendor-info.patch
Patch21: 8202952-C2-Unexpected-dead-nodes-after-matching.patch Patch21: 8202952-C2-Unexpected-dead-nodes-after-matching.patch
Patch22: 8161072.patch Patch22: 8161072.patch
Patch23: 8135318.patch
Patch24: 8134883.patch Patch24: 8134883.patch
Patch25: FromCardCache-default-card-index-can-cause.patch Patch25: FromCardCache-default-card-index-can-cause.patch
Patch26: disable-UseLSE-on-ARMv8.1-by-default.patch Patch26: disable-UseLSE-on-ARMv8.1-by-default.patch
@ -862,22 +861,18 @@ Patch35: 8186042-OopmapCache-implementation.patch
Patch36: 8060463.patch Patch36: 8060463.patch
Patch37: 8131600.patch Patch37: 8131600.patch
Patch38: 8138971.patch Patch38: 8138971.patch
Patch39: 8167409-Invalid-value-passed-to-critical-JNI-function.patch
Patch40: 8129626.patch Patch40: 8129626.patch
Patch41: 8203699-java-lang-invoke-SpecialInte.patch Patch41: 8203699-java-lang-invoke-SpecialInte.patch
Patch45: 8191129.patch Patch45: 8191129.patch
Patch46: 8182036.patch Patch46: 8182036.patch
Patch47: 8166197.patch Patch47: 8166197.patch
Patch48: 8158946-JDK-8165808-JDK-8166583-JDK-.patch Patch48: 8158946-JDK-8165808-JDK-8166583-JDK-.patch
Patch49: 8146792.patch
Patch50: 8047212.patch
Patch51: add-with-company-name-option.patch Patch51: add-with-company-name-option.patch
Patch56: 8160369.patch Patch56: 8160369.patch
Patch57: 8031085.patch Patch57: 8031085.patch
Patch58: Reduce-the-probability-of-the-crash-related-to-ciObj.patch Patch58: Reduce-the-probability-of-the-crash-related-to-ciObj.patch
Patch62: 8165857-CMS-_overflow_list-is-missing-volatile-speci.patch Patch62: 8165857-CMS-_overflow_list-is-missing-volatile-speci.patch
Patch63: 8033552-Fix-missing-missing-volatile-specifiers-in-C.patch Patch63: 8033552-Fix-missing-missing-volatile-specifiers-in-C.patch
Patch65: 8234264-Incorrrect-8047434-JDK-8-backport-in-8219677.patch
Patch67: 8165860-WorkGroup-classes-are-missing-volatile-speci.patch Patch67: 8165860-WorkGroup-classes-are-missing-volatile-speci.patch
Patch68: 8194154-System-property-user.dir-should-not-be-chang.patch Patch68: 8194154-System-property-user.dir-should-not-be-chang.patch
Patch70: 8164948.patch Patch70: 8164948.patch
@ -890,14 +885,16 @@ Patch75: Add-ability-to-configure-third-port-for-remote-JMX.patch
Patch76: 8203196-C1-emits-incorrect-code-due-to-integer-overf.patch Patch76: 8203196-C1-emits-incorrect-code-due-to-integer-overf.patch
Patch77: 8190332-PngReader-throws-NegativeArraySizeException-.patch Patch77: 8190332-PngReader-throws-NegativeArraySizeException-.patch
Patch78: 8171410-aarch64-long-multiplyExact-shifts-by-31-inst.patch Patch78: 8171410-aarch64-long-multiplyExact-shifts-by-31-inst.patch
Patch79: 8193255-Root-Certificates-should-be-stored-in-text-f.patch
Patch80: 8227662-freetype-seeks-to-index-at-the-end-of-the-fo.patch
Patch81: fix-incorrect-offset-for-oop-field-with-weak-memory-.patch Patch81: fix-incorrect-offset-for-oop-field-with-weak-memory-.patch
Patch82: prohibition-of-irreducible-loop-in-mergers.patch
Patch83: 8204947-Port-ShenandoahTaskTerminator-to-mainline-an.patch Patch83: 8204947-Port-ShenandoahTaskTerminator-to-mainline-an.patch
Patch84: 8205921-Optimizing-best-of-2-work-stealing-queue-sel.patch Patch84: 8205921-Optimizing-best-of-2-work-stealing-queue-sel.patch
Patch85: 8139041-Redundant-DMB-instructions.patch Patch85: 8139041-Redundant-DMB-instructions.patch
# 8u252
Patch86: 6858051-Create-GC-worker-threads-dynamically.patch
Patch87: 6858051-Add-a-switch-for-the-dynamic-thread-related-.patch
Patch88: dismiss-warnings-in-GCC-8.X.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: alsa-lib-devel BuildRequires: alsa-lib-devel
@ -1109,7 +1106,6 @@ pushd %{top_level_dir_name}
%patch18 -p1 %patch18 -p1
%patch21 -p1 %patch21 -p1
%patch22 -p1 %patch22 -p1
%patch23 -p1
%patch24 -p1 %patch24 -p1
%patch25 -p1 %patch25 -p1
%patch26 -p1 %patch26 -p1
@ -1125,22 +1121,18 @@ pushd %{top_level_dir_name}
%patch36 -p1 %patch36 -p1
%patch37 -p1 %patch37 -p1
%patch38 -p1 %patch38 -p1
%patch39 -p1
%patch40 -p1 %patch40 -p1
%patch41 -p1 %patch41 -p1
%patch45 -p1 %patch45 -p1
%patch46 -p1 %patch46 -p1
%patch47 -p1 %patch47 -p1
%patch48 -p1 %patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1 %patch51 -p1
%patch56 -p1 %patch56 -p1
%patch57 -p1 %patch57 -p1
%patch58 -p1 %patch58 -p1
%patch62 -p1 %patch62 -p1
%patch63 -p1 %patch63 -p1
%patch65 -p1
%patch67 -p1 %patch67 -p1
%patch68 -p1 %patch68 -p1
%patch70 -p1 %patch70 -p1
@ -1151,13 +1143,13 @@ pushd %{top_level_dir_name}
%patch76 -p1 %patch76 -p1
%patch77 -p1 %patch77 -p1
%patch78 -p1 %patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1 %patch81 -p1
%patch82 -p1
%patch83 -p1 %patch83 -p1
%patch84 -p1 %patch84 -p1
%patch85 -p1 %patch85 -p1
%patch86 -p1
%patch87 -p1
%patch88 -p1
popd popd
@ -1181,7 +1173,7 @@ export CFLAGS="$CFLAGS -mieee"
# pass EXTRA_CFLAGS to the HotSpot C++ compiler... # pass EXTRA_CFLAGS to the HotSpot C++ compiler...
# Explicitly set the C++ standard as the default has changed on GCC >= 6 # Explicitly set the C++ standard as the default has changed on GCC >= 6
EXTRA_CFLAGS="-std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fstack-protector-strong" EXTRA_CFLAGS="-std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fstack-protector-strong"
EXTRA_CPP_FLAGS="-std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fstack-protector-strong" EXTRA_CPP_FLAGS="-std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fstack-protector-strong"
EXTRA_LDFLAGS="-Wl,-z,now,-z,relro" EXTRA_LDFLAGS="-Wl,-z,now,-z,relro"
export EXTRA_CFLAGS export EXTRA_CFLAGS
@ -1209,8 +1201,8 @@ bash ../../configure \
--with-build-number=%{buildver} \ --with-build-number=%{buildver} \
--with-debug-level=$debugbuild \ --with-debug-level=$debugbuild \
--enable-unlimited-crypto \ --enable-unlimited-crypto \
--with-extra-cxxflags="$EXTRA_CPP_FLAGS" \
--with-extra-cflags="$EXTRA_CFLAGS" \ --with-extra-cflags="$EXTRA_CFLAGS" \
--with-extra-cxxflags="$EXTRA_CPP_FLAGS" \
--with-extra-ldflags="%{ourldflags}" \ --with-extra-ldflags="%{ourldflags}" \
--with-num-cores="$NUM_PROC" \ --with-num-cores="$NUM_PROC" \
--with-boot-jdk-jvmargs=-XX:-UsePerfData --with-boot-jdk-jvmargs=-XX:-UsePerfData
@ -1555,6 +1547,10 @@ require "copy_jdk_configs.lua"
%endif %endif
%changelog %changelog
* Tue May 21 2020 jdkboy <guoge1@huawei.com> - 1:1.8.0.262-b02.6
- Update to jdk8u-shenandoah-8u262-b02
- Create GC worker threads dynamically
* Tue Mar 20 2020 jdkboy <guoge1@huawei.com> - 1:1.8.0.242-b08.5 * Tue Mar 20 2020 jdkboy <guoge1@huawei.com> - 1:1.8.0.242-b08.5
- upgrade openjdk to jdk8u242-b08 - upgrade openjdk to jdk8u242-b08