From 3f561e29a9c90811f18f364d262e5e1915884202 Mon Sep 17 00:00:00 2001 From: Sharath Ballal Date: Fri, 8 Dec 2017 15:41:11 +0530 Subject: [PATCH 01/31] 8193124: SA: Testcases for clhsdb jdis and findpc commands Reviewed-by: sundar, cjplummer, jgeorge --- .../jtreg/serviceability/sa/ClhsdbFindPC.java | 108 ++++++++++++++++++ .../jtreg/serviceability/sa/ClhsdbJdis.java | 95 +++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java create mode 100644 test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java new file mode 100644 index 00000000000..30a2959ba19 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2017, 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. + */ + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; + +import jdk.test.lib.apps.LingeredApp; + +/* + * @test + * @bug 8193124 + * @summary Test the clhsdb 'findpc' command + * @library /test/lib + * @run main/othervm ClhsdbFindPC + */ + +public class ClhsdbFindPC { + + private static void testFindPC(boolean withXcomp) throws Exception { + LingeredApp theApp = null; + try { + ClhsdbLauncher test = new ClhsdbLauncher(); + theApp = withXcomp ? LingeredApp.startApp(List.of("-Xcomp")) + : LingeredApp.startApp(List.of("-Xint")); + System.out.print("Started LingeredApp "); + if (withXcomp) { + System.out.print("(-Xcomp) "); + } else { + System.out.print("(-Xint) "); + } + System.out.println("with pid " + theApp.getPid()); + + // Run 'jstack -v' command to get the pc + List cmds = List.of("jstack -v"); + String output = test.run(theApp.getPid(), cmds, null, null); + + // Test the 'findpc' command passing in the pc obtained from + // the 'jstack -v' command + cmds = new ArrayList(); + + // Output could be null if the test was skipped due to + // attach permission issues. + if (output != null) { + String cmdStr = null; + String[] parts = output.split("LingeredApp.main"); + String[] tokens = parts[1].split(" "); + for (String token : tokens) { + if (token.contains("pc")) { + String[] address = token.split("="); + // address[1] represents the address of the Method + cmdStr = "findpc " + address[1].replace(",",""); + cmds.add(cmdStr); + break; + } + } + + Map> expStrMap = new HashMap<>(); + if (withXcomp) { + expStrMap.put(cmdStr, List.of( + "In code in NMethod for jdk/test/lib/apps/LingeredApp.main", + "content:", + "oops:", + "frame size:")); + } else { + expStrMap.put(cmdStr, List.of( + "In interpreter codelet", + "invoke return entry points")); + } + + test.run(theApp.getPid(), cmds, expStrMap, null); + } + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } finally { + LingeredApp.stopApp(theApp); + } + } + + public static void main(String[] args) throws Exception { + System.out.println("Starting the ClhsdbFindPC test"); + testFindPC(true); + testFindPC(false); + System.out.println("Test PASSED"); + } +} + diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java new file mode 100644 index 00000000000..5d8c0bdcf7b --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2017, 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. + */ + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; + +import jdk.test.lib.apps.LingeredApp; + +/* + * @test + * @bug 8193124 + * @summary Test the clhsdb 'jdis' command + * @library /test/lib + * @run main/othervm ClhsdbJdis + */ + +public class ClhsdbJdis { + + public static void main(String[] args) throws Exception { + LingeredApp theApp = null; + System.out.println("Starting the ClhsdbJdis test"); + + try { + ClhsdbLauncher test = new ClhsdbLauncher(); + theApp = LingeredApp.startApp(); + System.out.println("Started LingeredApp with pid " + theApp.getPid()); + + // Run 'jstack -v' command to get the Method Address + List cmds = List.of("jstack -v"); + String output = test.run(theApp.getPid(), cmds, null, null); + + // Test the 'jdis' command passing in the address obtained from + // the 'jstack -v' command + cmds = new ArrayList(); + + // Output could be null if the test was skipped due to + // attach permission issues. + if (output != null) { + String cmdStr = null; + String[] parts = output.split("LingeredApp.main"); + String[] tokens = parts[1].split(" "); + for (String token : tokens) { + if (token.contains("Method")) { + String[] address = token.split("="); + // address[1] represents the address of the Method + cmdStr = "jdis " + address[1]; + cmds.add(cmdStr); + break; + } + } + + Map> expStrMap = new HashMap<>(); + expStrMap.put(cmdStr, List.of( + "public static void main(java.lang.String[])", + "Holder Class", + "public class jdk.test.lib.apps.LingeredApp @", + "Bytecode", + "line bci bytecode", + "Exception Table", + "start bci end bci handler bci catch type", + "Constant Pool of [public class jdk.test.lib.apps.LingeredApp @")); + + test.run(theApp.getPid(), cmds, expStrMap, null); + } + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } finally { + LingeredApp.stopApp(theApp); + } + System.out.println("Test PASSED"); + } +} + From b0138d81ade5cd659eb7ba2a63ec95eecf15eae9 Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Fri, 8 Dec 2017 15:24:47 -0500 Subject: [PATCH 02/31] 8193135: get rid of redundant _smr_ prefix/infix in ThreadSMRSupport stuff Reviewed-by: stefank, gtriantafill, coleenp --- src/hotspot/share/runtime/java.cpp | 4 +- src/hotspot/share/runtime/thread.cpp | 8 +- src/hotspot/share/runtime/threadSMR.cpp | 431 +++++++++--------- src/hotspot/share/runtime/threadSMR.hpp | 81 ++-- .../share/runtime/threadSMR.inline.hpp | 28 +- ...dThreadsListHandleInErrorHandlingTest.java | 2 +- .../runtime/Thread/TestThreadDumpSMRInfo.java | 8 +- 7 files changed, 281 insertions(+), 281 deletions(-) diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index 4edb5d82604..4f76467a0f0 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -357,7 +357,7 @@ void print_statistics() { MemTracker::final_report(tty); } - ThreadsSMRSupport::log_smr_statistics(); + ThreadsSMRSupport::log_statistics(); } #else // PRODUCT MODE STATISTICS @@ -399,7 +399,7 @@ void print_statistics() { Method::print_touched_methods(tty); } - ThreadsSMRSupport::log_smr_statistics(); + ThreadsSMRSupport::log_statistics(); } #endif diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index e95bd2f2e88..a66018c412d 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -3473,7 +3473,7 @@ static inline void *prefetch_and_load_ptr(void **addr, intx prefetch_interval) { X = (JavaThread*)prefetch_and_load_ptr((void**)MACRO_current_p, (intx)MACRO_scan_interval)) // All JavaThreads -#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_smr_java_thread_list(), X) +#define ALL_JAVA_THREADS(X) DO_JAVA_THREADS(ThreadsSMRSupport::get_java_thread_list(), X) // All JavaThreads + all non-JavaThreads (i.e., every thread in the system) void Threads::threads_do(ThreadClosure* tc) { @@ -4382,7 +4382,7 @@ void Threads::remove(JavaThread* p) { // that we do not remove thread without safepoint code notice { MutexLocker ml(Threads_lock); - assert(ThreadsSMRSupport::get_smr_java_thread_list()->includes(p), "p must be present"); + assert(ThreadsSMRSupport::get_java_thread_list()->includes(p), "p must be present"); // Maintain fast thread list ThreadsSMRSupport::remove_thread(p); @@ -4610,7 +4610,7 @@ void Threads::print_on(outputStream* st, bool print_stacks, } #endif // INCLUDE_SERVICES - ThreadsSMRSupport::print_smr_info_on(st); + ThreadsSMRSupport::print_info_on(st); st->cr(); ALL_JAVA_THREADS(p) { @@ -4679,7 +4679,7 @@ class PrintOnErrorClosure : public ThreadClosure { // memory (even in resource area), it might deadlock the error handler. void Threads::print_on_error(outputStream* st, Thread* current, char* buf, int buflen) { - ThreadsSMRSupport::print_smr_info_on(st); + ThreadsSMRSupport::print_info_on(st); st->cr(); bool found_current = false; diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index faafbbae05e..7c2a0f29cdc 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -31,131 +31,131 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/resourceHash.hpp" -Monitor* ThreadsSMRSupport::_smr_delete_lock = - new Monitor(Monitor::special, "smr_delete_lock", +Monitor* ThreadsSMRSupport::_delete_lock = + new Monitor(Monitor::special, "Thread_SMR_delete_lock", false /* allow_vm_block */, Monitor::_safepoint_check_never); // The '_cnt', '_max' and '_times" fields are enabled via // -XX:+EnableThreadSMRStatistics: -// # of parallel threads in _smr_delete_lock->wait(). +// # of parallel threads in _delete_lock->wait(). // Impl note: Hard to imagine > 64K waiting threads so this could be 16-bit, // but there is no nice 16-bit _FORMAT support. -uint ThreadsSMRSupport::_smr_delete_lock_wait_cnt = 0; +uint ThreadsSMRSupport::_delete_lock_wait_cnt = 0; -// Max # of parallel threads in _smr_delete_lock->wait(). -// Impl note: See _smr_delete_lock_wait_cnt note. -uint ThreadsSMRSupport::_smr_delete_lock_wait_max = 0; +// Max # of parallel threads in _delete_lock->wait(). +// Impl note: See _delete_lock_wait_cnt note. +uint ThreadsSMRSupport::_delete_lock_wait_max = 0; -// Flag to indicate when an _smr_delete_lock->notify() is needed. -// Impl note: See _smr_delete_lock_wait_cnt note. -volatile uint ThreadsSMRSupport::_smr_delete_notify = 0; +// Flag to indicate when an _delete_lock->notify() is needed. +// Impl note: See _delete_lock_wait_cnt note. +volatile uint ThreadsSMRSupport::_delete_notify = 0; // # of threads deleted over VM lifetime. // Impl note: Atomically incremented over VM lifetime so use unsigned for more // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc // isn't available everywhere (or is it?). -volatile uint ThreadsSMRSupport::_smr_deleted_thread_cnt = 0; +volatile uint ThreadsSMRSupport::_deleted_thread_cnt = 0; // Max time in millis to delete a thread. // Impl note: 16-bit might be too small on an overloaded machine. Use // unsigned since this is a time value. Set via Atomic::cmpxchg() in a // loop for correctness. -volatile uint ThreadsSMRSupport::_smr_deleted_thread_time_max = 0; +volatile uint ThreadsSMRSupport::_deleted_thread_time_max = 0; // Cumulative time in millis to delete threads. // Impl note: Atomically added to over VM lifetime so use unsigned for more // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc // isn't available everywhere (or is it?). -volatile uint ThreadsSMRSupport::_smr_deleted_thread_times = 0; +volatile uint ThreadsSMRSupport::_deleted_thread_times = 0; -ThreadsList* volatile ThreadsSMRSupport::_smr_java_thread_list = new ThreadsList(0); +ThreadsList* volatile ThreadsSMRSupport::_java_thread_list = new ThreadsList(0); // # of ThreadsLists allocated over VM lifetime. // Impl note: We allocate a new ThreadsList for every thread create and // every thread delete so we need a bigger type than the -// _smr_deleted_thread_cnt field. -uint64_t ThreadsSMRSupport::_smr_java_thread_list_alloc_cnt = 1; +// _deleted_thread_cnt field. +uint64_t ThreadsSMRSupport::_java_thread_list_alloc_cnt = 1; // # of ThreadsLists freed over VM lifetime. -// Impl note: See _smr_java_thread_list_alloc_cnt note. -uint64_t ThreadsSMRSupport::_smr_java_thread_list_free_cnt = 0; +// Impl note: See _java_thread_list_alloc_cnt note. +uint64_t ThreadsSMRSupport::_java_thread_list_free_cnt = 0; // Max size ThreadsList allocated. // Impl note: Max # of threads alive at one time should fit in unsigned 32-bit. -uint ThreadsSMRSupport::_smr_java_thread_list_max = 0; +uint ThreadsSMRSupport::_java_thread_list_max = 0; // Max # of nested ThreadsLists for a thread. // Impl note: Hard to imagine > 64K nested ThreadsLists so this could be // 16-bit, but there is no nice 16-bit _FORMAT support. -uint ThreadsSMRSupport::_smr_nested_thread_list_max = 0; +uint ThreadsSMRSupport::_nested_thread_list_max = 0; // # of ThreadsListHandles deleted over VM lifetime. // Impl note: Atomically incremented over VM lifetime so use unsigned for // more range. There will be fewer ThreadsListHandles than threads so // unsigned 32-bit should be fine. -volatile uint ThreadsSMRSupport::_smr_tlh_cnt = 0; +volatile uint ThreadsSMRSupport::_tlh_cnt = 0; // Max time in millis to delete a ThreadsListHandle. // Impl note: 16-bit might be too small on an overloaded machine. Use // unsigned since this is a time value. Set via Atomic::cmpxchg() in a // loop for correctness. -volatile uint ThreadsSMRSupport::_smr_tlh_time_max = 0; +volatile uint ThreadsSMRSupport::_tlh_time_max = 0; // Cumulative time in millis to delete ThreadsListHandles. // Impl note: Atomically added to over VM lifetime so use unsigned for more // range. Unsigned 64-bit would be more future proof, but 64-bit atomic inc // isn't available everywhere (or is it?). -volatile uint ThreadsSMRSupport::_smr_tlh_times = 0; +volatile uint ThreadsSMRSupport::_tlh_times = 0; -ThreadsList* ThreadsSMRSupport::_smr_to_delete_list = NULL; +ThreadsList* ThreadsSMRSupport::_to_delete_list = NULL; // # of parallel ThreadsLists on the to-delete list. // Impl note: Hard to imagine > 64K ThreadsLists needing to be deleted so // this could be 16-bit, but there is no nice 16-bit _FORMAT support. -uint ThreadsSMRSupport::_smr_to_delete_list_cnt = 0; +uint ThreadsSMRSupport::_to_delete_list_cnt = 0; // Max # of parallel ThreadsLists on the to-delete list. -// Impl note: See _smr_to_delete_list_cnt note. -uint ThreadsSMRSupport::_smr_to_delete_list_max = 0; +// Impl note: See _to_delete_list_cnt note. +uint ThreadsSMRSupport::_to_delete_list_max = 0; // 'inline' functions first so the definitions are before first use: -inline void ThreadsSMRSupport::add_smr_deleted_thread_times(uint add_value) { - Atomic::add(add_value, &_smr_deleted_thread_times); +inline void ThreadsSMRSupport::add_deleted_thread_times(uint add_value) { + Atomic::add(add_value, &_deleted_thread_times); } -inline void ThreadsSMRSupport::inc_smr_deleted_thread_cnt() { - Atomic::inc(&_smr_deleted_thread_cnt); +inline void ThreadsSMRSupport::inc_deleted_thread_cnt() { + Atomic::inc(&_deleted_thread_cnt); } -inline void ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt() { - _smr_java_thread_list_alloc_cnt++; +inline void ThreadsSMRSupport::inc_java_thread_list_alloc_cnt() { + _java_thread_list_alloc_cnt++; } -inline void ThreadsSMRSupport::update_smr_deleted_thread_time_max(uint new_value) { +inline void ThreadsSMRSupport::update_deleted_thread_time_max(uint new_value) { while (true) { - uint cur_value = _smr_deleted_thread_time_max; + uint cur_value = _deleted_thread_time_max; if (new_value <= cur_value) { // No need to update max value so we're done. break; } - if (Atomic::cmpxchg(new_value, &_smr_deleted_thread_time_max, cur_value) == cur_value) { + if (Atomic::cmpxchg(new_value, &_deleted_thread_time_max, cur_value) == cur_value) { // Updated max value so we're done. Otherwise try it all again. break; } } } -inline void ThreadsSMRSupport::update_smr_java_thread_list_max(uint new_value) { - if (new_value > _smr_java_thread_list_max) { - _smr_java_thread_list_max = new_value; +inline void ThreadsSMRSupport::update_java_thread_list_max(uint new_value) { + if (new_value > _java_thread_list_max) { + _java_thread_list_max = new_value; } } -inline ThreadsList* ThreadsSMRSupport::xchg_smr_java_thread_list(ThreadsList* new_list) { - return (ThreadsList*)Atomic::xchg(new_list, &_smr_java_thread_list); +inline ThreadsList* ThreadsSMRSupport::xchg_java_thread_list(ThreadsList* new_list) { + return (ThreadsList*)Atomic::xchg(new_list, &_java_thread_list); } @@ -268,7 +268,7 @@ class ScanHazardPtrGatherProtectedThreadsClosure : public ThreadClosure { } // The current JavaThread has a hazard ptr (ThreadsList reference) - // which might be _smr_java_thread_list or it might be an older + // which might be _java_thread_list or it might be an older // ThreadsList that has been removed but not freed. In either case, // the hazard ptr is protecting all the JavaThreads on that // ThreadsList. @@ -347,7 +347,7 @@ class ScanHazardPtrPrintMatchingThreadsClosure : public ThreadClosure { if (Thread::is_hazard_ptr_tagged(current_list)) return; // The current JavaThread has a hazard ptr (ThreadsList reference) - // which might be _smr_java_thread_list or it might be an older + // which might be _java_thread_list or it might be an older // ThreadsList that has been removed but not freed. In either case, // the hazard ptr is protecting all the JavaThreads on that // ThreadsList, but we only care about matching a specific JavaThread. @@ -476,7 +476,7 @@ ThreadsListHandle::~ThreadsListHandle() { if (EnableThreadSMRStatistics) { _timer.stop(); uint millis = (uint)_timer.milliseconds(); - ThreadsSMRSupport::update_smr_tlh_stats(millis); + ThreadsSMRSupport::update_tlh_stats(millis); } } @@ -574,12 +574,12 @@ ThreadsList *ThreadsSMRSupport::acquire_stable_list_fast_path(Thread *self) { ThreadsList* threads; // Stable recording of a hazard ptr for SMR. This code does not use - // locks so its use of the _smr_java_thread_list & _threads_hazard_ptr + // locks so its use of the _java_thread_list & _threads_hazard_ptr // fields is racy relative to code that uses those fields with locks. // OrderAccess and Atomic functions are used to deal with those races. // while (true) { - threads = get_smr_java_thread_list(); + threads = get_java_thread_list(); // Publish a tagged hazard ptr to denote that the hazard ptr is not // yet verified as being stable. Due to the fence after the hazard @@ -590,9 +590,9 @@ ThreadsList *ThreadsSMRSupport::acquire_stable_list_fast_path(Thread *self) { ThreadsList* unverified_threads = Thread::tag_hazard_ptr(threads); self->set_threads_hazard_ptr(unverified_threads); - // If _smr_java_thread_list has changed, we have lost a race with + // If _java_thread_list has changed, we have lost a race with // Threads::add() or Threads::remove() and have to try again. - if (get_smr_java_thread_list() != threads) { + if (get_java_thread_list() != threads) { continue; } @@ -634,15 +634,15 @@ ThreadsList *ThreadsSMRSupport::acquire_stable_list_nested_path(Thread *self) { { // Only grab the Threads_lock if we don't already own it. MutexLockerEx ml(Threads_lock->owned_by_self() ? NULL : Threads_lock); - node = new NestedThreadsList(get_smr_java_thread_list()); + node = new NestedThreadsList(get_java_thread_list()); // We insert at the front of the list to match up with the delete // in release_stable_list(). node->set_next(self->get_nested_threads_hazard_ptr()); self->set_nested_threads_hazard_ptr(node); if (EnableThreadSMRStatistics) { self->inc_nested_threads_hazard_ptr_cnt(); - if (self->nested_threads_hazard_ptr_cnt() > _smr_nested_thread_list_max) { - _smr_nested_thread_list_max = self->nested_threads_hazard_ptr_cnt(); + if (self->nested_threads_hazard_ptr_cnt() > _nested_thread_list_max) { + _nested_thread_list_max = self->nested_threads_hazard_ptr_cnt(); } } } @@ -652,25 +652,101 @@ ThreadsList *ThreadsSMRSupport::acquire_stable_list_nested_path(Thread *self) { } void ThreadsSMRSupport::add_thread(JavaThread *thread){ - ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread); + ThreadsList *new_list = ThreadsList::add_thread(ThreadsSMRSupport::get_java_thread_list(), thread); if (EnableThreadSMRStatistics) { - ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt(); - ThreadsSMRSupport::update_smr_java_thread_list_max(new_list->length()); + ThreadsSMRSupport::inc_java_thread_list_alloc_cnt(); + ThreadsSMRSupport::update_java_thread_list_max(new_list->length()); } - // Initial _smr_java_thread_list will not generate a "Threads::add" mesg. + // Initial _java_thread_list will not generate a "Threads::add" mesg. log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::add: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list)); - ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list); - ThreadsSMRSupport::smr_free_list(old_list); + ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list); + ThreadsSMRSupport::free_list(old_list); } -// set_smr_delete_notify() and clear_smr_delete_notify() are called -// under the protection of the smr_delete_lock, but we also use an +// set_delete_notify() and clear_delete_notify() are called +// under the protection of the delete_lock, but we also use an // Atomic operation to ensure the memory update is seen earlier than -// when the smr_delete_lock is dropped. +// when the delete_lock is dropped. // -void ThreadsSMRSupport::clear_smr_delete_notify() { - Atomic::dec(&_smr_delete_notify); +void ThreadsSMRSupport::clear_delete_notify() { + Atomic::dec(&_delete_notify); +} + +bool ThreadsSMRSupport::delete_notify() { + // Use load_acquire() in order to see any updates to _delete_notify + // earlier than when delete_lock is grabbed. + return (OrderAccess::load_acquire(&_delete_notify) != 0); +} + +// Safely free a ThreadsList after a Threads::add() or Threads::remove(). +// The specified ThreadsList may not get deleted during this call if it +// is still in-use (referenced by a hazard ptr). Other ThreadsLists +// in the chain may get deleted by this call if they are no longer in-use. +void ThreadsSMRSupport::free_list(ThreadsList* threads) { + assert_locked_or_safepoint(Threads_lock); + + threads->set_next_list(_to_delete_list); + _to_delete_list = threads; + if (EnableThreadSMRStatistics) { + _to_delete_list_cnt++; + if (_to_delete_list_cnt > _to_delete_list_max) { + _to_delete_list_max = _to_delete_list_cnt; + } + } + + // Hash table size should be first power of two higher than twice the length of the ThreadsList + int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1; + hash_table_size--; + hash_table_size |= hash_table_size >> 1; + hash_table_size |= hash_table_size >> 2; + hash_table_size |= hash_table_size >> 4; + hash_table_size |= hash_table_size >> 8; + hash_table_size |= hash_table_size >> 16; + hash_table_size++; + + // Gather a hash table of the current hazard ptrs: + ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size); + ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table); + Threads::threads_do(&scan_cl); + + // Walk through the linked list of pending freeable ThreadsLists + // and free the ones that are not referenced from hazard ptrs. + ThreadsList* current = _to_delete_list; + ThreadsList* prev = NULL; + ThreadsList* next = NULL; + bool threads_is_freed = false; + while (current != NULL) { + next = current->next_list(); + if (!scan_table->has_entry((void*)current)) { + // This ThreadsList is not referenced by a hazard ptr. + if (prev != NULL) { + prev->set_next_list(next); + } + if (_to_delete_list == current) { + _to_delete_list = next; + } + + log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current)); + if (current == threads) threads_is_freed = true; + delete current; + if (EnableThreadSMRStatistics) { + _java_thread_list_free_cnt++; + _to_delete_list_cnt--; + } + } else { + prev = current; + } + current = next; + } + + if (!threads_is_freed) { + // Only report "is not freed" on the original call to + // free_list() for this ThreadsList. + log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads)); + } + + delete scan_table; } // Return true if the specified JavaThread is protected by a hazard @@ -681,7 +757,7 @@ bool ThreadsSMRSupport::is_a_protected_JavaThread(JavaThread *thread) { // Hash table size should be first power of two higher than twice // the length of the Threads list. - int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1; + int hash_table_size = MIN2((int)get_java_thread_list()->length(), 32) << 1; hash_table_size--; hash_table_size |= hash_table_size >> 1; hash_table_size |= hash_table_size >> 2; @@ -736,10 +812,10 @@ void ThreadsSMRSupport::release_stable_list_fast_path(Thread *self) { self->set_threads_hazard_ptr(NULL); // We use double-check locking to reduce traffic on the system - // wide smr_delete_lock. - if (ThreadsSMRSupport::smr_delete_notify()) { + // wide Thread-SMR delete_lock. + if (ThreadsSMRSupport::delete_notify()) { // An exiting thread might be waiting in smr_delete(); we need to - // check with smr_delete_lock to be sure. + // check with delete_lock to be sure. release_stable_list_wake_up((char *) "regular hazard ptr"); } } @@ -772,7 +848,7 @@ void ThreadsSMRSupport::release_stable_list_nested_path(Thread *self) { } // An exiting thread might be waiting in smr_delete(); we need to - // check with smr_delete_lock to be sure. + // check with delete_lock to be sure. release_stable_list_wake_up((char *) "nested hazard ptr"); log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::release_stable_list: delete NestedThreadsList node containing ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(node->t_list())); @@ -781,21 +857,21 @@ void ThreadsSMRSupport::release_stable_list_nested_path(Thread *self) { } // Wake up portion of the release stable ThreadsList protocol; -// uses the smr_delete_lock(). +// uses the delete_lock(). // void ThreadsSMRSupport::release_stable_list_wake_up(char *log_str) { assert(log_str != NULL, "sanity check"); - // Note: smr_delete_lock is held in smr_delete() for the entire + // Note: delete_lock is held in smr_delete() for the entire // hazard ptr search so that we do not lose this notify() if // the exiting thread has to wait. That code path also holds - // Threads_lock (which was grabbed before smr_delete_lock) so that + // Threads_lock (which was grabbed before delete_lock) so that // threads_do() can be called. This means the system can't start a // safepoint which means this thread can't take too long to get to - // a safepoint because of being blocked on smr_delete_lock. + // a safepoint because of being blocked on delete_lock. // - MonitorLockerEx ml(ThreadsSMRSupport::smr_delete_lock(), Monitor::_no_safepoint_check_flag); - if (ThreadsSMRSupport::smr_delete_notify()) { + MonitorLockerEx ml(ThreadsSMRSupport::delete_lock(), Monitor::_no_safepoint_check_flag); + if (ThreadsSMRSupport::delete_notify()) { // Notify any exiting JavaThreads that are waiting in smr_delete() // that we've released a ThreadsList. ml.notify_all(); @@ -804,23 +880,23 @@ void ThreadsSMRSupport::release_stable_list_wake_up(char *log_str) { } void ThreadsSMRSupport::remove_thread(JavaThread *thread) { - ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_smr_java_thread_list(), thread); + ThreadsList *new_list = ThreadsList::remove_thread(ThreadsSMRSupport::get_java_thread_list(), thread); if (EnableThreadSMRStatistics) { - ThreadsSMRSupport::inc_smr_java_thread_list_alloc_cnt(); + ThreadsSMRSupport::inc_java_thread_list_alloc_cnt(); // This list is smaller so no need to check for a "longest" update. } - // Final _smr_java_thread_list will not generate a "Threads::remove" mesg. + // Final _java_thread_list will not generate a "Threads::remove" mesg. log_debug(thread, smr)("tid=" UINTX_FORMAT ": Threads::remove: new ThreadsList=" INTPTR_FORMAT, os::current_thread_id(), p2i(new_list)); - ThreadsList *old_list = ThreadsSMRSupport::xchg_smr_java_thread_list(new_list); - ThreadsSMRSupport::smr_free_list(old_list); + ThreadsList *old_list = ThreadsSMRSupport::xchg_java_thread_list(new_list); + ThreadsSMRSupport::free_list(old_list); } -// See note for clear_smr_delete_notify(). +// See note for clear_delete_notify(). // -void ThreadsSMRSupport::set_smr_delete_notify() { - Atomic::inc(&_smr_delete_notify); +void ThreadsSMRSupport::set_delete_notify() { + Atomic::inc(&_delete_notify); } // Safely delete a JavaThread when it is no longer in use by a @@ -842,16 +918,16 @@ void ThreadsSMRSupport::smr_delete(JavaThread *thread) { MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); // Cannot use a MonitorLockerEx helper here because we have // to drop the Threads_lock first if we wait. - ThreadsSMRSupport::smr_delete_lock()->lock_without_safepoint_check(); - // Set the smr_delete_notify flag after we grab smr_delete_lock + ThreadsSMRSupport::delete_lock()->lock_without_safepoint_check(); + // Set the delete_notify flag after we grab delete_lock // and before we scan hazard ptrs because we're doing // double-check locking in release_stable_list(). - ThreadsSMRSupport::set_smr_delete_notify(); + ThreadsSMRSupport::set_delete_notify(); if (!is_a_protected_JavaThread(thread)) { // This is the common case. - ThreadsSMRSupport::clear_smr_delete_notify(); - ThreadsSMRSupport::smr_delete_lock()->unlock(); + ThreadsSMRSupport::clear_delete_notify(); + ThreadsSMRSupport::delete_lock()->unlock(); break; } if (!has_logged_once) { @@ -865,22 +941,22 @@ void ThreadsSMRSupport::smr_delete(JavaThread *thread) { } // We have to drop the Threads_lock to wait or delete the thread if (EnableThreadSMRStatistics) { - _smr_delete_lock_wait_cnt++; - if (_smr_delete_lock_wait_cnt > _smr_delete_lock_wait_max) { - _smr_delete_lock_wait_max = _smr_delete_lock_wait_cnt; + _delete_lock_wait_cnt++; + if (_delete_lock_wait_cnt > _delete_lock_wait_max) { + _delete_lock_wait_max = _delete_lock_wait_cnt; } } // Wait for a release_stable_list() call before we check again. No // safepoint check, no timeout, and not as suspend equivalent flag // because this JavaThread is not on the Threads list. - ThreadsSMRSupport::smr_delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0, + ThreadsSMRSupport::delete_lock()->wait(Mutex::_no_safepoint_check_flag, 0, !Mutex::_as_suspend_equivalent_flag); if (EnableThreadSMRStatistics) { - _smr_delete_lock_wait_cnt--; + _delete_lock_wait_cnt--; } - ThreadsSMRSupport::clear_smr_delete_notify(); - ThreadsSMRSupport::smr_delete_lock()->unlock(); + ThreadsSMRSupport::clear_delete_notify(); + ThreadsSMRSupport::delete_lock()->unlock(); // Retry the whole scenario. } @@ -893,166 +969,89 @@ void ThreadsSMRSupport::smr_delete(JavaThread *thread) { if (EnableThreadSMRStatistics) { timer.stop(); uint millis = (uint)timer.milliseconds(); - ThreadsSMRSupport::inc_smr_deleted_thread_cnt(); - ThreadsSMRSupport::add_smr_deleted_thread_times(millis); - ThreadsSMRSupport::update_smr_deleted_thread_time_max(millis); + ThreadsSMRSupport::inc_deleted_thread_cnt(); + ThreadsSMRSupport::add_deleted_thread_times(millis); + ThreadsSMRSupport::update_deleted_thread_time_max(millis); } log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_delete: thread=" INTPTR_FORMAT " is deleted.", os::current_thread_id(), p2i(thread)); } -bool ThreadsSMRSupport::smr_delete_notify() { - // Use load_acquire() in order to see any updates to _smr_delete_notify - // earlier than when smr_delete_lock is grabbed. - return (OrderAccess::load_acquire(&_smr_delete_notify) != 0); -} - -// Safely free a ThreadsList after a Threads::add() or Threads::remove(). -// The specified ThreadsList may not get deleted during this call if it -// is still in-use (referenced by a hazard ptr). Other ThreadsLists -// in the chain may get deleted by this call if they are no longer in-use. -void ThreadsSMRSupport::smr_free_list(ThreadsList* threads) { - assert_locked_or_safepoint(Threads_lock); - - threads->set_next_list(_smr_to_delete_list); - _smr_to_delete_list = threads; - if (EnableThreadSMRStatistics) { - _smr_to_delete_list_cnt++; - if (_smr_to_delete_list_cnt > _smr_to_delete_list_max) { - _smr_to_delete_list_max = _smr_to_delete_list_cnt; - } - } - - // Hash table size should be first power of two higher than twice the length of the ThreadsList - int hash_table_size = MIN2((int)get_smr_java_thread_list()->length(), 32) << 1; - hash_table_size--; - hash_table_size |= hash_table_size >> 1; - hash_table_size |= hash_table_size >> 2; - hash_table_size |= hash_table_size >> 4; - hash_table_size |= hash_table_size >> 8; - hash_table_size |= hash_table_size >> 16; - hash_table_size++; - - // Gather a hash table of the current hazard ptrs: - ThreadScanHashtable *scan_table = new ThreadScanHashtable(hash_table_size); - ScanHazardPtrGatherThreadsListClosure scan_cl(scan_table); - Threads::threads_do(&scan_cl); - - // Walk through the linked list of pending freeable ThreadsLists - // and free the ones that are not referenced from hazard ptrs. - ThreadsList* current = _smr_to_delete_list; - ThreadsList* prev = NULL; - ThreadsList* next = NULL; - bool threads_is_freed = false; - while (current != NULL) { - next = current->next_list(); - if (!scan_table->has_entry((void*)current)) { - // This ThreadsList is not referenced by a hazard ptr. - if (prev != NULL) { - prev->set_next_list(next); - } - if (_smr_to_delete_list == current) { - _smr_to_delete_list = next; - } - - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is freed.", os::current_thread_id(), p2i(current)); - if (current == threads) threads_is_freed = true; - delete current; - if (EnableThreadSMRStatistics) { - _smr_java_thread_list_free_cnt++; - _smr_to_delete_list_cnt--; - } - } else { - prev = current; - } - current = next; - } - - if (!threads_is_freed) { - // Only report "is not freed" on the original call to - // smr_free_list() for this ThreadsList. - log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::smr_free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads)); - } - - delete scan_table; -} - // Debug, logging, and printing stuff at the end: // Log Threads class SMR info. -void ThreadsSMRSupport::log_smr_statistics() { +void ThreadsSMRSupport::log_statistics() { LogTarget(Info, thread, smr) log; if (log.is_enabled()) { LogStream out(log); - print_smr_info_on(&out); + print_info_on(&out); } } // Print Threads class SMR info. -void ThreadsSMRSupport::print_smr_info_on(outputStream* st) { +void ThreadsSMRSupport::print_info_on(outputStream* st) { // Only grab the Threads_lock if we don't already own it // and if we are not reporting an error. MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock); st->print_cr("Threads class SMR info:"); - st->print_cr("_smr_java_thread_list=" INTPTR_FORMAT ", length=%u, " - "elements={", p2i(_smr_java_thread_list), - _smr_java_thread_list->length()); - print_smr_info_elements_on(st, _smr_java_thread_list); + st->print_cr("_java_thread_list=" INTPTR_FORMAT ", length=%u, " + "elements={", p2i(_java_thread_list), + _java_thread_list->length()); + print_info_elements_on(st, _java_thread_list); st->print_cr("}"); - if (_smr_to_delete_list != NULL) { - st->print_cr("_smr_to_delete_list=" INTPTR_FORMAT ", length=%u, " - "elements={", p2i(_smr_to_delete_list), - _smr_to_delete_list->length()); - print_smr_info_elements_on(st, _smr_to_delete_list); + if (_to_delete_list != NULL) { + st->print_cr("_to_delete_list=" INTPTR_FORMAT ", length=%u, " + "elements={", p2i(_to_delete_list), + _to_delete_list->length()); + print_info_elements_on(st, _to_delete_list); st->print_cr("}"); - for (ThreadsList *t_list = _smr_to_delete_list->next_list(); + for (ThreadsList *t_list = _to_delete_list->next_list(); t_list != NULL; t_list = t_list->next_list()) { st->print("next-> " INTPTR_FORMAT ", length=%u, " "elements={", p2i(t_list), t_list->length()); - print_smr_info_elements_on(st, t_list); + print_info_elements_on(st, t_list); st->print_cr("}"); } } if (!EnableThreadSMRStatistics) { return; } - st->print_cr("_smr_java_thread_list_alloc_cnt=" UINT64_FORMAT "," - "_smr_java_thread_list_free_cnt=" UINT64_FORMAT "," - "_smr_java_thread_list_max=%u, " - "_smr_nested_thread_list_max=%u", - _smr_java_thread_list_alloc_cnt, - _smr_java_thread_list_free_cnt, - _smr_java_thread_list_max, - _smr_nested_thread_list_max); - if (_smr_tlh_cnt > 0) { - st->print_cr("_smr_tlh_cnt=%u" - ", _smr_tlh_times=%u" - ", avg_smr_tlh_time=%0.2f" - ", _smr_tlh_time_max=%u", - _smr_tlh_cnt, _smr_tlh_times, - ((double) _smr_tlh_times / _smr_tlh_cnt), - _smr_tlh_time_max); + st->print_cr("_java_thread_list_alloc_cnt=" UINT64_FORMAT "," + "_java_thread_list_free_cnt=" UINT64_FORMAT "," + "_java_thread_list_max=%u, " + "_nested_thread_list_max=%u", + _java_thread_list_alloc_cnt, + _java_thread_list_free_cnt, + _java_thread_list_max, + _nested_thread_list_max); + if (_tlh_cnt > 0) { + st->print_cr("_tlh_cnt=%u" + ", _tlh_times=%u" + ", avg_tlh_time=%0.2f" + ", _tlh_time_max=%u", + _tlh_cnt, _tlh_times, + ((double) _tlh_times / _tlh_cnt), + _tlh_time_max); } - if (_smr_deleted_thread_cnt > 0) { - st->print_cr("_smr_deleted_thread_cnt=%u" - ", _smr_deleted_thread_times=%u" - ", avg_smr_deleted_thread_time=%0.2f" - ", _smr_deleted_thread_time_max=%u", - _smr_deleted_thread_cnt, _smr_deleted_thread_times, - ((double) _smr_deleted_thread_times / _smr_deleted_thread_cnt), - _smr_deleted_thread_time_max); + if (_deleted_thread_cnt > 0) { + st->print_cr("_deleted_thread_cnt=%u" + ", _deleted_thread_times=%u" + ", avg_deleted_thread_time=%0.2f" + ", _deleted_thread_time_max=%u", + _deleted_thread_cnt, _deleted_thread_times, + ((double) _deleted_thread_times / _deleted_thread_cnt), + _deleted_thread_time_max); } - st->print_cr("_smr_delete_lock_wait_cnt=%u, _smr_delete_lock_wait_max=%u", - _smr_delete_lock_wait_cnt, _smr_delete_lock_wait_max); - st->print_cr("_smr_to_delete_list_cnt=%u, _smr_to_delete_list_max=%u", - _smr_to_delete_list_cnt, _smr_to_delete_list_max); + st->print_cr("_delete_lock_wait_cnt=%u, _delete_lock_wait_max=%u", + _delete_lock_wait_cnt, _delete_lock_wait_max); + st->print_cr("_to_delete_list_cnt=%u, _to_delete_list_max=%u", + _to_delete_list_cnt, _to_delete_list_max); } // Print ThreadsList elements (4 per line). -void ThreadsSMRSupport::print_smr_info_elements_on(outputStream* st, - ThreadsList* t_list) { +void ThreadsSMRSupport::print_info_elements_on(outputStream* st, ThreadsList* t_list) { uint cnt = 0; JavaThreadIterator jti(t_list); for (JavaThread *jt = jti.first(); jt != NULL; jt = jti.next()) { diff --git a/src/hotspot/share/runtime/threadSMR.hpp b/src/hotspot/share/runtime/threadSMR.hpp index cb41daf4d6f..bb22f72d192 100644 --- a/src/hotspot/share/runtime/threadSMR.hpp +++ b/src/hotspot/share/runtime/threadSMR.hpp @@ -81,67 +81,68 @@ // class ThreadsSMRSupport : AllStatic { // The coordination between ThreadsSMRSupport::release_stable_list() and - // ThreadsSMRSupport::smr_delete() uses the smr_delete_lock in order to + // ThreadsSMRSupport::smr_delete() uses the delete_lock in order to // reduce the traffic on the Threads_lock. - static Monitor* _smr_delete_lock; + static Monitor* _delete_lock; // The '_cnt', '_max' and '_times" fields are enabled via // -XX:+EnableThreadSMRStatistics (see thread.cpp for a // description about each field): - static uint _smr_delete_lock_wait_cnt; - static uint _smr_delete_lock_wait_max; - // The smr_delete_notify flag is used for proper double-check - // locking in order to reduce the traffic on the smr_delete_lock. - static volatile uint _smr_delete_notify; - static volatile uint _smr_deleted_thread_cnt; - static volatile uint _smr_deleted_thread_time_max; - static volatile uint _smr_deleted_thread_times; - static ThreadsList* volatile _smr_java_thread_list; - static uint64_t _smr_java_thread_list_alloc_cnt; - static uint64_t _smr_java_thread_list_free_cnt; - static uint _smr_java_thread_list_max; - static uint _smr_nested_thread_list_max; - static volatile uint _smr_tlh_cnt; - static volatile uint _smr_tlh_time_max; - static volatile uint _smr_tlh_times; - static ThreadsList* _smr_to_delete_list; - static uint _smr_to_delete_list_cnt; - static uint _smr_to_delete_list_max; + static uint _delete_lock_wait_cnt; + static uint _delete_lock_wait_max; + // The delete_notify flag is used for proper double-check + // locking in order to reduce the traffic on the system wide + // Thread-SMR delete_lock. + static volatile uint _delete_notify; + static volatile uint _deleted_thread_cnt; + static volatile uint _deleted_thread_time_max; + static volatile uint _deleted_thread_times; + static ThreadsList* volatile _java_thread_list; + static uint64_t _java_thread_list_alloc_cnt; + static uint64_t _java_thread_list_free_cnt; + static uint _java_thread_list_max; + static uint _nested_thread_list_max; + static volatile uint _tlh_cnt; + static volatile uint _tlh_time_max; + static volatile uint _tlh_times; + static ThreadsList* _to_delete_list; + static uint _to_delete_list_cnt; + static uint _to_delete_list_max; static ThreadsList *acquire_stable_list_fast_path(Thread *self); static ThreadsList *acquire_stable_list_nested_path(Thread *self); - static void add_smr_deleted_thread_times(uint add_value); - static void add_smr_tlh_times(uint add_value); - static void clear_smr_delete_notify(); - static void inc_smr_deleted_thread_cnt(); - static void inc_smr_java_thread_list_alloc_cnt(); - static void inc_smr_tlh_cnt(); + static void add_deleted_thread_times(uint add_value); + static void add_tlh_times(uint add_value); + static void clear_delete_notify(); + static Monitor* delete_lock() { return _delete_lock; } + static bool delete_notify(); + static void free_list(ThreadsList* threads); + static void inc_deleted_thread_cnt(); + static void inc_java_thread_list_alloc_cnt(); + static void inc_tlh_cnt(); static bool is_a_protected_JavaThread(JavaThread *thread); static void release_stable_list_fast_path(Thread *self); static void release_stable_list_nested_path(Thread *self); static void release_stable_list_wake_up(char *log_str); - static void set_smr_delete_notify(); - static Monitor* smr_delete_lock() { return _smr_delete_lock; } - static bool smr_delete_notify(); - static void smr_free_list(ThreadsList* threads); - static void update_smr_deleted_thread_time_max(uint new_value); - static void update_smr_java_thread_list_max(uint new_value); - static void update_smr_tlh_time_max(uint new_value); - static ThreadsList* xchg_smr_java_thread_list(ThreadsList* new_list); + static void set_delete_notify(); + static void update_deleted_thread_time_max(uint new_value); + static void update_java_thread_list_max(uint new_value); + static void update_tlh_time_max(uint new_value); + static ThreadsList* xchg_java_thread_list(ThreadsList* new_list); public: static ThreadsList *acquire_stable_list(Thread *self, bool is_ThreadsListSetter); static void add_thread(JavaThread *thread); - static ThreadsList* get_smr_java_thread_list(); + static ThreadsList* get_java_thread_list(); static bool is_a_protected_JavaThread_with_lock(JavaThread *thread); static void release_stable_list(Thread *self); static void remove_thread(JavaThread *thread); static void smr_delete(JavaThread *thread); - static void update_smr_tlh_stats(uint millis); + static void update_tlh_stats(uint millis); // Logging and printing support: - static void log_smr_statistics(); - static void print_smr_info_elements_on(outputStream* st, ThreadsList* t_list); - static void print_smr_info_on(outputStream* st); + static void log_statistics(); + static void print_info_elements_on(outputStream* st, ThreadsList* t_list); + static void print_info_on(outputStream* st); }; // A fast list of JavaThreads. diff --git a/src/hotspot/share/runtime/threadSMR.inline.hpp b/src/hotspot/share/runtime/threadSMR.inline.hpp index d516cd39308..e0420e764b6 100644 --- a/src/hotspot/share/runtime/threadSMR.inline.hpp +++ b/src/hotspot/share/runtime/threadSMR.inline.hpp @@ -53,24 +53,24 @@ inline void ThreadsList::threads_do(T *cl) const { } // These three inlines are private to ThreadsSMRSupport, but -// they are called by public inline update_smr_tlh_stats() below: +// they are called by public inline update_tlh_stats() below: -inline void ThreadsSMRSupport::add_smr_tlh_times(uint add_value) { - Atomic::add(add_value, &_smr_tlh_times); +inline void ThreadsSMRSupport::add_tlh_times(uint add_value) { + Atomic::add(add_value, &_tlh_times); } -inline void ThreadsSMRSupport::inc_smr_tlh_cnt() { - Atomic::inc(&_smr_tlh_cnt); +inline void ThreadsSMRSupport::inc_tlh_cnt() { + Atomic::inc(&_tlh_cnt); } -inline void ThreadsSMRSupport::update_smr_tlh_time_max(uint new_value) { +inline void ThreadsSMRSupport::update_tlh_time_max(uint new_value) { while (true) { - uint cur_value = _smr_tlh_time_max; + uint cur_value = _tlh_time_max; if (new_value <= cur_value) { // No need to update max value so we're done. break; } - if (Atomic::cmpxchg(new_value, &_smr_tlh_time_max, cur_value) == cur_value) { + if (Atomic::cmpxchg(new_value, &_tlh_time_max, cur_value) == cur_value) { // Updated max value so we're done. Otherwise try it all again. break; } @@ -85,8 +85,8 @@ inline ThreadsList* ThreadsListSetter::list() { return ret; } -inline ThreadsList* ThreadsSMRSupport::get_smr_java_thread_list() { - return (ThreadsList*)OrderAccess::load_acquire(&_smr_java_thread_list); +inline ThreadsList* ThreadsSMRSupport::get_java_thread_list() { + return (ThreadsList*)OrderAccess::load_acquire(&_java_thread_list); } inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *thread) { @@ -94,10 +94,10 @@ inline bool ThreadsSMRSupport::is_a_protected_JavaThread_with_lock(JavaThread *t return is_a_protected_JavaThread(thread); } -inline void ThreadsSMRSupport::update_smr_tlh_stats(uint millis) { - ThreadsSMRSupport::inc_smr_tlh_cnt(); - ThreadsSMRSupport::add_smr_tlh_times(millis); - ThreadsSMRSupport::update_smr_tlh_time_max(millis); +inline void ThreadsSMRSupport::update_tlh_stats(uint millis) { + ThreadsSMRSupport::inc_tlh_cnt(); + ThreadsSMRSupport::add_tlh_times(millis); + ThreadsSMRSupport::update_tlh_time_max(millis); } #endif // SHARE_VM_RUNTIME_THREADSMR_INLINE_HPP diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java b/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java index c0f2e0b7b2b..6f9c66688cf 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java @@ -89,7 +89,7 @@ public class NestedThreadsListHandleInErrorHandlingTest { // We should have a section of Threads class SMR info: Pattern.compile("Threads class SMR info:"), // We should have one nested ThreadsListHandle: - Pattern.compile(".*, _smr_nested_thread_list_max=1"), + Pattern.compile(".*, _nested_thread_list_max=1"), // The current thread (marked with '=>') in the threads list // should show a hazard ptr: Pattern.compile("=>.* JavaThread \"main\" .*_threads_hazard_ptr=0x[0-9A-Fa-f][0-9A-Fa-f]*, _nested_threads_hazard_ptr_cnt=1, _nested_threads_hazard_ptrs=0x.*"), diff --git a/test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java b/test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java index 02b673bc299..663d1273bd4 100644 --- a/test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java +++ b/test/hotspot/jtreg/runtime/Thread/TestThreadDumpSMRInfo.java @@ -45,7 +45,7 @@ public class TestThreadDumpSMRInfo { // Here's a sample "Threads class SMR info" section: // // Threads class SMR info: - // _smr_java_thread_list=0x0000000000ce8da0, length=23, elements={ + // _java_thread_list=0x0000000000ce8da0, length=23, elements={ // 0x000000000043a800, 0x0000000000aee800, 0x0000000000b06800, 0x0000000000b26000, // 0x0000000000b28800, 0x0000000000b2b000, 0x0000000000b2e000, 0x0000000000b30000, // 0x0000000000b32800, 0x0000000000b35000, 0x0000000000b3f000, 0x0000000000b41800, @@ -53,9 +53,9 @@ public class TestThreadDumpSMRInfo { // 0x0000000000b55800, 0x0000000000b57800, 0x0000000000b5a000, 0x0000000000b5c800, // 0x0000000000cc8800, 0x0000000000fd9800, 0x0000000000ef4800 // } - // _smr_java_thread_list_alloc_cnt=24, _smr_java_thread_list_free_cnt=23, _smr_java_thread_list_max=23, _smr_nested_thread_list_max=0 - // _smr_delete_lock_wait_cnt=0, _smr_delete_lock_wait_max=0 - // _smr_to_delete_list_cnt=0, _smr_to_delete_list_max=1 + // _java_thread_list_alloc_cnt=24, _java_thread_list_free_cnt=23, _java_thread_list_max=23, _nested_thread_list_max=0 + // _delete_lock_wait_cnt=0, _delete_lock_wait_max=0 + // _to_delete_list_cnt=0, _to_delete_list_max=1 final static String HEADER_STR = "Threads class SMR info:"; From 915b2cd1f2d0e9da1984704d4c618835e914a9b5 Mon Sep 17 00:00:00 2001 From: Calvin Cheung Date: Fri, 8 Dec 2017 15:14:08 -0800 Subject: [PATCH 03/31] 8192989: runtime/appcds/javaldr/ArrayTest.java crashes with assert(k->is_instance_klass()) Disable loading array classes from the class list Reviewed-by: iklam, jiangli --- .../share/classfile/classListParser.cpp | 58 +++++++++---------- .../share/classfile/classListParser.hpp | 2 +- src/hotspot/share/memory/metaspaceShared.cpp | 16 ++--- .../runtime/appcds/javaldr/ArrayTest.java | 16 +++-- 4 files changed, 50 insertions(+), 42 deletions(-) diff --git a/src/hotspot/share/classfile/classListParser.cpp b/src/hotspot/share/classfile/classListParser.cpp index b1fa759ae10..86b8e581d1c 100644 --- a/src/hotspot/share/classfile/classListParser.cpp +++ b/src/hotspot/share/classfile/classListParser.cpp @@ -315,12 +315,13 @@ InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS return k; } -InstanceKlass* ClassListParser::load_current_class(TRAPS) { +Klass* ClassListParser::load_current_class(TRAPS) { TempNewSymbol class_name_symbol = SymbolTable::new_symbol(_class_name, THREAD); guarantee(!HAS_PENDING_EXCEPTION, "Exception creating a symbol."); - InstanceKlass *klass = NULL; + Klass *klass = NULL; if (!is_loading_from_source()) { + // Load classes for the boot/platform/app loaders only. if (is_super_specified()) { error("If source location is not specified, super class must not be specified"); } @@ -330,40 +331,36 @@ InstanceKlass* ClassListParser::load_current_class(TRAPS) { bool non_array = !FieldType::is_array(class_name_symbol); - Handle s = java_lang_String::create_from_symbol(class_name_symbol, CHECK_0); - // Translate to external class name format, i.e., convert '/' chars to '.' - Handle string = java_lang_String::externalize_classname(s, CHECK_0); JavaValue result(T_OBJECT); - InstanceKlass* spec_klass = non_array ? - SystemDictionary::ClassLoader_klass() : SystemDictionary::Class_klass(); - Symbol* method_name = non_array ? - vmSymbols::loadClass_name() : vmSymbols::forName_name(); - Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); - if (non_array) { + // At this point, we are executing in the context of the boot loader. We + // cannot call Class.forName because that is context dependent and + // would load only classes for the boot loader. + // + // Instead, let's call java_system_loader().loadClass() directly, which will + // delegate to the correct loader (boot, platform or app) depending on + // the class name. + + Handle s = java_lang_String::create_from_symbol(class_name_symbol, CHECK_0); + // ClassLoader.loadClass() wants external class name format, i.e., convert '/' chars to '.' + Handle ext_class_name = java_lang_String::externalize_classname(s, CHECK_0); + Handle loader = Handle(THREAD, SystemDictionary::java_system_loader()); + JavaCalls::call_virtual(&result, loader, //SystemDictionary::java_system_loader(), - spec_klass, - method_name, //vmSymbols::loadClass_name(), + SystemDictionary::ClassLoader_klass(), + vmSymbols::loadClass_name(), vmSymbols::string_class_signature(), - string, + ext_class_name, THREAD); } else { - JavaCalls::call_static(&result, - spec_klass, - method_name, - vmSymbols::string_class_signature(), - string, - CHECK_NULL); + // array classes are not supported in class list. + THROW_NULL(vmSymbols::java_lang_ClassNotFoundException()); } assert(result.get_type() == T_OBJECT, "just checking"); oop obj = (oop) result.get_jobject(); if (!HAS_PENDING_EXCEPTION && (obj != NULL)) { - if (non_array) { - klass = InstanceKlass::cast(java_lang_Class::as_Klass(obj)); - } else { - klass = static_cast(java_lang_Class::array_klass_acquire(obj)); - } + klass = java_lang_Class::as_Klass(obj); } else { // load classes in bootclasspath/a if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; @@ -372,7 +369,7 @@ InstanceKlass* ClassListParser::load_current_class(TRAPS) { if (non_array) { Klass* k = SystemDictionary::resolve_or_null(class_name_symbol, CHECK_NULL); if (k != NULL) { - klass = InstanceKlass::cast(k); + klass = k; } else { if (!HAS_PENDING_EXCEPTION) { THROW_NULL(vmSymbols::java_lang_ClassNotFoundException()); @@ -388,14 +385,15 @@ InstanceKlass* ClassListParser::load_current_class(TRAPS) { } } - if (klass != NULL && is_id_specified()) { + if (klass != NULL && klass->is_instance_klass() && is_id_specified()) { + InstanceKlass* ik = InstanceKlass::cast(klass); int id = this->id(); - SystemDictionaryShared::update_shared_entry(klass, id); + SystemDictionaryShared::update_shared_entry(ik, id); InstanceKlass* old = table()->lookup(id); - if (old != NULL && old != klass) { + if (old != NULL && old != ik) { error("Duplicated ID %d for class %s", id, _class_name); } - table()->add(id, klass); + table()->add(id, ik); } return klass; diff --git a/src/hotspot/share/classfile/classListParser.hpp b/src/hotspot/share/classfile/classListParser.hpp index e6d48f41c8d..4fe9750749e 100644 --- a/src/hotspot/share/classfile/classListParser.hpp +++ b/src/hotspot/share/classfile/classListParser.hpp @@ -136,7 +136,7 @@ public: return _class_name; } - InstanceKlass* load_current_class(TRAPS); + Klass* load_current_class(TRAPS); bool is_loading_from_source(); diff --git a/src/hotspot/share/memory/metaspaceShared.cpp b/src/hotspot/share/memory/metaspaceShared.cpp index 7d90abd4aae..3b76707b95c 100644 --- a/src/hotspot/share/memory/metaspaceShared.cpp +++ b/src/hotspot/share/memory/metaspaceShared.cpp @@ -1627,14 +1627,16 @@ int MetaspaceShared::preload_classes(const char* class_list_path, TRAPS) { log_trace(cds)("Shared spaces preloaded: %s", klass->external_name()); } - InstanceKlass* ik = InstanceKlass::cast(klass); + if (klass->is_instance_klass()) { + InstanceKlass* ik = InstanceKlass::cast(klass); - // Link the class to cause the bytecodes to be rewritten and the - // cpcache to be created. The linking is done as soon as classes - // are loaded in order that the related data structures (klass and - // cpCache) are located together. - try_link_class(ik, THREAD); - guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class"); + // Link the class to cause the bytecodes to be rewritten and the + // cpcache to be created. The linking is done as soon as classes + // are loaded in order that the related data structures (klass and + // cpCache) are located together. + try_link_class(ik, THREAD); + guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class"); + } class_count++; } diff --git a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java index 3deb59b3219..bc9e52792dd 100644 --- a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java +++ b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java @@ -44,7 +44,9 @@ public class ArrayTest { static String arrayClasses[] = { "ArrayTestHelper", "[Ljava/lang/Comparable;", - "[I" + "[I", + "[[[Ljava/lang/Object;", + "[[B" }; public static void main(String[] args) throws Exception { @@ -56,7 +58,12 @@ public class ArrayTest { String bootClassPath = "-Xbootclasspath/a:" + whiteBoxJar; // create an archive containing array classes - TestCommon.dump(appJar, TestCommon.list(arrayClasses), bootClassPath, "-verbose:class"); + OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list(arrayClasses), bootClassPath, "-verbose:class"); + // we currently don't support array classes during CDS dump + output.shouldContain("Preload Warning: Cannot find [Ljava/lang/Comparable;") + .shouldContain("Preload Warning: Cannot find [I") + .shouldContain("Preload Warning: Cannot find [[[Ljava/lang/Object;") + .shouldContain("Preload Warning: Cannot find [[B"); List argsList = new ArrayList(); argsList.add("-XX:+UnlockDiagnosticVMOptions"); @@ -67,12 +74,13 @@ public class ArrayTest { argsList.add("-verbose:class"); argsList.add("ArrayTestHelper"); // the following are input args to the ArrayTestHelper. - for (int i = 0; i < arrayClasses.length; i++) { + // skip checking array classes during run time + for (int i = 0; i < 1; i++) { argsList.add(arrayClasses[i]); } String[] opts = new String[argsList.size()]; opts = argsList.toArray(opts); - OutputAnalyzer output = TestCommon.execCommon(opts); + output = TestCommon.execCommon(opts); TestCommon.checkExec(output); } } From 200e63f32c824e07cb703420f3e3f99c5f1ecfa8 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Sat, 9 Dec 2017 07:50:50 -0800 Subject: [PATCH 04/31] 8191229: serviceability/jvmti/GetOwnedMonitorInfo/GetOwnedMonitorInfoTest.java fails with NoClassDefFoundError Call FindClass() when we are in the proper classloader context Reviewed-by: sspitsyn, dholmes, amenkov --- .../libGetOwnedMonitorInfoTest.c | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c b/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c index a18e8240903..5147fae5304 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c +++ b/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo/libGetOwnedMonitorInfoTest.c @@ -49,6 +49,7 @@ extern "C" { static volatile jboolean event_has_posted = JNI_FALSE; static volatile jint status = PASSED; +static volatile jclass testClass = NULL; static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved); @@ -66,16 +67,10 @@ static void ShowErrorMessage(jvmtiEnv *jvmti, jvmtiError errCode, const char *me } static jboolean CheckLockObject(JNIEnv *env, jobject monitor) { - jclass testClass; - - testClass = (*env)->FindClass(env, TEST_CLASS); if (testClass == NULL) { - fprintf(stderr, "MonitorContendedEnter: " TEST_CLASS " not found\n"); - status = FAILED; - event_has_posted = JNI_TRUE; + // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS. return JNI_FALSE; } - return (*env)->IsInstanceOf(env, monitor, testClass); } @@ -171,7 +166,26 @@ Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { - return JNI_VERSION_1_8; + jint res; + JNIEnv *env; + + res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &env), + JNI_VERSION_9); + if (res != JNI_OK || env == NULL) { + fprintf(stderr, "Error: GetEnv call failed(%d)!\n", res); + return JNI_ERR; + } + + testClass = (*env)->FindClass(env, TEST_CLASS); + if (testClass != NULL) { + testClass = (*env)->NewGlobalRef(env, testClass); + } + if (testClass == NULL) { + fprintf(stderr, "Error: Could not load class %s!\n", TEST_CLASS); + return JNI_ERR; + } + + return JNI_VERSION_9; } static @@ -185,7 +199,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printf("Agent_OnLoad started\n"); res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), - JVMTI_VERSION_1); + JVMTI_VERSION_9); if (res != JNI_OK || jvmti == NULL) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; @@ -221,6 +235,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } + memset(&callbacks, 0, sizeof(callbacks)); callbacks.MonitorContendedEnter = &MonitorContendedEnter; callbacks.MonitorContendedEntered = &MonitorContendedEntered; From d8a31c4cb8a618bf60767f336deed3c8f9beb556 Mon Sep 17 00:00:00 2001 From: Man Cao Date: Tue, 12 Dec 2017 11:55:57 -0500 Subject: [PATCH 05/31] 8193386: CompressedClassSize too large with MaxMetaspace Reviewed-by: ysuenaga, coleenp --- src/hotspot/share/memory/metaspace.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index 18de6beaef9..bb11f40c9c5 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -3695,7 +3695,6 @@ void Metaspace::ergo_initialize() { MaxMetaspaceExpansion = align_down_bounded(MaxMetaspaceExpansion, _commit_alignment); CompressedClassSpaceSize = align_down_bounded(CompressedClassSpaceSize, _reserve_alignment); - set_compressed_class_space_size(CompressedClassSpaceSize); // Initial virtual space size will be calculated at global_initialize() size_t min_metaspace_sz = @@ -3714,6 +3713,7 @@ void Metaspace::ergo_initialize() { min_metaspace_sz); } + set_compressed_class_space_size(CompressedClassSpaceSize); } void Metaspace::global_initialize() { From 8ab2ee6ab156da1dd9936f1769b4e6e6a848fa8d Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 12 Dec 2017 19:05:02 +0100 Subject: [PATCH 06/31] 8193363: TestDumpReplay.java fails with product builds Added missing -XX:+IgnoreUnrecognizedVMOptions Reviewed-by: kvn --- test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java b/test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java index d1f03a8429e..2a19d15a20a 100644 --- a/test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java +++ b/test/hotspot/jtreg/compiler/ciReplay/TestDumpReplay.java @@ -27,7 +27,8 @@ * @modules java.base/jdk.internal.misc:+open * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions + * -Xbootclasspath/a:. -XX:+WhiteBoxAPI * -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline * -XX:CompileCommand=compileonly,compiler.ciReplay.TestDumpReplay::* * compiler.ciReplay.TestDumpReplay From b1001c7d7dd5511f86e9799141ba99367ade394e Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 12 Dec 2017 19:06:19 -0500 Subject: [PATCH 07/31] 8193222: EnsureLocalCapacity() should maintain capacity requests through multiple calls Reviewed-by: coleenp, dcubed --- make/test/JtregNativeHotspot.gmk | 1 + src/hotspot/share/prims/jniCheck.cpp | 5 +- .../TestCheckedEnsureLocalCapacity.java | 85 +++++++++++++++++++ .../libTestCheckedEnsureLocalCapacity.c | 49 +++++++++++ 4 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/runtime/jni/checked/TestCheckedEnsureLocalCapacity.java create mode 100644 test/hotspot/jtreg/runtime/jni/checked/libTestCheckedEnsureLocalCapacity.c diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk index 8cf3b0ed6f3..b171e568eea 100644 --- a/make/test/JtregNativeHotspot.gmk +++ b/make/test/JtregNativeHotspot.gmk @@ -113,6 +113,7 @@ ifeq ($(TOOLCHAIN_TYPE), solstudio) BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHandshakeTransitionTest := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHasNoEntryPoint := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libReturnError := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libTestCheckedEnsureLocalCapacity := -lc endif ifeq ($(OPENJDK_TARGET_OS), linux) diff --git a/src/hotspot/share/prims/jniCheck.cpp b/src/hotspot/share/prims/jniCheck.cpp index 34281a7a071..2e1a0dbd917 100644 --- a/src/hotspot/share/prims/jniCheck.cpp +++ b/src/hotspot/share/prims/jniCheck.cpp @@ -826,7 +826,10 @@ JNI_ENTRY_CHECKED(jint, } jint result = UNCHECKED()->EnsureLocalCapacity(env, capacity); if (result == JNI_OK) { - add_planned_handle_capacity(thr->active_handles(), capacity); + // increase local ref capacity if needed + if ((size_t)capacity > thr->active_handles()->get_planned_capacity()) { + add_planned_handle_capacity(thr->active_handles(), capacity); + } } functionExit(thr); return result; diff --git a/test/hotspot/jtreg/runtime/jni/checked/TestCheckedEnsureLocalCapacity.java b/test/hotspot/jtreg/runtime/jni/checked/TestCheckedEnsureLocalCapacity.java new file mode 100644 index 00000000000..87e5d7d1baf --- /dev/null +++ b/test/hotspot/jtreg/runtime/jni/checked/TestCheckedEnsureLocalCapacity.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2017, 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 8193222 + * @summary Check EnsureLocalCapacity doesn't shrink unexpectedly + * @library /test/lib + * @run main/othervm/native TestCheckedEnsureLocalCapacity launch + */ +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class TestCheckedEnsureLocalCapacity { + + static { + System.loadLibrary("TestCheckedEnsureLocalCapacity"); + } + + // Calls EnsureLocalCapacity(capacity) and then creates "copies" number + // of LocalRefs to "o". + // If capacity > copies no warning should ensue (with the bug fixed). + // If copies > capacity + warning-threshold then we still get a warning. + private static native void ensureCapacity(Object o, int capacity, int copies); + + private static int[][] testArgs = { + { 60, 45 }, // good: capacity > copies + { 1, 45 } // bad: copies >> capacity + }; + + private static final String EXCEED_WARNING = + "^WARNING: JNI local refs: \\d++, exceeds capacity:"; + + private static final String WARNING = "^WARNING: "; + + public static void main(String[] args) throws Throwable { + if (args.length == 2) { + ensureCapacity(new Object(), + Integer.parseInt(args[0]), + Integer.parseInt(args[1])); + return; + } + + // No warning + ProcessTools.executeTestJvm("-Xcheck:jni", + "TestCheckedEnsureLocalCapacity", + Integer.toString(testArgs[0][0]), + Integer.toString(testArgs[0][1])). + shouldHaveExitValue(0). + // check no capacity warning + stdoutShouldNotMatch(EXCEED_WARNING). + // check no other warning + stdoutShouldNotMatch(WARNING). + reportDiagnosticSummary(); + + // Warning + ProcessTools.executeTestJvm("-Xcheck:jni", + "TestCheckedEnsureLocalCapacity", + Integer.toString(testArgs[1][0]), + Integer.toString(testArgs[1][1])). + shouldHaveExitValue(0). + // check for capacity warning + stdoutShouldMatch(EXCEED_WARNING). + reportDiagnosticSummary(); + } +} diff --git a/test/hotspot/jtreg/runtime/jni/checked/libTestCheckedEnsureLocalCapacity.c b/test/hotspot/jtreg/runtime/jni/checked/libTestCheckedEnsureLocalCapacity.c new file mode 100644 index 00000000000..08ec8d9455c --- /dev/null +++ b/test/hotspot/jtreg/runtime/jni/checked/libTestCheckedEnsureLocalCapacity.c @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017, 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. + */ + +#include +#include + +void reduceLocalCapacity(JNIEnv* env) { + puts("reduceLocalCapacity: setting to 1"); + (*env)->EnsureLocalCapacity(env,1); +} + +JNIEXPORT void JNICALL +Java_TestCheckedEnsureLocalCapacity_ensureCapacity(JNIEnv *env, + jobject unused, + jobject target, + jint capacity, + jint copies) { + int i; + printf("ensureCapacity: setting to %d\n", capacity); + (*env)->EnsureLocalCapacity(env, capacity); // set high + reduceLocalCapacity(env); // sets low + + printf("ensureCapacity: creating %d LocalRefs\n", copies); + for (i = 0; i < copies; i++) { + target = (*env)->NewLocalRef(env, target); + } + + puts("ensureCapacity: done"); +} From 0fa3f5ebf8acd000a704e7b7ac210f1afb2083af Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Tue, 12 Dec 2017 21:27:06 -0500 Subject: [PATCH 08/31] 8193407: jdk/hs fails Solaris slowdebug test-image build Add a missing '-lc' option for libCNLookUp. Reviewed-by: dholmes, kvn --- make/test/JtregNativeHotspot.gmk | 1 + 1 file changed, 1 insertion(+) diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk index 8cf3b0ed6f3..486401fb4d3 100644 --- a/make/test/JtregNativeHotspot.gmk +++ b/make/test/JtregNativeHotspot.gmk @@ -113,6 +113,7 @@ ifeq ($(TOOLCHAIN_TYPE), solstudio) BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHandshakeTransitionTest := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libHasNoEntryPoint := -lc BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libReturnError := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libCNLookUp := -lc endif ifeq ($(OPENJDK_TARGET_OS), linux) From eb417da9531dcff6d82d5afd9e22fc8833ab1d00 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Fri, 8 Dec 2017 13:04:43 -0800 Subject: [PATCH 09/31] 8193271: ProblemList tools/launcher/TestXcheckJNIWarnings.java Reviewed-by: darcy --- test/jdk/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index a8d5eee330b..a29f5df566c 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -257,6 +257,7 @@ javax/sound/sampled/Mixers/DisabledAssertionCrash.java 7067310 generic-all tools/pack200/CommandLineTests.java 8059906 generic-all tools/launcher/FXLauncherTest.java 8068049 linux-all,macosx-all +tools/launcher/TestXcheckJNIWarnings.java 8190984 solaris-all tools/jimage/JImageExtractTest.java 8170120 generic-all tools/jimage/JImageListTest.java 8170120 generic-all From 276093653ad4797b29d827705d50ecf2f3fb614b Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Tue, 12 Dec 2017 21:46:06 -0500 Subject: [PATCH 10/31] 8190984: tools/launcher/TestXcheckJNIWarnings.java WARNING was found in the output Reviewed-by: dholmes, mchung --- src/java.base/share/native/libjava/System.c | 3 +++ test/jdk/ProblemList.txt | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/native/libjava/System.c b/src/java.base/share/native/libjava/System.c index 07e638862db..9116b8d8265 100644 --- a/src/java.base/share/native/libjava/System.c +++ b/src/java.base/share/native/libjava/System.c @@ -186,6 +186,9 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props) jobject ret = NULL; jstring jVMVal = NULL; + if ((*env)->EnsureLocalCapacity(env, 50) < 0) { + return NULL; + } sprops = GetJavaProperties(env); CHECK_NULL_RETURN(sprops, NULL); diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index a29f5df566c..a8d5eee330b 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -257,7 +257,6 @@ javax/sound/sampled/Mixers/DisabledAssertionCrash.java 7067310 generic-all tools/pack200/CommandLineTests.java 8059906 generic-all tools/launcher/FXLauncherTest.java 8068049 linux-all,macosx-all -tools/launcher/TestXcheckJNIWarnings.java 8190984 solaris-all tools/jimage/JImageExtractTest.java 8170120 generic-all tools/jimage/JImageListTest.java 8170120 generic-all From 16d95cbf9dcc8f7812514e25e5e5002d2fc26a16 Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Wed, 13 Dec 2017 10:21:21 +0100 Subject: [PATCH 11/31] 8192971: LockCompilationTest fails intermittently Remove all unnecessary compilations Reviewed-by: kvn, thartmann --- .../compiler/whitebox/LockCompilationTest.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/test/hotspot/jtreg/compiler/whitebox/LockCompilationTest.java b/test/hotspot/jtreg/compiler/whitebox/LockCompilationTest.java index 077cbf54e5c..594fe3cb9c5 100644 --- a/test/hotspot/jtreg/compiler/whitebox/LockCompilationTest.java +++ b/test/hotspot/jtreg/compiler/whitebox/LockCompilationTest.java @@ -33,6 +33,7 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,*SimpleTestCaseHelper::method * compiler.whitebox.LockCompilationTest */ @@ -46,20 +47,7 @@ public class LockCompilationTest extends CompilerWhiteBoxTest { // This case waits for 5 seconds and verifies that the method hasn't been // compiled during that time. Only do that for one of the test cases. - // Only compile SimpleTestCaseHelper.method and exclude all other to ensure no - // contention on the compile queue causes problems. - String directive = - "[{ match:\"*SimpleTestCaseHelper.method\", Exclude:false}, " + - " { match:\"*.*\", Exclude:true}]"; - if (WHITE_BOX.addCompilerDirective(directive) != 2) { - throw new RuntimeException("Could not add directive"); - } - try { - CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"}); - } finally { - WHITE_BOX.removeCompilerDirective(2); - } - + CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"}); } private LockCompilationTest(TestCase testCase) { From 35417330245f7fb9e531ffe971dc66c22ee6559d Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 13 Dec 2017 07:14:18 -0500 Subject: [PATCH 12/31] 8193053: jvm crash by G1CMBitMapClosure::do_addr We were adding an unloaded mirror to the SATB collection set in remove_handle. Reviewed-by: hseigel, kbarrett --- .../share/classfile/classLoaderData.cpp | 31 +++++++++++++++++-- .../share/classfile/classLoaderData.hpp | 3 +- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp index 06c5d947cd0..865ab45e305 100644 --- a/src/hotspot/share/classfile/classLoaderData.cpp +++ b/src/hotspot/share/classfile/classLoaderData.cpp @@ -574,9 +574,9 @@ void ClassLoaderData::unload() { ls.cr(); } - // In some rare cases items added to this list will not be freed elsewhere. - // To keep it simple, just free everything in it here. - free_deallocate_list(); + // Some items on the _deallocate_list need to free their C heap structures + // if they are not already on the _klasses list. + unload_deallocate_list(); // Clean up global class iterator for compiler static_klass_iterator.adjust_saved_class(this); @@ -755,6 +755,7 @@ OopHandle ClassLoaderData::add_handle(Handle h) { } void ClassLoaderData::remove_handle(OopHandle h) { + assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading"); oop* ptr = h.ptr_raw(); if (ptr != NULL) { assert(_handles.contains(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr)); @@ -799,6 +800,7 @@ void ClassLoaderData::add_to_deallocate_list(Metadata* m) { void ClassLoaderData::free_deallocate_list() { // Don't need lock, at safepoint assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint"); + assert(!is_unloading(), "only called for ClassLoaderData that are not unloading"); if (_deallocate_list == NULL) { return; } @@ -828,6 +830,29 @@ void ClassLoaderData::free_deallocate_list() { } } +// This is distinct from free_deallocate_list. For class loader data that are +// unloading, this frees the C heap memory for constant pools on the list. If there +// were C heap memory allocated for methods, it would free that too. The C heap memory +// for InstanceKlasses on this list is freed in the ClassLoaderData destructor. +void ClassLoaderData::unload_deallocate_list() { + // Don't need lock, at safepoint + assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint"); + assert(is_unloading(), "only called for ClassLoaderData that are unloading"); + if (_deallocate_list == NULL) { + return; + } + // Go backwards because this removes entries that are freed. + for (int i = _deallocate_list->length() - 1; i >= 0; i--) { + Metadata* m = _deallocate_list->at(i); + assert (!m->on_stack(), "wouldn't be unloading if this were so"); + _deallocate_list->remove_at(i); + // Only constant pool entries have C heap memory to free. + if (m->is_constantPool()) { + ((ConstantPool*)m)->release_C_heap_structures(); + } + } +} + // These anonymous class loaders are to contain classes used for JSR292 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) { // Add a new class loader data to the graph. diff --git a/src/hotspot/share/classfile/classLoaderData.hpp b/src/hotspot/share/classfile/classLoaderData.hpp index fc142452165..79d6c63f599 100644 --- a/src/hotspot/share/classfile/classLoaderData.hpp +++ b/src/hotspot/share/classfile/classLoaderData.hpp @@ -307,7 +307,8 @@ class ClassLoaderData : public CHeapObj { void packages_do(void f(PackageEntry*)); // Deallocate free list during class unloading. - void free_deallocate_list(); + void free_deallocate_list(); // for the classes that are not unloaded + void unload_deallocate_list(); // for the classes that are unloaded // Allocate out of this class loader data MetaWord* allocate(size_t size); From 0c05e5a478b1849f9ec5d6c3229ebe8efa7572f7 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Wed, 13 Dec 2017 19:32:48 +0300 Subject: [PATCH 13/31] 8190869: C2: missing strength reduction of Math.pow(x, 2.0D) to x*x Reviewed-by: kvn --- src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp | 13 +++++++++++++ src/hotspot/share/opto/library_call.cpp | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp index 12b38d8c5ef..c0a2ea19e28 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_pow.cpp @@ -765,6 +765,11 @@ ALIGNED_(8) juint _log2_pow[] = 0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL }; +ALIGNED_(8) juint _DOUBLE2[] = +{ + 0x00000000UL, 0x40000000UL +}; + //registers, // input: xmm0, xmm1 // scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 @@ -803,6 +808,7 @@ void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm address HIGHMASK_LOG_X = (address)_HIGHMASK_LOG_X; address HALFMASK = (address)_HALFMASK; address log2 = (address)_log2_pow; + address DOUBLE2 = (address)_DOUBLE2; bind(start); @@ -810,6 +816,13 @@ void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xm movsd(Address(rsp, 8), xmm0); movsd(Address(rsp, 16), xmm1); + // Special case: pow(x, 2.0) => x * x + movdq(tmp1, xmm1); + cmp64(tmp1, ExternalAddress(DOUBLE2)); + jccb(Assembler::notEqual, B1_2); + mulsd(xmm0, xmm0); + jmp(B1_5); + bind(B1_2); pextrw(eax, xmm0, 3); xorpd(xmm2, xmm2); diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index bb4ed6cef8e..98bc277018b 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -1789,10 +1789,19 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) { return StubRoutines::dexp() != NULL ? runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(), "dexp") : runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dexp), "EXP"); - case vmIntrinsics::_dpow: - return StubRoutines::dpow() != NULL ? - runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(), "dpow") : + case vmIntrinsics::_dpow: { + Node* exp = round_double_node(argument(2)); + const TypeD* d = _gvn.type(exp)->isa_double_constant(); + if (d != NULL && d->getd() == 2.0) { + // Special case: pow(x, 2.0) => x * x + Node* base = round_double_node(argument(0)); + set_result(_gvn.transform(new MulDNode(base, base))); + return true; + } + return StubRoutines::dexp() != NULL ? + runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(), "dpow") : runtime_math(OptoRuntime::Math_DD_D_Type(), FN_PTR(SharedRuntime::dpow), "POW"); + } #undef FN_PTR // These intrinsics are not yet correctly implemented From c11f132abe050315c0c5e78321e039df510e32f6 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Wed, 13 Dec 2017 11:59:55 -0800 Subject: [PATCH 14/31] 8191788: add jdk.internal.vm.compiler to --limit-modules if -Djvmci.Compiler=graal is in the command line Skip tests which use --limit-modules when Graal is used as JIT compiler. Reviewed-by: alanb, mchung, dholmes, ccheung, dnsimon --- .hgignore | 2 ++ .../jtreg/runtime/SharedArchiveFile/BootAppendTests.java | 2 +- .../jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java | 2 +- .../runtime/appcds/jigsaw/classpathtests/BootAppendTests.java | 2 +- .../runtime/appcds/jigsaw/classpathtests/ClassPathTests.java | 2 +- .../jigsaw/classpathtests/EmptyClassInBootClassPath.java | 2 +- .../jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java | 2 +- test/jdk/TEST.ROOT | 1 + test/jdk/com/sun/tools/attach/modules/Driver.java | 1 + test/jdk/java/lang/String/concat/WithSecurityManager.java | 3 ++- .../System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java | 1 + test/jdk/java/lang/instrument/TestAgentWithLimitMods.java | 3 ++- .../ManagementFactory/DefaultManagementProviderTest.java | 1 + test/jdk/java/net/SocketOption/OptionsTest.java | 3 ++- test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java | 1 + .../java/nio/channels/DatagramChannel/SocketOptionTests.java | 3 ++- .../nio/channels/ServerSocketChannel/SocketOptionTests.java | 3 ++- .../jdk/java/nio/channels/SocketChannel/SocketOptionTests.java | 3 ++- test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java | 1 + test/jdk/tools/launcher/modules/listmods/ListModsTest.java | 1 + .../modules/showmoduleresolution/ShowModuleResolutionTest.java | 1 + 21 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.hgignore b/.hgignore index 95446e54dcf..35f87bf0e30 100644 --- a/.hgignore +++ b/.hgignore @@ -11,3 +11,5 @@ nbproject/private/ test/nashorn/script/external test/nashorn/lib NashornProfile.txt +.*/JTreport/.* +.*/JTwork/.* diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java index 9cf2534d485..287d3b30ce4 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java @@ -23,7 +23,7 @@ /** * @test - * @requires vm.cds + * @requires vm.cds & !vm.graal.enabled * @summary Testing -Xbootclasspath/a support for CDS * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) * @library /test/lib diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java index 2513d0e5a19..a88eb2fa414 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java @@ -27,7 +27,7 @@ * @summary Test combinations of jigsaw options that affect the use of AppCDS * * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled * @library /test/lib .. * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java index 71392801fda..e35a7182590 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java @@ -25,7 +25,7 @@ /** * @test * @summary AppCDS tests for testing -Xbootclasspath/a - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java index 6f929ab227f..b50cfb6bf74 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java @@ -24,7 +24,7 @@ /** * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled * @library ../.. * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java index a635603473e..63daf117cb1 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java @@ -29,7 +29,7 @@ * 2) app loader will load the class from the jimage by default; * app loader will load the class from the bootclasspath if the * "--limit-modules java.base" option is specified - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java index 434ddfcfae6..6cceed1ae93 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java @@ -24,7 +24,7 @@ /** * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled * @library ../.. * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/jdk/TEST.ROOT b/test/jdk/TEST.ROOT index 2f00dbb7f82..0f089f11145 100644 --- a/test/jdk/TEST.ROOT +++ b/test/jdk/TEST.ROOT @@ -36,6 +36,7 @@ requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI requires.properties= \ sun.arch.data.model \ java.runtime.name \ + vm.graal.enabled \ vm.cds # Minimum jtreg version diff --git a/test/jdk/com/sun/tools/attach/modules/Driver.java b/test/jdk/com/sun/tools/attach/modules/Driver.java index 7323709fcf0..94d37531c55 100644 --- a/test/jdk/com/sun/tools/attach/modules/Driver.java +++ b/test/jdk/com/sun/tools/attach/modules/Driver.java @@ -23,6 +23,7 @@ /** * @test + * @requires !vm.graal.enabled * @modules jdk.attach * @build m/* Agent * @run main/othervm -Djdk.attach.allowAttachSelf m/p.Main jmx javaagent diff --git a/test/jdk/java/lang/String/concat/WithSecurityManager.java b/test/jdk/java/lang/String/concat/WithSecurityManager.java index 2835a3813f4..475cc1938b7 100644 --- a/test/jdk/java/lang/String/concat/WithSecurityManager.java +++ b/test/jdk/java/lang/String/concat/WithSecurityManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -27,6 +27,7 @@ import java.security.Permission; * @test * @summary String concatenation fails with a custom SecurityManager that uses concatenation * @bug 8155090 8158851 + * @requires !vm.graal.enabled * * @compile WithSecurityManager.java * diff --git a/test/jdk/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java b/test/jdk/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java index 998b1fc6759..a9f35d22597 100644 --- a/test/jdk/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java +++ b/test/jdk/java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java @@ -46,6 +46,7 @@ import java.util.ResourceBundle; * throwing NullPointerException. The test uses --limit-module * to force the selection of one or the other. * @author danielfuchs + * @requires !vm.graal.enabled * @build LoggerFinderAPI * @run main/othervm --limit-modules java.base,java.logging * -Djava.util.logging.SimpleFormatter.format=LOG-%4$s:-[%2$s]-%5$s%6$s%n diff --git a/test/jdk/java/lang/instrument/TestAgentWithLimitMods.java b/test/jdk/java/lang/instrument/TestAgentWithLimitMods.java index ddf51b54399..1ca4f3825e5 100644 --- a/test/jdk/java/lang/instrument/TestAgentWithLimitMods.java +++ b/test/jdk/java/lang/instrument/TestAgentWithLimitMods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, 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 @@ -24,6 +24,7 @@ /** * * @test + * @requires !vm.graal.enabled * @summary Tests that the -javaagent option adds the java.instrument into * the module graph * diff --git a/test/jdk/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java b/test/jdk/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java index e9ccd515a88..f09a51e3c0e 100644 --- a/test/jdk/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java +++ b/test/jdk/java/lang/management/ManagementFactory/DefaultManagementProviderTest.java @@ -26,6 +26,7 @@ * @bug 8151099 * @summary Verify platform MXBeans initialized properly with java.management * module only. No other management provider + * @requires !vm.graal.enabled * @modules java.management * @run main/othervm --limit-modules=java.management DefaultManagementProviderTest */ diff --git a/test/jdk/java/net/SocketOption/OptionsTest.java b/test/jdk/java/net/SocketOption/OptionsTest.java index 232873372ee..214c2d920f1 100644 --- a/test/jdk/java/net/SocketOption/OptionsTest.java +++ b/test/jdk/java/net/SocketOption/OptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -24,6 +24,7 @@ /* * @test * @bug 8036979 8072384 8044773 + * @requires !vm.graal.enabled * @run main/othervm -Xcheck:jni OptionsTest * @run main/othervm -Xcheck:jni -Djava.net.preferIPv4Stack=true OptionsTest * @run main/othervm --limit-modules=java.base OptionsTest diff --git a/test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java b/test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java index e07cf66dd61..407811bb494 100644 --- a/test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java +++ b/test/jdk/java/net/SocketOption/UnsupportedOptionsTest.java @@ -32,6 +32,7 @@ import java.util.List; * @bug 8143554 8044773 * @summary Test checks that UnsupportedOperationException for unsupported * SOCKET_OPTIONS is thrown by both getOption() and setOption() methods. + * @requires !vm.graal.enabled * @run main UnsupportedOptionsTest * @run main/othervm --limit-modules=java.base UnsupportedOptionsTest */ diff --git a/test/jdk/java/nio/channels/DatagramChannel/SocketOptionTests.java b/test/jdk/java/nio/channels/DatagramChannel/SocketOptionTests.java index abb8b174979..00a232d9fd2 100644 --- a/test/jdk/java/nio/channels/DatagramChannel/SocketOptionTests.java +++ b/test/jdk/java/nio/channels/DatagramChannel/SocketOptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -24,6 +24,7 @@ /* @test * @bug 4640544 8044773 * @summary Unit test for setOption/getOption/options methods + * @requires !vm.graal.enabled * @run main SocketOptionTests * @run main/othervm --limit-modules=java.base SocketOptionTests */ diff --git a/test/jdk/java/nio/channels/ServerSocketChannel/SocketOptionTests.java b/test/jdk/java/nio/channels/ServerSocketChannel/SocketOptionTests.java index 1687b73f04a..126d669d4c2 100644 --- a/test/jdk/java/nio/channels/ServerSocketChannel/SocketOptionTests.java +++ b/test/jdk/java/nio/channels/ServerSocketChannel/SocketOptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -25,6 +25,7 @@ * @bug 4640544 8044773 * @summary Unit test for ServerSocketChannel setOption/getOption/options * methods. + * @requires !vm.graal.enabled * @run main SocketOptionTests * @run main/othervm --limit-modules=java.base SocketOptionTests */ diff --git a/test/jdk/java/nio/channels/SocketChannel/SocketOptionTests.java b/test/jdk/java/nio/channels/SocketChannel/SocketOptionTests.java index 5e75ad9a93a..38b242bb4d3 100644 --- a/test/jdk/java/nio/channels/SocketChannel/SocketOptionTests.java +++ b/test/jdk/java/nio/channels/SocketChannel/SocketOptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -25,6 +25,7 @@ * @bug 4640544 8044773 * @summary Unit test to check SocketChannel setOption/getOption/options * methods. + * @requires !vm.graal.enabled * @run main SocketOptionTests * @run main/othervm --limit-modules=java.base SocketOptionTests */ diff --git a/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java b/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java index e898837c72e..d697067b1f9 100644 --- a/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java +++ b/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java @@ -23,6 +23,7 @@ /** * @test + * @requires !vm.graal.enabled * @library /lib/testlibrary /test/lib * @modules java.desktop java.logging jdk.compiler * @build LimitModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.* diff --git a/test/jdk/tools/launcher/modules/listmods/ListModsTest.java b/test/jdk/tools/launcher/modules/listmods/ListModsTest.java index 913f17ee8a9..38be89358a8 100644 --- a/test/jdk/tools/launcher/modules/listmods/ListModsTest.java +++ b/test/jdk/tools/launcher/modules/listmods/ListModsTest.java @@ -23,6 +23,7 @@ /** * @test + * @requires !vm.graal.enabled * @library /lib/testlibrary /test/lib * @modules java.se * @build ListModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.* diff --git a/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java b/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java index 0d2a1c4c3ed..d6eaedc693b 100644 --- a/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java +++ b/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java @@ -23,6 +23,7 @@ /** * @test + * @requires !vm.graal.enabled * @modules jdk.jdeps jdk.zipfs * @library /lib/testlibrary * @build ShowModuleResolutionTest jdk.testlibrary.* From f287b874f2435db3cbc48f02361e01c50c28cb19 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 13 Dec 2017 12:28:22 -0800 Subject: [PATCH 15/31] 8193439: Update Graal Reviewed-by: kvn --- .../.mx.graal/suite.py | 6 +- .../core/aarch64/AArch64LIRKindTool.java | 2 +- .../graalvm/compiler/core/common/LIRKind.java | 74 ++++++--- .../core/common/util/CompilationAlarm.java | 14 +- .../compiler/core/sparc/SPARCLIRKindTool.java | 2 +- .../core/test/CooperativePhaseTest.java | 149 ------------------ .../compiler/core/test/CountedLoopTest.java | 2 +- .../graalvm/compiler/debug/Assertions.java | 4 +- .../src/org/graalvm/compiler/graph/Graph.java | 5 + .../AArch64HotSpotForeignCallsProvider.java | 4 + .../aarch64/AArch64HotSpotLIRGenerator.java | 4 +- .../AMD64HotSpotForeignCallsProvider.java | 4 + .../amd64/AMD64HotSpotLIRKindTool.java | 5 +- .../SPARCHotSpotForeignCallsProvider.java | 4 + .../sparc/SPARCHotSpotLIRGenerator.java | 2 +- .../hotspot/test/CRC32CSubstitutionsTest.java | 94 +++++++++++ .../hotspot/test/CheckGraalIntrinsics.java | 7 + .../hotspot/test/JVMCIInfopointErrorTest.java | 8 +- .../hotspot/GraalHotSpotVMConfig.java | 1 + .../compiler/hotspot/HotSpotHostBackend.java | 4 +- .../hotspot/HotSpotReferenceMapBuilder.java | 9 +- .../meta/HotSpotGraphBuilderPlugins.java | 10 ++ .../replacements/CRC32CSubstitutions.java | 64 ++++++++ .../jtt/bytecode/BC_idiv_overflow.java | 47 ++++++ .../jtt/bytecode/BC_ldiv_overflow.java | 47 ++++++ .../org/graalvm/compiler/nodes/IfNode.java | 36 ++++- .../nodes/calc/IntegerDivRemNode.java | 3 +- .../common/ProfileCompiledMethodsPhase.java | 2 +- .../compiler/printer/GraphPrinter.java | 17 +- .../StandardGraphBuilderPlugins.java | 18 +++ .../replacements/classfile/Classfile.java | 8 +- .../virtual/phases/ea/GraphEffectList.java | 10 +- 32 files changed, 452 insertions(+), 214 deletions(-) delete mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java create mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java create mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32CSubstitutions.java create mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_idiv_overflow.java create mode 100644 src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_ldiv_overflow.java diff --git a/src/jdk.internal.vm.compiler/.mx.graal/suite.py b/src/jdk.internal.vm.compiler/.mx.graal/suite.py index e8df78c52c0..b1dc74b7d5f 100644 --- a/src/jdk.internal.vm.compiler/.mx.graal/suite.py +++ b/src/jdk.internal.vm.compiler/.mx.graal/suite.py @@ -107,7 +107,6 @@ suite = { "subDir" : "share/classes", "dependencies" : ["JVMCI_SERVICES", "JVMCI_API", "org.graalvm.util"], "sourceDirs" : ["src"], - "dependencies" : ["org.graalvm.util"], "checkstyle" : "org.graalvm.compiler.graph", "uses" : ["org.graalvm.compiler.options.OptionDescriptors"], "javaCompliance" : "1.8", @@ -148,6 +147,7 @@ suite = { "dependencies" : [ "JVMCI_API", "org.graalvm.compiler.serviceprovider", + "org.graalvm.graphio", "org.graalvm.compiler.options" ], "annotationProcessors" : ["GRAAL_OPTIONS_PROCESSOR"], @@ -291,7 +291,6 @@ suite = { "subDir" : "share/classes", "sourceDirs" : ["src"], "dependencies" : [ - "org.graalvm.compiler.core.aarch64", "org.graalvm.compiler.hotspot", "org.graalvm.compiler.replacements.aarch64", ], @@ -435,6 +434,7 @@ suite = { "mx:JUNIT", "org.graalvm.compiler.api.test", "org.graalvm.compiler.graph", + "org.graalvm.graphio", ], "annotationProcessors" : ["GRAAL_NODEINFO_PROCESSOR"], "javaCompliance" : "1.8", @@ -945,6 +945,7 @@ suite = { "dependencies" : [ "org.graalvm.compiler.lir.jtt", "org.graalvm.compiler.lir.amd64", + "org.graalvm.compiler.core.amd64", "JVMCI_HOTSPOT" ], "checkstyle" : "org.graalvm.compiler.graph", @@ -1019,7 +1020,6 @@ suite = { "subDir" : "share/classes", "sourceDirs" : ["src"], "dependencies" : [ - "org.graalvm.graphio", "org.graalvm.compiler.core", "org.graalvm.compiler.java", ], diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java index 71f55db33c5..5616a5e36ea 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRKindTool.java @@ -68,7 +68,7 @@ public class AArch64LIRKindTool implements LIRKindTool { @Override public LIRKind getNarrowOopKind() { - return LIRKind.reference(AArch64Kind.DWORD); + return LIRKind.compressedReference(AArch64Kind.DWORD); } @Override diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java index 688a328a006..cb0c4009fb5 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/LIRKind.java @@ -33,8 +33,9 @@ import jdk.vm.ci.meta.ValueKind; /** * Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the - * low level representation of the value, and a {@link #referenceMask} that describes the location - * of object references in the value, and optionally a {@link #derivedReferenceBase}. + * low level representation of the value, a {@link #referenceMask} that describes the location of + * object references in the value, a {@link #referenceCompressionMask} that indicates which of these + * references are compressed references, and for derived references a {@link #derivedReferenceBase}. * *

Constructing {@link LIRKind} instances

* @@ -52,7 +53,7 @@ import jdk.vm.ci.meta.ValueKind; * compare-and-swap. For convert operations, {@link LIRKind#combine} should be used. *

* If it is known that the result will be a reference (e.g. pointer arithmetic where the end result - * is a valid oop), {@link LIRKind#reference} should be used. + * is a valid oop), {@link #reference} or {@link LIRKind#compressedReference} should be used. *

* If it is known that the result will neither be a reference nor be derived from a reference, * {@link LIRKind#value} can be used. If the operation producing this value has inputs, this is very @@ -64,19 +65,28 @@ import jdk.vm.ci.meta.ValueKind; */ public final class LIRKind extends ValueKind { + /** + * The location of object references in the value. If the value is a vector type, each bit + * represents one component of the vector. + */ private final int referenceMask; + /** Mask with 1-bits indicating which references in {@link #referenceMask} are compressed. */ + private final int referenceCompressionMask; + private AllocatableValue derivedReferenceBase; private static final int UNKNOWN_REFERENCE = -1; public static final LIRKind Illegal = unknownReference(ValueKind.Illegal.getPlatformKind()); - private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue derivedReferenceBase) { + private LIRKind(PlatformKind platformKind, int referenceMask, int referenceCompressionMask, AllocatableValue derivedReferenceBase) { super(platformKind); this.referenceMask = referenceMask; + this.referenceCompressionMask = referenceCompressionMask; this.derivedReferenceBase = derivedReferenceBase; + assert this.referenceCompressionMask == 0 || this.referenceMask == this.referenceCompressionMask : "mixing compressed and uncompressed references is untested"; assert derivedReferenceBase == null || !derivedReferenceBase.getValueKind(LIRKind.class).isDerivedReference() : "derived reference can't have another derived reference as base"; } @@ -86,15 +96,23 @@ public final class LIRKind extends ValueKind { * reference. Otherwise, {@link #combine(Value...)} should be used instead. */ public static LIRKind value(PlatformKind platformKind) { - return new LIRKind(platformKind, 0, null); + return new LIRKind(platformKind, 0, 0, null); } /** - * Create a {@link LIRKind} of type {@code platformKind} that contains a single tracked oop - * reference. + * Create a {@link LIRKind} of type {@code platformKind} that contains a single, tracked, + * uncompressed oop reference. */ public static LIRKind reference(PlatformKind platformKind) { - return derivedReference(platformKind, null); + return derivedReference(platformKind, null, false); + } + + /** + * Create a {@link LIRKind} of type {@code platformKind} that contains a single, tracked, + * compressed oop reference. + */ + public static LIRKind compressedReference(PlatformKind platformKind) { + return derivedReference(platformKind, null, true); } /** @@ -112,10 +130,12 @@ public final class LIRKind extends ValueKind { /** * Create a {@link LIRKind} of type {@code platformKind} that contains a derived reference. */ - public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base) { + public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base, boolean compressed) { int length = platformKind.getVectorLength(); assert 0 < length && length < 32 : "vector of " + length + " references not supported"; - return new LIRKind(platformKind, (1 << length) - 1, base); + int referenceMask = (1 << length) - 1; + int referenceCompressionMask = (compressed ? referenceMask : 0); + return new LIRKind(platformKind, referenceMask, referenceCompressionMask, base); } /** @@ -125,7 +145,7 @@ public final class LIRKind extends ValueKind { * used instead to automatically propagate this information. */ public static LIRKind unknownReference(PlatformKind platformKind) { - return new LIRKind(platformKind, UNKNOWN_REFERENCE, null); + return new LIRKind(platformKind, UNKNOWN_REFERENCE, UNKNOWN_REFERENCE, null); } /** @@ -139,9 +159,9 @@ public final class LIRKind extends ValueKind { return makeUnknownReference(); } else { if (isValue()) { - return derivedReference(getPlatformKind(), base); + return derivedReference(getPlatformKind(), base, false); } else { - return new LIRKind(getPlatformKind(), referenceMask, base); + return new LIRKind(getPlatformKind(), referenceMask, referenceCompressionMask, base); } } } @@ -240,7 +260,7 @@ public final class LIRKind extends ValueKind { return mergeKind; } /* {@code mergeKind} is a reference. */ - if (mergeKind.referenceMask != inputKind.referenceMask) { + if (mergeKind.referenceMask != inputKind.referenceMask || mergeKind.referenceCompressionMask != inputKind.referenceCompressionMask) { /* * Reference masks do not match so the result can only be an unknown reference. */ @@ -284,9 +304,11 @@ public final class LIRKind extends ValueKind { } else { // reference type int newLength = Math.min(32, newPlatformKind.getVectorLength()); - int newReferenceMask = referenceMask & (0xFFFFFFFF >>> (32 - newLength)); + int lengthMask = 0xFFFFFFFF >>> (32 - newLength); + int newReferenceMask = referenceMask & lengthMask; + int newReferenceCompressionMask = referenceCompressionMask & lengthMask; assert newReferenceMask != UNKNOWN_REFERENCE; - return new LIRKind(newPlatformKind, newReferenceMask, derivedReferenceBase); + return new LIRKind(newPlatformKind, newReferenceMask, newReferenceCompressionMask, derivedReferenceBase); } } @@ -308,12 +330,14 @@ public final class LIRKind extends ValueKind { // repeat reference mask to fill new kind int newReferenceMask = 0; + int newReferenceCompressionMask = 0; for (int i = 0; i < newLength; i += getPlatformKind().getVectorLength()) { newReferenceMask |= referenceMask << i; + newReferenceCompressionMask |= referenceCompressionMask << i; } assert newReferenceMask != UNKNOWN_REFERENCE; - return new LIRKind(newPlatformKind, newReferenceMask, derivedReferenceBase); + return new LIRKind(newPlatformKind, newReferenceMask, newReferenceCompressionMask, derivedReferenceBase); } } @@ -322,7 +346,7 @@ public final class LIRKind extends ValueKind { * {@link LIRKind#unknownReference}. */ public LIRKind makeUnknownReference() { - return new LIRKind(getPlatformKind(), UNKNOWN_REFERENCE, null); + return new LIRKind(getPlatformKind(), UNKNOWN_REFERENCE, UNKNOWN_REFERENCE, null); } /** @@ -384,6 +408,17 @@ public final class LIRKind extends ValueKind { return !isUnknownReference() && (referenceMask & 1 << idx) != 0; } + /** + * Check whether the {@code idx}th part of this value is a compressed reference. + * + * @param idx The index into the vector if this is a vector kind. Must be 0 if this is a scalar + * kind. + */ + public boolean isCompressedReference(int idx) { + assert 0 <= idx && idx < getPlatformKind().getVectorLength() : "invalid index " + idx + " in " + this; + return !isUnknownReference() && (referenceCompressionMask & (1 << idx)) != 0; + } + /** * Check whether this kind is a value type that doesn't need to be tracked at safepoints. */ @@ -432,6 +467,7 @@ public final class LIRKind extends ValueKind { result = prime * result + ((getPlatformKind() == null) ? 0 : getPlatformKind().hashCode()); result = prime * result + ((getDerivedReferenceBase() == null) ? 0 : getDerivedReferenceBase().hashCode()); result = prime * result + referenceMask; + result = prime * result + referenceCompressionMask; return result; } @@ -445,7 +481,7 @@ public final class LIRKind extends ValueKind { } LIRKind other = (LIRKind) obj; - if (getPlatformKind() != other.getPlatformKind() || referenceMask != other.referenceMask) { + if (getPlatformKind() != other.getPlatformKind() || referenceMask != other.referenceMask || referenceCompressionMask != other.referenceCompressionMask) { return false; } if (isDerivedReference()) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/CompilationAlarm.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/CompilationAlarm.java index b0dc7fd691d..426bb8d055d 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/CompilationAlarm.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/CompilationAlarm.java @@ -22,6 +22,7 @@ */ package org.graalvm.compiler.core.common.util; +import org.graalvm.compiler.debug.Assertions; import org.graalvm.compiler.options.Option; import org.graalvm.compiler.options.OptionKey; import org.graalvm.compiler.options.OptionType; @@ -34,7 +35,8 @@ public final class CompilationAlarm implements AutoCloseable { public static class Options { // @formatter:off - @Option(help = "Time limit in seconds before a compilation expires (0 to disable the limit).", type = OptionType.Debug) + @Option(help = "Time limit in seconds before a compilation expires (0 to disable the limit). " + + "The compilation alarm will be implicitly disabled if assertions are enabled.", type = OptionType.Debug) public static final OptionKey CompilationExpirationPeriod = new OptionKey<>(300); // @formatter:on } @@ -85,15 +87,16 @@ public final class CompilationAlarm implements AutoCloseable { /** * Starts an alarm for setting a time limit on a compilation if there isn't already an active - * alarm and {@link CompilationAlarm.Options#CompilationExpirationPeriod}{@code > 0}. The - * returned value can be used in a try-with-resource statement to disable the alarm once the - * compilation is finished. + * alarm, if assertions are disabled and + * {@link CompilationAlarm.Options#CompilationExpirationPeriod}{@code > 0}. The returned value + * can be used in a try-with-resource statement to disable the alarm once the compilation is + * finished. * * @return a {@link CompilationAlarm} if there was no current alarm for the calling thread * before this call otherwise {@code null} */ public static CompilationAlarm trackCompilationPeriod(OptionValues options) { - int period = Options.CompilationExpirationPeriod.getValue(options); + int period = Assertions.assertionsEnabled() ? 0 : Options.CompilationExpirationPeriod.getValue(options); if (period > 0) { CompilationAlarm current = currentAlarm.get(); if (current == null) { @@ -105,4 +108,5 @@ public final class CompilationAlarm implements AutoCloseable { } return null; } + } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRKindTool.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRKindTool.java index d24c4215f48..e772b2282d3 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRKindTool.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.sparc/src/org/graalvm/compiler/core/sparc/SPARCLIRKindTool.java @@ -68,7 +68,7 @@ public class SPARCLIRKindTool implements LIRKindTool { @Override public LIRKind getNarrowOopKind() { - return LIRKind.reference(SPARCKind.WORD); + return LIRKind.compressedReference(SPARCKind.WORD); } @Override diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java deleted file mode 100644 index 5a8f6418b37..00000000000 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CooperativePhaseTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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. - */ -package org.graalvm.compiler.core.test; - -import static org.graalvm.compiler.core.common.util.CompilationAlarm.Options.CompilationExpirationPeriod; - -import org.graalvm.compiler.core.common.RetryableBailoutException; -import org.graalvm.compiler.core.common.util.CompilationAlarm; -import org.graalvm.compiler.debug.GraalError; -import org.graalvm.compiler.nodes.StructuredGraph; -import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions; -import org.graalvm.compiler.options.OptionValues; -import org.graalvm.compiler.phases.Phase; -import org.junit.Test; - -public class CooperativePhaseTest extends GraalCompilerTest { - - public static void snippet() { - // dummy snippet - } - - private static class CooperativePhase extends Phase { - - @Override - protected void run(StructuredGraph graph) { - CompilationAlarm compilationAlarm = CompilationAlarm.current(); - while (true) { - sleep(200); - if (compilationAlarm.hasExpired()) { - return; - } - } - } - - } - - private static class UnCooperativePhase extends Phase { - - @Override - protected void run(StructuredGraph graph) { - CompilationAlarm compilationAlarm = CompilationAlarm.current(); - while (true) { - sleep(200); - if (compilationAlarm.hasExpired()) { - throw new RetryableBailoutException("Expiring..."); - } - } - } - - } - - private static class PartiallyCooperativePhase extends Phase { - - @Override - protected void run(StructuredGraph graph) { - CompilationAlarm compilationAlarm = CompilationAlarm.current(); - for (int i = 0; i < 10; i++) { - sleep(200); - if (compilationAlarm.hasExpired()) { - throw new RuntimeException("Phase must not exit in the timeout path"); - } - } - } - } - - private static class CooperativePhaseWithoutAlarm extends Phase { - - @Override - protected void run(StructuredGraph graph) { - CompilationAlarm compilationAlarm = CompilationAlarm.current(); - if (compilationAlarm.hasExpired()) { - throw new RuntimeException("Phase must not exit in the timeout path"); - } - } - } - - private static void sleep(long millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException e) { - GraalError.shouldNotReachHere(e.getCause()); - } - } - - @Test(timeout = 60_000) - @SuppressWarnings("try") - public void test01() { - initializeForTimeout(); - OptionValues initialOptions = getInitialOptions(); - OptionValues options = new OptionValues(initialOptions, CompilationExpirationPeriod, 1/* sec */); - try (CompilationAlarm c1 = CompilationAlarm.trackCompilationPeriod(options)) { - StructuredGraph g = parseEager("snippet", AllowAssumptions.NO, options); - new CooperativePhase().apply(g); - } - } - - @Test(expected = RetryableBailoutException.class, timeout = 60_000) - @SuppressWarnings("try") - public void test02() { - initializeForTimeout(); - OptionValues initialOptions = getInitialOptions(); - OptionValues options = new OptionValues(initialOptions, CompilationExpirationPeriod, 1/* sec */); - try (CompilationAlarm c1 = CompilationAlarm.trackCompilationPeriod(options)) { - StructuredGraph g = parseEager("snippet", AllowAssumptions.NO, options); - new UnCooperativePhase().apply(g); - } - } - - @Test(timeout = 60_000) - @SuppressWarnings("try") - public void test03() { - initializeForTimeout(); - // 0 disables alarm utility - OptionValues initialOptions = getInitialOptions(); - OptionValues options = new OptionValues(initialOptions, CompilationExpirationPeriod, 0); - try (CompilationAlarm c1 = CompilationAlarm.trackCompilationPeriod(options)) { - StructuredGraph g = parseEager("snippet", AllowAssumptions.NO, options); - new PartiallyCooperativePhase().apply(g); - } - } - - @Test(timeout = 60_000) - @SuppressWarnings("try") - public void test04() { - initializeForTimeout(); - StructuredGraph g = parseEager("snippet", AllowAssumptions.NO); - new CooperativePhaseWithoutAlarm().apply(g); - } -} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java index 877e98aae84..31ceb066d07 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CountedLoopTest.java @@ -264,7 +264,7 @@ public class CountedLoopTest extends GraalCompilerTest { } @Override - protected boolean checkMidTierGraph(StructuredGraph graph) { + protected boolean checkHighTierGraph(StructuredGraph graph) { LoopsData loops = new LoopsData(graph); loops.detectedCountedLoops(); for (IVPropertyNode node : graph.getNodes().filter(IVPropertyNode.class)) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/Assertions.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/Assertions.java index c4acd5ff2a8..7e9afb0f2fe 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/Assertions.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/Assertions.java @@ -54,8 +54,8 @@ public class Assertions { // @formatter:off public static class Options { - @Option(help = "Enable expensive assertions. (Require normal assertions enabled)", type = OptionType.Debug) - public static final OptionKey DetailedAsserts = new OptionKey<>(true); + @Option(help = "Enable expensive assertions if normal assertions (i.e. -ea or -esa) are enabled.", type = OptionType.Debug) + public static final OptionKey DetailedAsserts = new OptionKey<>(false); } // @formatter:on diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java index 092a84a3aff..ed07cb925db 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Graph.java @@ -472,6 +472,11 @@ public class Graph { } } + public T addWithoutUniqueWithInputs(T node) { + addInputs(node); + return addHelper(node); + } + private final class AddInputsFilter extends Node.EdgeVisitor { @Override diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java index 054fb34bda9..aff7f0ee6fb 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotForeignCallsProvider.java @@ -30,6 +30,7 @@ import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRES import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS; import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF; import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32; +import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C; import static org.graalvm.word.LocationIdentity.any; import org.graalvm.compiler.core.common.LIRKind; @@ -79,6 +80,9 @@ public class AArch64HotSpotForeignCallsProvider extends HotSpotHostForeignCallsP if (config.useCRC32Intrinsics) { registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any()); } + if (config.useCRC32CIntrinsics) { + registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, any()); + } super.initialize(providers, options); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java index 2ed6e3408c0..3e9d19ae1a4 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64HotSpotLIRGenerator.java @@ -30,8 +30,8 @@ import java.util.function.Function; import org.graalvm.compiler.asm.Label; import org.graalvm.compiler.asm.aarch64.AArch64Address.AddressingMode; -import org.graalvm.compiler.asm.aarch64.AArch64Assembler.PrefetchMode; import org.graalvm.compiler.asm.aarch64.AArch64Assembler.ConditionFlag; +import org.graalvm.compiler.asm.aarch64.AArch64Assembler.PrefetchMode; import org.graalvm.compiler.core.aarch64.AArch64ArithmeticLIRGenerator; import org.graalvm.compiler.core.aarch64.AArch64LIRGenerator; import org.graalvm.compiler.core.aarch64.AArch64LIRKindTool; @@ -202,7 +202,7 @@ public class AArch64HotSpotLIRGenerator extends AArch64LIRGenerator implements H assert inputKind.getPlatformKind() == AArch64Kind.QWORD; if (inputKind.isReference(0)) { // oop - Variable result = newVariable(LIRKind.reference(AArch64Kind.DWORD)); + Variable result = newVariable(LIRKind.compressedReference(AArch64Kind.DWORD)); append(new AArch64HotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); return result; } else { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java index e92e17485dc..d1caa3b8d0e 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java @@ -33,6 +33,7 @@ import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEff import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF; import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP; import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32; +import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C; import static org.graalvm.word.LocationIdentity.any; import org.graalvm.compiler.core.common.LIRKind; @@ -99,6 +100,9 @@ public class AMD64HotSpotForeignCallsProvider extends HotSpotHostForeignCallsPro // This stub does callee saving registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any()); } + if (config.useCRC32CIntrinsics) { + registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any()); + } super.initialize(providers, options); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRKindTool.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRKindTool.java index 095a2a2e056..403ffa09eb2 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRKindTool.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64HotSpotLIRKindTool.java @@ -22,14 +22,15 @@ */ package org.graalvm.compiler.hotspot.amd64; -import jdk.vm.ci.amd64.AMD64Kind; import org.graalvm.compiler.core.amd64.AMD64LIRKindTool; import org.graalvm.compiler.core.common.LIRKind; +import jdk.vm.ci.amd64.AMD64Kind; + public class AMD64HotSpotLIRKindTool extends AMD64LIRKindTool { @Override public LIRKind getNarrowOopKind() { - return LIRKind.reference(AMD64Kind.DWORD); + return LIRKind.compressedReference(AMD64Kind.DWORD); } @Override diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java index 795119fe9ab..a82a1f62912 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java @@ -34,6 +34,7 @@ import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.JUMP_ADDRES import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.RegisterEffect.PRESERVES_REGISTERS; import static org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage.Transition.LEAF_NOFP; import static org.graalvm.compiler.hotspot.replacements.CRC32Substitutions.UPDATE_BYTES_CRC32; +import static org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions.UPDATE_BYTES_CRC32C; import static org.graalvm.word.LocationIdentity.any; import org.graalvm.compiler.core.common.LIRKind; @@ -87,6 +88,9 @@ public class SPARCHotSpotForeignCallsProvider extends HotSpotHostForeignCallsPro // This stub does callee saving registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any()); } + if (config.useCRC32CIntrinsics) { + registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any()); + } super.initialize(providers, options); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java index 793935718a5..7665a7e95a0 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.sparc/src/org/graalvm/compiler/hotspot/sparc/SPARCHotSpotLIRGenerator.java @@ -307,7 +307,7 @@ public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSp assert inputKind.getPlatformKind() == XWORD : inputKind; if (inputKind.isReference(0)) { // oop - Variable result = newVariable(LIRKind.reference(WORD)); + Variable result = newVariable(LIRKind.compressedReference(WORD)); append(new SPARCHotSpotMove.CompressPointer(result, asAllocatable(pointer), getProviders().getRegisters().getHeapBaseRegister().asValue(), encoding, nonNull)); return result; } else { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java new file mode 100644 index 00000000000..7d333e52141 --- /dev/null +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CRC32CSubstitutionsTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2007, 2017, 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. + */ +package org.graalvm.compiler.hotspot.test; + +import java.io.DataInputStream; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.zip.Checksum; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + +import org.graalvm.compiler.test.GraalTest; +import org.graalvm.compiler.core.test.GraalCompilerTest; + +import org.junit.Test; + +import static org.junit.Assume.assumeFalse; + +/** + * Tests compiled calls to {@link java.util.zip.CRC32C}. + */ +@SuppressWarnings("javadoc") +public class CRC32CSubstitutionsTest extends GraalCompilerTest { + + public static long updateBytes(byte[] input, int offset, int end) throws Throwable { + Class crcClass = Class.forName("java.util.zip.CRC32C"); + MethodHandle newMH = MethodHandles.publicLookup().findConstructor(crcClass, MethodType.methodType(void.class)); + Checksum crc = (Checksum) newMH.invoke(); + crc.update(input, offset, end); + return crc.getValue(); + } + + @Test + public void test1() throws Throwable { + assumeFalse(GraalTest.Java8OrEarlier); + String classfileName = CRC32CSubstitutionsTest.class.getSimpleName().replace('.', '/') + ".class"; + InputStream s = CRC32CSubstitutionsTest.class.getResourceAsStream(classfileName); + byte[] buf = new byte[s.available()]; + new DataInputStream(s).readFully(buf); + int end = buf.length; + for (int offset = 0; offset < buf.length; offset++) { + test("updateBytes", buf, offset, end); + } + } + + public static long updateByteBuffer(ByteBuffer buffer) throws Throwable { + Class crcClass = Class.forName("java.util.zip.CRC32C"); + MethodHandle newMH = MethodHandles.publicLookup().findConstructor(crcClass, MethodType.methodType(void.class)); + MethodHandle updateMH = MethodHandles.publicLookup().findVirtual(crcClass, "update", MethodType.methodType(void.class, ByteBuffer.class)); + Checksum crc = (Checksum) newMH.invoke(); + buffer.rewind(); + updateMH.invokeExact(crc, buffer); // Checksum.update(ByteBuffer) is also available since 9 + return crc.getValue(); + } + + @Test + public void test2() throws Throwable { + assumeFalse(GraalTest.Java8OrEarlier); + String classfileName = CRC32CSubstitutionsTest.class.getSimpleName().replace('.', '/') + ".class"; + InputStream s = CRC32CSubstitutionsTest.class.getResourceAsStream(classfileName); + byte[] buf = new byte[s.available()]; + new DataInputStream(s).readFully(buf); + + ByteBuffer directBuf = ByteBuffer.allocateDirect(buf.length); + directBuf.put(buf); + ByteBuffer heapBuf = ByteBuffer.wrap(buf); + + test("updateByteBuffer", directBuf); + test("updateByteBuffer", heapBuf); + } + +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java index 8802c18dc3f..e076a01cf3f 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java @@ -466,6 +466,13 @@ public class CheckGraalIntrinsics extends GraalTest { } } + // CRC32C intrinsics + if (!config.useCRC32CIntrinsics) { + add(IGNORE, + "java/util/zip/CRC32C.updateBytes(I[BII)I", + "java/util/zip/CRC32C.updateDirectByteBuffer(IJII)I"); + } + // AES intrinsics if (!config.useAESIntrinsics) { if (isJDK9OrHigher()) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java index d0ad9c8c978..17aec82b3d5 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/JVMCIInfopointErrorTest.java @@ -33,9 +33,9 @@ import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.core.common.LIRKind; import org.graalvm.compiler.core.common.type.StampFactory; import org.graalvm.compiler.core.test.GraalCompilerTest; -import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.DebugContext.Scope; +import org.graalvm.compiler.debug.DebugHandlersFactory; import org.graalvm.compiler.graph.NodeClass; import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder; import org.graalvm.compiler.lir.FullInfopointOp; @@ -150,7 +150,7 @@ public class JVMCIInfopointErrorTest extends GraalCompilerTest { codeCache.addCode(method, compiledCode, null, null); } - @Test(expected = JVMCIError.class) + @Test(expected = Error.class) public void testInvalidShortOop() { test((tool, state, safepoint) -> { PlatformKind kind = tool.target().arch.getPlatformKind(JavaKind.Short); @@ -163,14 +163,14 @@ public class JVMCIInfopointErrorTest extends GraalCompilerTest { }); } - @Test(expected = JVMCIError.class) + @Test(expected = Error.class) public void testInvalidShortDerivedOop() { test((tool, state, safepoint) -> { Variable baseOop = tool.newVariable(LIRKind.fromJavaKind(tool.target().arch, JavaKind.Object)); tool.append(new ValueDef(baseOop)); PlatformKind kind = tool.target().arch.getPlatformKind(JavaKind.Short); - LIRKind lirKind = LIRKind.derivedReference(kind, baseOop); + LIRKind lirKind = LIRKind.derivedReference(kind, baseOop, false); Variable var = tool.newVariable(lirKind); tool.append(new ValueDef(var)); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java index 97c0c281bc4..cad06750b47 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java @@ -165,6 +165,7 @@ public class GraalHotSpotVMConfig extends HotSpotVMConfigAccess { public final boolean usePopCountInstruction = getFlag("UsePopCountInstruction", Boolean.class); public final boolean useAESIntrinsics = getFlag("UseAESIntrinsics", Boolean.class); public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class); + public final boolean useCRC32CIntrinsics = isJDK8 ? false : getFlag("UseCRC32CIntrinsics", Boolean.class); public final boolean threadLocalHandshakes = getFlag("ThreadLocalHandshakes", Boolean.class, false); private final boolean useMultiplyToLenIntrinsic = getFlag("UseMultiplyToLenIntrinsic", Boolean.class); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java index 968e81506ad..3b2c0b23c40 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotHostBackend.java @@ -45,6 +45,7 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.common.InitTimer; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; +import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.runtime.JVMCICompiler; @@ -142,7 +143,8 @@ public abstract class HotSpotHostBackend extends HotSpotBackend { @Override public ReferenceMapBuilder newReferenceMapBuilder(int totalFrameSize) { - return new HotSpotReferenceMapBuilder(totalFrameSize, config.maxOopMapStackOffset); + int uncompressedReferenceSize = getTarget().arch.getPlatformKind(JavaKind.Object).getSizeInBytes(); + return new HotSpotReferenceMapBuilder(totalFrameSize, config.maxOopMapStackOffset, uncompressedReferenceSize); } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReferenceMapBuilder.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReferenceMapBuilder.java index 97fc0fd01ed..364d12e9a1b 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReferenceMapBuilder.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotReferenceMapBuilder.java @@ -22,15 +22,15 @@ */ package org.graalvm.compiler.hotspot; -import static org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant; import static jdk.vm.ci.code.ValueUtil.asRegister; import static jdk.vm.ci.code.ValueUtil.asStackSlot; import static jdk.vm.ci.code.ValueUtil.isRegister; +import static org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant; import java.util.ArrayList; -import org.graalvm.compiler.core.common.PermanentBailoutException; import org.graalvm.compiler.core.common.LIRKind; +import org.graalvm.compiler.core.common.PermanentBailoutException; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.lir.LIRFrameState; import org.graalvm.compiler.lir.Variable; @@ -52,8 +52,10 @@ public final class HotSpotReferenceMapBuilder extends ReferenceMapBuilder { private final int totalFrameSize; private final int maxOopMapStackOffset; + private final int uncompressedReferenceSize; - public HotSpotReferenceMapBuilder(int totalFrameSize, int maxOopMapStackOffset) { + public HotSpotReferenceMapBuilder(int totalFrameSize, int maxOopMapStackOffset, int uncompressedReferenceSize) { + this.uncompressedReferenceSize = uncompressedReferenceSize; this.objectValues = new ArrayList<>(); this.objectCount = 0; this.maxOopMapStackOffset = maxOopMapStackOffset; @@ -116,6 +118,7 @@ public final class HotSpotReferenceMapBuilder extends ReferenceMapBuilder { for (int i = 0; i < kind.getPlatformKind().getVectorLength(); i++) { if (kind.isReference(i)) { + assert kind.isCompressedReference(i) ? (bytes < uncompressedReferenceSize) : (bytes == uncompressedReferenceSize); objects[idx] = toLocation(obj, i * bytes); derivedBase[idx] = base; sizeInBytes[idx] = bytes; diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java index 84dcaad7b8f..2861fd7610f 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java @@ -46,6 +46,7 @@ import org.graalvm.compiler.hotspot.nodes.CurrentJavaThreadNode; import org.graalvm.compiler.hotspot.replacements.AESCryptSubstitutions; import org.graalvm.compiler.hotspot.replacements.BigIntegerSubstitutions; import org.graalvm.compiler.hotspot.replacements.CRC32Substitutions; +import org.graalvm.compiler.hotspot.replacements.CRC32CSubstitutions; import org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode; import org.graalvm.compiler.hotspot.replacements.CipherBlockChainingSubstitutions; import org.graalvm.compiler.hotspot.replacements.ClassGetHubNode; @@ -165,6 +166,7 @@ public class HotSpotGraphBuilderPlugins { registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider); registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider); registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider); + registerCRC32CPlugins(invocationPlugins, config, replacementBytecodeProvider); registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider); registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider); registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider); @@ -530,4 +532,12 @@ public class HotSpotGraphBuilderPlugins { } } } + + private static void registerCRC32CPlugins(InvocationPlugins plugins, GraalHotSpotVMConfig config, BytecodeProvider bytecodeProvider) { + if (config.useCRC32CIntrinsics) { + Registration r = new Registration(plugins, "java.util.zip.CRC32C", bytecodeProvider); + r.registerMethodSubstitution(CRC32CSubstitutions.class, "updateBytes", int.class, byte[].class, int.class, int.class); + r.registerMethodSubstitution(CRC32CSubstitutions.class, "updateDirectByteBuffer", int.class, long.class, int.class, int.class); + } + } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32CSubstitutions.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32CSubstitutions.java new file mode 100644 index 00000000000..3c872a724c8 --- /dev/null +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/CRC32CSubstitutions.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2012, 2017, 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. + */ +package org.graalvm.compiler.hotspot.replacements; + +import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayBaseOffset; + +import org.graalvm.compiler.api.replacements.ClassSubstitution; +import org.graalvm.compiler.api.replacements.MethodSubstitution; +import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor; +import org.graalvm.compiler.graph.Node.ConstantNodeParameter; +import org.graalvm.compiler.graph.Node.NodeIntrinsic; +import org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode; +import org.graalvm.compiler.nodes.extended.ForeignCallNode; +import org.graalvm.compiler.word.Word; +import org.graalvm.word.WordBase; +import org.graalvm.word.WordFactory; + +import jdk.vm.ci.meta.JavaKind; + +// JaCoCo Exclude + +/** + * Substitutions for java.util.zip.CRC32C. + */ +@ClassSubstitution(className = "java.util.zip.CRC32C", optional = true) +public class CRC32CSubstitutions { + + @MethodSubstitution + static int updateBytes(int crc, byte[] b, int off, int end) { + Word bufAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(b, arrayBaseOffset(JavaKind.Byte) + off)); + return updateBytesCRC32(UPDATE_BYTES_CRC32C, crc, bufAddr, end - off); + } + + @MethodSubstitution + static int updateDirectByteBuffer(int crc, long addr, int off, int end) { + WordBase bufAddr = WordFactory.unsigned(addr).add(off); + return updateBytesCRC32(UPDATE_BYTES_CRC32C, crc, bufAddr, end - off); + } + + public static final ForeignCallDescriptor UPDATE_BYTES_CRC32C = new ForeignCallDescriptor("updateBytesCRC32C", int.class, int.class, WordBase.class, int.class); + + @NodeIntrinsic(ForeignCallNode.class) + public static native int updateBytesCRC32(@ConstantNodeParameter ForeignCallDescriptor descriptor, int crc, WordBase buf, int length); +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_idiv_overflow.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_idiv_overflow.java new file mode 100644 index 00000000000..17b8ad6daee --- /dev/null +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_idiv_overflow.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017, 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. + */ +package org.graalvm.compiler.jtt.bytecode; + +import org.junit.Test; + +import org.graalvm.compiler.jtt.JTTTest; + +/* + */ +public class BC_idiv_overflow extends JTTTest { + + public static int test(int a, int b) { + return a / (b | 1); + } + + @Test + public void run0() throws Throwable { + runTest("test", Integer.MIN_VALUE, -1); + } + + @Test + public void run1() throws Throwable { + runTest("test", Integer.MIN_VALUE, 1); + } + +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_ldiv_overflow.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_ldiv_overflow.java new file mode 100644 index 00000000000..fa87695711a --- /dev/null +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.jtt/src/org/graalvm/compiler/jtt/bytecode/BC_ldiv_overflow.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017, 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. + */ +package org.graalvm.compiler.jtt.bytecode; + +import org.junit.Test; + +import org.graalvm.compiler.jtt.JTTTest; + +/* + */ +public class BC_ldiv_overflow extends JTTTest { + + public static long test(long a, long b) { + return a / (b | 1); + } + + @Test + public void run0() throws Throwable { + runTest("test", Long.MIN_VALUE, -1L); + } + + @Test + public void run1() throws Throwable { + runTest("test", Long.MIN_VALUE, 1L); + } + +} diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java index ff7428f7799..3b65fc3ad7c 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/IfNode.java @@ -30,8 +30,6 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; -import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.ResolvedJavaType; import org.graalvm.compiler.core.common.calc.Condition; import org.graalvm.compiler.core.common.type.IntegerStamp; import org.graalvm.compiler.core.common.type.Stamp; @@ -67,7 +65,9 @@ import org.graalvm.util.Equivalence; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.PrimitiveConstant; +import jdk.vm.ci.meta.ResolvedJavaType; /** * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome @@ -416,6 +416,7 @@ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRL if (result.graph() == null) { result = graph().addOrUniqueWithInputs(result); } + result = proxyReplacement(result); /* * This optimization can be performed even if multiple values merge at this phi * since the two inputs get simplified into one. @@ -698,6 +699,7 @@ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRL ValueNode falseValue = singlePhi.valueAt(falseEnd); ValueNode conditional = canonicalizeConditionalCascade(tool, trueValue, falseValue); if (conditional != null) { + conditional = proxyReplacement(conditional); singlePhi.setValueAt(trueEnd, conditional); removeThroughFalseBranch(tool, merge); return true; @@ -729,6 +731,36 @@ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRL return false; } + private ValueNode proxyReplacement(ValueNode replacement) { + /* + * Special case: Every empty diamond we collapse to a conditional node can potentially + * contain loop exit nodes on both branches. See the graph below: The two loop exits + * (instanceof begin node) exit the same loop. The resulting phi is defined outside the + * loop, but the resulting conditional node will be inside the loop, so we need to proxy the + * resulting conditional node. Callers of this method ensure that true and false successor + * have no usages, therefore a and b in the graph below can never be proxies themselves. + */ + // @formatter:off + // +--+ + // |If| + // +--+ +-----+ +-----+ + // +----+ +----+ | a | | b | + // |Lex | |Lex | +----^+ +^----+ + // +----+ +----+ | | + // +-------+ +---+ + // | Merge +---------+Phi| + // +-------+ +---+ + // @formatter:on + if (this.graph().hasValueProxies()) { + if (trueSuccessor instanceof LoopExitNode && falseSuccessor instanceof LoopExitNode) { + assert ((LoopExitNode) trueSuccessor).loopBegin() == ((LoopExitNode) falseSuccessor).loopBegin(); + assert trueSuccessor.usages().isEmpty() && falseSuccessor.usages().isEmpty(); + return this.graph().addOrUnique(new ValueProxyNode(replacement, (LoopExitNode) trueSuccessor)); + } + } + return replacement; + } + protected void removeThroughFalseBranch(SimplifierTool tool, AbstractMergeNode merge) { AbstractBeginNode trueBegin = trueSuccessor(); LogicNode conditionNode = condition(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java index 7a25afd4025..d494c49dde9 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerDivRemNode.java @@ -60,7 +60,8 @@ public abstract class IntegerDivRemNode extends FixedBinaryNode implements Lower // Assigning canDeopt during constructor, because it must never change during lifetime of // the node. - this.canDeopt = ((IntegerStamp) getY().stamp(NodeView.DEFAULT)).contains(0); + IntegerStamp yStamp = (IntegerStamp) getY().stamp(NodeView.DEFAULT); + this.canDeopt = yStamp.contains(0) || yStamp.contains(-1); } public final Op getOp() { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ProfileCompiledMethodsPhase.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ProfileCompiledMethodsPhase.java index 1f632ea2faf..e57ee577539 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ProfileCompiledMethodsPhase.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ProfileCompiledMethodsPhase.java @@ -121,7 +121,7 @@ public class ProfileCompiledMethodsPhase extends Phase { private static void addSectionCounters(FixedWithNextNode start, Collection sectionBlocks, Collection> childLoops, ScheduleResult schedule, ControlFlowGraph cfg) { HashSet blocks = new HashSet<>(sectionBlocks); - for (Loop loop : childLoops) { + for (Loop loop : childLoops) { blocks.removeAll(loop.getBlocks()); } double weight = getSectionWeight(schedule, blocks) / cfg.blockFor(start).probability(); diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java index 979dd3e85ee..7cb7b9dc0ec 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/GraphPrinter.java @@ -194,15 +194,26 @@ interface GraphPrinter extends Closeable, JavaConstantFormatter { static String constantToString(Object value) { Class c = value.getClass(); + String suffix = ""; if (c.isArray()) { return constantArrayToString(value); } else if (value instanceof Enum) { return ((Enum) value).name(); } else if (isToStringTrusted(c)) { - return value.toString(); + try { + return value.toString(); + } catch (Throwable t) { + suffix = "[toString error: " + t.getClass().getName() + "]"; + if (isToStringTrusted(t.getClass())) { + try { + suffix = "[toString error: " + t + "]"; + } catch (Throwable t2) { + // No point in going further + } + } + } } - return MetaUtil.getSimpleName(c, true) + "@" + Integer.toHexString(System.identityHashCode(value)); - + return MetaUtil.getSimpleName(c, true) + "@" + Integer.toHexString(System.identityHashCode(value)) + suffix; } static String constantArrayToString(Object array) { diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java index ba074f3a9c4..55708c96e59 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/StandardGraphBuilderPlugins.java @@ -141,6 +141,7 @@ public class StandardGraphBuilderPlugins { registerJMHBlackholePlugins(plugins, bytecodeProvider); registerJFRThrowablePlugins(plugins, bytecodeProvider); registerMethodHandleImplPlugins(plugins, snippetReflection, bytecodeProvider); + registerJcovCollectPlugins(plugins, bytecodeProvider); } private static final Field STRING_VALUE_FIELD; @@ -910,4 +911,21 @@ public class StandardGraphBuilderPlugins { } }); } + + /** + * Registers a plugin to ignore {@code com.sun.tdk.jcov.runtime.Collect.hit} within an + * intrinsic. + */ + private static void registerJcovCollectPlugins(InvocationPlugins plugins, BytecodeProvider bytecodeProvider) { + Registration r = new Registration(plugins, "com.sun.tdk.jcov.runtime.Collect", bytecodeProvider); + r.register1("hit", int.class, new InvocationPlugin() { + @Override + public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) { + if (b.parsingIntrinsic()) { + return true; + } + return false; + } + }); + } } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java index c983a1b466c..bdc74fb15dc 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/classfile/Classfile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -46,8 +46,8 @@ public class Classfile { private final ResolvedJavaType type; private final List codeAttributes; - private static final int MAJOR_VERSION_JAVA_MIN = 51; - private static final int MAJOR_VERSION_JAVA_MAX = 54; + private static final int MAJOR_VERSION_JAVA7 = 51; + private static final int MAJOR_VERSION_JAVA10 = 54; private static final int MAGIC = 0xCAFEBABE; /** @@ -65,7 +65,7 @@ public class Classfile { int minor = stream.readUnsignedShort(); int major = stream.readUnsignedShort(); - if (major < MAJOR_VERSION_JAVA_MIN || major > MAJOR_VERSION_JAVA_MAX) { + if (major < MAJOR_VERSION_JAVA7 || major > MAJOR_VERSION_JAVA10) { throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor); } diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java index 9dae16eef14..30b94e9f0eb 100644 --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/GraphEffectList.java @@ -34,7 +34,6 @@ import org.graalvm.compiler.nodes.IfNode; import org.graalvm.compiler.nodes.NodeView; import org.graalvm.compiler.nodes.PhiNode; import org.graalvm.compiler.nodes.PiNode; -import org.graalvm.compiler.nodes.ProxyNode; import org.graalvm.compiler.nodes.StructuredGraph; import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.debug.DynamicCounterNode; @@ -116,14 +115,7 @@ public final class GraphEffectList extends EffectList { */ public void addFloatingNode(ValueNode node, @SuppressWarnings("unused") String cause) { add("add floating node", graph -> { - if (node instanceof ProxyNode) { - ProxyNode proxyNode = (ProxyNode) node; - ValueNode value = proxyNode.value(); - if (!value.isAlive()) { - graph.addWithoutUnique(value); - } - } - graph.addWithoutUnique(node); + graph.addWithoutUniqueWithInputs(node); }); } From bfe4e0e4a2996daccad275bb5554fd9486c8e0ed Mon Sep 17 00:00:00 2001 From: Dean Long Date: Wed, 13 Dec 2017 20:35:09 -0800 Subject: [PATCH 16/31] 8193323: Crash in "failed dependencies, but counter didn't change" with enabled UseJVMCICompiler Reviewed-by: kvn --- src/hotspot/share/compiler/compileBroker.cpp | 24 ++++++++++++------- src/hotspot/share/jvmci/jvmciCompilerToVM.cpp | 4 ++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index a1354fe08f4..b62ccd936bb 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1852,17 +1852,23 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { TraceTime t1("compilation", &time); EventCompilation event; - JVMCIEnv env(task, system_dictionary_modification_counter); - methodHandle method(thread, target_handle); - jvmci->compile_method(method, osr_bci, &env); + // Skip redefined methods + if (target_handle->is_old()) { + failure_reason = "redefined method"; + retry_message = "not retryable"; + compilable = ciEnv::MethodCompilable_never; + } else { + JVMCIEnv env(task, system_dictionary_modification_counter); + methodHandle method(thread, target_handle); + jvmci->compile_method(method, osr_bci, &env); - post_compile(thread, task, event, task->code() != NULL, NULL); - - failure_reason = env.failure_reason(); - if (!env.retryable()) { - retry_message = "not retryable"; - compilable = ciEnv::MethodCompilable_not_at_tier; + failure_reason = env.failure_reason(); + if (!env.retryable()) { + retry_message = "not retryable"; + compilable = ciEnv::MethodCompilable_not_at_tier; + } } + post_compile(thread, task, event, task->code() != NULL, NULL); } else #endif // INCLUDE_JVMCI diff --git a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp index c0509df788b..fb89dba68f4 100644 --- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp +++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp @@ -761,6 +761,10 @@ C2V_END C2V_VMENTRY(jboolean, isCompilable,(JNIEnv *, jobject, jobject jvmci_method)) methodHandle method = CompilerToVM::asMethod(jvmci_method); + // Skip redefined methods + if (method->is_old()) { + return false; + } return !method->is_not_compilable(CompLevel_full_optimization); C2V_END From 64a1914e1cc3e5a5c5b1601cd7630ac4be7132e2 Mon Sep 17 00:00:00 2001 From: Jini George Date: Thu, 14 Dec 2017 12:49:47 +0530 Subject: [PATCH 17/31] 8192985: SA: Test cases for the clhsdb 'inspect', 'scanoops' and 'printas' commands Create tests for the clhsdb commands: inspect, scanoops and printas Reviewed-by: sspitsyn, sballal, cjplummer --- .../serviceability/sa/ClhsdbInspect.java | 98 ++++++++++++++ .../serviceability/sa/ClhsdbPrintAs.java | 127 ++++++++++++++++++ .../serviceability/sa/ClhsdbScanOops.java | 116 ++++++++++++++++ 3 files changed, 341 insertions(+) create mode 100644 test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java create mode 100644 test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java create mode 100644 test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java new file mode 100644 index 00000000000..8697b21860d --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2017, 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. + */ + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; +import jdk.test.lib.apps.LingeredApp; + +/* + * @test + * @bug 8192985 + * @summary Test the clhsdb 'inspect' command + * @library /test/lib + * @run main/othervm ClhsdbInspect + */ + +public class ClhsdbInspect { + + public static void main(String[] args) throws Exception { + System.out.println("Starting the ClhsdbInspect test"); + + LingeredAppWithLock theApp = null; + try { + ClhsdbLauncher test = new ClhsdbLauncher(); + + theApp = new LingeredAppWithLock(); + LingeredApp.startApp(null, theApp); + System.out.println("Started LingeredApp with pid " + theApp.getPid()); + + // Run the 'jstack -v' command to get the address of a Method* + // and the oop address of a java.lang.ref.ReferenceQueue$Lock + // object + List cmds = List.of("jstack -v"); + + String jstackOutput = test.run(theApp.getPid(), cmds, null, null); + + if (jstackOutput == null) { + // Output could be null due to attach permission issues + // and if we are skipping this. + LingeredApp.stopApp(theApp); + return; + } + + String addressString = null; + Map tokensMap = new HashMap<>(); + tokensMap.put("waiting to lock", + "instance of Oop for java/lang/Class"); + tokensMap.put("Method\\*=", "Type is Method"); + tokensMap.put("waiting to re-lock in wait", + "instance of Oop for java/lang/ref/ReferenceQueue$Lock"); + + for (String key: tokensMap.keySet()) { + cmds = new ArrayList(); + Map> expStrMap = new HashMap<>(); + + String[] snippets = jstackOutput.split(key); + String[] tokens = snippets[1].split(" "); + for (String token: tokens) { + if (token.contains("0x")) { + addressString = token.replace("<", "").replace(">", ""); + break; + } + } + + String cmd = "inspect " + addressString; + cmds.add(cmd); + expStrMap.put(cmd, List.of(tokensMap.get(key))); + test.run(theApp.getPid(), cmds, expStrMap, null); + } + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } finally { + LingeredApp.stopApp(theApp); + } + System.out.println("Test PASSED"); + } +} diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java new file mode 100644 index 00000000000..525c57c781c --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2017, 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. + */ + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; +import jdk.test.lib.apps.LingeredApp; + +/* + * @test + * @bug 8192985 + * @summary Test the clhsdb 'printas' command + * @library /test/lib + * @run main/othervm ClhsdbPrintAs + */ + +public class ClhsdbPrintAs { + + public static void main(String[] args) throws Exception { + System.out.println("Starting the ClhsdbPrintAs test"); + + LingeredApp theApp = null; + try { + ClhsdbLauncher test = new ClhsdbLauncher(); + theApp = LingeredApp.startApp(); + System.out.println("Started LingeredApp with pid " + theApp.getPid()); + + // Run the 'jstack -v' command to get the address of a the Method* + // representing LingeredApp.main + List cmds = List.of("jstack -v"); + Map> expStrMap; + + String jstackOutput = test.run(theApp.getPid(), cmds, null, null); + + if (jstackOutput == null) { + // Output could be null due to attach permission issues + // and if we are skipping this. + LingeredApp.stopApp(theApp); + return; + } + + String[] snippets = jstackOutput.split("LingeredApp.main"); + String addressString = null; + + String[] tokens = snippets[1].split("Method\\*="); + String[] words = tokens[1].split(" "); + addressString = words[0]; + + cmds = new ArrayList(); + expStrMap = new HashMap<>(); + + String cmd = "printas Method " + addressString; + cmds.add(cmd); + expStrMap.put(cmd, List.of + ("ConstMethod", "MethodCounters", "Method::_access_flags")); + + // Run the printas Method command to obtain the address + // of ConstMethod* + String methodDetailsOutput = test.run(theApp.getPid(), cmds, expStrMap, null); + snippets = methodDetailsOutput.split("ConstMethod*"); + + tokens = snippets[1].split(" "); + for (String token : tokens) { + if (token.contains("0x")) { + addressString = token.replace("\n", ""); + break; + } + } + + cmds = new ArrayList(); + expStrMap = new HashMap<>(); + + cmd = "printas ConstMethod " + addressString; + cmds.add(cmd); + expStrMap.put(cmd, List.of + ("ConstantPool", "_max_locals", "_flags")); + + // Run the printas constMethod command to obtain the address + // of ConstantPool* + String constMethodDetailsOutput = test.run(theApp.getPid(), cmds, expStrMap, null); + snippets = constMethodDetailsOutput.split("ConstantPool*"); + + tokens = snippets[1].split(" "); + for (String token : tokens) { + if (token.contains("0x")) { + addressString = token.replace("\n", ""); + break; + } + } + + cmds = new ArrayList(); + expStrMap = new HashMap<>(); + + cmd = "printas ConstantPool " + addressString; + cmds.add(cmd); + expStrMap.put(cmd, List.of + ("ConstantPoolCache", "_pool_holder", "InstanceKlass*")); + test.run(theApp.getPid(), cmds, expStrMap, null); + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } finally { + LingeredApp.stopApp(theApp); + } + System.out.println("Test PASSED"); + } +} diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java new file mode 100644 index 00000000000..3eba0e7217a --- /dev/null +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017, 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. + */ + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; +import jdk.test.lib.Utils; +import jdk.test.lib.apps.LingeredApp; + +/* + * @test + * @bug 8192985 + * @summary Test the clhsdb 'scanoops' command + * @library /test/lib + * @run main/othervm/timeout=1200 ClhsdbScanOops + */ + +public class ClhsdbScanOops { + + private static void testWithGcType(String gc) throws Exception { + + LingeredApp theApp = null; + + try { + ClhsdbLauncher test = new ClhsdbLauncher(); + List vmArgs = new ArrayList(); + vmArgs.add(gc); + theApp = LingeredApp.startApp(vmArgs); + + System.out.println ("Started LingeredApp with the GC option " + gc + + " and pid " + theApp.getPid()); + + // Run the 'universe' command to get the address ranges + List cmds = List.of("universe"); + + String universeOutput = test.run(theApp.getPid(), cmds, null, null); + + if (universeOutput == null) { + // Output could be null due to attach permission issues + // and if we are skipping this. + LingeredApp.stopApp(theApp); + return; + } + + cmds = new ArrayList(); + Map> expStrMap = new HashMap<>(); + Map> unExpStrMap = new HashMap<>(); + + String startAddress = null; + String endAddress = null; + String[] snippets = null; + + if (gc.contains("UseParallelGC")) { + snippets = universeOutput.split("eden = "); + } else { + snippets = universeOutput.split("eden \\["); + } + String[] words = snippets[1].split(","); + // Get the addresses from Eden + startAddress = words[0].replace("[", ""); + endAddress = words[1]; + String cmd = "scanoops " + startAddress + " " + endAddress; + cmds.add(cmd); + + expStrMap.put(cmd, List.of + ("java/lang/Object", "java/lang/Class", "java/lang/Thread", + "java/lang/String", "[B", "[I")); + + // Test the 'type' option also + // scanoops java/lang/String + // Ensure that only the java/lang/String oops are printed. + cmd = cmd + " java/lang/String"; + cmds.add(cmd); + expStrMap.put(cmd, List.of("java/lang/String")); + unExpStrMap.put(cmd, List.of("java/lang/Thread")); + + test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap); + } catch (Exception ex) { + throw new RuntimeException("Test ERROR " + ex, ex); + } finally { + LingeredApp.stopApp(theApp); + } + } + + public static void main(String[] args) throws Exception { + System.out.println("Starting the ClhsdbScanOops test"); + try { + testWithGcType("-XX:+UseParallelGC"); + testWithGcType("-XX:+UseSerialGC"); + } catch (Exception e) { + throw new Error("Test failed with " + e); + } + System.out.println("Test PASSED"); + } +} From 3c55f378ca76902c3ea057296e5758ba8f2206c3 Mon Sep 17 00:00:00 2001 From: Leo Korinth Date: Wed, 6 Dec 2017 11:11:16 +0100 Subject: [PATCH 18/31] 8133805: Remove the bot_updates parameter from G1Allocator's allocation methods Reviewed-by: tschatzl, sjohanss --- src/hotspot/share/gc/g1/g1AllocRegion.cpp | 22 ++++----- src/hotspot/share/gc/g1/g1AllocRegion.hpp | 47 +++++++------------ .../share/gc/g1/g1AllocRegion.inline.hpp | 40 +++++++--------- src/hotspot/share/gc/g1/g1Allocator.cpp | 12 ++--- .../share/gc/g1/g1Allocator.inline.hpp | 6 +-- 5 files changed, 50 insertions(+), 77 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1AllocRegion.cpp b/src/hotspot/share/gc/g1/g1AllocRegion.cpp index 3f70a68c4fb..12e93ff0918 100644 --- a/src/hotspot/share/gc/g1/g1AllocRegion.cpp +++ b/src/hotspot/share/gc/g1/g1AllocRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -42,17 +42,17 @@ void G1AllocRegion::setup(G1CollectedHeap* g1h, HeapRegion* dummy_region) { // Make sure that any allocation attempt on this region will fail // and will not trigger any asserts. - assert(allocate(dummy_region, 1, false) == NULL, "should fail"); - assert(par_allocate(dummy_region, 1, false) == NULL, "should fail"); - assert(allocate(dummy_region, 1, true) == NULL, "should fail"); - assert(par_allocate(dummy_region, 1, true) == NULL, "should fail"); + assert(dummy_region->allocate_no_bot_updates(1) == NULL, "should fail"); + assert(dummy_region->allocate(1) == NULL, "should fail"); + DEBUG_ONLY(size_t assert_tmp); + assert(dummy_region->par_allocate_no_bot_updates(1, 1, &assert_tmp) == NULL, "should fail"); + assert(dummy_region->par_allocate(1, 1, &assert_tmp) == NULL, "should fail"); _g1h = g1h; _dummy_region = dummy_region; } -size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region, - bool bot_updates) { +size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region) { assert(alloc_region != NULL && alloc_region != _dummy_region, "pre-condition"); size_t result = 0; @@ -74,7 +74,7 @@ size_t G1AllocRegion::fill_up_remaining_space(HeapRegion* alloc_region, size_t min_word_size_to_fill = CollectedHeap::min_fill_size(); while (free_word_size >= min_word_size_to_fill) { - HeapWord* dummy = par_allocate(alloc_region, free_word_size, bot_updates); + HeapWord* dummy = par_allocate(alloc_region, free_word_size); if (dummy != NULL) { // If the allocation was successful we should fill in the space. CollectedHeap::fill_with_object(dummy, free_word_size); @@ -110,7 +110,7 @@ size_t G1AllocRegion::retire(bool fill_up) { "the alloc region should never be empty"); if (fill_up) { - result = fill_up_remaining_space(alloc_region, _bot_updates); + result = fill_up_remaining_space(alloc_region); } assert_alloc_region(alloc_region->used() >= _used_bytes_before, "invariant"); @@ -135,7 +135,7 @@ HeapWord* G1AllocRegion::new_alloc_region_and_allocate(size_t word_size, new_alloc_region->reset_pre_dummy_top(); // Need to do this before the allocation _used_bytes_before = new_alloc_region->used(); - HeapWord* result = allocate(new_alloc_region, word_size, _bot_updates); + HeapWord* result = allocate(new_alloc_region, word_size); assert_alloc_region(result != NULL, "the allocation should succeeded"); OrderAccess::storestore(); @@ -301,7 +301,7 @@ HeapRegion* OldGCAllocRegion::release() { // possible object. In this case this region will not be retained, so the // original problem cannot occur. if (to_allocate_words >= G1CollectedHeap::min_fill_size()) { - HeapWord* dummy = attempt_allocation(to_allocate_words, true /* bot_updates */); + HeapWord* dummy = attempt_allocation(to_allocate_words); CollectedHeap::fill_with_object(dummy, to_allocate_words); } } diff --git a/src/hotspot/share/gc/g1/g1AllocRegion.hpp b/src/hotspot/share/gc/g1/g1AllocRegion.hpp index afcb2a340c8..81aec1b197b 100644 --- a/src/hotspot/share/gc/g1/g1AllocRegion.hpp +++ b/src/hotspot/share/gc/g1/g1AllocRegion.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -83,37 +83,27 @@ private: // whether the _alloc_region is NULL or not. static HeapRegion* _dummy_region; - // Some of the methods below take a bot_updates parameter. Its value - // should be the same as the _bot_updates field. The idea is that - // the parameter will be a constant for a particular alloc region - // and, given that these methods will be hopefully inlined, the - // compiler should compile out the test. - // Perform a non-MT-safe allocation out of the given region. - static inline HeapWord* allocate(HeapRegion* alloc_region, - size_t word_size, - bool bot_updates); + inline HeapWord* allocate(HeapRegion* alloc_region, + size_t word_size); // Perform a MT-safe allocation out of the given region. - static inline HeapWord* par_allocate(HeapRegion* alloc_region, - size_t word_size, - bool bot_updates); + inline HeapWord* par_allocate(HeapRegion* alloc_region, + size_t word_size); // Perform a MT-safe allocation out of the given region, with the given // minimum and desired size. Returns the actual size allocated (between // minimum and desired size) in actual_word_size if the allocation has been // successful. - static inline HeapWord* par_allocate(HeapRegion* alloc_region, - size_t min_word_size, - size_t desired_word_size, - size_t* actual_word_size, - bool bot_updates); + inline HeapWord* par_allocate(HeapRegion* alloc_region, + size_t min_word_size, + size_t desired_word_size, + size_t* actual_word_size); // Ensure that the region passed as a parameter has been filled up // so that noone else can allocate out of it any more. // Returns the number of bytes that have been wasted by filled up // the space. - static size_t fill_up_remaining_space(HeapRegion* alloc_region, - bool bot_updates); + size_t fill_up_remaining_space(HeapRegion* alloc_region); // After a region is allocated by alloc_new_region, this // method is used to set it as the active alloc_region @@ -160,8 +150,7 @@ public: // First-level allocation: Should be called without holding a // lock. It will try to allocate lock-free out of the active region, // or return NULL if it was unable to. - inline HeapWord* attempt_allocation(size_t word_size, - bool bot_updates); + inline HeapWord* attempt_allocation(size_t word_size); // Perform an allocation out of the current allocation region, with the given // minimum and desired size. Returns the actual size allocated (between // minimum and desired size) in actual_word_size if the allocation has been @@ -170,8 +159,7 @@ public: // out of the active region, or return NULL if it was unable to. inline HeapWord* attempt_allocation(size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - bool bot_updates); + size_t* actual_word_size); // Second-level allocation: Should be called while holding a // lock. It will try to first allocate lock-free out of the active @@ -179,23 +167,20 @@ public: // alloc region with a new one. We require that the caller takes the // appropriate lock before calling this so that it is easier to make // it conform to its locking protocol. - inline HeapWord* attempt_allocation_locked(size_t word_size, - bool bot_updates); + inline HeapWord* attempt_allocation_locked(size_t word_size); // Same as attempt_allocation_locked(size_t, bool), but allowing specification // of minimum word size of the block in min_word_size, and the maximum word // size of the allocation in desired_word_size. The actual size of the block is // returned in actual_word_size. inline HeapWord* attempt_allocation_locked(size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - bool bot_updates); + size_t* actual_word_size); // Should be called to allocate a new region even if the max of this // type of regions has been reached. Should only be called if other // allocation attempts have failed and we are not holding a valid // active region. - inline HeapWord* attempt_allocation_force(size_t word_size, - bool bot_updates); + inline HeapWord* attempt_allocation_force(size_t word_size); // Should be called before we start using this object. void init(); @@ -236,7 +221,7 @@ protected: virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes); virtual size_t retire(bool fill_up); -public: + G1GCAllocRegion(const char* name, bool bot_updates, G1EvacStats* stats, InCSetState::in_cset_state_t purpose) : G1AllocRegion(name, bot_updates), _stats(stats), _purpose(purpose) { assert(stats != NULL, "Must pass non-NULL PLAB statistics"); diff --git a/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp b/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp index c9a4d4058e5..1c08b8e2896 100644 --- a/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp +++ b/src/hotspot/share/gc/g1/g1AllocRegion.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -37,52 +37,47 @@ inline HeapWord* G1AllocRegion::allocate(HeapRegion* alloc_region, - size_t word_size, - bool bot_updates) { + size_t word_size) { assert(alloc_region != NULL, "pre-condition"); - if (!bot_updates) { + if (!_bot_updates) { return alloc_region->allocate_no_bot_updates(word_size); } else { return alloc_region->allocate(word_size); } } -inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t word_size, bool bot_updates) { +inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t word_size) { size_t temp; - return par_allocate(alloc_region, word_size, word_size, &temp, bot_updates); + return par_allocate(alloc_region, word_size, word_size, &temp); } inline HeapWord* G1AllocRegion::par_allocate(HeapRegion* alloc_region, size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - bool bot_updates) { + size_t* actual_word_size) { assert(alloc_region != NULL, "pre-condition"); assert(!alloc_region->is_empty(), "pre-condition"); - if (!bot_updates) { + if (!_bot_updates) { return alloc_region->par_allocate_no_bot_updates(min_word_size, desired_word_size, actual_word_size); } else { return alloc_region->par_allocate(min_word_size, desired_word_size, actual_word_size); } } -inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size, bool bot_updates) { +inline HeapWord* G1AllocRegion::attempt_allocation(size_t word_size) { size_t temp; - return attempt_allocation(word_size, word_size, &temp, bot_updates); + return attempt_allocation(word_size, word_size, &temp); } inline HeapWord* G1AllocRegion::attempt_allocation(size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - bool bot_updates) { - assert_alloc_region(bot_updates == _bot_updates, "pre-condition"); - + size_t* actual_word_size) { HeapRegion* alloc_region = _alloc_region; assert_alloc_region(alloc_region != NULL, "not initialized properly"); - HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size, bot_updates); + HeapWord* result = par_allocate(alloc_region, min_word_size, desired_word_size, actual_word_size); if (result != NULL) { trace("alloc", min_word_size, desired_word_size, *actual_word_size, result); return result; @@ -91,19 +86,18 @@ inline HeapWord* G1AllocRegion::attempt_allocation(size_t min_word_size, return NULL; } -inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size, bool bot_updates) { +inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t word_size) { size_t temp; - return attempt_allocation_locked(word_size, word_size, &temp, bot_updates); + return attempt_allocation_locked(word_size, word_size, &temp); } inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - bool bot_updates) { + size_t* actual_word_size) { // First we have to redo the allocation, assuming we're holding the // appropriate lock, in case another thread changed the region while // we were waiting to get the lock. - HeapWord* result = attempt_allocation(min_word_size, desired_word_size, actual_word_size, bot_updates); + HeapWord* result = attempt_allocation(min_word_size, desired_word_size, actual_word_size); if (result != NULL) { return result; } @@ -119,9 +113,7 @@ inline HeapWord* G1AllocRegion::attempt_allocation_locked(size_t min_word_size, return NULL; } -inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size, - bool bot_updates) { - assert_alloc_region(bot_updates == _bot_updates, "pre-condition"); +inline HeapWord* G1AllocRegion::attempt_allocation_force(size_t word_size) { assert_alloc_region(_alloc_region != NULL, "not initialized properly"); trace("forcing alloc", word_size, word_size); diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index b486ad356bc..2e46425f3f8 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -190,14 +190,12 @@ HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size, HeapWord* result = survivor_gc_alloc_region(context)->attempt_allocation(min_word_size, desired_word_size, - actual_word_size, - false /* bot_updates */); + actual_word_size); if (result == NULL && !survivor_is_full(context)) { MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag); result = survivor_gc_alloc_region(context)->attempt_allocation_locked(min_word_size, desired_word_size, - actual_word_size, - false /* bot_updates */); + actual_word_size); if (result == NULL) { set_survivor_full(context); } @@ -217,14 +215,12 @@ HeapWord* G1Allocator::old_attempt_allocation(size_t min_word_size, HeapWord* result = old_gc_alloc_region(context)->attempt_allocation(min_word_size, desired_word_size, - actual_word_size, - true /* bot_updates */); + actual_word_size); if (result == NULL && !old_is_full(context)) { MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag); result = old_gc_alloc_region(context)->attempt_allocation_locked(min_word_size, desired_word_size, - actual_word_size, - true /* bot_updates */); + actual_word_size); if (result == NULL) { set_old_full(context); } diff --git a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp index 6f05a21d9a3..d04343b158c 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp +++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp @@ -30,18 +30,18 @@ #include "gc/shared/plab.inline.hpp" HeapWord* G1Allocator::attempt_allocation(size_t word_size, AllocationContext_t context) { - return mutator_alloc_region(context)->attempt_allocation(word_size, false /* bot_updates */); + return mutator_alloc_region(context)->attempt_allocation(word_size); } HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size, AllocationContext_t context) { - HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size, false /* bot_updates */); + HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size); assert(result != NULL || mutator_alloc_region(context)->get() == NULL, "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(context)->get())); return result; } HeapWord* G1Allocator::attempt_allocation_force(size_t word_size, AllocationContext_t context) { - return mutator_alloc_region(context)->attempt_allocation_force(word_size, false /* bot_updates */); + return mutator_alloc_region(context)->attempt_allocation_force(word_size); } inline HeapWord* G1PLABAllocator::plab_allocate(InCSetState dest, From 5dd68ed125526e4e02348105ab330cab7f0d72f8 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 13 Dec 2017 15:37:48 -0800 Subject: [PATCH 19/31] 8165603: runtime/appcds/UseAppCDS.java: failed to clean up files after test when running with agentvm Reviewed-by: mseledtsov, dholmes --- test/hotspot/jtreg/ProblemList.txt | 1 - .../jtreg/runtime/appcds/MultiReleaseJars.java | 13 +++++++------ .../runtime/appcds/SharedArchiveConsistency.java | 12 ++++-------- test/hotspot/jtreg/runtime/appcds/UseAppCDS.java | 14 ++++++++------ .../appcds/cacheObject/RedefineClassTest.java | 1 - .../runtime/appcds/jvmti/InstrumentationTest.java | 6 +++--- .../jtreg/runtime/appcds/test-classes/Util.java | 14 +++++++------- 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index a07b9c9e792..d56bd6c0a14 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -77,7 +77,6 @@ runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all # This test is disabled since it will stress NMT and timeout during normal testing runtime/NMT/MallocStressTest.java 8166548 generic-all runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all -runtime/AppCDS/UseAppCDS.java 8165603 windows-all ############################################################################# diff --git a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java index fdc6ef06492..21085ddde3f 100644 --- a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java +++ b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java @@ -72,13 +72,14 @@ public class MultiReleaseJars { if (contents == null) { throw new java.lang.RuntimeException("No input for writing to file" + file); } - FileOutputStream fos = new FileOutputStream(file); - PrintStream ps = new PrintStream(fos); - for (String str : contents) { - ps.println(str); + try ( + FileOutputStream fos = new FileOutputStream(file); + PrintStream ps = new PrintStream(fos) + ) { + for (String str : contents) { + ps.println(str); + } } - ps.close(); - fos.close(); } /* version.jar entries and files: diff --git a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java index e7b1dac98ed..3e8642daecd 100644 --- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java +++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java @@ -245,11 +245,10 @@ public class SharedArchiveConsistency { // Copy file with bytes deleted or inserted // del -- true, deleted, false, inserted public static void copyFile(File from, File to, boolean del) throws Exception { - FileChannel inputChannel = null; - FileChannel outputChannel = null; - try { - inputChannel = new FileInputStream(from).getChannel(); - outputChannel = new FileOutputStream(to).getChannel(); + try ( + FileChannel inputChannel = new FileInputStream(from).getChannel(); + FileChannel outputChannel = new FileOutputStream(to).getChannel() + ) { long size = inputChannel.size(); int init_size = getFileHeaderSize(inputChannel); outputChannel.transferFrom(inputChannel, 0, init_size); @@ -264,9 +263,6 @@ public class SharedArchiveConsistency { outputChannel.write(ByteBuffer.wrap(new byte[n])); outputChannel.transferFrom(inputChannel, init_size + n , size - init_size); } - } finally { - inputChannel.close(); - outputChannel.close(); } } diff --git a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java index 639c06de59c..6db1a1c34cc 100644 --- a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java +++ b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java @@ -108,12 +108,14 @@ public class UseAppCDS { public static List toClassNames(String filename) throws IOException { ArrayList classes = new ArrayList<>(); - BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename))); - for (; ; ) { - String line = br.readLine(); - if (line == null) - break; - classes.add(line.replaceAll("/", ".")); + try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename)))) { + for (; ; ) { + String line = br.readLine(); + if (line == null) { + break; + } + classes.add(line.replaceAll("/", ".")); + } } return classes; } diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java index bfcd82f5742..05177441a59 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java @@ -43,7 +43,6 @@ import com.sun.tools.attach.VirtualMachine; import com.sun.tools.attach.VirtualMachineDescriptor; import java.io.File; -import java.io.FileOutputStream; import java.util.List; import jdk.test.lib.Asserts; import jdk.test.lib.cds.CDSOptions; diff --git a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java index 1e869c28929..4121fe17e67 100644 --- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java +++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java @@ -182,9 +182,9 @@ public class InstrumentationTest { // We use the flagFile to prevent the child process to make progress, until we have // attached to it. File f = new File(flagFile); - FileOutputStream o = new FileOutputStream(f); - o.write(1); - o.close(); + try (FileOutputStream o = new FileOutputStream(f)) { + o.write(1); + } if (!f.exists()) { throw new RuntimeException("Failed to create " + f); } diff --git a/test/hotspot/jtreg/runtime/appcds/test-classes/Util.java b/test/hotspot/jtreg/runtime/appcds/test-classes/Util.java index 4289c765257..29bb3b2b06e 100644 --- a/test/hotspot/jtreg/runtime/appcds/test-classes/Util.java +++ b/test/hotspot/jtreg/runtime/appcds/test-classes/Util.java @@ -39,7 +39,7 @@ public class Util { throws FileNotFoundException, IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { - DataInputStream dis = new DataInputStream(new FileInputStream(clsFile)); + try (DataInputStream dis = new DataInputStream(new FileInputStream(clsFile))) { byte[] buff = new byte[(int)clsFile.length()]; dis.readFully(buff); replace(buff, fromString, toString); @@ -57,6 +57,7 @@ public class Util { System.out.println("Loaded : " + cls); return cls; + } } /** @@ -146,11 +147,10 @@ public class Util { JarFile jf = new JarFile(jarFile); JarEntry ent = jf.getJarEntry(className.replace('.', '/') + ".class"); - DataInputStream dis = new DataInputStream(jf.getInputStream(ent)); - byte[] buff = new byte[(int)ent.getSize()]; - dis.readFully(buff); - dis.close(); - - return buff; + try (DataInputStream dis = new DataInputStream(jf.getInputStream(ent))) { + byte[] buff = new byte[(int)ent.getSize()]; + dis.readFully(buff); + return buff; + } } } From e817cd88c17c3c2ff612775bdab43d71738a9139 Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Fri, 15 Dec 2017 16:51:13 +0100 Subject: [PATCH 20/31] 8193608: Quarantine test/hotspot/jtreg/compiler/codegen/Test6896617.java until JDK-8193479 is fixed Added test to ProblemList.txt Reviewed-by: vlivanov --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index d56bd6c0a14..28dde210a6f 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -42,6 +42,7 @@ compiler/ciReplay/TestSAServer.java 8029528 generic-all compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all +compiler/codegen/Test6896617.java 8193479 generic-all compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java 8140405 generic-all compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all From 47bbcac66793180eebf65cbd1837916c77a94ef3 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Fri, 15 Dec 2017 11:23:50 -0500 Subject: [PATCH 21/31] 8154587: Resolution fails for default method named 'clone' Make sure default methods with the same names as those in j.l.Object get put in the default methods table where resolution can find them. Reviewed-by: acorn, lfoltan --- .../share/classfile/defaultMethods.cpp | 35 ++-- .../share/classfile/systemDictionary.hpp | 6 + src/hotspot/share/oops/cpCache.cpp | 1 + src/hotspot/share/oops/klassVtable.cpp | 45 ++++-- src/hotspot/share/oops/klassVtable.hpp | 9 +- .../jtreg/runtime/clone/AbstractClone.java | 55 +++++++ .../jtreg/runtime/clone/AbstractNoClones.jasm | 142 ++++++++++++++++ .../jtreg/runtime/clone/DefaultClone.jasm | 145 +++++++++++++++++ .../jtreg/runtime/clone/DefaultFinalize.jasm | 144 +++++++++++++++++ .../jtreg/runtime/clone/DefaultHashCode.jasm | 126 +++++++++++++++ .../runtime/clone/DefaultNoCloneInC.jasm | 151 ++++++++++++++++++ .../jtreg/runtime/clone/LocalClone.jasm | 144 +++++++++++++++++ .../hotspot/jtreg/runtime/clone/NoClones.jasm | 133 +++++++++++++++ .../clone/invokevirtual/DefMethClone.jasm | 32 ++++ .../clone/invokevirtual/HasLocalClone.jasm | 96 +++++++++++ .../jtreg/runtime/clone/invokevirtual/I1.java | 25 +++ .../runtime/clone/invokevirtual/I1Abstr.java | 27 ++++ .../clone/invokevirtual/NoLocalClone.jasm | 81 ++++++++++ .../invokevirtual/NoLocalCloneAbstr.jasm | 81 ++++++++++ .../clone/invokevirtual/SuperClass.jasm | 33 ++++ 20 files changed, 1478 insertions(+), 33 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/clone/AbstractClone.java create mode 100644 test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/DefaultClone.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/LocalClone.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/NoClones.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm create mode 100644 test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm diff --git a/src/hotspot/share/classfile/defaultMethods.cpp b/src/hotspot/share/classfile/defaultMethods.cpp index b09d552bcf4..b4b65edb902 100644 --- a/src/hotspot/share/classfile/defaultMethods.cpp +++ b/src/hotspot/share/classfile/defaultMethods.cpp @@ -26,6 +26,7 @@ #include "classfile/bytecodeAssembler.hpp" #include "classfile/defaultMethods.hpp" #include "classfile/symbolTable.hpp" +#include "classfile/systemDictionary.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.hpp" @@ -683,10 +684,11 @@ class FindMethodsByErasedSig : public HierarchyVisitor { Symbol* _method_name; Symbol* _method_signature; StatefulMethodFamily* _family; + bool _cur_class_is_interface; public: - FindMethodsByErasedSig(Symbol* name, Symbol* signature) : - _method_name(name), _method_signature(signature), + FindMethodsByErasedSig(Symbol* name, Symbol* signature, bool is_interf) : + _method_name(name), _method_signature(signature), _cur_class_is_interface(is_interf), _family(NULL) {} void get_discovered_family(MethodFamily** family) { @@ -709,14 +711,17 @@ class FindMethodsByErasedSig : public HierarchyVisitor { InstanceKlass* iklass = current_class(); Method* m = iklass->find_method(_method_name, _method_signature); - // private interface methods are not candidates for default methods - // invokespecial to private interface methods doesn't use default method logic - // private class methods are not candidates for default methods, - // private methods do not override default methods, so need to perform - // default method inheritance without including private methods - // The overpasses are your supertypes' errors, we do not include them - // future: take access controls into account for superclass methods - if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) { + // Private interface methods are not candidates for default methods. + // invokespecial to private interface methods doesn't use default method logic. + // Private class methods are not candidates for default methods. + // Private methods do not override default methods, so need to perform + // default method inheritance without including private methods. + // The overpasses are your supertypes' errors, we do not include them. + // Non-public methods in java.lang.Object are not candidates for default + // methods. + // Future: take access controls into account for superclass methods + if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private() && + (!_cur_class_is_interface || !SystemDictionary::is_nonpublic_Object_method(m))) { if (_family == NULL) { _family = new StatefulMethodFamily(); } @@ -726,8 +731,8 @@ class FindMethodsByErasedSig : public HierarchyVisitor { scope->add_mark(restorer); } else { // This is the rule that methods in classes "win" (bad word) over - // methods in interfaces. This works because of single inheritance - // private methods in classes do not "win", they will be found + // methods in interfaces. This works because of single inheritance. + // Private methods in classes do not "win", they will be found // first on searching, but overriding for invokevirtual needs // to find default method candidates for the same signature _family->set_target_if_empty(m); @@ -745,10 +750,10 @@ static void create_defaults_and_exceptions( static void generate_erased_defaults( InstanceKlass* klass, GrowableArray* empty_slots, - EmptyVtableSlot* slot, TRAPS) { + EmptyVtableSlot* slot, bool is_intf, TRAPS) { // sets up a set of methods with the same exact erased signature - FindMethodsByErasedSig visitor(slot->name(), slot->signature()); + FindMethodsByErasedSig visitor(slot->name(), slot->signature(), is_intf); visitor.run(klass); MethodFamily* family; @@ -817,7 +822,7 @@ void DefaultMethods::generate_default_methods( slot->print_on(&ls); ls.cr(); } - generate_erased_defaults(klass, empty_slots, slot, CHECK); + generate_erased_defaults(klass, empty_slots, slot, klass->is_interface(), CHECK); } log_debug(defaultmethods)("Creating defaults and overpasses..."); create_defaults_and_exceptions(empty_slots, klass, CHECK); diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp index 9047b2a0d39..65939640913 100644 --- a/src/hotspot/share/classfile/systemDictionary.hpp +++ b/src/hotspot/share/classfile/systemDictionary.hpp @@ -649,6 +649,12 @@ public: static bool is_platform_class_loader(oop class_loader); static void clear_invoke_method_table(); + // Returns TRUE if the method is a non-public member of class java.lang.Object. + static bool is_nonpublic_Object_method(Method* m) { + assert(m != NULL, "Unexpected NULL Method*"); + return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass(); + } + protected: static InstanceKlass* find_shared_class(Symbol* class_name); diff --git a/src/hotspot/share/oops/cpCache.cpp b/src/hotspot/share/oops/cpCache.cpp index 3434af1f114..661428651f1 100644 --- a/src/hotspot/share/oops/cpCache.cpp +++ b/src/hotspot/share/oops/cpCache.cpp @@ -177,6 +177,7 @@ void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_co // instruction somehow links to a non-interface method (in Object). // In that case, the method has no itable index and must be invoked as a virtual. // Set a flag to keep track of this corner case. + assert(method->is_public(), "Calling non-public method in Object with invokeinterface"); change_to_virtual = true; // ...and fall through as if we were handling invokevirtual: diff --git a/src/hotspot/share/oops/klassVtable.cpp b/src/hotspot/share/oops/klassVtable.cpp index 1789f6c6264..a718ccd3e96 100644 --- a/src/hotspot/share/oops/klassVtable.cpp +++ b/src/hotspot/share/oops/klassVtable.cpp @@ -86,13 +86,14 @@ void klassVtable::compute_vtable_size_and_num_mirandas( GrowableArray new_mirandas(20); // compute the number of mirandas methods that must be added to the end - get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces); + get_mirandas(&new_mirandas, all_mirandas, super, methods, NULL, local_interfaces, + class_flags.is_interface()); *num_new_mirandas = new_mirandas.length(); // Interfaces do not need interface methods in their vtables // This includes miranda methods and during later processing, default methods if (!class_flags.is_interface()) { - vtable_length += *num_new_mirandas * vtableEntry::size(); + vtable_length += *num_new_mirandas * vtableEntry::size(); } if (Universe::is_bootstrapping() && vtable_length == 0) { @@ -454,8 +455,13 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, const methodHand } else { super_method = method_at(i); } - // Check if method name matches - if (super_method->name() == name && super_method->signature() == signature) { + // Check if method name matches. Ignore match if klass is an interface and the + // matching method is a non-public java.lang.Object method. (See JVMS 5.4.3.4) + // This is safe because the method at this slot should never get invoked. + // (TBD: put in a method to throw NoSuchMethodError if this slot is ever used.) + if (super_method->name() == name && super_method->signature() == signature && + (!_klass->is_interface() || + !SystemDictionary::is_nonpublic_Object_method(super_method))) { // get super_klass for method_holder for the found method InstanceKlass* super_klass = super_method->method_holder(); @@ -713,7 +719,7 @@ bool klassVtable::is_miranda_entry_at(int i) { if (mhk->is_interface()) { assert(m->is_public(), "should be public"); assert(ik()->implements_interface(method_holder) , "this class should implement the interface"); - if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super())) { + if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super(), klass()->is_interface())) { return true; } } @@ -738,7 +744,10 @@ bool klassVtable::is_miranda_entry_at(int i) { // During the first run, the current instanceKlass has not yet been // created, the superclasses and superinterfaces do have instanceKlasses // but may not have vtables, the default_methods list is empty, no overpasses. -// This is seen by default method creation. +// Default method generation uses the all_mirandas array as the starter set for +// maximally-specific default method calculation. So, for both classes and +// interfaces, it is necessary that the first pass will find all non-private +// interface instance methods, whether or not they are concrete. // // Pass 2: recalculated during vtable initialization: only include abstract methods. // The goal of pass 2 is to walk through the superinterfaces to see if any of @@ -772,7 +781,8 @@ bool klassVtable::is_miranda_entry_at(int i) { // Part of the Miranda Rights in the US mean that if you do not have // an attorney one will be appointed for you. bool klassVtable::is_miranda(Method* m, Array* class_methods, - Array* default_methods, const Klass* super) { + Array* default_methods, const Klass* super, + bool is_interface) { if (m->is_static() || m->is_private() || m->is_overpass()) { return false; } @@ -800,8 +810,11 @@ bool klassVtable::is_miranda(Method* m, Array* class_methods, for (const Klass* cursuper = super; cursuper != NULL; cursuper = cursuper->super()) { - if (InstanceKlass::cast(cursuper)->find_local_method(name, signature, - Klass::find_overpass, Klass::skip_static, Klass::skip_private) != NULL) { + Method* found_mth = InstanceKlass::cast(cursuper)->find_local_method(name, signature, + Klass::find_overpass, Klass::skip_static, Klass::skip_private); + // Ignore non-public methods in java.lang.Object if klass is an interface. + if (found_mth != NULL && (!is_interface || + !SystemDictionary::is_nonpublic_Object_method(found_mth))) { return false; } } @@ -820,7 +833,7 @@ bool klassVtable::is_miranda(Method* m, Array* class_methods, void klassVtable::add_new_mirandas_to_lists( GrowableArray* new_mirandas, GrowableArray* all_mirandas, Array* current_interface_methods, Array* class_methods, - Array* default_methods, const Klass* super) { + Array* default_methods, const Klass* super, bool is_interface) { // iterate thru the current interface's method to see if it a miranda int num_methods = current_interface_methods->length(); @@ -839,7 +852,7 @@ void klassVtable::add_new_mirandas_to_lists( } if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable - if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all? + if (is_miranda(im, class_methods, default_methods, super, is_interface)) { // is it a miranda at all? const InstanceKlass *sk = InstanceKlass::cast(super); // check if it is a duplicate of a super's miranda if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) { @@ -858,7 +871,8 @@ void klassVtable::get_mirandas(GrowableArray* new_mirandas, const Klass* super, Array* class_methods, Array* default_methods, - Array* local_interfaces) { + Array* local_interfaces, + bool is_interface) { assert((new_mirandas->length() == 0) , "current mirandas must be 0"); // iterate thru the local interfaces looking for a miranda @@ -867,7 +881,7 @@ void klassVtable::get_mirandas(GrowableArray* new_mirandas, InstanceKlass *ik = InstanceKlass::cast(local_interfaces->at(i)); add_new_mirandas_to_lists(new_mirandas, all_mirandas, ik->methods(), class_methods, - default_methods, super); + default_methods, super, is_interface); // iterate thru each local's super interfaces Array* super_ifs = ik->transitive_interfaces(); int num_super_ifs = super_ifs->length(); @@ -875,7 +889,7 @@ void klassVtable::get_mirandas(GrowableArray* new_mirandas, InstanceKlass *sik = InstanceKlass::cast(super_ifs->at(j)); add_new_mirandas_to_lists(new_mirandas, all_mirandas, sik->methods(), class_methods, - default_methods, super); + default_methods, super, is_interface); } } } @@ -888,7 +902,8 @@ void klassVtable::get_mirandas(GrowableArray* new_mirandas, int klassVtable::fill_in_mirandas(int initialized) { GrowableArray mirandas(20); get_mirandas(&mirandas, NULL, ik()->super(), ik()->methods(), - ik()->default_methods(), ik()->local_interfaces()); + ik()->default_methods(), ik()->local_interfaces(), + klass()->is_interface()); for (int i = 0; i < mirandas.length(); i++) { if (log_develop_is_enabled(Trace, vtables)) { Method* meth = mirandas.at(i); diff --git a/src/hotspot/share/oops/klassVtable.hpp b/src/hotspot/share/oops/klassVtable.hpp index e0ad097b1a9..97ca22c991e 100644 --- a/src/hotspot/share/oops/klassVtable.hpp +++ b/src/hotspot/share/oops/klassVtable.hpp @@ -144,21 +144,24 @@ class klassVtable VALUE_OBJ_CLASS_SPEC { bool is_miranda_entry_at(int i); int fill_in_mirandas(int initialized); static bool is_miranda(Method* m, Array* class_methods, - Array* default_methods, const Klass* super); + Array* default_methods, const Klass* super, + bool is_interface); static void add_new_mirandas_to_lists( GrowableArray* new_mirandas, GrowableArray* all_mirandas, Array* current_interface_methods, Array* class_methods, Array* default_methods, - const Klass* super); + const Klass* super, + bool is_interface); static void get_mirandas( GrowableArray* new_mirandas, GrowableArray* all_mirandas, const Klass* super, Array* class_methods, Array* default_methods, - Array* local_interfaces); + Array* local_interfaces, + bool is_interface); void verify_against(outputStream* st, klassVtable* vt, int index); inline InstanceKlass* ik() const; // When loading a class from CDS archive at run time, and no class redefintion diff --git a/test/hotspot/jtreg/runtime/clone/AbstractClone.java b/test/hotspot/jtreg/runtime/clone/AbstractClone.java new file mode 100644 index 00000000000..52b5b990850 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/AbstractClone.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that invokeinterface of clone() works properly where clone() is + * an abstract method in a superinterface and also overridden locally. + * @run main AbstractClone + */ + +public class AbstractClone { + + interface I1 { + Object clone(); + } + + interface I2 extends I1 { } + + static class C implements I2 { + public Object clone() { + return "In C's clone()"; + } + } + + static Object test(I2 i) { return i.clone(); } + + public static void main(String[] args) { + String s = (String)test(new C()); + if (!s.equals("In C's clone()")) { + throw new RuntimeException("Wrong clone() called"); + } + } +} diff --git a/test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm b/test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm new file mode 100644 index 00000000000..d08263e701d --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/AbstractNoClones.jasm @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that invokeinterface of clone() works properly where clone() is + * an abstract method in a superinterface and not overridden locally. + * @compile AbstractNoClones.jasm + * @run main AbstractNoClones + */ + +// The below .jasm code implements the following java code: +// +// public class AbstractNoClones { +// +// interface I1 { +// Object clone(); +// } +// +// interface I2 extends I1 { } +// +// static class C implements I2 { } +// +// static Object test(I2 i) { return i.clone(); } +// +// public static void main(String[] args) { +// try { +// String s = (String)test(new C()); +// throw new RuntimeException("Expected IAE not thrown"); +// } catch (java.lang.IllegalAccessError e) { +// if (!e.toString().contains("C.clone")) { +// throw new RuntimeException("Wrong IllegalAccessError exception thrown"); +// } +// } +// } +// } + + +interface AbstractNoClones$I1 version 53:0 { + + public abstract Method clone:"()Ljava/lang/Object;"; + + static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones; + +} // end Class AbstractNoClones$I1 + + +interface AbstractNoClones$I2 implements AbstractNoClones$I1 version 53:0 { + + static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones; + static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones; + +} // end Class AbstractNoClones$I2 + + +super class AbstractNoClones$C implements AbstractNoClones$I2 version 53:0 { + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static InnerClass C=class AbstractNoClones$C of class AbstractNoClones; + static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones; + +} // end Class AbstractNoClones$C + + +super public class AbstractNoClones version 53:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod AbstractNoClones$I2.clone:"()Ljava/lang/Object;", 1; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + try t0; + new class AbstractNoClones$C; + dup; + invokespecial Method AbstractNoClones$C."":"()V"; + invokestatic Method test:"(LAbstractNoClones$I2;)Ljava/lang/Object;"; + checkcast class java/lang/String; + astore_1; + new class java/lang/RuntimeException; + dup; + ldc String "Expected IAE not thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + endtry t0; + catch t0 java/lang/IllegalAccessError; + stack_frame_type stack1; + stack_map class java/lang/IllegalAccessError; + astore_1; + aload_1; + invokevirtual Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;"; + ldc String "C.clone"; + invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z"; + ifne L47; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong IllegalAccessError exception thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L47: stack_frame_type same; + return; + } + + static InnerClass C=class AbstractNoClones$C of class AbstractNoClones; + static abstract interface InnerClass I2=class AbstractNoClones$I2 of class AbstractNoClones; + static abstract interface InnerClass I1=class AbstractNoClones$I1 of class AbstractNoClones; + +} // end Class AbstractNoClones diff --git a/test/hotspot/jtreg/runtime/clone/DefaultClone.jasm b/test/hotspot/jtreg/runtime/clone/DefaultClone.jasm new file mode 100644 index 00000000000..949e4f36367 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/DefaultClone.jasm @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that a default method named clone() does not get masked by + * java.lang.Object.clone() during resolution. + * @compile DefaultClone.jasm + * @run main DefaultClone + */ + +// The below .jasm code implements the following java code: +// +// public class DefaultClone { +// +// interface I1 { +// default Object clone() { +// return "In I1's clone()"; +// } +// } +// +// +// interface I2 extends I1 { } +// +// +// static class C implements I2 { +// public Object clone() { +// return "In C's clone()"; +// } +// } +// +// +// static Object test(I2 i) { return i.clone(); } +// +// public static void main(String[] args) { +// String s = (String)test(new C()); +// if (!s.equals("In C's clone()")) { +// throw new RuntimeException("Wrong clone() called"); +// } +// } +// } + + +interface DefaultClone$I1 version 53:0 { + + public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 { + ldc String "In I1\'s clone()"; + areturn; + } + + static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone; + +} // end Class DefaultClone$I1 + + + +interface DefaultClone$I2 implements DefaultClone$I1 version 53:0 { + + static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone; + static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone; + +} // end Class DefaultClone$I2 + + +super class DefaultClone$C implements DefaultClone$I2 version 53:0 { + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 { + ldc String "In C\'s clone()"; + areturn; + } + + static InnerClass C=class DefaultClone$C of class DefaultClone; + static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone; + +} // end Class DefaultClone$C + + +super public class DefaultClone version 53:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LDefaultClone$I2;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod DefaultClone$I2.clone:"()Ljava/lang/Object;", 1; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + new class DefaultClone$C; + dup; + invokespecial Method DefaultClone$C."":"()V"; + invokestatic Method test:"(LDefaultClone$I2;)Ljava/lang/Object;"; + checkcast class java/lang/String; + astore_1; + aload_1; + ldc String "In C\'s clone()"; + invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; + ifne L33; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong clone() called"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L33: stack_frame_type append; + locals_map class java/lang/String; + return; + } + + static InnerClass C=class DefaultClone$C of class DefaultClone; + static abstract interface InnerClass I2=class DefaultClone$I2 of class DefaultClone; + static abstract interface InnerClass I1=class DefaultClone$I1 of class DefaultClone; + +} // end Class DefaultClone diff --git a/test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm b/test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm new file mode 100644 index 00000000000..18be16bea72 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/DefaultFinalize.jasm @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that a default method named finalize() does not get masked by + * java.lang.Object.finalize() during resolution. + * @compile DefaultFinalize.jasm + * @run main DefaultFinalize + */ + +// The below .jasm code implements the following java code: +// +// public class DefaultFinalize { +// +// static String res; +// +// interface I1 { +// default void finalize() { +// res = "In I1's finalize()"; +// } +// } +// +// interface I2 extends I1 { } +// +// static class C implements I2 { +// public void finalize() { +// res = "In C's finalize()"; +// } +// } +// +// static void test(I2 i) { i.finalize(); } +// +// public static void main(String[] args) { +// test(new C()); +// if (!res.equals("In C's finalize()")) { +// throw new RuntimeException("Wrong finalize() method called"); +// } +// } +// } + + +interface DefaultFinalize$I1 version 54:0 { + + public Method finalize:"()V" stack 1 locals 1 { + ldc String "In I1\'s finalize()"; + putstatic Field DefaultFinalize.res:"Ljava/lang/String;"; + return; + } + + static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize; + +} // end Class DefaultFinalize$I1 + + +interface DefaultFinalize$I2 implements DefaultFinalize$I1 version 54:0 { + + static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize; + static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize; + +} // end Class DefaultFinalize$I2 + + +super class DefaultFinalize$C implements DefaultFinalize$I2 version 54:0 { + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public Method finalize:"()V" stack 1 locals 1 { + ldc String "In C\'s finalize()"; + putstatic Field DefaultFinalize.res:"Ljava/lang/String;"; + return; + } + + static InnerClass C=class DefaultFinalize$C of class DefaultFinalize; + static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize; + +} // end Class DefaultFinalize$C + + +super public class DefaultFinalize version 54:0 { + + static Field res:"Ljava/lang/String;"; + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LDefaultFinalize$I2;)V" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod DefaultFinalize$I2.finalize:"()V", 1; + return; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 { + new class DefaultFinalize$C; + dup; + invokespecial Method DefaultFinalize$C."":"()V"; + invokestatic Method test:"(LDefaultFinalize$I2;)V"; + getstatic Field res:"Ljava/lang/String;"; + ldc String "In C\'s finalize()"; + invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; + ifne L31; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong finalize() method called"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L31: stack_frame_type same; + return; + } + + static InnerClass C=class DefaultFinalize$C of class DefaultFinalize; + static abstract interface InnerClass I2=class DefaultFinalize$I2 of class DefaultFinalize; + static abstract interface InnerClass I1=class DefaultFinalize$I1 of class DefaultFinalize; + +} // end Class DefaultFinalize diff --git a/test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm b/test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm new file mode 100644 index 00000000000..3fc12795e8a --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/DefaultHashCode.jasm @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that invokeinterface calls the right hashCode() method when + * there is both a local method named hashCode() and a default method + * named hashCode(). + * @compile DefaultHashCode.jasm + * @run main DefaultHashCode + */ + +// The below .jasm code implements the following java code: +// +// public class DefaultHashCode { +// +// interface I2 { +// default int hashCode() { +// return 5; +// } +// } +// +// static class C implements I2 { +// public int hashCode() { +// return 4; +// } +// } +// +// static int test(I2 i) { return i.hashCode(); } +// +// public static void main(String[] args) { +// if (test(new C()) != 4) { +// throw new RuntimeException("Wrong hashCode() function called"); +// } +// } +// } + + +interface DefaultHashCode$I2 version 53:0 { + + public Method hashCode:"()I" stack 1 locals 1 { + iconst_5; + ireturn; + } + + static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode; + +} // end Class DefaultHashCode$I2 + + +super class DefaultHashCode$C implements DefaultHashCode$I2 version 53:0 { + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public Method hashCode:"()I" stack 1 locals 1 { + iconst_4; + ireturn; + } + + static InnerClass C=class DefaultHashCode$C of class DefaultHashCode; + static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode; + +} // end Class DefaultHashCode$C + + +super public class DefaultHashCode version 53:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LDefaultHashCode$I2;)I" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod DefaultHashCode$I2.hashCode:"()I", 1; + ireturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 1 { + new class DefaultHashCode$C; + dup; + invokespecial Method DefaultHashCode$C."":"()V"; + invokestatic Method test:"(LDefaultHashCode$I2;)I"; + iconst_4; + if_icmpeq L24; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong hashCode() function called"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L24: stack_frame_type same; + return; + } + + static InnerClass C=class DefaultHashCode$C of class DefaultHashCode; + static abstract interface InnerClass I2=class DefaultHashCode$I2 of class DefaultHashCode; + +} // end Class DefaultHashCode + diff --git a/test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm b/test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm new file mode 100644 index 00000000000..d90195d438b --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/DefaultNoCloneInC.jasm @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that calling clone() with an invokeinterface opcode throws an IAE + * even if there is a default method named clone() in a super interface. + * @compile DefaultNoCloneInC.jasm + * @run main DefaultNoCloneInC + */ + +// The below .jasm code implements the following java code: +// +// public class DefaultNoCloneInC { +// +// interface I1 { +// default Object clone() { +// return "In I1's clone()"; +// } +// } +// +// +// interface I2 extends I1 { } +// +// +// static class C implements I2 { } +// +// +// static Object test(I2 i) { return i.clone(); } +// +// public static void main(String[] args) { +// try { +// String s = (String)test(new C()); +// throw new RuntimeException("Expected IAE not thrown"); +// } catch (java.lang.IllegalAccessError e) { +// if (!e.toString().contains("C.clone")) { +// throw new RuntimeException("Wrong IllegalAccessError exception thrown"); +// } +// } +// } +// } + + +interface DefaultNoCloneInC$I1 version 53:0 { + + public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 { + ldc String "In I1\'s clone()"; + areturn; + } + + static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC; + +} // end Class DefaultNoCloneInC$I1 + + +interface DefaultNoCloneInC$I2 implements DefaultNoCloneInC$I1 version 53:0 { + + static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC; + static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC; + +} // end Class DefaultNoCloneInC$I2 + + +super class DefaultNoCloneInC$C implements DefaultNoCloneInC$I2 version 53:0 { + + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC; + static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC; + +} // end Class DefaultNoCloneInC$C + + +super public class DefaultNoCloneInC version 53:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod DefaultNoCloneInC$I2.clone:"()Ljava/lang/Object;", 1; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + try t0; + new class DefaultNoCloneInC$C; + dup; + invokespecial Method DefaultNoCloneInC$C."":"()V"; + invokestatic Method test:"(LDefaultNoCloneInC$I2;)Ljava/lang/Object;"; + checkcast class java/lang/String; + astore_1; + new class java/lang/RuntimeException; + dup; + ldc String "Expected IAE not thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + endtry t0; + catch t0 java/lang/IllegalAccessError; + stack_frame_type stack1; + stack_map class java/lang/IllegalAccessError; + astore_1; + aload_1; + invokevirtual Method java/lang/IllegalAccessError.toString:"()Ljava/lang/String;"; + ldc String "C.clone"; + invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z"; + ifne L47; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong IllegalAccessError exception thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L47: stack_frame_type same; + return; + } + + static InnerClass C=class DefaultNoCloneInC$C of class DefaultNoCloneInC; + static abstract interface InnerClass I2=class DefaultNoCloneInC$I2 of class DefaultNoCloneInC; + static abstract interface InnerClass I1=class DefaultNoCloneInC$I1 of class DefaultNoCloneInC; + +} // end Class DefaultNoCloneInC diff --git a/test/hotspot/jtreg/runtime/clone/LocalClone.jasm b/test/hotspot/jtreg/runtime/clone/LocalClone.jasm new file mode 100644 index 00000000000..b4245dbf3c6 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/LocalClone.jasm @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that method resolution for invokeinterface of clone() fails + * if it cannot find a public method named clone(). + * @compile LocalClone.jasm + * @run main LocalClone + */ + +// The below .jasm code implements the following java code: +// +// interface I1 { } +// +// +// public class LocalClone { +// +// interface I2 extends I1 { } +// +// +// static class C implements I2 { +// public Object clone() { +// return "In C's clone()"; +// } +// } +// +// static Object test(I2 i) { return i.clone(); } +// +// public static void main(String[] args) { +// try { +// String s = (String)test(new C()); +// throw new RuntimeException("Expected NSME not thrown"); +// } catch (java.lang.NoSuchMethodError e) { +// if (!e.toString().contains("I2.clone")) { +// throw new RuntimeException("Wrong NoSuchMethodError exception thrown"); +// } +// } +// } +// } + + +interface I1 version 53:0 { } // end Class I1 + + +interface LocalClone$I2 implements I1 version 53:0 { + + static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone; + +} // end Class LocalClone$I2 + + +super class LocalClone$C implements LocalClone$I2 version 53:0 { + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 { + ldc String "In C\'s clone()"; + areturn; + } + + static InnerClass C=class LocalClone$C of class LocalClone; + static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone; + +} // end Class LocalClone$C + + +super public class LocalClone version 53:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LLocalClone$I2;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod LocalClone$I2.clone:"()Ljava/lang/Object;", 1; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + try t0; + new class LocalClone$C; + dup; + invokespecial Method LocalClone$C."":"()V"; + invokestatic Method test:"(LLocalClone$I2;)Ljava/lang/Object;"; + checkcast class java/lang/String; + astore_1; + new class java/lang/RuntimeException; + dup; + ldc String "Expected NSME not thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + endtry t0; + catch t0 java/lang/NoSuchMethodError; + stack_frame_type stack1; + stack_map class java/lang/NoSuchMethodError; + astore_1; + aload_1; + invokevirtual Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;"; + ldc String "I2.clone"; + invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z"; + ifne L47; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong NoSuchMethodError exception thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L47: stack_frame_type same; + return; + } + + static InnerClass C=class LocalClone$C of class LocalClone; + static abstract interface InnerClass I2=class LocalClone$I2 of class LocalClone; + +} // end Class LocalClone + diff --git a/test/hotspot/jtreg/runtime/clone/NoClones.jasm b/test/hotspot/jtreg/runtime/clone/NoClones.jasm new file mode 100644 index 00000000000..9121ee785cb --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/NoClones.jasm @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that a NoSuchMethodError exception gets thrown if invokeinterface + * calls clone() and there is no public implementation of clone(). + * @compile NoClones.jasm + * @run main NoClones + */ + +// The below .jasm code implements the following java code: +// +// interface I1 { } +// +// +// public class NoClones { +// +// interface I2 extends I1 { } +// +// static class C implements I2 { } +// +// static Object test(I2 i) { return i.clone(); } +// +// public static void main(String[] args) { +// try { +// String s = (String)test(new C()); +// throw new RuntimeException("Expected NSME not thrown"); +// } catch (java.lang.NoSuchMethodError e) { +// if (!e.toString().contains("I2.clone")) { +// throw new RuntimeException("Wrong NoSuchMethodError exception thrown"); +// } +// } +// } +// } + + +interface I1 version 53:0 { } // end Class I1 + + +interface NoClones$I2 implements I1 version 53:0 { + + static abstract interface InnerClass I2=class NoClones$I2 of class NoClones; + +} // end Class NoClones$I2 + + +super class NoClones$C implements NoClones$I2 version 53:0 { + + Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static InnerClass C=class NoClones$C of class NoClones; + static abstract interface InnerClass I2=class NoClones$I2 of class NoClones; + +} // end Class NoClones$C + + +super public class NoClones version 53:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + static Method test:"(LNoClones$I2;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokeinterface InterfaceMethod NoClones$I2.clone:"()Ljava/lang/Object;", 1; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + try t0; + new class NoClones$C; + dup; + invokespecial Method NoClones$C."":"()V"; + invokestatic Method test:"(LNoClones$I2;)Ljava/lang/Object;"; + checkcast class java/lang/String; + astore_1; + new class java/lang/RuntimeException; + dup; + ldc String "Expected NSME not thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + endtry t0; + catch t0 java/lang/NoSuchMethodError; + stack_frame_type stack1; + stack_map class java/lang/NoSuchMethodError; + astore_1; + aload_1; + invokevirtual Method java/lang/NoSuchMethodError.toString:"()Ljava/lang/String;"; + ldc String "I2.clone"; + invokevirtual Method java/lang/String.contains:"(Ljava/lang/CharSequence;)Z"; + ifne L47; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong NoSuchMethodError exception thrown"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L47: stack_frame_type same; + return; + } + + static InnerClass C=class NoClones$C of class NoClones; + static abstract interface InnerClass I2=class NoClones$I2 of class NoClones; + +} // end Class NoClones diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm new file mode 100644 index 00000000000..f065d1816d7 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/DefMethClone.jasm @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017, 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. + * + */ + +interface DefMethClone version 54:0 { + + public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 { + ldc String "In DefMethClone\'s clone()"; + areturn; + } + +} // end Class DefMethClone diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm new file mode 100644 index 00000000000..7c86e318c1a --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that invokevirtual of clone() finds the clone() method that + * is local to the calling class. + * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm + * @run main/othervm -noverify HasLocalClone + */ + +// The below .jasm code implements the following java code: +// +// public class HasLocalClone extends SuperClass implements I1 { +// +// public Object clone() { +// return "In HasLocalClone's clone()"; +// } +// +// static Object test(SuperClass a) { return a.clone(); } +// +// public static void main(String[] args) { +// String s = (String)test(new HasLocalClone()); +// if (!s.equals("In HasLocalCloneC's clone()")) { +// throw new RuntimeException("Wrong clone() called: " + s); +// } +// } +// } + + +super public class HasLocalClone extends SuperClass implements I1 version 54:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method SuperClass."":"()V"; + return; + } + + public Method clone:"()Ljava/lang/Object;" stack 1 locals 1 { + ldc String "In HasLocalClone\'s clone()"; + areturn; + } + + static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;"; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + new class HasLocalClone; + dup; + invokespecial Method "":"()V"; + invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;"; + checkcast class java/lang/String; + astore_1; + aload_1; + ldc String "In HasLocalClone\'s clone()"; + invokevirtual Method java/lang/String.equals:"(Ljava/lang/Object;)Z"; + ifne L37; + new class java/lang/RuntimeException; + dup; + aload_1; + invokedynamic InvokeDynamic REF_invokeStatic:java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Ljava/lang/String;)Ljava/lang/String;" String "Wrong clone() called: "; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L37: stack_frame_type append; + locals_map class java/lang/String; + return; + } + + public static final InnerClass Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles; + +} // end Class HasLocalClone diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java new file mode 100644 index 00000000000..1804047c063 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2017, 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. + * + */ + +interface I1 extends DefMethClone { } diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java new file mode 100644 index 00000000000..063e9f3f562 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/I1Abstr.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017, 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. + * + */ + +interface I1Abstr extends DefMethClone { + Object clone(); +} diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm new file mode 100644 index 00000000000..990790c3d47 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that invokevirtual of clone() calls java.lang.Object.clone() + * even if a superinterface has a default method named clone(). + * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm + * @run main/othervm -noverify NoLocalClone + */ + +// The below .jasm code implements the following java code: +// +// public class NoLocalClone extends SuperClass implements Cloneable,I1 { +// +// static Object test(SuperClass a) { return a.clone(); } +// +// public static void main(String[] args) { +// Object obj = test(new NoLocalClone()); +// if (!(obj instanceof NoLocalClone)) { +// throw new RuntimeException("Wrong clone() called."); +// } +// } +// } + +super public class NoLocalClone extends SuperClass implements java/lang/Cloneable, I1 version 54:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method SuperClass."":"()V"; + return; + } + + static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;"; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + new class NoLocalClone; + dup; + invokespecial Method "":"()V"; + invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;"; + astore_1; + aload_1; + instanceof class NoLocalClone; + ifne L31; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong clone() called."; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L31: stack_frame_type append; + locals_map class java/lang/Object; + return; + } + +} // end Class NoLocalClone diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm new file mode 100644 index 00000000000..b8dab0ccbca --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 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 8154587 + * @summary Check that invokevirtual of clone() calls java.lang.Object.clone() + * even if a superinterface has an abstract method named clone(). + * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm + * @run main/othervm -noverify NoLocalCloneAbstr + */ + +// The below .jasm code implements the following java code: +// +// public class NoLocalCloneAbstr extends SuperClass implements Cloneable,I1Abstr { +// +// static Object test(SuperClass a) { return a.clone(); } +// +// public static void main(String[] args) { +// Object obj = test(new NoLocalCloneAbstr()); +// if (!(obj instanceof NoLocalCloneAbstr)) { +// throw new RuntimeException("Wrong clone() called."); +// } +// } +// } + +super public class NoLocalCloneAbstr extends SuperClass implements java/lang/Cloneable, I1Abstr version 54:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method SuperClass."":"()V"; + return; + } + + static Method test:"(LSuperClass;)Ljava/lang/Object;" stack 1 locals 1 { + aload_0; + invokevirtual Method SuperClass.clone:"()Ljava/lang/Object;"; + areturn; + } + + public static Method main:"([Ljava/lang/String;)V" stack 3 locals 2 { + new class NoLocalCloneAbstr; + dup; + invokespecial Method "":"()V"; + invokestatic Method test:"(LSuperClass;)Ljava/lang/Object;"; + astore_1; + aload_1; + instanceof class NoLocalCloneAbstr; + ifne L31; + new class java/lang/RuntimeException; + dup; + ldc String "Wrong clone() called."; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L31: stack_frame_type append; + locals_map class java/lang/Object; + return; + } + +} // end Class NoLocalCloneAbstr diff --git a/test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm b/test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm new file mode 100644 index 00000000000..99b3f5681a9 --- /dev/null +++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/SuperClass.jasm @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017, 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. + * + */ + +super public class SuperClass implements DefMethClone version 54:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + +} // end Class SuperClass From dd8b1890979b1d2c998f72e20599e90b2b0a1a23 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Fri, 15 Dec 2017 15:13:18 -0500 Subject: [PATCH 22/31] 8167372: Add code to check for getting oops while thread is in native Add asserts that detect when a thread is getting oops while in native Reviewed-by: coleenp, shade, jiangli, gtriantafill --- src/hotspot/share/runtime/jniHandles.cpp | 13 +++++++++++++ src/hotspot/share/runtime/jniHandles.hpp | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/hotspot/share/runtime/jniHandles.cpp b/src/hotspot/share/runtime/jniHandles.cpp index 483f9a5cb6e..863cc7852c2 100644 --- a/src/hotspot/share/runtime/jniHandles.cpp +++ b/src/hotspot/share/runtime/jniHandles.cpp @@ -47,6 +47,7 @@ jobject JNIHandles::make_local(oop obj) { } else { Thread* thread = Thread::current(); assert(Universe::heap()->is_in_reserved(obj), "sanity check"); + assert(!current_thread_in_native(), "must not be in native"); return thread->active_handles()->allocate_handle(obj); } } @@ -59,6 +60,8 @@ jobject JNIHandles::make_local(Thread* thread, oop obj) { return NULL; // ignore null handles } else { assert(Universe::heap()->is_in_reserved(obj), "sanity check"); + assert(thread->is_Java_thread(), "not a Java thread"); + assert(!current_thread_in_native(), "must not be in native"); return thread->active_handles()->allocate_handle(obj); } } @@ -70,6 +73,7 @@ jobject JNIHandles::make_local(JNIEnv* env, oop obj) { } else { JavaThread* thread = JavaThread::thread_from_jni_environment(env); assert(Universe::heap()->is_in_reserved(obj), "sanity check"); + assert(!current_thread_in_native(), "must not be in native"); return thread->active_handles()->allocate_handle(obj); } } @@ -77,6 +81,7 @@ jobject JNIHandles::make_local(JNIEnv* env, oop obj) { jobject JNIHandles::make_global(Handle obj) { assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC"); + assert(!current_thread_in_native(), "must not be in native"); jobject res = NULL; if (!obj.is_null()) { // ignore null handles @@ -93,6 +98,7 @@ jobject JNIHandles::make_global(Handle obj) { jobject JNIHandles::make_weak_global(Handle obj) { assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC"); + assert(!current_thread_in_native(), "must not be in native"); jobject res = NULL; if (!obj.is_null()) { // ignore null handles @@ -265,6 +271,13 @@ void JNIHandles::verify() { weak_oops_do(&verify_handle); } +// This method is implemented here to avoid circular includes between +// jniHandles.hpp and thread.hpp. +bool JNIHandles::current_thread_in_native() { + Thread* thread = Thread::current(); + return (thread->is_Java_thread() && + JavaThread::current()->thread_state() == _thread_in_native); +} void jni_handles_init() { diff --git a/src/hotspot/share/runtime/jniHandles.hpp b/src/hotspot/share/runtime/jniHandles.hpp index 8bba3e3125b..535104f267d 100644 --- a/src/hotspot/share/runtime/jniHandles.hpp +++ b/src/hotspot/share/runtime/jniHandles.hpp @@ -48,6 +48,10 @@ class JNIHandles : AllStatic { template inline static oop resolve_impl(jobject handle); template static oop resolve_jweak(jweak handle); + // This method is not inlined in order to avoid circular includes between + // this header file and thread.hpp. + static bool current_thread_in_native(); + public: // Low tag bit in jobject used to distinguish a jweak. jweak is // type equivalent to jobject, but there are places where we need to @@ -230,6 +234,7 @@ inline oop JNIHandles::guard_value(oop value) { template inline oop JNIHandles::resolve_impl(jobject handle) { assert(handle != NULL, "precondition"); + assert(!current_thread_in_native(), "must not be in native"); oop result; if (is_jweak(handle)) { // Unlikely result = resolve_jweak(handle); From 12a45fe7f86c981bb7f636e8dd63cf9732641412 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Thu, 14 Dec 2017 12:57:21 +0100 Subject: [PATCH 23/31] 8193509: Test dynamic path to retrieve active processor count Reviewed-by: dholmes, mdoerr --- .../jtreg/runtime/os/TestUseCpuAllocPath.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java diff --git a/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java new file mode 100644 index 00000000000..76eb73d8085 --- /dev/null +++ b/test/hotspot/jtreg/runtime/os/TestUseCpuAllocPath.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017, 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. + */ + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +/** + * @test + * @summary If #processors > 1024 os_linux.cpp uses special coding. + * Excercise this by forcing usage of this coding. If this fails, this + * VM was either compiled on a platform which does not define CPU_ALLOC, + * or it is executed on a platform that does not support it. + * @requires os.family == "linux" + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @run driver TestUseCpuAllocPath + */ +public class TestUseCpuAllocPath { + + static final String SUCCESS_STRING = "active_processor_count: using dynamic path (forced)"; + + public static void main(String[] args) throws Exception { + ProcessBuilder pb = + ProcessTools.createJavaProcessBuilder(false, + "-Xlog:os=trace", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+UseCpuAllocPath", + "-version"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain(SUCCESS_STRING); + } +} From f01d0f469c77fdef50faa610166a262ed9e29130 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Mon, 18 Dec 2017 12:11:01 +0100 Subject: [PATCH 24/31] 8193514: UseMembar should not be obsoleted yet Reviewed-by: dcubed, acorn, mdoerr --- src/hotspot/share/runtime/arguments.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 2540390b5c9..9bdebaae906 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -497,7 +497,7 @@ static SpecialFlag const special_jvm_flags[] = { { "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, - { "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, + { "UseMembar", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "FastTLABRefill", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, { "SafepointSpinBeforeYield", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, { "DeferThrSuspendLoopCount", JDK_Version::jdk(10), JDK_Version::jdk(11), JDK_Version::jdk(12) }, From 1d0acb189a2c735b573b00eed80256a64f0eb621 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 19 Dec 2017 06:29:17 -0500 Subject: [PATCH 25/31] 8186903: Remove j-types from Atomic Make jlong into int64_t, atomic_FN_long into atomic_FN_int64, make jbyte to u_char. Reviewed-by: dholmes, dcubed --- src/hotspot/cpu/x86/stubGenerator_x86_32.cpp | 2 +- src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 30 +++++------ src/hotspot/cpu/zero/stubGenerator_zero.cpp | 2 +- src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp | 12 ++--- src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s | 12 ++--- .../os_cpu/bsd_zero/atomic_bsd_zero.hpp | 6 +-- .../os_cpu/linux_arm/atomic_linux_arm.hpp | 26 ++++----- src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp | 34 ++++++------ src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp | 36 ++++++------- .../os_cpu/linux_sparc/os_linux_sparc.hpp | 18 +++---- .../os_cpu/linux_x86/atomic_linux_x86.hpp | 12 ++--- .../os_cpu/linux_zero/atomic_linux_zero.hpp | 6 +-- .../os_cpu/solaris_sparc/os_solaris_sparc.hpp | 18 +++---- .../os_cpu/solaris_x86/atomic_solaris_x86.hpp | 54 +++++++++---------- .../os_cpu/solaris_x86/os_solaris_x86.cpp | 22 ++++---- .../os_cpu/solaris_x86/os_solaris_x86.hpp | 18 +++---- .../os_cpu/windows_x86/atomic_windows_x86.hpp | 22 ++++---- .../os_cpu/windows_x86/os_windows_x86.cpp | 44 +++++++-------- .../os_cpu/windows_x86/os_windows_x86.hpp | 30 +++++------ src/hotspot/share/runtime/atomic.hpp | 16 +++--- src/hotspot/share/runtime/stubRoutines.cpp | 3 +- src/hotspot/share/runtime/stubRoutines.hpp | 6 +-- 22 files changed, 213 insertions(+), 216 deletions(-) diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp index 677b018d838..39bdbc5fb72 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp @@ -433,7 +433,7 @@ class StubGenerator: public StubCodeGenerator { //---------------------------------------------------------------------------------------------------- - // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest) + // Support for int32_t Atomic::xchg(int32_t exchange_value, volatile int32_t* dest) // // xchg exists as far back as 8086, lock needed for MP only // Stack layout immediately after call: diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 5b28a4e28d5..6942d03aa49 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -611,8 +611,8 @@ class StubGenerator: public StubCodeGenerator { return start; } - // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest, - // jbyte compare_value) + // Support for int8_t atomic::atomic_cmpxchg(int8_t exchange_value, volatile int8_t* dest, + // int8_t compare_value) // // Arguments : // c_rarg0: exchange_value @@ -637,9 +637,9 @@ class StubGenerator: public StubCodeGenerator { return start; } - // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value, - // volatile jlong* dest, - // jlong compare_value) + // Support for int64_t atomic::atomic_cmpxchg(int64_t exchange_value, + // volatile int64_t* dest, + // int64_t compare_value) // Arguments : // c_rarg0: exchange_value // c_rarg1: dest @@ -694,8 +694,8 @@ class StubGenerator: public StubCodeGenerator { // Result: // *dest += add_value // return *dest; - address generate_atomic_add_ptr() { - StubCodeMark mark(this, "StubRoutines", "atomic_add_ptr"); + address generate_atomic_add_long() { + StubCodeMark mark(this, "StubRoutines", "atomic_add_long"); address start = __ pc(); __ movptr(rax, c_rarg0); // Copy to eax we need a return value anyhow @@ -5015,14 +5015,14 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_catch_exception_entry = generate_catch_exception(); // atomic calls - StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); - StubRoutines::_atomic_xchg_long_entry = generate_atomic_xchg_long(); - StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg(); - StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte(); - StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long(); - StubRoutines::_atomic_add_entry = generate_atomic_add(); - StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr(); - StubRoutines::_fence_entry = generate_orderaccess_fence(); + StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); + StubRoutines::_atomic_xchg_long_entry = generate_atomic_xchg_long(); + StubRoutines::_atomic_cmpxchg_entry = generate_atomic_cmpxchg(); + StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte(); + StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long(); + StubRoutines::_atomic_add_entry = generate_atomic_add(); + StubRoutines::_atomic_add_long_entry = generate_atomic_add_long(); + StubRoutines::_fence_entry = generate_orderaccess_fence(); // platform dependent StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp(); diff --git a/src/hotspot/cpu/zero/stubGenerator_zero.cpp b/src/hotspot/cpu/zero/stubGenerator_zero.cpp index 748ad405293..138da0b3a3d 100644 --- a/src/hotspot/cpu/zero/stubGenerator_zero.cpp +++ b/src/hotspot/cpu/zero/stubGenerator_zero.cpp @@ -258,7 +258,7 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_add_entry = ShouldNotCallThisStub(); - StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub(); + StubRoutines::_atomic_add_long_entry = ShouldNotCallThisStub(); StubRoutines::_fence_entry = ShouldNotCallThisStub(); } diff --git a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp index 458dcf242c8..40021fa9a65 100644 --- a/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp +++ b/src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp @@ -132,8 +132,8 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, extern "C" { // defined in bsd_x86.s - jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool); - void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst); + int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t, bool); + void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst); } template<> @@ -143,15 +143,15 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T compare_value, cmpxchg_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); - return cmpxchg_using_helper(_Atomic_cmpxchg_long, exchange_value, dest, compare_value); + return cmpxchg_using_helper(_Atomic_cmpxchg_long, exchange_value, dest, compare_value); } template<> template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { STATIC_ASSERT(8 == sizeof(T)); - volatile jlong dest; - _Atomic_move_long(reinterpret_cast(src), reinterpret_cast(&dest)); + volatile int64_t dest; + _Atomic_move_long(reinterpret_cast(src), reinterpret_cast(&dest)); return PrimitiveConversions::cast(dest); } @@ -160,7 +160,7 @@ template inline void Atomic::PlatformStore<8>::operator()(T store_value, T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); - _Atomic_move_long(reinterpret_cast(&store_value), reinterpret_cast(dest)); + _Atomic_move_long(reinterpret_cast(&store_value), reinterpret_cast(dest)); } #endif // AMD64 diff --git a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s index fa029a537c4..816b886f4f8 100644 --- a/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s +++ b/src/hotspot/os_cpu/bsd_x86/bsd_x86_32.s @@ -633,10 +633,10 @@ mmx_acs_CopyLeft: ret - # Support for jlong Atomic::cmpxchg(jlong exchange_value, - # volatile jlong* dest, - # jlong compare_value, - # bool is_MP) + # Support for int64_t Atomic::cmpxchg(int64_t exchange_value, + # volatile int64_t* dest, + # int64_t compare_value, + # bool is_MP) # .p2align 4,,15 ELF_TYPE(_Atomic_cmpxchg_long,@function) @@ -658,8 +658,8 @@ SYMBOL(_Atomic_cmpxchg_long): ret - # Support for jlong Atomic::load and Atomic::store. - # void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst) + # Support for int64_t Atomic::load and Atomic::store. + # void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst) .p2align 4,,15 ELF_TYPE(_Atomic_move_long,@function) SYMBOL(_Atomic_move_long): diff --git a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp index 0daea3c6c4b..82027fa3188 100644 --- a/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp +++ b/src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp @@ -265,8 +265,8 @@ template<> template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { STATIC_ASSERT(8 == sizeof(T)); - volatile jlong dest; - os::atomic_copy64(reinterpret_cast(src), reinterpret_cast(&dest)); + volatile int64_t dest; + os::atomic_copy64(reinterpret_cast(src), reinterpret_cast(&dest)); return PrimitiveConversions::cast(dest); } @@ -275,7 +275,7 @@ template inline void Atomic::PlatformStore<8>::operator()(T store_value, T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); - os::atomic_copy64(reinterpret_cast(&store_value), reinterpret_cast(dest)); + os::atomic_copy64(reinterpret_cast(&store_value), reinterpret_cast(dest)); } #endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP diff --git a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp index d5c6ecd9f8d..0e675007c0f 100644 --- a/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp +++ b/src/hotspot/os_cpu/linux_arm/atomic_linux_arm.hpp @@ -50,7 +50,7 @@ template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { STATIC_ASSERT(8 == sizeof(T)); return PrimitiveConversions::cast( - (*os::atomic_load_long_func)(reinterpret_cast(src))); + (*os::atomic_load_long_func)(reinterpret_cast(src))); } template<> @@ -59,7 +59,7 @@ inline void Atomic::PlatformStore<8>::operator()(T store_value, T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); (*os::atomic_store_long_func)( - PrimitiveConversions::cast(store_value), reinterpret_cast(dest)); + PrimitiveConversions::cast(store_value), reinterpret_cast(dest)); } #endif @@ -103,7 +103,7 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co : "memory"); return val; #else - return add_using_helper(os::atomic_add_func, add_value, dest); + return add_using_helper(os::atomic_add_func, add_value, dest); #endif } @@ -146,7 +146,7 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, : "memory"); return old_val; #else - return xchg_using_helper(os::atomic_xchg_func, exchange_value, dest); + return xchg_using_helper(os::atomic_xchg_func, exchange_value, dest); #endif } @@ -178,17 +178,17 @@ struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {}; #ifndef AARCH64 -inline jint reorder_cmpxchg_func(jint exchange_value, - jint volatile* dest, - jint compare_value) { +inline int32_t reorder_cmpxchg_func(int32_t exchange_value, + int32_t volatile* dest, + int32_t compare_value) { // Warning: Arguments are swapped to avoid moving them for kernel call return (*os::atomic_cmpxchg_func)(compare_value, exchange_value, dest); } -inline jlong reorder_cmpxchg_long_func(jlong exchange_value, - jlong volatile* dest, - jlong compare_value) { - assert(VM_Version::supports_cx8(), "Atomic compare and exchange jlong not supported on this architecture!"); +inline int64_t reorder_cmpxchg_long_func(int64_t exchange_value, + int64_t volatile* dest, + int64_t compare_value) { + assert(VM_Version::supports_cx8(), "Atomic compare and exchange int64_t not supported on this architecture!"); // Warning: Arguments are swapped to avoid moving them for kernel call return (*os::atomic_cmpxchg_long_func)(compare_value, exchange_value, dest); } @@ -221,7 +221,7 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, : "memory"); return rv; #else - return cmpxchg_using_helper(reorder_cmpxchg_func, exchange_value, dest, compare_value); + return cmpxchg_using_helper(reorder_cmpxchg_func, exchange_value, dest, compare_value); #endif } @@ -251,7 +251,7 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, : "memory"); return rv; #else - return cmpxchg_using_helper(reorder_cmpxchg_long_func, exchange_value, dest, compare_value); + return cmpxchg_using_helper(reorder_cmpxchg_long_func, exchange_value, dest, compare_value); #endif } diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp index 4f90cd10bee..b032eef819c 100644 --- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp +++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp @@ -598,11 +598,11 @@ void os::print_register_info(outputStream *st, const void *context) { #ifndef AARCH64 -typedef jlong cmpxchg_long_func_t(jlong, jlong, volatile jlong*); +typedef int64_t cmpxchg_long_func_t(int64_t, int64_t, volatile int64_t*); cmpxchg_long_func_t* os::atomic_cmpxchg_long_func = os::atomic_cmpxchg_long_bootstrap; -jlong os::atomic_cmpxchg_long_bootstrap(jlong compare_value, jlong exchange_value, volatile jlong* dest) { +int64_t os::atomic_cmpxchg_long_bootstrap(int64_t compare_value, int64_t exchange_value, volatile int64_t* dest) { // try to use the stub: cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); @@ -612,16 +612,16 @@ jlong os::atomic_cmpxchg_long_bootstrap(jlong compare_value, jlong exchange_valu } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jlong old_value = *dest; + int64_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } -typedef jlong load_long_func_t(const volatile jlong*); +typedef int64_t load_long_func_t(const volatile int64_t*); load_long_func_t* os::atomic_load_long_func = os::atomic_load_long_bootstrap; -jlong os::atomic_load_long_bootstrap(const volatile jlong* src) { +int64_t os::atomic_load_long_bootstrap(const volatile int64_t* src) { // try to use the stub: load_long_func_t* func = CAST_TO_FN_PTR(load_long_func_t*, StubRoutines::atomic_load_long_entry()); @@ -631,15 +631,15 @@ jlong os::atomic_load_long_bootstrap(const volatile jlong* src) { } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jlong old_value = *src; + int64_t old_value = *src; return old_value; } -typedef void store_long_func_t(jlong, volatile jlong*); +typedef void store_long_func_t(int64_t, volatile int64_t*); store_long_func_t* os::atomic_store_long_func = os::atomic_store_long_bootstrap; -void os::atomic_store_long_bootstrap(jlong val, volatile jlong* dest) { +void os::atomic_store_long_bootstrap(int64_t val, volatile int64_t* dest) { // try to use the stub: store_long_func_t* func = CAST_TO_FN_PTR(store_long_func_t*, StubRoutines::atomic_store_long_entry()); @@ -652,11 +652,11 @@ void os::atomic_store_long_bootstrap(jlong val, volatile jlong* dest) { *dest = val; } -typedef jint atomic_add_func_t(jint add_value, volatile jint *dest); +typedef int32_t atomic_add_func_t(int32_t add_value, volatile int32_t *dest); atomic_add_func_t * os::atomic_add_func = os::atomic_add_bootstrap; -jint os::atomic_add_bootstrap(jint add_value, volatile jint *dest) { +int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest) { atomic_add_func_t * func = CAST_TO_FN_PTR(atomic_add_func_t*, StubRoutines::atomic_add_entry()); if (func != NULL) { @@ -664,16 +664,16 @@ jint os::atomic_add_bootstrap(jint add_value, volatile jint *dest) { return (*func)(add_value, dest); } - jint old_value = *dest; + int32_t old_value = *dest; *dest = old_value + add_value; return (old_value + add_value); } -typedef jint atomic_xchg_func_t(jint exchange_value, volatile jint *dest); +typedef int32_t atomic_xchg_func_t(int32_t exchange_value, volatile int32_t *dest); atomic_xchg_func_t * os::atomic_xchg_func = os::atomic_xchg_bootstrap; -jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest) { +int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest) { atomic_xchg_func_t * func = CAST_TO_FN_PTR(atomic_xchg_func_t*, StubRoutines::atomic_xchg_entry()); if (func != NULL) { @@ -681,16 +681,16 @@ jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest) { return (*func)(exchange_value, dest); } - jint old_value = *dest; + int32_t old_value = *dest; *dest = exchange_value; return (old_value); } -typedef jint cmpxchg_func_t(jint, jint, volatile jint*); +typedef int32_t cmpxchg_func_t(int32_t, int32_t, volatile int32_t*); cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; -jint os::atomic_cmpxchg_bootstrap(jint compare_value, jint exchange_value, volatile jint* dest) { +int32_t os::atomic_cmpxchg_bootstrap(int32_t compare_value, int32_t exchange_value, volatile int32_t* dest) { // try to use the stub: cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); @@ -700,7 +700,7 @@ jint os::atomic_cmpxchg_bootstrap(jint compare_value, jint exchange_value, volat } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jint old_value = *dest; + int32_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; diff --git a/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp b/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp index a618a83726f..2ed55a72a49 100644 --- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp +++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.hpp @@ -45,35 +45,35 @@ static bool register_code_area(char *low, char *high) { return true; } #ifndef AARCH64 - static jlong (*atomic_cmpxchg_long_func)(jlong compare_value, - jlong exchange_value, - volatile jlong *dest); + static int64_t (*atomic_cmpxchg_long_func)(int64_t compare_value, + int64_t exchange_value, + volatile int64_t *dest); - static jlong (*atomic_load_long_func)(const volatile jlong*); + static int64_t (*atomic_load_long_func)(const volatile int64_t*); - static void (*atomic_store_long_func)(jlong, volatile jlong*); + static void (*atomic_store_long_func)(int64_t, volatile int64_t*); - static jint (*atomic_add_func)(jint add_value, volatile jint *dest); + static int32_t (*atomic_add_func)(int32_t add_value, volatile int32_t *dest); - static jint (*atomic_xchg_func)(jint exchange_value, volatile jint *dest); + static int32_t (*atomic_xchg_func)(int32_t exchange_value, volatile int32_t *dest); - static jint (*atomic_cmpxchg_func)(jint compare_value, - jint exchange_value, - volatile jint *dest); + static int32_t (*atomic_cmpxchg_func)(int32_t compare_value, + int32_t exchange_value, + volatile int32_t *dest); - static jlong atomic_cmpxchg_long_bootstrap(jlong, jlong, volatile jlong*); + static int64_t atomic_cmpxchg_long_bootstrap(int64_t, int64_t, volatile int64_t*); - static jlong atomic_load_long_bootstrap(const volatile jlong*); + static int64_t atomic_load_long_bootstrap(const volatile int64_t*); - static void atomic_store_long_bootstrap(jlong, volatile jlong*); + static void atomic_store_long_bootstrap(int64_t, volatile int64_t*); - static jint atomic_add_bootstrap(jint add_value, volatile jint *dest); + static int32_t atomic_add_bootstrap(int32_t add_value, volatile int32_t *dest); - static jint atomic_xchg_bootstrap(jint exchange_value, volatile jint *dest); + static int32_t atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest); - static jint atomic_cmpxchg_bootstrap(jint compare_value, - jint exchange_value, - volatile jint *dest); + static int32_t atomic_cmpxchg_bootstrap(int32_t compare_value, + int32_t exchange_value, + volatile int32_t *dest); #endif // !AARCH64 #endif // OS_CPU_LINUX_ARM_VM_OS_LINUX_ARM_HPP diff --git a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp index 22d9cf0d88e..4107cfa0ba4 100644 --- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp +++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -28,15 +28,15 @@ // // NOTE: we are back in class os here, not Linux // - static jint (*atomic_xchg_func) (jint, volatile jint*); - static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint); - static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong); - static jint (*atomic_add_func) (jint, volatile jint*); + static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*); + static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t); + static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t); + static int32_t (*atomic_add_func) (int32_t, volatile int32_t*); - static jint atomic_xchg_bootstrap (jint, volatile jint*); - static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint); - static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong); - static jint atomic_add_bootstrap (jint, volatile jint*); + static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*); + static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t); + static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t); + static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*); static void setup_fpu() {} diff --git a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp index be5649dc401..882ec3a5a9e 100644 --- a/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp +++ b/src/hotspot/os_cpu/linux_x86/atomic_linux_x86.hpp @@ -133,8 +133,8 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, extern "C" { // defined in linux_x86.s - jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong); - void _Atomic_move_long(const volatile jlong* src, volatile jlong* dst); + int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t); + void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst); } template<> @@ -144,15 +144,15 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T compare_value, cmpxchg_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); - return cmpxchg_using_helper(_Atomic_cmpxchg_long, exchange_value, dest, compare_value); + return cmpxchg_using_helper(_Atomic_cmpxchg_long, exchange_value, dest, compare_value); } template<> template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { STATIC_ASSERT(8 == sizeof(T)); - volatile jlong dest; - _Atomic_move_long(reinterpret_cast(src), reinterpret_cast(&dest)); + volatile int64_t dest; + _Atomic_move_long(reinterpret_cast(src), reinterpret_cast(&dest)); return PrimitiveConversions::cast(dest); } @@ -161,7 +161,7 @@ template inline void Atomic::PlatformStore<8>::operator()(T store_value, T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); - _Atomic_move_long(reinterpret_cast(&store_value), reinterpret_cast(dest)); + _Atomic_move_long(reinterpret_cast(&store_value), reinterpret_cast(dest)); } #endif // AMD64 diff --git a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp index af9eb3fb85c..0f02bca36c7 100644 --- a/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp +++ b/src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp @@ -185,8 +185,8 @@ template<> template inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const { STATIC_ASSERT(8 == sizeof(T)); - volatile jlong dest; - os::atomic_copy64(reinterpret_cast(src), reinterpret_cast(&dest)); + volatile int64_t dest; + os::atomic_copy64(reinterpret_cast(src), reinterpret_cast(&dest)); return PrimitiveConversions::cast(dest); } @@ -195,7 +195,7 @@ template inline void Atomic::PlatformStore<8>::operator()(T store_value, T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); - os::atomic_copy64(reinterpret_cast(&store_value), reinterpret_cast(dest)); + os::atomic_copy64(reinterpret_cast(&store_value), reinterpret_cast(dest)); } #endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_HPP diff --git a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp index 59bd417b470..82557d91f70 100644 --- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp +++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -28,15 +28,15 @@ // // NOTE: we are back in class os here, not Solaris // - static jint (*atomic_xchg_func) (jint, volatile jint*); - static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint); - static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong); - static jint (*atomic_add_func) (jint, volatile jint*); + static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*); + static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t); + static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t); + static int32_t (*atomic_add_func) (int32_t, volatile int32_t*); - static jint atomic_xchg_bootstrap (jint, volatile jint*); - static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint); - static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong); - static jint atomic_add_bootstrap (jint, volatile jint*); + static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*); + static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t); + static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t); + static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*); static void setup_fpu() {} diff --git a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp index 4acd7df025d..7844a146a32 100644 --- a/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp +++ b/src/hotspot/os_cpu/solaris_x86/atomic_solaris_x86.hpp @@ -28,16 +28,16 @@ // For Sun Studio - implementation is in solaris_x86_64.il. extern "C" { - jint _Atomic_add(jint add_value, volatile jint* dest); - jlong _Atomic_add_long(jlong add_value, volatile jlong* dest); + int32_t _Atomic_add(int32_t add_value, volatile int32_t* dest); + int64_t _Atomic_add_long(int64_t add_value, volatile int64_t* dest); - jint _Atomic_xchg(jint exchange_value, volatile jint* dest); - jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, - jbyte compare_value); - jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest, - jint compare_value); - jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest, - jlong compare_value); + int32_t _Atomic_xchg(int32_t exchange_value, volatile int32_t* dest); + int8_t _Atomic_cmpxchg_byte(int8_t exchange_value, volatile int8_t* dest, + int8_t compare_value); + int32_t _Atomic_cmpxchg(int32_t exchange_value, volatile int32_t* dest, + int32_t compare_value); + int64_t _Atomic_cmpxchg_long(int64_t exchange_value, volatile int64_t* dest, + int64_t compare_value); } template @@ -55,8 +55,8 @@ inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) co STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); return PrimitiveConversions::cast( - _Atomic_add(PrimitiveConversions::cast(add_value), - reinterpret_cast(dest))); + _Atomic_add(PrimitiveConversions::cast(add_value), + reinterpret_cast(dest))); } // Not using add_using_helper; see comment for cmpxchg. @@ -66,8 +66,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); return PrimitiveConversions::cast( - _Atomic_add_long(PrimitiveConversions::cast(add_value), - reinterpret_cast(dest))); + _Atomic_add_long(PrimitiveConversions::cast(add_value), + reinterpret_cast(dest))); } template<> @@ -76,11 +76,11 @@ inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, T volatile* dest) const { STATIC_ASSERT(4 == sizeof(T)); return PrimitiveConversions::cast( - _Atomic_xchg(PrimitiveConversions::cast(exchange_value), - reinterpret_cast(dest))); + _Atomic_xchg(PrimitiveConversions::cast(exchange_value), + reinterpret_cast(dest))); } -extern "C" jlong _Atomic_xchg_long(jlong exchange_value, volatile jlong* dest); +extern "C" int64_t _Atomic_xchg_long(int64_t exchange_value, volatile int64_t* dest); template<> template @@ -88,8 +88,8 @@ inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); return PrimitiveConversions::cast( - _Atomic_xchg_long(PrimitiveConversions::cast(exchange_value), - reinterpret_cast(dest))); + _Atomic_xchg_long(PrimitiveConversions::cast(exchange_value), + reinterpret_cast(dest))); } // Not using cmpxchg_using_helper here, because some configurations of @@ -106,9 +106,9 @@ inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value, cmpxchg_memory_order order) const { STATIC_ASSERT(1 == sizeof(T)); return PrimitiveConversions::cast( - _Atomic_cmpxchg_byte(PrimitiveConversions::cast(exchange_value), - reinterpret_cast(dest), - PrimitiveConversions::cast(compare_value))); + _Atomic_cmpxchg_byte(PrimitiveConversions::cast(exchange_value), + reinterpret_cast(dest), + PrimitiveConversions::cast(compare_value))); } template<> @@ -119,9 +119,9 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, cmpxchg_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); return PrimitiveConversions::cast( - _Atomic_cmpxchg(PrimitiveConversions::cast(exchange_value), - reinterpret_cast(dest), - PrimitiveConversions::cast(compare_value))); + _Atomic_cmpxchg(PrimitiveConversions::cast(exchange_value), + reinterpret_cast(dest), + PrimitiveConversions::cast(compare_value))); } template<> @@ -132,9 +132,9 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, cmpxchg_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return PrimitiveConversions::cast( - _Atomic_cmpxchg_long(PrimitiveConversions::cast(exchange_value), - reinterpret_cast(dest), - PrimitiveConversions::cast(compare_value))); + _Atomic_cmpxchg_long(PrimitiveConversions::cast(exchange_value), + reinterpret_cast(dest), + PrimitiveConversions::cast(compare_value))); } #endif // OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_HPP diff --git a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp index 570ce8c4788..b61011b04ea 100644 --- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp +++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp @@ -904,12 +904,12 @@ void os::Solaris::init_thread_fpu_state(void) { // until initialization is complete. // TODO - replace with .il implementation when compiler supports it. -typedef jint xchg_func_t (jint, volatile jint*); -typedef jint cmpxchg_func_t (jint, volatile jint*, jint); -typedef jlong cmpxchg_long_func_t(jlong, volatile jlong*, jlong); -typedef jint add_func_t (jint, volatile jint*); +typedef int32_t xchg_func_t (int32_t, volatile int32_t*); +typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t); +typedef int64_t cmpxchg_long_func_t(int64_t, volatile int64_t*, int64_t); +typedef int32_t add_func_t (int32_t, volatile int32_t*); -jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { +int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) { // try to use the stub: xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry()); @@ -919,12 +919,12 @@ jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jint old_value = *dest; + int32_t old_value = *dest; *dest = exchange_value; return old_value; } -jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) { +int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) { // try to use the stub: cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); @@ -934,13 +934,13 @@ jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jint old_value = *dest; + int32_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } -jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) { +int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) { // try to use the stub: cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); @@ -950,13 +950,13 @@ jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* de } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jlong old_value = *dest; + int64_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } -jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) { +int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) { // try to use the stub: add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry()); diff --git a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp index 90bff295ea0..f4c91a5a453 100644 --- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp +++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -31,15 +31,15 @@ #ifdef AMD64 static void setup_fpu() {} #else - static jint (*atomic_xchg_func) (jint, volatile jint*); - static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint); - static jlong (*atomic_cmpxchg_long_func)(jlong, volatile jlong*, jlong); - static jint (*atomic_add_func) (jint, volatile jint*); + static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*); + static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t); + static int64_t (*atomic_cmpxchg_long_func)(int64_t, volatile int64_t*, int64_t); + static int32_t (*atomic_add_func) (int32_t, volatile int32_t*); - static jint atomic_xchg_bootstrap (jint, volatile jint*); - static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint); - static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong); - static jint atomic_add_bootstrap (jint, volatile jint*); + static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*); + static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t); + static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t); + static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*); static void setup_fpu(); #endif // AMD64 diff --git a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp index 5b72577fc6f..293e051ffcf 100644 --- a/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/atomic_windows_x86.hpp @@ -54,13 +54,13 @@ struct Atomic::PlatformAdd template<> template inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - return add_using_helper(os::atomic_add_func, add_value, dest); + return add_using_helper(os::atomic_add_func, add_value, dest); } template<> template inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - return add_using_helper(os::atomic_add_ptr_func, add_value, dest); + return add_using_helper(os::atomic_add_long_func, add_value, dest); } #define DEFINE_STUB_XCHG(ByteSize, StubType, StubName) \ @@ -72,8 +72,8 @@ inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) co return xchg_using_helper(StubName, exchange_value, dest); \ } -DEFINE_STUB_XCHG(4, jint, os::atomic_xchg_func) -DEFINE_STUB_XCHG(8, jlong, os::atomic_xchg_long_func) +DEFINE_STUB_XCHG(4, int32_t, os::atomic_xchg_func) +DEFINE_STUB_XCHG(8, int64_t, os::atomic_xchg_long_func) #undef DEFINE_STUB_XCHG @@ -88,9 +88,9 @@ DEFINE_STUB_XCHG(8, jlong, os::atomic_xchg_long_func) return cmpxchg_using_helper(StubName, exchange_value, dest, compare_value); \ } -DEFINE_STUB_CMPXCHG(1, jbyte, os::atomic_cmpxchg_byte_func) -DEFINE_STUB_CMPXCHG(4, jint, os::atomic_cmpxchg_func) -DEFINE_STUB_CMPXCHG(8, jlong, os::atomic_cmpxchg_long_func) +DEFINE_STUB_CMPXCHG(1, int8_t, os::atomic_cmpxchg_byte_func) +DEFINE_STUB_CMPXCHG(4, int32_t, os::atomic_cmpxchg_func) +DEFINE_STUB_CMPXCHG(8, int64_t, os::atomic_cmpxchg_long_func) #undef DEFINE_STUB_CMPXCHG @@ -162,10 +162,10 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, T compare_value, cmpxchg_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); - jint ex_lo = (jint)exchange_value; - jint ex_hi = *( ((jint*)&exchange_value) + 1 ); - jint cmp_lo = (jint)compare_value; - jint cmp_hi = *( ((jint*)&compare_value) + 1 ); + int32_t ex_lo = (int32_t)exchange_value; + int32_t ex_hi = *( ((int32_t*)&exchange_value) + 1 ); + int32_t cmp_lo = (int32_t)compare_value; + int32_t cmp_hi = *( ((int32_t*)&compare_value) + 1 ); __asm { push ebx push edi diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp index 80d62854dbb..cf31a17fd49 100644 --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp @@ -218,17 +218,17 @@ void os::initialize_thread(Thread* thr) { // Atomics and Stub Functions -typedef jint xchg_func_t (jint, volatile jint*); -typedef intptr_t xchg_long_func_t (jlong, volatile jlong*); -typedef jint cmpxchg_func_t (jint, volatile jint*, jint); -typedef jbyte cmpxchg_byte_func_t (jbyte, volatile jbyte*, jbyte); -typedef jlong cmpxchg_long_func_t (jlong, volatile jlong*, jlong); -typedef jint add_func_t (jint, volatile jint*); -typedef intptr_t add_ptr_func_t (intptr_t, volatile intptr_t*); +typedef int32_t xchg_func_t (int32_t, volatile int32_t*); +typedef int64_t xchg_long_func_t (int64_t, volatile int64_t*); +typedef int32_t cmpxchg_func_t (int32_t, volatile int32_t*, int32_t); +typedef int8_t cmpxchg_byte_func_t (int8_t, volatile int8_t*, int8_t); +typedef int64_t cmpxchg_long_func_t (int64_t, volatile int64_t*, int64_t); +typedef int32_t add_func_t (int32_t, volatile int32_t*); +typedef int64_t add_long_func_t (int64_t, volatile int64_t*); #ifdef AMD64 -jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { +int32_t os::atomic_xchg_bootstrap(int32_t exchange_value, volatile int32_t* dest) { // try to use the stub: xchg_func_t* func = CAST_TO_FN_PTR(xchg_func_t*, StubRoutines::atomic_xchg_entry()); @@ -238,12 +238,12 @@ jint os::atomic_xchg_bootstrap(jint exchange_value, volatile jint* dest) { } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jint old_value = *dest; + int32_t old_value = *dest; *dest = exchange_value; return old_value; } -intptr_t os::atomic_xchg_long_bootstrap(jlong exchange_value, volatile jlong* dest) { +int64_t os::atomic_xchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest) { // try to use the stub: xchg_long_func_t* func = CAST_TO_FN_PTR(xchg_long_func_t*, StubRoutines::atomic_xchg_long_entry()); @@ -253,13 +253,13 @@ intptr_t os::atomic_xchg_long_bootstrap(jlong exchange_value, volatile jlong* de } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - intptr_t old_value = *dest; + int64_t old_value = *dest; *dest = exchange_value; return old_value; } -jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint compare_value) { +int32_t os::atomic_cmpxchg_bootstrap(int32_t exchange_value, volatile int32_t* dest, int32_t compare_value) { // try to use the stub: cmpxchg_func_t* func = CAST_TO_FN_PTR(cmpxchg_func_t*, StubRoutines::atomic_cmpxchg_entry()); @@ -269,13 +269,13 @@ jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jint old_value = *dest; + int32_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; } -jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) { +int8_t os::atomic_cmpxchg_byte_bootstrap(int8_t exchange_value, volatile int8_t* dest, int8_t compare_value) { // try to use the stub: cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry()); @@ -285,7 +285,7 @@ jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* de } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jbyte old_value = *dest; + int8_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; @@ -293,7 +293,7 @@ jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* de #endif // AMD64 -jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) { +int64_t os::atomic_cmpxchg_long_bootstrap(int64_t exchange_value, volatile int64_t* dest, int64_t compare_value) { // try to use the stub: cmpxchg_long_func_t* func = CAST_TO_FN_PTR(cmpxchg_long_func_t*, StubRoutines::atomic_cmpxchg_long_entry()); @@ -303,7 +303,7 @@ jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* de } assert(Threads::number_of_threads() == 0, "for bootstrap only"); - jlong old_value = *dest; + int64_t old_value = *dest; if (old_value == compare_value) *dest = exchange_value; return old_value; @@ -311,7 +311,7 @@ jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* de #ifdef AMD64 -jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) { +int32_t os::atomic_add_bootstrap(int32_t add_value, volatile int32_t* dest) { // try to use the stub: add_func_t* func = CAST_TO_FN_PTR(add_func_t*, StubRoutines::atomic_add_entry()); @@ -324,12 +324,12 @@ jint os::atomic_add_bootstrap(jint add_value, volatile jint* dest) { return (*dest) += add_value; } -intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* dest) { +int64_t os::atomic_add_long_bootstrap(int64_t add_value, volatile int64_t* dest) { // try to use the stub: - add_ptr_func_t* func = CAST_TO_FN_PTR(add_ptr_func_t*, StubRoutines::atomic_add_ptr_entry()); + add_long_func_t* func = CAST_TO_FN_PTR(add_long_func_t*, StubRoutines::atomic_add_long_entry()); if (func != NULL) { - os::atomic_add_ptr_func = func; + os::atomic_add_long_func = func; return (*func)(add_value, dest); } assert(Threads::number_of_threads() == 0, "for bootstrap only"); @@ -342,7 +342,7 @@ xchg_long_func_t* os::atomic_xchg_long_func = os::atomic_xchg_long_bootstr cmpxchg_func_t* os::atomic_cmpxchg_func = os::atomic_cmpxchg_bootstrap; cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap; add_func_t* os::atomic_add_func = os::atomic_add_bootstrap; -add_ptr_func_t* os::atomic_add_ptr_func = os::atomic_add_ptr_bootstrap; +add_long_func_t* os::atomic_add_long_func = os::atomic_add_long_bootstrap; #endif // AMD64 diff --git a/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp b/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp index 495ad4ff071..c3964929d19 100644 --- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp +++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.hpp @@ -29,32 +29,32 @@ // NOTE: we are back in class os here, not win32 // #ifdef AMD64 - static jint (*atomic_xchg_func) (jint, volatile jint*); - static intptr_t (*atomic_xchg_long_func) (jlong, volatile jlong*); + static int32_t (*atomic_xchg_func) (int32_t, volatile int32_t*); + static int64_t (*atomic_xchg_long_func) (int64_t, volatile int64_t*); - static jint (*atomic_cmpxchg_func) (jint, volatile jint*, jint); - static jbyte (*atomic_cmpxchg_byte_func) (jbyte, volatile jbyte*, jbyte); - static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong); + static int32_t (*atomic_cmpxchg_func) (int32_t, volatile int32_t*, int32_t); + static int8_t (*atomic_cmpxchg_byte_func) (int8_t, volatile int8_t*, int8_t); + static int64_t (*atomic_cmpxchg_long_func) (int64_t, volatile int64_t*, int64_t); - static jint (*atomic_add_func) (jint, volatile jint*); - static intptr_t (*atomic_add_ptr_func) (intptr_t, volatile intptr_t*); + static int32_t (*atomic_add_func) (int32_t, volatile int32_t*); + static int64_t (*atomic_add_long_func) (int64_t, volatile int64_t*); - static jint atomic_xchg_bootstrap (jint, volatile jint*); - static intptr_t atomic_xchg_long_bootstrap (jlong, volatile jlong*); + static int32_t atomic_xchg_bootstrap (int32_t, volatile int32_t*); + static int64_t atomic_xchg_long_bootstrap (int64_t, volatile int64_t*); - static jint atomic_cmpxchg_bootstrap (jint, volatile jint*, jint); - static jbyte atomic_cmpxchg_byte_bootstrap(jbyte, volatile jbyte*, jbyte); + static int32_t atomic_cmpxchg_bootstrap (int32_t, volatile int32_t*, int32_t); + static int8_t atomic_cmpxchg_byte_bootstrap(int8_t, volatile int8_t*, int8_t); #else - static jlong (*atomic_cmpxchg_long_func) (jlong, volatile jlong*, jlong); + static int64_t (*atomic_cmpxchg_long_func) (int64_t, volatile int64_t*, int64_t); #endif // AMD64 - static jlong atomic_cmpxchg_long_bootstrap(jlong, volatile jlong*, jlong); + static int64_t atomic_cmpxchg_long_bootstrap(int64_t, volatile int64_t*, int64_t); #ifdef AMD64 - static jint atomic_add_bootstrap (jint, volatile jint*); - static intptr_t atomic_add_ptr_bootstrap (intptr_t, volatile intptr_t*); + static int32_t atomic_add_bootstrap (int32_t, volatile int32_t*); + static int64_t atomic_add_long_bootstrap (int64_t, volatile int64_t*); #endif // AMD64 static void setup_fpu(); diff --git a/src/hotspot/share/runtime/atomic.hpp b/src/hotspot/share/runtime/atomic.hpp index 9f3411c68c1..1270369a160 100644 --- a/src/hotspot/share/runtime/atomic.hpp +++ b/src/hotspot/share/runtime/atomic.hpp @@ -45,8 +45,8 @@ enum cmpxchg_memory_order { class Atomic : AllStatic { public: - // Atomic operations on jlong types are not available on all 32-bit - // platforms. If atomic ops on jlongs are defined here they must only + // Atomic operations on int64 types are not available on all 32-bit + // platforms. If atomic ops on int64 are defined here they must only // be used from code that verifies they are available at runtime and // can provide an alternative action if not - see supports_cx8() for // a means to test availability. @@ -639,16 +639,16 @@ struct Atomic::AddImpl< // // Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment. template<> -struct Atomic::AddImpl VALUE_OBJ_CLASS_SPEC { - jshort operator()(jshort add_value, jshort volatile* dest) const { +struct Atomic::AddImpl VALUE_OBJ_CLASS_SPEC { + short operator()(short add_value, short volatile* dest) const { #ifdef VM_LITTLE_ENDIAN assert((intx(dest) & 0x03) == 0x02, "wrong alignment"); - jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1)); + int new_value = Atomic::add(add_value << 16, (volatile int*)(dest-1)); #else assert((intx(dest) & 0x03) == 0x00, "wrong alignment"); - jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest)); + int new_value = Atomic::add(add_value << 16, (volatile int*)(dest)); #endif - return (jshort)(new_value >> 16); // preserves sign + return (short)(new_value >> 16); // preserves sign } }; @@ -807,7 +807,7 @@ inline T Atomic::CmpxchgByteUsingInt::operator()(T exchange_value, do { // value to swap in matches current value ... uint32_t new_value = cur; - // ... except for the one jbyte we want to update + // ... except for the one byte we want to update reinterpret_cast(&new_value)[offset] = canon_exchange_value; uint32_t res = cmpxchg(new_value, aligned_dest, cur, order); diff --git a/src/hotspot/share/runtime/stubRoutines.cpp b/src/hotspot/share/runtime/stubRoutines.cpp index 3043e9382d7..ec0be25e9e3 100644 --- a/src/hotspot/share/runtime/stubRoutines.cpp +++ b/src/hotspot/share/runtime/stubRoutines.cpp @@ -62,12 +62,11 @@ address StubRoutines::_verify_oop_subroutine_entry = NULL; address StubRoutines::_atomic_xchg_entry = NULL; address StubRoutines::_atomic_xchg_long_entry = NULL; address StubRoutines::_atomic_store_entry = NULL; -address StubRoutines::_atomic_store_ptr_entry = NULL; address StubRoutines::_atomic_cmpxchg_entry = NULL; address StubRoutines::_atomic_cmpxchg_byte_entry = NULL; address StubRoutines::_atomic_cmpxchg_long_entry = NULL; address StubRoutines::_atomic_add_entry = NULL; -address StubRoutines::_atomic_add_ptr_entry = NULL; +address StubRoutines::_atomic_add_long_entry = NULL; address StubRoutines::_fence_entry = NULL; address StubRoutines::_d2i_wrapper = NULL; address StubRoutines::_d2l_wrapper = NULL; diff --git a/src/hotspot/share/runtime/stubRoutines.hpp b/src/hotspot/share/runtime/stubRoutines.hpp index 25884a86b90..23f5f35d44f 100644 --- a/src/hotspot/share/runtime/stubRoutines.hpp +++ b/src/hotspot/share/runtime/stubRoutines.hpp @@ -103,12 +103,11 @@ class StubRoutines: AllStatic { static address _atomic_xchg_entry; static address _atomic_xchg_long_entry; static address _atomic_store_entry; - static address _atomic_store_ptr_entry; static address _atomic_cmpxchg_entry; static address _atomic_cmpxchg_byte_entry; static address _atomic_cmpxchg_long_entry; static address _atomic_add_entry; - static address _atomic_add_ptr_entry; + static address _atomic_add_long_entry; static address _fence_entry; static address _d2i_wrapper; static address _d2l_wrapper; @@ -277,12 +276,11 @@ class StubRoutines: AllStatic { static address atomic_xchg_entry() { return _atomic_xchg_entry; } static address atomic_xchg_long_entry() { return _atomic_xchg_long_entry; } static address atomic_store_entry() { return _atomic_store_entry; } - static address atomic_store_ptr_entry() { return _atomic_store_ptr_entry; } static address atomic_cmpxchg_entry() { return _atomic_cmpxchg_entry; } static address atomic_cmpxchg_byte_entry() { return _atomic_cmpxchg_byte_entry; } static address atomic_cmpxchg_long_entry() { return _atomic_cmpxchg_long_entry; } static address atomic_add_entry() { return _atomic_add_entry; } - static address atomic_add_ptr_entry() { return _atomic_add_ptr_entry; } + static address atomic_add_long_entry() { return _atomic_add_long_entry; } static address fence_entry() { return _fence_entry; } static address d2i_wrapper() { return _d2i_wrapper; } From c7421b5e3bc437820b6a0a42652a356935438197 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Mon, 4 Dec 2017 08:59:47 -0800 Subject: [PATCH 26/31] 8193672: [test] Enhance vm.cds property to check for all conditions required to run CDS tests Reviewed-by: dholmes, dsamersoff, simonis --- src/hotspot/share/prims/whitebox.cpp | 8 +++++- .../ArchiveDoesNotExist.java | 2 +- .../SharedArchiveFile/BootAppendTests.java | 2 +- .../CdsDifferentCompactStrings.java | 2 +- .../CdsDifferentObjectAlignment.java | 2 +- .../CdsSameObjectAlignment.java | 2 +- .../DefaultUseWithClient.java | 2 +- .../DumpSharedDictionary.java | 2 +- .../NonBootLoaderClasses.java | 2 +- .../PrintSharedArchiveAndExit.java | 2 +- .../SharedArchiveFile/SASymbolTableTest.java | 2 +- .../SharedArchiveFile/SharedArchiveFile.java | 2 +- .../SharedArchiveFile/SharedBaseAddress.java | 2 +- .../SharedArchiveFile/SharedStrings.java | 2 +- .../SharedArchiveFile/SharedStringsDedup.java | 2 +- .../SharedStringsRunAuto.java | 2 +- .../SharedSymbolTableBucketSize.java | 2 +- .../SpaceUtilizationCheck.java | 2 +- .../TestInterpreterMethodEntries.java | 2 +- .../TransformInterfaceAndImplementor.java | 2 +- .../TransformSuperAndSubClasses.java | 2 +- .../TransformSuperSubTwoPckgs.java | 2 +- .../jtreg/runtime/appcds/AppendClasspath.java | 3 +-- .../runtime/appcds/BootClassPathMismatch.java | 3 +-- .../appcds/CaseSensitiveClassPath.java | 2 +- .../jtreg/runtime/appcds/ClassLoaderTest.java | 3 +-- .../jtreg/runtime/appcds/ClassPathAttr.java | 3 +-- .../runtime/appcds/CommandLineFlagCombo.java | 4 +-- .../appcds/CommandLineFlagComboNegative.java | 3 +-- .../runtime/appcds/DirClasspathTest.java | 3 +-- .../jtreg/runtime/appcds/DumpClassList.java | 2 +- .../jtreg/runtime/appcds/ExtraSymbols.java | 2 +- .../runtime/appcds/FieldAnnotationsTest.java | 2 +- .../runtime/appcds/FreeUnusedMetadata.java | 2 +- .../jtreg/runtime/appcds/HelloExtTest.java | 3 +-- .../jtreg/runtime/appcds/HelloTest.java | 4 +-- .../runtime/appcds/IgnoreEmptyClassPaths.java | 3 +-- .../jtreg/runtime/appcds/JvmtiAddPath.java | 3 +-- .../runtime/appcds/MismatchedUseAppCDS.java | 3 +-- .../runtime/appcds/MissingSuperTest.java | 4 +-- .../runtime/appcds/MultiProcessSharing.java | 4 +-- .../runtime/appcds/MultiReleaseJars.java | 3 +-- .../jtreg/runtime/appcds/OldClassTest.java | 3 +-- .../jtreg/runtime/appcds/PackageSealing.java | 3 +-- .../jtreg/runtime/appcds/ParallelLoad2.java | 3 +-- .../runtime/appcds/ParallelLoadTest.java | 3 +-- .../appcds/PrintSharedArchiveAndExit.java | 3 +-- .../runtime/appcds/ProhibitedPackage.java | 3 +-- .../runtime/appcds/ProtectionDomain.java | 3 +-- .../runtime/appcds/RewriteBytecodesTest.java | 3 +-- .../appcds/SharedArchiveConsistency.java | 27 +++++++++---------- .../runtime/appcds/SharedArchiveFile.java | 3 +-- .../runtime/appcds/SharedBaseAddress.java | 3 +-- .../jtreg/runtime/appcds/SharedPackages.java | 3 +-- .../jtreg/runtime/appcds/SignedJar.java | 3 +-- .../runtime/appcds/SpecifySysLoaderProp.java | 19 +++++++------ .../runtime/appcds/TraceLongClasspath.java | 3 +-- .../jtreg/runtime/appcds/UseAppCDS.java | 3 +-- .../jtreg/runtime/appcds/VerifierTest_0.java | 3 +-- .../jtreg/runtime/appcds/VerifierTest_1A.java | 3 +-- .../jtreg/runtime/appcds/VerifierTest_1B.java | 3 +-- .../jtreg/runtime/appcds/VerifierTest_2.java | 3 +-- .../jtreg/runtime/appcds/WideIloadTest.java | 2 +- .../jtreg/runtime/appcds/WrongClasspath.java | 3 +-- .../appcds/XShareAutoWithChangedJar.java | 3 +-- .../CheckCachedResolvedReferences.java | 2 +- .../cacheObject/DumpTimeVerifyFailure.java | 2 +- .../appcds/cacheObject/GCStressTest.java | 2 +- .../appcds/cacheObject/OpenArchiveRegion.java | 2 +- .../cacheObject/RangeNotWithinHeap.java | 2 +- .../appcds/cacheObject/RedefineClassTest.java | 2 +- .../appcds/customLoader/ClassListFormatA.java | 3 +-- .../appcds/customLoader/ClassListFormatB.java | 3 +-- .../appcds/customLoader/ClassListFormatC.java | 3 +-- .../appcds/customLoader/ClassListFormatD.java | 3 +-- .../appcds/customLoader/ClassListFormatE.java | 3 +-- .../appcds/customLoader/HelloCustom.java | 3 +-- .../customLoader/LoaderSegregationTest.java | 3 +-- .../customLoader/ParallelTestMultiFP.java | 3 +-- .../customLoader/ParallelTestSingleFP.java | 3 +-- .../ProhibitedPackageNamesTest.java | 3 +-- .../appcds/customLoader/ProtectionDomain.java | 3 +-- .../SameNameInTwoLoadersTest.java | 3 +-- .../customLoader/UnintendedLoadersTest.java | 3 +-- .../UnloadUnregisteredLoaderTest.java | 3 +-- .../customLoader/UnsupportedPlatforms.java | 2 -- .../runtime/appcds/javaldr/ArrayTest.java | 3 +-- .../appcds/javaldr/CheckAnonymousClass.java | 3 +-- .../runtime/appcds/javaldr/GCDuringDump.java | 2 +- .../javaldr/GCSharedStringsDuringDump.java | 2 +- .../CheckUnsupportedDumpingOptions.java | 3 +-- .../appcds/jigsaw/JigsawOptionsCombo.java | 3 +-- .../jigsaw/PatchModule/AppClassInCP.java | 2 +- .../jigsaw/PatchModule/CustomPackage.java | 2 +- .../PatchModule/MismatchedPatchModule.java | 2 +- .../appcds/jigsaw/PatchModule/PatchDir.java | 2 +- .../jigsaw/PatchModule/PatchJavaBase.java | 2 +- .../appcds/jigsaw/PatchModule/Simple.java | 2 +- .../PatchModule/SubClassOfPatchedClass.java | 2 +- .../appcds/jigsaw/PatchModule/TwoJars.java | 2 +- .../classpathtests/BootAppendTests.java | 2 +- .../jigsaw/classpathtests/ClassPathTests.java | 2 +- .../DummyClassesInBootClassPath.java | 3 +-- .../EmptyClassInBootClassPath.java | 2 +- .../jigsaw/limitmods/LimitModsTests.java | 2 +- .../jigsaw/overridetests/OverrideTests.java | 2 +- .../appcds/jvmti/ClassFileLoadHookTest.java | 2 +- .../appcds/jvmti/InstrumentationTest.java | 2 +- .../ParallelLoadAndTransformTest.java | 2 +- .../TransformInterfaceImplementorAppCDS.java | 2 +- .../TransformSuperSubAppCDS.java | 2 +- .../redefineClass/RedefineBasicTest.java | 3 +-- .../RedefineRunningMethods_Shared.java | 3 +-- .../appcds/sharedStrings/ExerciseGC.java | 2 +- .../appcds/sharedStrings/FlagCombo.java | 2 +- .../sharedStrings/IncompatibleOptions.java | 2 +- .../sharedStrings/InternSharedString.java | 2 +- .../sharedStrings/InvalidFileFormat.java | 2 +- .../appcds/sharedStrings/LargePages.java | 2 +- .../sharedStrings/LockSharedStrings.java | 2 +- .../sharedStrings/SharedStringsBasic.java | 2 +- .../sharedStrings/SharedStringsBasicPlus.java | 2 +- .../sharedStrings/SharedStringsStress.java | 2 +- .../sharedStrings/SharedStringsWbTest.java | 2 +- .../appcds/sharedStrings/SysDictCrash.java | 2 +- 125 files changed, 153 insertions(+), 205 deletions(-) diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 28d8851ff08..30b57b8f2ad 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -1727,10 +1727,16 @@ WB_END WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env)) #if INCLUDE_CDS +# ifdef _LP64 + if (!UseCompressedOops || !UseCompressedClassPointers) { + // On 64-bit VMs, CDS is supported only with compressed oops/pointers + return false; + } +# endif // _LP64 return true; #else return false; -#endif +#endif // INCLUDE_CDS WB_END diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java index 7d893d8c57c..52c198e6068 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/ArchiveDoesNotExist.java @@ -28,7 +28,7 @@ * attempting to use CDS archive. JVM should exit gracefully * when sharing mode is ON, and continue w/o sharing if sharing * mode is AUTO. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java index 287d3b30ce4..22c9da4b09c 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/BootAppendTests.java @@ -25,7 +25,7 @@ * @test * @requires vm.cds & !vm.graal.enabled * @summary Testing -Xbootclasspath/a support for CDS - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java index 12eeed2695e..d3e9d4e5a69 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentCompactStrings.java @@ -26,7 +26,7 @@ * @requires vm.cds * @summary CDS (class data sharing) requires the same -XX:[+-]CompactStrings * setting between archive creation time and load time. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java index d325850c9ed..880e544aa48 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java @@ -29,7 +29,7 @@ * This is a negative test; using object alignment for loading that * is different from object alignment for creating a CDS file * should fail when loading. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @bug 8025642 * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java index 0afbdd468a4..5d5bb3b79fa 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CdsSameObjectAlignment.java @@ -26,7 +26,7 @@ * @requires vm.cds * @summary Testing CDS (class data sharing) using varying object alignment. * Using same object alignment for each dump/load pair - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java index 6184ecf3006..157789aa286 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DefaultUseWithClient.java @@ -24,7 +24,7 @@ /* * @test DefaultUseWithClient * @summary Test default behavior of sharing with -client - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java index 102103e6835..c3ea5c8c192 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/DumpSharedDictionary.java @@ -28,7 +28,7 @@ * Feature support: compressed oops/kptrs, 64-bit os, not on windows * @requires vm.cds * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * @run main DumpSharedDictionary diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java index bf840dd566e..f52f356368d 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java @@ -24,7 +24,7 @@ /* * @test NonBootLoaderClasses * @summary Test to ensure platform and app classes are not being archived - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java index 0c628ce6e88..559a203fe43 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java @@ -26,7 +26,7 @@ * @requires vm.cds * @bug 8066670 * @summary Testing -XX:+PrintSharedArchiveAndExit option - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java index ab99c0d6823..38b2477221c 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SASymbolTableTest.java @@ -25,7 +25,7 @@ * @test SASymbolTableTest * @requires vm.cds * @summary Walk symbol table using SA, with and without CDS. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.hotspot.agent/sun.jvm.hotspot.oops diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java index d4a32eb56b6..74517933e54 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedArchiveFile.java @@ -26,7 +26,7 @@ * @requires vm.cds * @bug 8014138 * @summary Testing new -XX:SharedArchiveFile= option - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java index 3de51cd76bd..980e592d531 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedBaseAddress.java @@ -26,7 +26,7 @@ * @requires vm.cds * @summary Test variety of values for SharedBaseAddress, making sure * VM handles normal values as well as edge values w/o a crash. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java index a39a019f481..38a3d000c39 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStrings.java @@ -28,7 +28,7 @@ * are actually shared * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java index 946e52f9fe4..ca4e0937077 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsDedup.java @@ -27,7 +27,7 @@ * @summary Test -Xshare:auto with shared strings and -XX:+UseStringDeduplication * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java index d2bdc770568..7b0f4cf2d21 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedStringsRunAuto.java @@ -27,7 +27,7 @@ * @summary Test -Xshare:auto with shared strings. * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java index 5610c953e50..575dabdba9a 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java @@ -26,7 +26,7 @@ * @requires vm.cds * @bug 8059510 * @summary Test SharedSymbolTableBucketSize option - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java index f9cfe9f3ae4..e69e8966c71 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/SpaceUtilizationCheck.java @@ -25,7 +25,7 @@ * @test SpaceUtilizationCheck * @requires vm.cds * @summary Check if the space utilization for shared spaces is adequate - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java index baee2e05812..fd56dbb801b 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/TestInterpreterMethodEntries.java @@ -27,7 +27,7 @@ * @bug 8169711 * @summary Test interpreter method entries for intrinsics with CDS (class data sharing) * and different settings of the intrinsic flag during dump/use of the archive. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java index 3adc4ac8580..24bfa161956 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformInterfaceAndImplementor.java @@ -27,7 +27,7 @@ * @summary Exercise initial transformation (ClassFileLoadHook) * with CDS with Interface/Implementor pair * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java index d48a160c720..6cdc1d50ce2 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperAndSubClasses.java @@ -28,7 +28,7 @@ * @summary Exercise initial transformation (ClassFileLoadHook) * with CDS with SubClass and SuperClass * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java index ebf8e1d7f60..eb00cca41a0 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/serviceability/transformRelatedClasses/TransformSuperSubTwoPckgs.java @@ -28,7 +28,7 @@ * @summary Exercise initial transformation (ClassFileLoadHook) * with CDS with SubClass and SuperClass, each lives in own separate package * @library /test/lib /runtime/SharedArchiveFile /testlibrary/jvmti - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java b/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java index a59d1f3753b..e0703ff6da6 100644 --- a/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java +++ b/test/hotspot/jtreg/runtime/appcds/AppendClasspath.java @@ -25,8 +25,7 @@ /* * @test * @summary At run time, it is OK to append new elements to the classpath that was used at dump time. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java index 4e2bbdbce49..402dd19daac 100644 --- a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java +++ b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java @@ -25,8 +25,7 @@ /* * @test * @summary bootclasspath mismatch test. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java b/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java index 56315c16d64..c3f3c6de371 100644 --- a/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java +++ b/test/hotspot/jtreg/runtime/appcds/CaseSensitiveClassPath.java @@ -27,7 +27,7 @@ * @test * @summary Test case sensitive aspect of comparing class paths * between dump time and archive use time - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java b/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java index 8012a1de39a..bef3cc921d8 100644 --- a/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java +++ b/test/hotspot/jtreg/runtime/appcds/ClassLoaderTest.java @@ -25,8 +25,7 @@ /* * @test * @summary Initiating and defining classloader test. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java b/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java index d32f7b8f2be..4389a93c3af 100644 --- a/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java +++ b/test/hotspot/jtreg/runtime/appcds/ClassPathAttr.java @@ -25,8 +25,7 @@ /* * @test * @summary Class-Path: attribute in MANIFEST file - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java index 8f1fc68b81b..ba3f803b95b 100644 --- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java +++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java @@ -24,8 +24,8 @@ /* * @test CommandLineFlagCombo - * AppCDS does not support uncompressed oops - * @requires (vm.gc=="null") & ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) + * @requires vm.cds + * @requires (vm.gc=="null") * @summary Test command line flag combinations that * could likely affect the behaviour of AppCDS * @library /test/lib diff --git a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java index 75effb9926c..a4fb110ba32 100644 --- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java +++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagComboNegative.java @@ -28,8 +28,7 @@ * the dump and execute steps, in such way that they cause errors * E.g. use compressed oops for creating and archive, but then * execute w/o compressed oops - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java b/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java index 047f2d00080..0c78b6d4a05 100644 --- a/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java +++ b/test/hotspot/jtreg/runtime/appcds/DirClasspathTest.java @@ -25,8 +25,7 @@ /* * @test * @summary AppCDS handling of directories in -cp - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @run main DirClasspathTest */ diff --git a/test/hotspot/jtreg/runtime/appcds/DumpClassList.java b/test/hotspot/jtreg/runtime/appcds/DumpClassList.java index 4526770c2da..ab6d045f7e5 100644 --- a/test/hotspot/jtreg/runtime/appcds/DumpClassList.java +++ b/test/hotspot/jtreg/runtime/appcds/DumpClassList.java @@ -26,7 +26,7 @@ * @test * @summary DumpLoadedClassList should exclude generated classes, classes in bootclasspath/a and * --patch-module. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java index 4fc3bb8757e..5cc9a669e31 100644 --- a/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java +++ b/test/hotspot/jtreg/runtime/appcds/ExtraSymbols.java @@ -25,7 +25,7 @@ /* * @test * @summary Adding extra symbols into CDS archive using -XX:SharedArchiveConfigFile - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java b/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java index 88a346ff850..0da34651b81 100644 --- a/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java +++ b/test/hotspot/jtreg/runtime/appcds/FieldAnnotationsTest.java @@ -25,7 +25,7 @@ /* * @test * @summary Test for field annotations. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java b/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java index 30f167cdf20..f0413b6219a 100644 --- a/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java +++ b/test/hotspot/jtreg/runtime/appcds/FreeUnusedMetadata.java @@ -25,7 +25,7 @@ /* * @test * @summary Unused metadata created during dump time should be freed from the CDS archive. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules jdk.jartool/sun.tools.jar * @compile test-classes/MethodNoReturn.jasm test-classes/Hello.java diff --git a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java index 3dba32bfbd0..b9bfda3eb9b 100644 --- a/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java +++ b/test/hotspot/jtreg/runtime/appcds/HelloExtTest.java @@ -25,8 +25,7 @@ /* * @test * @summary a simple test for loading a class using the ext class loader in AppCDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/HelloTest.java b/test/hotspot/jtreg/runtime/appcds/HelloTest.java index eee29f575ad..49dd766a2dd 100644 --- a/test/hotspot/jtreg/runtime/appcds/HelloTest.java +++ b/test/hotspot/jtreg/runtime/appcds/HelloTest.java @@ -25,8 +25,7 @@ /* * @test * @summary Hello World test for AppCDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management @@ -36,7 +35,6 @@ */ public class HelloTest { - public static void main(String[] args) throws Exception { TestCommon.test(JarBuilder.getOrCreateHelloJar(), TestCommon.list("Hello"), "Hello"); diff --git a/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java b/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java index 8bf4dec9326..12c2fc89992 100644 --- a/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java +++ b/test/hotspot/jtreg/runtime/appcds/IgnoreEmptyClassPaths.java @@ -25,8 +25,7 @@ /* * @test * @summary Test the -XX:+IgnoreEmptyClassPaths flag - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java b/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java index 12d41a2c066..7f3d7069504 100644 --- a/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java +++ b/test/hotspot/jtreg/runtime/appcds/JvmtiAddPath.java @@ -25,8 +25,7 @@ /* * @test * @summary JvmtiEnv::AddToBootstrapClassLoaderSearch and JvmtiEnv::AddToSystemClassLoaderSearch should disable AppCDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @bug 8060592 * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java b/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java index 085e79e622d..2c91908cb77 100644 --- a/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java +++ b/test/hotspot/jtreg/runtime/appcds/MismatchedUseAppCDS.java @@ -25,8 +25,7 @@ /* * @test * @summary Try different combination of mismatched UseAppCDS between dump time and run time. - * (Note: AppCDS does not support uncompressed oops.) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java b/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java index fa9bfb93493..e18eb586b85 100644 --- a/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java +++ b/test/hotspot/jtreg/runtime/appcds/MissingSuperTest.java @@ -25,8 +25,8 @@ /* * @test * @summary When super class is missing during dumping, no crash should happen. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java b/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java index 25861868344..1889b8537a1 100644 --- a/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java +++ b/test/hotspot/jtreg/runtime/appcds/MultiProcessSharing.java @@ -25,8 +25,8 @@ /* * @test * @summary Run multiple processes with the same archive, ensure they share - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java index 21085ddde3f..b1d8ea3e91d 100644 --- a/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java +++ b/test/hotspot/jtreg/runtime/appcds/MultiReleaseJars.java @@ -26,8 +26,7 @@ * @test MultiReleaseJars * @bug 8170105 * @summary Test multi-release jar with AppCDS. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java index d41faf33608..4252e2ff3ef 100644 --- a/test/hotspot/jtreg/runtime/appcds/OldClassTest.java +++ b/test/hotspot/jtreg/runtime/appcds/OldClassTest.java @@ -25,8 +25,7 @@ /* * @test * @summary classes with major version < JDK_1.5 (48) should not be included in CDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/PackageSealing.java b/test/hotspot/jtreg/runtime/appcds/PackageSealing.java index 00651ee0a3f..78b19a5d618 100644 --- a/test/hotspot/jtreg/runtime/appcds/PackageSealing.java +++ b/test/hotspot/jtreg/runtime/appcds/PackageSealing.java @@ -25,8 +25,7 @@ /* * @test * @summary AppCDS handling of package. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java b/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java index 6c07c6bebce..7d6edb8d56c 100644 --- a/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java +++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoad2.java @@ -25,8 +25,7 @@ /* * @test * @summary Load app classes from CDS archive in parallel threads. Similar to ParallelLoad.java, but each class in its own JAR - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java b/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java index b5dd75a0a7c..f9bc9470d6e 100644 --- a/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java +++ b/test/hotspot/jtreg/runtime/appcds/ParallelLoadTest.java @@ -25,9 +25,8 @@ /* * @test * @summary Load app classes from CDS archive in parallel threads - * AppCDS does not support uncompressed oops * @library /test/lib - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @modules java.base/jdk.internal.misc * java.management * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java b/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java index e3072bba759..c46abc3e68f 100644 --- a/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java +++ b/test/hotspot/jtreg/runtime/appcds/PrintSharedArchiveAndExit.java @@ -25,8 +25,7 @@ /* * @test * @summary test the -XX:+PrintSharedArchiveAndExit flag - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java b/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java index 92e7227c9c5..9c3d5ebebf0 100644 --- a/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java +++ b/test/hotspot/jtreg/runtime/appcds/ProhibitedPackage.java @@ -25,8 +25,7 @@ /* * @test * @summary AppCDS handling of prohibited package. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java b/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java index 2ff23525a1a..5ba0cf31451 100644 --- a/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java +++ b/test/hotspot/jtreg/runtime/appcds/ProtectionDomain.java @@ -25,8 +25,7 @@ /* * @test * @summary AppCDS handling of protection domain. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java b/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java index d49587d6bce..c9fc3c40a64 100644 --- a/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java +++ b/test/hotspot/jtreg/runtime/appcds/RewriteBytecodesTest.java @@ -26,8 +26,7 @@ * @test * @summary Use ClassLoader.defineClass() to load a class with rewritten bytecode. Make sure * the archived class with the same name is not loaded. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java index 3e8642daecd..2d6f24a83a9 100644 --- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java +++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveConsistency.java @@ -23,20 +23,19 @@ */ /* - * @test - * @summary SharedArchiveConsistency - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.compiler - * java.management - * jdk.jartool/sun.tools.jar - * jdk.internal.jvmstat/sun.jvmstat.monitor - * @build sun.hotspot.WhiteBox - * @compile test-classes/Hello.java - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency + * @test + * @summary SharedArchiveConsistency + * @requires vm.cds + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.compiler + * java.management + * jdk.jartool/sun.tools.jar + * jdk.internal.jvmstat/sun.jvmstat.monitor + * @build sun.hotspot.WhiteBox + * @compile test-classes/Hello.java + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SharedArchiveConsistency */ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Utils; diff --git a/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java b/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java index f18b5f21880..5ae838f4a82 100644 --- a/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java +++ b/test/hotspot/jtreg/runtime/appcds/SharedArchiveFile.java @@ -24,8 +24,7 @@ /* * @test * @summary The diagnostic option, -XX:SharedArchiveFile can be unlocked using -XX:+UseAppCDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java b/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java index b317aac0d8f..172beee2acf 100644 --- a/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java +++ b/test/hotspot/jtreg/runtime/appcds/SharedBaseAddress.java @@ -27,8 +27,7 @@ * @summary Test variety of values for SharedBaseAddress, in AppCDS mode, * making sure VM handles normal values as well as edge values * w/o a crash. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/SharedPackages.java b/test/hotspot/jtreg/runtime/appcds/SharedPackages.java index c748d53c39c..eeb3becf404 100644 --- a/test/hotspot/jtreg/runtime/appcds/SharedPackages.java +++ b/test/hotspot/jtreg/runtime/appcds/SharedPackages.java @@ -25,8 +25,7 @@ /* * @test * @summary AppCDS handling of package. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/SignedJar.java b/test/hotspot/jtreg/runtime/appcds/SignedJar.java index 7c3391ea034..e0a268b3b32 100644 --- a/test/hotspot/jtreg/runtime/appcds/SignedJar.java +++ b/test/hotspot/jtreg/runtime/appcds/SignedJar.java @@ -25,8 +25,7 @@ /* * @test * @summary AppCDS handling of signed JAR. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java b/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java index bea6a0ac3f0..652789fe609 100644 --- a/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java +++ b/test/hotspot/jtreg/runtime/appcds/SpecifySysLoaderProp.java @@ -23,17 +23,16 @@ */ /* - * @test - * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) - * @library /test/lib - * @modules java.base/jdk.internal.misc + * @test + * @summary If -Djava.system.class.loader=xxx is specified in command-line, disable UseAppCDS + * @requires vm.cds + * @library /test/lib + * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar - * @compile test-classes/TestClassLoader.java - * @compile test-classes/ReportMyLoader.java - * @compile test-classes/TrySwitchMyLoader.java - * @run main SpecifySysLoaderProp + * @compile test-classes/TestClassLoader.java + * @compile test-classes/ReportMyLoader.java + * @compile test-classes/TrySwitchMyLoader.java + * @run main SpecifySysLoaderProp */ import java.io.*; diff --git a/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java b/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java index b3f73278dba..0ed8a213d16 100644 --- a/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java +++ b/test/hotspot/jtreg/runtime/appcds/TraceLongClasspath.java @@ -25,8 +25,7 @@ /* * @test * @summary ensure -XX:+TraceClassPaths showing entire expecting app classpath - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java index 6db1a1c34cc..5cd1b14bb82 100644 --- a/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java +++ b/test/hotspot/jtreg/runtime/appcds/UseAppCDS.java @@ -25,8 +25,7 @@ /* * @test * @summary Testing use of UseAppCDS flag - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java index 6ed2f6d35d5..4bf4e6e83b4 100644 --- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java +++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_0.java @@ -25,8 +25,7 @@ /* * @test * @summary Unverfiable app classes should not be archived. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java index 8a5430e2263..438d7aaf4aa 100644 --- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java +++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1A.java @@ -25,8 +25,7 @@ /* * @test * @summary Unverfiable app classes should not be archived. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java index 7a721d13ba8..460e3535294 100644 --- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java +++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_1B.java @@ -25,8 +25,7 @@ /* * @test * @summary Unverfiable app classes should not be archived. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java b/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java index c7bbe8793f7..2242347952c 100644 --- a/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java +++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest_2.java @@ -25,8 +25,7 @@ /* * @test * @summary Unverfiable app classes should not be archived. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * @modules jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java b/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java index 9323924449d..9873a8e6ced 100644 --- a/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java +++ b/test/hotspot/jtreg/runtime/appcds/WideIloadTest.java @@ -25,7 +25,7 @@ /** * @test * @summary Test 'iload_w' bytecode in shared class - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java b/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java index d3069c33cd9..3834034b2b7 100644 --- a/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java +++ b/test/hotspot/jtreg/runtime/appcds/WrongClasspath.java @@ -25,8 +25,7 @@ /* * @test * @summary classpath mismatch between dump time and execution time - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java b/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java index d3c5c8ef50c..5da7e87498b 100644 --- a/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java +++ b/test/hotspot/jtreg/runtime/appcds/XShareAutoWithChangedJar.java @@ -25,8 +25,7 @@ /* * @test * @summary Test -Xshare:auto for AppCDS - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java index 6bd96c2abfd..a1e9901a1c3 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckCachedResolvedReferences.java @@ -25,7 +25,7 @@ /* * @test * @summary Test resolved_references - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java index 12be0931edf..3ec0e9f62cc 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DumpTimeVerifyFailure.java @@ -26,7 +26,7 @@ * @test * @summary Dump time should not crash if any class with shared strings fails verification due to missing dependencies. * @bug 8186789 - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java index 591de9b3e67..bf5eecf3594 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/GCStressTest.java @@ -25,7 +25,7 @@ /* * @test * @summary - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java index df1b348913f..cf5957142f3 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java @@ -25,7 +25,7 @@ /* * @test * @summary Test open archive heap regions - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java index 13242f72f0b..faac5a65559 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RangeNotWithinHeap.java @@ -28,7 +28,7 @@ * mapped due to out of range, and -Xshare:on should not fail. Test on * linux 64-bit only since the HeapBaseMinAddress value is platform specific. * The value used in the test may cause different behavior on other platforms. - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires (os.family == "linux") & (os.arch == "amd64") & (sun.arch.data.model == "64") * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java index 05177441a59..fe01a9befaf 100644 --- a/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java +++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/RedefineClassTest.java @@ -26,7 +26,7 @@ * @test * @summary Redefine shared class. GC should not cause crash with cached resolved_references. * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @requires vm.flavor != "minimal" * @requires (sun.arch.data.model != "32") & (os.family != "windows") diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java index 65c4d846499..f93c91fefbe 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatA.java @@ -26,8 +26,7 @@ * @test * @summary Tests the format checking of class list format. * - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java index 6ae1488d125..c590f6d4254 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatB.java @@ -26,8 +26,7 @@ * @test * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp. * - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java index ff4dd11eb1e..021c6beac5e 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatC.java @@ -26,8 +26,7 @@ * @test * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp. * - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java index 0a911d6750e..e815720b7e7 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatD.java @@ -26,8 +26,7 @@ * @test * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp. * - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java index b61e08459b6..0e33538608b 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ClassListFormatE.java @@ -26,8 +26,7 @@ * @test * @summary Tests the format checking of hotspot/src/closed/share/vm/classfile/classListParser.cpp. * - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java b/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java index 750a251f178..1cbf37ecc95 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/HelloCustom.java @@ -25,8 +25,7 @@ /* * @test * @summary Hello World test for AppCDS custom loader support - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java b/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java index f7d6b7bdcf0..b0719c8f0ba 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/LoaderSegregationTest.java @@ -26,8 +26,7 @@ * @test * @summary Check that during dumping, the classes for BOOT/EXT/APP loaders are segregated from the * custom loader classes. - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java index bd7f99ccccc..3667024d844 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestMultiFP.java @@ -25,8 +25,7 @@ /* * @test * @summary Load classes from CDS archive into multiple custom loader using parallel threads - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java index 585cd67f71c..6264f2ce352 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ParallelTestSingleFP.java @@ -25,8 +25,7 @@ /* * @test * @summary Load classes from CDS archive into a single custom loader using parallel threads (finger print) - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java index 1b0da00532f..6fa6ea0c391 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProhibitedPackageNamesTest.java @@ -25,8 +25,7 @@ /* * @test * @summary Make sure prohibited packages cannot be stored into archive for custom loaders. - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java b/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java index dad59f91ab7..00aefd99df9 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/ProtectionDomain.java @@ -26,8 +26,7 @@ * @test * @summary AppCDS handling of protection domain in custom loaders. * - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java b/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java index 0e1df9ee222..0a3d524278d 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/SameNameInTwoLoadersTest.java @@ -26,8 +26,7 @@ * @test * @summary Testing the loading of a class with the same name in two different class loaders. * - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java b/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java index a83d2cdd9e3..31c1b88de4f 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnintendedLoadersTest.java @@ -25,8 +25,7 @@ /* * @test * @summary Make sure classes intended for custom loaders cannot be loaded by BOOT/EXT/APP loaders - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java b/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java index 1b80ebca452..4de3064efcc 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnloadUnregisteredLoaderTest.java @@ -26,8 +26,7 @@ * @test * @summary Test the behavior when shared classes loaded by custom loaders are * unloaded. - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.cds.custom.loaders * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/testlibrary * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java b/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java index ade10497dab..ed0a2121da8 100644 --- a/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java +++ b/test/hotspot/jtreg/runtime/appcds/customLoader/UnsupportedPlatforms.java @@ -25,8 +25,6 @@ /* * @test * @summary Ensure that support for AppCDS custom class loaders are not enabled on unsupported platforms. - * (NOTE: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java index bc9e52792dd..edf771a6f5e 100644 --- a/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java +++ b/test/hotspot/jtreg/runtime/appcds/javaldr/ArrayTest.java @@ -25,8 +25,7 @@ /* * @test * @summary test the ability to archive array classes and load them from the archive - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules jdk.jartool/sun.tools.jar * @compile ArrayTestHelper.java diff --git a/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java b/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java index 804c480cd74..2491729abde 100644 --- a/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java +++ b/test/hotspot/jtreg/runtime/appcds/javaldr/CheckAnonymousClass.java @@ -25,8 +25,7 @@ /* * @test * @summary ensure no anonymous class is being dumped into the CDS archive - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules jdk.jartool/sun.tools.jar * @compile ../test-classes/Hello.java diff --git a/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java b/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java index 22a7dad0a6d..6b9109d2f0a 100644 --- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java +++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java @@ -26,7 +26,7 @@ * @test * @summary When dumping the CDS archive, try to cause garbage collection while classes are being loaded. * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java b/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java index 8faffaaf14e..b50272c8495 100644 --- a/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java +++ b/test/hotspot/jtreg/runtime/appcds/javaldr/GCSharedStringsDuringDump.java @@ -28,7 +28,7 @@ * option for testing the interaction with GC and shared strings. * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @requires vm.gc.G1 * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java index 99efbcbf135..111c690dcad 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/CheckUnsupportedDumpingOptions.java @@ -25,8 +25,7 @@ /* * @test * @summary Abort dumping if any of the new jigsaw vm options is specified. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib .. * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java index a88eb2fa414..05da79d88cd 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/JigsawOptionsCombo.java @@ -26,8 +26,7 @@ * @test * @summary Test combinations of jigsaw options that affect the use of AppCDS * - * AppCDS does not support uncompressed oops - * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled + * @requires vm.cds & !vm.graal.enabled * @library /test/lib .. * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java index 07a09fda627..e9dfcda03f7 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/AppClassInCP.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary a test to demonstrate that an application class in the -cp * will be archived although --patch-module is specified. The class in * the -cp has no dependencies on the class in the --patch-module. diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java index 9f6fbbb2ad1..dcb48348ace 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/CustomPackage.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary if a class is defined to a package which is not defined to any * module in the jimage, the class will not be found during dump * time but it will be used during run time. diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java index b614f58a551..608eb97e393 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/MismatchedPatchModule.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary different settings of --patch-module at dump time and runtime are * acceptable. The class found in runtime --patch-module entry should * be used. diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java index 854d4419922..2765363fb22 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchDir.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary a simple test to ensure that a directory in the --patch-module * option does not affect dump process * @library ../.. diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java index 726cf1b7675..f43ce60e51d 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/PatchJavaBase.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary sharing is disabled if java.base is patch at runtime * @library ../.. * @library /test/hotspot/jtreg/testlibrary diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java index 80959541cfd..fdbee7abe50 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/Simple.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary a simple test to ensure that class is loaded from jar file in --patch-module at runtime * @library ../.. * @library /test/hotspot/jtreg/testlibrary diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java index de460b5f2ee..efadb54bcda 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/SubClassOfPatchedClass.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary the class in the -cp is a subclass of the class in --patch-module. The * patched class should be used at runtime. * @library ../.. diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java index ef8b71a2165..498dbee3c02 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/PatchModule/TwoJars.java @@ -24,7 +24,7 @@ /* * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @summary a patched class found in --patch-module should be used at runtime * @library ../.. * @library /test/hotspot/jtreg/testlibrary diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java index e35a7182590..c36152d4b48 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/BootAppendTests.java @@ -25,7 +25,7 @@ /** * @test * @summary AppCDS tests for testing -Xbootclasspath/a - * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled + * @requires vm.cds & !vm.graal.enabled * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java index b50cfb6bf74..bd2bcada13f 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/ClassPathTests.java @@ -24,7 +24,7 @@ /** * @test - * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled + * @requires vm.cds & !vm.graal.enabled * @library ../.. * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java index 05311e818a1..17269da5260 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java @@ -25,8 +25,7 @@ /* * @test * @summary Ensure that classes found in jimage takes precedence over classes found in -Xbootclasspath/a. - * AppCDS does not support uncompressed oops - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.activation * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java index 63daf117cb1..e8e672dc664 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/EmptyClassInBootClassPath.java @@ -29,7 +29,7 @@ * 2) app loader will load the class from the jimage by default; * app loader will load the class from the bootclasspath if the * "--limit-modules java.base" option is specified - * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled + * @requires vm.cds & !vm.graal.enabled * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java index 6cceed1ae93..14529eab309 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/limitmods/LimitModsTests.java @@ -24,7 +24,7 @@ /** * @test - * @requires ((vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)) & !vm.graal.enabled + * @requires vm.cds & !vm.graal.enabled * @library ../.. * @library /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java index 42355b73ec2..f6056fe1775 100644 --- a/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java +++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/overridetests/OverrideTests.java @@ -24,7 +24,7 @@ /** * @test - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @modules java.base/jdk.internal.misc * @library ../.. * @library /test/lib diff --git a/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java b/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java index e62013ba8a3..35023dddb40 100644 --- a/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java +++ b/test/hotspot/jtreg/runtime/appcds/jvmti/ClassFileLoadHookTest.java @@ -26,7 +26,7 @@ * @test * @summary Test jvmti class file loader hook interaction with AppCDS * @library /test/lib /test/hotspot/jtreg/runtime/appcds - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar * java.management diff --git a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java index 4121fe17e67..8ee5803fd4c 100644 --- a/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java +++ b/test/hotspot/jtreg/runtime/appcds/jvmti/InstrumentationTest.java @@ -27,7 +27,7 @@ * @summary Exercise the java.lang.instrument.Instrumentation APIs on classes archived * using CDS/AppCDSv1/AppCDSv2. * @library /test/lib /test/hotspot/jtreg/runtime/appcds /test/hotspot/jtreg/runtime/appcds/test-classes - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java index 6356e2d4a6d..7346faffb9d 100644 --- a/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java +++ b/test/hotspot/jtreg/runtime/appcds/jvmti/parallelLoad/ParallelLoadAndTransformTest.java @@ -29,7 +29,7 @@ * @library /test/lib /test/hotspot/jtreg/runtime/appcds * /test/hotspot/jtreg/runtime/appcds/test-classes /test/hotspot/jtreg/runtime/appcds/jvmti * /test/hotspot/jtreg/testlibrary/jvmti - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @modules java.base/jdk.internal.misc * java.management * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java index 4addd099854..5e5973ddb10 100644 --- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java +++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformInterfaceImplementorAppCDS.java @@ -32,7 +32,7 @@ * /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti * /test/hotspot/jtreg/runtime/appcds/customLoader * /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java index 2c631b916e4..b451ee3b41b 100644 --- a/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java +++ b/test/hotspot/jtreg/runtime/appcds/jvmti/transformRelatedClasses/TransformSuperSubAppCDS.java @@ -32,7 +32,7 @@ * /test/hotspot/jtreg/runtime/SharedArchiveFile /test/hotspot/jtreg/testlibrary/jvmti * /test/hotspot/jtreg/runtime/appcds/customLoader * /test/hotspot/jtreg/runtime/appcds/customLoader/test-classes - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.flavor != "minimal" * @modules java.base/jdk.internal.misc * jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java index 396e2cba703..f7843d6ffa8 100644 --- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java +++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineBasicTest.java @@ -26,8 +26,7 @@ * @test * @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to * make sure class redefinition works with CDS. - * (Note: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds * @modules java.compiler * java.instrument diff --git a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java index 2c2782873a6..81eb41b42c0 100644 --- a/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java +++ b/test/hotspot/jtreg/runtime/appcds/redefineClass/RedefineRunningMethods_Shared.java @@ -26,8 +26,7 @@ * @test * @summary Run /runtime/RedefineTests/RedefineRunningMethods in AppCDS mode to * make sure class redefinition works with CDS. - * (Note: AppCDS does not support uncompressed oops) - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @library /test/lib /test/hotspot/jtreg/runtime/RedefineTests /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc * @modules java.compiler diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java index 7d70f463b4e..c3815c3cde4 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java @@ -25,7 +25,7 @@ /* * @test * @summary Exercise GC with shared strings - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @library /test/hotspot/jtreg/runtime/appcds /test/lib diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java index 951f2ec6447..7151a52bd1c 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/FlagCombo.java @@ -25,7 +25,7 @@ /* * @test * @summary Test relevant combinations of command line flags with shared strings - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires (sun.arch.data.model != "32") & (os.family != "windows") * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java index 6e71c88dcea..f78246823c9 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java @@ -28,7 +28,7 @@ * Also test mismatch in oops encoding between dump time and run time * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires (vm.gc=="null") * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java index d64643257d0..7623847cb81 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java @@ -27,7 +27,7 @@ * @summary Test shared strings together with string intern operation * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/hotspot/jtreg/runtime/appcds /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java index b781f345eed..0cdc1001329 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java @@ -27,7 +27,7 @@ * @summary Check most common errors in file format * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java index a234da4a9df..3b78faa8190 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java @@ -27,7 +27,7 @@ * @summary Basic shared string test with large pages * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java index 921361ec96a..828817ff3d8 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java @@ -27,7 +27,7 @@ * @summary Test locking on shared strings * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/hotspot/jtreg/runtime/appcds /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java index 7d9623aa4b7..65c0a0138d9 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java @@ -27,7 +27,7 @@ * @summary Basic test for shared strings * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/hotspot/jtreg/runtime/appcds /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java index 93209142709..2f7c4f3e5d6 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java @@ -27,7 +27,7 @@ * @summary Basic plus test for shared strings * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/hotspot/jtreg/runtime/appcds /test/lib * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java index db531617a88..5a054a606b1 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java @@ -27,7 +27,7 @@ * @summary Write a lots of shared strings. * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/hotspot/jtreg/runtime/appcds /test/lib * @modules jdk.jartool/sun.tools.jar diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java index fe3f05350a7..0031b2f65e4 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java @@ -27,7 +27,7 @@ * @summary White box test for shared strings * Feature support: G1GC only, compressed oops/kptrs, 64-bit os, not on windows * @requires (sun.arch.data.model != "32") & (os.family != "windows") - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc diff --git a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java index c96a75da7e1..ead22de3dc1 100644 --- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java +++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java @@ -26,7 +26,7 @@ * @test * @summary Regression test for JDK-8098821 * @bug 8098821 - * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @requires vm.cds * @requires vm.gc.G1 * @library /test/lib /test/hotspot/jtreg/runtime/appcds * @modules java.base/jdk.internal.misc From 1c4fcc16271dff227e9b7ebb12f0a88e7d080631 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Tue, 19 Dec 2017 11:29:07 -0800 Subject: [PATCH 27/31] 8191374: Improve error message when CDS is not supported on exploded build Reviewed-by: jiangli, hseigel --- src/hotspot/share/classfile/classLoader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 109196b74fb..a4673204336 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -802,6 +802,14 @@ void ClassLoader::setup_boot_search_path(const char *class_path) { int end = 0; bool set_base_piece = true; +#if INCLUDE_CDS + if (DumpSharedSpaces || UseSharedSpaces) { + if (!Arguments::has_jimage()) { + vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL); + } + } +#endif + // Iterate over class path entries for (int start = 0; start < len; start = end) { while (class_path[end] && class_path[end] != os::path_separator()[0]) { From 670ac3b2369e9723a4b9306480f502402c6059b3 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 19 Dec 2017 17:31:53 -0500 Subject: [PATCH 28/31] 8193840: Add compiler/c2/Test8007294.java to the problem list Reviewed-by: coleenp --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 28dde210a6f..03b8ef8eafa 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -51,6 +51,7 @@ compiler/startup/SmallCodeCacheStartup.java 8134286 generic-all compiler/tiered/LevelTransitionTest.java 8067651 generic-all compiler/types/correctness/CorrectnessTest.java 8066173 generic-all compiler/types/correctness/OffTest.java 8066173 generic-all +compiler/c2/Test8007294.java 8192992 generic-all # aot test intermittently failing in jprt 8175791 compiler/aot/DeoptimizationTest.java 8175791 windows-all From 114c1a7a6950ecb9138ebc6e3283800052f0cc64 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 20 Dec 2017 10:05:09 -0500 Subject: [PATCH 29/31] 8152957: Improve specificity of safepoint logging to print safepoint type Upgrade safepoint begin logs to Info logging, which has the reason. Reviewed-by: dholmes, hseigel, zgu --- src/hotspot/share/runtime/safepoint.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/runtime/safepoint.cpp b/src/hotspot/share/runtime/safepoint.cpp index 23d56c8e0d5..4c573746361 100644 --- a/src/hotspot/share/runtime/safepoint.cpp +++ b/src/hotspot/share/runtime/safepoint.cpp @@ -103,7 +103,7 @@ void SafepointSynchronize::begin() { int nof_threads = Threads::number_of_threads(); - log_debug(safepoint)("Safepoint synchronization initiated. (%d)", nof_threads); + log_debug(safepoint)("Safepoint synchronization initiated. (%d threads)", nof_threads); RuntimeService::record_safepoint_begin(); @@ -407,9 +407,7 @@ void SafepointSynchronize::begin() { // Update the count of active JNI critical regions GCLocker::set_jni_lock_count(_current_jni_active_count); - if (log_is_enabled(Debug, safepoint)) { - log_debug(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description()); - } + log_info(safepoint)("Entering safepoint region: %s", VMThread::vm_safepoint_description()); RuntimeService::record_safepoint_synchronized(); if (PrintSafepointStatistics) { @@ -496,14 +494,14 @@ void SafepointSynchronize::end() { cur_state->restart(); // TSS _running SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page } - log_debug(safepoint)("Leaving safepoint region"); + log_info(safepoint)("Leaving safepoint region"); } else { // Set to not synchronized, so the threads will not go into the signal_thread_blocked method // when they get restarted. _state = _not_synchronized; OrderAccess::fence(); - log_debug(safepoint)("Leaving safepoint region"); + log_info(safepoint)("Leaving safepoint region"); // Start suspended threads jtiwh.rewind(); From 808189636a945a92ad130cd3a1cdb29a93b13164 Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 20 Dec 2017 11:30:23 -0800 Subject: [PATCH 30/31] 8193897: JDK-8191374 caused windows_i586 build to fail Reviewed-by: hseigel --- src/hotspot/share/classfile/classLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index a4673204336..2aa83548fe0 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -803,7 +803,7 @@ void ClassLoader::setup_boot_search_path(const char *class_path) { bool set_base_piece = true; #if INCLUDE_CDS - if (DumpSharedSpaces || UseSharedSpaces) { + if (DumpSharedSpaces) { if (!Arguments::has_jimage()) { vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL); } From 257f4fccd0f678294226157039abc5dd5d937441 Mon Sep 17 00:00:00 2001 From: Gary Adams Date: Wed, 20 Dec 2017 13:41:40 -0500 Subject: [PATCH 31/31] 8180709: java -javaagent:agent.jar with run-time that does not contain java.instrument prints confusing error Reviewed-by: cjplummer, sspitsyn --- src/hotspot/share/runtime/arguments.cpp | 11 +++++++++-- src/hotspot/share/runtime/arguments.hpp | 6 +++++- src/hotspot/share/runtime/thread.cpp | 11 +++++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 9bdebaae906..d652b376881 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -200,7 +200,9 @@ SystemProperty::SystemProperty(const char* key, const char* value, bool writeabl _writeable = writeable; } -AgentLibrary::AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib) { +AgentLibrary::AgentLibrary(const char* name, const char* options, + bool is_absolute_path, void* os_lib, + bool instrument_lib) { _name = AllocateHeap(strlen(name)+1, mtArguments); strcpy(_name, name); if (options == NULL) { @@ -214,6 +216,7 @@ AgentLibrary::AgentLibrary(const char* name, const char* options, bool is_absolu _next = NULL; _state = agent_invalid; _is_static_lib = false; + _is_instrument_lib = instrument_lib; } // Check if head of 'option' matches 'name', and sets 'tail' to the remaining @@ -290,6 +293,10 @@ void Arguments::add_init_agent(const char* name, char* options, bool absolute_pa _agentList.add(new AgentLibrary(name, options, absolute_path, NULL)); } +void Arguments::add_instrument_agent(const char* name, char* options, bool absolute_path) { + _agentList.add(new AgentLibrary(name, options, absolute_path, NULL, true)); +} + // Late-binding agents not started via arguments void Arguments::add_loaded_agent(AgentLibrary *agentLib) { _agentList.add(agentLib); @@ -2791,7 +2798,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m size_t length = strlen(tail) + 1; char *options = NEW_C_HEAP_ARRAY(char, length, mtArguments); jio_snprintf(options, length, "%s", tail); - add_init_agent("instrument", options, false); + add_instrument_agent("instrument", options, false); // java agents need module java.instrument if (!create_numbered_property("jdk.module.addmods", "java.instrument", addmods_count++)) { return JNI_ENOMEM; diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp index 222f4b25ad6..89ceb159a1d 100644 --- a/src/hotspot/share/runtime/arguments.hpp +++ b/src/hotspot/share/runtime/arguments.hpp @@ -142,6 +142,7 @@ public: void* _os_lib; bool _is_absolute_path; bool _is_static_lib; + bool _is_instrument_lib; AgentState _state; AgentLibrary* _next; @@ -154,13 +155,15 @@ public: void set_os_lib(void* os_lib) { _os_lib = os_lib; } AgentLibrary* next() const { return _next; } bool is_static_lib() const { return _is_static_lib; } + bool is_instrument_lib() const { return _is_instrument_lib; } void set_static_lib(bool is_static_lib) { _is_static_lib = is_static_lib; } bool valid() { return (_state == agent_valid); } void set_valid() { _state = agent_valid; } void set_invalid() { _state = agent_invalid; } // Constructor - AgentLibrary(const char* name, const char* options, bool is_absolute_path, void* os_lib); + AgentLibrary(const char* name, const char* options, bool is_absolute_path, + void* os_lib, bool instrument_lib=false); }; // maintain an order of entry list of AgentLibrary @@ -337,6 +340,7 @@ class Arguments : AllStatic { // -agentlib and -agentpath arguments static AgentLibraryList _agentList; static void add_init_agent(const char* name, char* options, bool absolute_path); + static void add_instrument_agent(const char* name, char* options, bool absolute_path); // Late-binding agents not started via arguments static void add_loaded_agent(AgentLibrary *agentLib); diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index a66018c412d..bb83e12896b 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -4038,9 +4038,16 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, } if (library == NULL) { const char *sub_msg = " on the library path, with error: "; - size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + strlen(ebuf) + 1; + const char *sub_msg2 = "\nModule java.instrument may be missing from runtime image."; + + size_t len = strlen(msg) + strlen(name) + strlen(sub_msg) + + strlen(ebuf) + strlen(sub_msg2) + 1; char *buf = NEW_C_HEAP_ARRAY(char, len, mtThread); - jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); + if (!agent->is_instrument_lib()) { + jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); + } else { + jio_snprintf(buf, len, "%s%s%s%s%s", msg, name, sub_msg, ebuf, sub_msg2); + } // If we can't find the agent, exit. vm_exit_during_initialization(buf, NULL); FREE_C_HEAP_ARRAY(char, buf);