From fdbe749d2a3c0f258c2d4d90080e1b4cd2b90077 Mon Sep 17 00:00:00 2001 From: Goetz Lindenmaier Date: Wed, 29 Jul 2015 15:08:42 -0700 Subject: [PATCH 1/8] 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off LogTouchedMethods causes the template interpreter to generate profiling code even if no compiler is used. If TieredCompilation is off, code containing an assertion that checks that UseCompiler is set, is reached. This assertion exists on the sparc and ppc platforms. Reviewed-by: simonis, iklam, minqi --- hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp | 2 +- hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp | 2 +- .../CommandLine/PrintTouchedMethods.java | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp index 00330ef3461..2c95de9b782 100644 --- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp +++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp @@ -2187,7 +2187,7 @@ void InterpreterMacroAssembler::get_method_counters(Register method, } void InterpreterMacroAssembler::increment_invocation_counter(Register Rcounters, Register iv_be_count, Register Rtmp_r0) { - assert(UseCompiler, "incrementing must be useful"); + assert(UseCompiler || LogTouchedMethods, "incrementing must be useful"); Register invocation_count = iv_be_count; Register backedge_count = Rtmp_r0; int delta = InvocationCounter::count_increment; diff --git a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp index 153bfbdda55..44ad8d91dae 100644 --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp @@ -2314,7 +2314,7 @@ void InterpreterMacroAssembler::get_method_counters(Register method, } void InterpreterMacroAssembler::increment_invocation_counter( Register Rcounters, Register Rtmp, Register Rtmp2 ) { - assert(UseCompiler, "incrementing must be useful"); + assert(UseCompiler || LogTouchedMethods, "incrementing must be useful"); assert_different_registers(Rcounters, Rtmp, Rtmp2); Address inv_counter(Rcounters, MethodCounters::invocation_counter_offset() + diff --git a/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java b/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java index 0eb1852552a..7bae35ee714 100644 --- a/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java +++ b/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java @@ -87,6 +87,24 @@ public class PrintTouchedMethods { output.shouldNotContain("TestLogTouchedMethods.methodB:()V"); output.shouldHaveExitValue(0); + String[] javaArgs4 = {"-XX:+UnlockDiagnosticVMOptions", "-Xint", "-XX:+LogTouchedMethods", "-XX:+PrintTouchedMethodsAtExit", "-XX:-TieredCompilation", "TestLogTouchedMethods"}; + pb = ProcessTools.createJavaProcessBuilder(javaArgs4); + output = new OutputAnalyzer(pb.start()); + lines = output.asLines(); + + if (lines.size() < 1) { + throw new Exception("Empty output"); + } + + first = lines.get(0); + if (!first.equals("# Method::print_touched_methods version 1")) { + throw new Exception("First line mismatch"); + } + + output.shouldContain("TestLogTouchedMethods.methodA:()V"); + output.shouldNotContain("TestLogTouchedMethods.methodB:()V"); + output.shouldHaveExitValue(0); + // Test jcmd PrintTouchedMethods VM.print_touched_methods String pid = Integer.toString(ProcessTools.getProcessId()); pb = new ProcessBuilder(); From 4b348c9fec8d94846c6052add3037b11238fa0e1 Mon Sep 17 00:00:00 2001 From: Jeremy Manson Date: Wed, 29 Jul 2015 22:59:03 -0400 Subject: [PATCH 2/8] 6661889: thread id on Linux is inconsistent in error and log outputs Reviewed-by: dholmes, kvn --- hotspot/src/os/linux/vm/os_linux.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 0af27515e89..3b198380646 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -653,8 +653,7 @@ static void *java_start(Thread *thread) { OSThread* osthread = thread->osthread(); Monitor* sync = osthread->startThread_lock(); - // thread_id is kernel thread id (similar to Solaris LWP id) - osthread->set_thread_id(os::Linux::gettid()); + osthread->set_thread_id(os::current_thread_id()); if (UseNUMA) { int lgrp_id = os::numa_get_group_id(); @@ -1424,7 +1423,8 @@ size_t os::lasterror(char *buf, size_t len) { return n; } -intx os::current_thread_id() { return (intx)pthread_self(); } +// thread_id is kernel thread id (similar to Solaris LWP id) +intx os::current_thread_id() { return os::Linux::gettid(); } int os::current_process_id() { return ::getpid(); } From 98fb52479fdd94f158e455edcbc920ddc2490d3b Mon Sep 17 00:00:00 2001 From: Alexander Kulyakhtin Date: Thu, 30 Jul 2015 12:41:39 +0300 Subject: [PATCH 3/8] 8130527: Serviceability tests fails with Can't attach to process A helper method changed to provide workaround for 8132539 Reviewed-by: jbachorik --- hotspot/test/testlibrary/jdk/test/lib/Utils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hotspot/test/testlibrary/jdk/test/lib/Utils.java b/hotspot/test/testlibrary/jdk/test/lib/Utils.java index 73027cbaab3..eb9ae00017c 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java +++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java @@ -314,9 +314,8 @@ public final class Utils { */ public static String fileAsString(String filename) throws IOException { Path filePath = Paths.get(filename); - return Files.exists(filePath) - ? Files.lines(filePath).collect(Collectors.joining(NEW_LINE)) - : null; + if (!Files.exists(filePath)) return null; + return new String(Files.readAllBytes(filePath)); } /** From 3b63ebf830734aab17c085f86fde4b1bed26c0a4 Mon Sep 17 00:00:00 2001 From: Dmitry Samersoff Date: Thu, 30 Jul 2015 16:26:00 +0300 Subject: [PATCH 4/8] 8059036: Implement Diagnostic Commands for heap and finalizerinfo Implement Diagnostic Commands for heap and finalizerinfo Reviewed-by: sla, plevart, mchung --- hotspot/src/share/vm/classfile/vmSymbols.hpp | 5 ++ .../share/vm/services/diagnosticCommand.cpp | 57 ++++++++++++ .../share/vm/services/diagnosticCommand.hpp | 40 +++++++++ .../dcmd/gc/FinalizerInfoTest.java | 87 +++++++++++++++++++ .../serviceability/dcmd/gc/HeapInfoTest.java | 54 ++++++++++++ 5 files changed, 243 insertions(+) create mode 100644 hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java create mode 100644 hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index b453e0ec1fa..967750e6c72 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -568,6 +568,11 @@ template(java_lang_management_ThreadInfo_constructor_signature, "(Ljava/lang/Thread;ILjava/lang/Object;Ljava/lang/Thread;JJJJ[Ljava/lang/StackTraceElement;)V") \ template(java_lang_management_ThreadInfo_with_locks_constructor_signature, "(Ljava/lang/Thread;ILjava/lang/Object;Ljava/lang/Thread;JJJJ[Ljava/lang/StackTraceElement;[Ljava/lang/Object;[I[Ljava/lang/Object;)V") \ template(long_long_long_long_void_signature, "(JJJJ)V") \ + template(finalizer_histogram_klass, "java/lang/ref/FinalizerHistogram") \ + template(void_finalizer_histogram_entry_array_signature, "()[Ljava/lang/ref/FinalizerHistogram$Entry;") \ + template(get_finalizer_histogram_name, "getFinalizerHistogram") \ + template(finalizer_histogram_entry_name_field, "className") \ + template(finalizer_histogram_entry_count_field, "instanceCount") \ \ template(java_lang_management_MemoryPoolMXBean, "java/lang/management/MemoryPoolMXBean") \ template(java_lang_management_MemoryManagerMXBean, "java/lang/management/MemoryManagerMXBean") \ diff --git a/hotspot/src/share/vm/services/diagnosticCommand.cpp b/hotspot/src/share/vm/services/diagnosticCommand.cpp index e0fa2193c11..8c326cf73f5 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp @@ -37,6 +37,7 @@ #include "services/management.hpp" #include "services/writeableFlags.hpp" #include "utilities/macros.hpp" +#include "oops/objArrayOop.inline.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC @@ -57,6 +58,8 @@ void DCmdRegistrant::register_dcmds(){ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); #if INCLUDE_SERVICES // Heap dumping/inspection supported DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); @@ -333,6 +336,60 @@ void RunFinalizationDCmd::execute(DCmdSource source, TRAPS) { vmSymbols::void_method_signature(), CHECK); } +void HeapInfoDCmd::execute(DCmdSource source, TRAPS) { + Universe::heap()->print_on(output()); +} + +void FinalizerInfoDCmd::execute(DCmdSource source, TRAPS) { + ResourceMark rm; + + + Klass* k = SystemDictionary::resolve_or_null( + vmSymbols::finalizer_histogram_klass(), THREAD); + assert(k != NULL, "FinalizerHistogram class is not accessible"); + + instanceKlassHandle klass(THREAD, k); + JavaValue result(T_ARRAY); + + // We are calling lang.ref.FinalizerHistogram.getFinalizerHistogram() method + // and expect it to return array of FinalizerHistogramEntry as Object[] + + JavaCalls::call_static(&result, klass, + vmSymbols::get_finalizer_histogram_name(), + vmSymbols::void_finalizer_histogram_entry_array_signature(), CHECK); + + objArrayOop result_oop = (objArrayOop) result.get_jobject(); + if (result_oop->length() == 0) { + output()->print_cr("No instances waiting for finalization found"); + return; + } + + oop foop = result_oop->obj_at(0); + InstanceKlass* ik = InstanceKlass::cast(foop->klass()); + + fieldDescriptor count_fd, name_fd; + + Klass* count_res = ik->find_field( + vmSymbols::finalizer_histogram_entry_count_field(), vmSymbols::int_signature(), &count_fd); + + Klass* name_res = ik->find_field( + vmSymbols::finalizer_histogram_entry_name_field(), vmSymbols::string_signature(), &name_fd); + + assert(count_res != NULL && name_res != NULL, "Unexpected layout of FinalizerHistogramEntry"); + + output()->print_cr("Unreachable instances waiting for finalization"); + output()->print_cr("#instances class name"); + output()->print_cr("-----------------------"); + + for (int i = 0; i < result_oop->length(); ++i) { + oop element_oop = result_oop->obj_at(i); + oop str_oop = element_oop->obj_field(name_fd.offset()); + char *name = java_lang_String::as_utf8_string(str_oop); + int count = element_oop->int_field(count_fd.offset()); + output()->print_cr("%10d %s", count, name); + } +} + #if INCLUDE_SERVICES // Heap dumping/inspection supported HeapDumpDCmd::HeapDumpDCmd(outputStream* output, bool heap) : DCmdWithParser(output, heap), diff --git a/hotspot/src/share/vm/services/diagnosticCommand.hpp b/hotspot/src/share/vm/services/diagnosticCommand.hpp index 9362687128a..3106c0c9079 100644 --- a/hotspot/src/share/vm/services/diagnosticCommand.hpp +++ b/hotspot/src/share/vm/services/diagnosticCommand.hpp @@ -241,6 +241,46 @@ public: virtual void execute(DCmdSource source, TRAPS); }; +class HeapInfoDCmd : public DCmd { +public: + HeapInfoDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } + static const char* name() { return "GC.heap_info"; } + static const char* description() { + return "Provide generic Java heap information."; + } + static const char* impact() { + return "Medium"; + } + static int num_arguments() { return 0; } + static const JavaPermission permission() { + JavaPermission p = {"java.lang.management.ManagementPermission", + "monitor", NULL}; + return p; + } + + virtual void execute(DCmdSource source, TRAPS); +}; + +class FinalizerInfoDCmd : public DCmd { +public: + FinalizerInfoDCmd(outputStream* output, bool heap) : DCmd(output, heap) { } + static const char* name() { return "GC.finalizer_info"; } + static const char* description() { + return "Provide information about Java finalization queue."; + } + static const char* impact() { + return "Medium"; + } + static int num_arguments() { return 0; } + static const JavaPermission permission() { + JavaPermission p = {"java.lang.management.ManagementPermission", + "monitor", NULL}; + return p; + } + + virtual void execute(DCmdSource source, TRAPS); +}; + #if INCLUDE_SERVICES // Heap dumping supported // See also: dump_heap in attachListener.cpp class HeapDumpDCmd : public DCmdWithParser { diff --git a/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java b/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java new file mode 100644 index 00000000000..1e53a234b5a --- /dev/null +++ b/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2015, 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 org.testng.annotations.Test; +import org.testng.Assert; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; + +import jdk.test.lib.OutputAnalyzer; +import jdk.test.lib.dcmd.CommandExecutor; +import jdk.test.lib.dcmd.PidJcmdExecutor; + +/* + * @test + * @summary + * @library /testlibrary + * @build jdk.test.lib.* + * @build jdk.test.lib.dcmd.* + * @run testng FinalizerInfoTest + */ +public class FinalizerInfoTest { + static ReentrantLock lock = new ReentrantLock(); + static volatile int wasInitialized = 0; + static volatile int wasTrapped = 0; + static final String cmd = "GC.finalizer_info"; + static final int objectsCount = 1000; + + class MyObject { + public MyObject() { + // Make sure object allocation/deallocation is not optimized out + wasInitialized += 1; + } + + protected void finalize() { + // Trap the object in a finalization queue + wasTrapped += 1; + lock.lock(); + } + } + + public void run(CommandExecutor executor) { + try { + lock.lock(); + for(int i = 0; i < objectsCount; ++i) { + new MyObject(); + } + System.out.println("Objects initialized: " + objectsCount); + System.gc(); + + while(wasTrapped < 1) { + // Waiting for gc thread. + } + + OutputAnalyzer output = executor.execute(cmd); + output.shouldContain("MyObject"); + } finally { + lock.unlock(); + } + } + + @Test + public void pid() { + run(new PidJcmdExecutor()); + } +} diff --git a/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java b/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java new file mode 100644 index 00000000000..daedf1252ef --- /dev/null +++ b/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2015, 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 org.testng.annotations.Test; +import org.testng.Assert; + +import java.io.IOException; + +import jdk.test.lib.dcmd.CommandExecutor; +import jdk.test.lib.dcmd.PidJcmdExecutor; +import jdk.test.lib.OutputAnalyzer; + + +/* + * @test + * @summary Test of diagnostic command GC.heap_info + * @library /testlibrary + * @build jdk.test.lib.* + * @build jdk.test.lib.dcmd.* + * @run testng HeapInfoTest + */ +public class HeapInfoTest { + public void run(CommandExecutor executor) { + String cmd = "GC.heap_info"; + OutputAnalyzer output = executor.execute(cmd); + output.shouldContain("Metaspace"); + } + + @Test + public void pid() { + run(new PidJcmdExecutor()); + } +} + From abd5c879c5a8bf862944ff9348a6bbc6640c7004 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Fri, 31 Jul 2015 15:36:19 +0200 Subject: [PATCH 5/8] 8129976: RunFinalizationTest.java times out frequently Reviewed-by: sspitsyn --- .../dcmd/gc/RunFinalizationTest.java | 73 ++++++++++--------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java index 21606a83b7c..bc34351974c 100644 --- a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java +++ b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java @@ -21,15 +21,13 @@ * questions. */ -import org.testng.annotations.Test; -import org.testng.Assert; - +import java.util.concurrent.Phaser; import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.TimeoutException; import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; +import jdk.test.lib.Utils; /* * @test @@ -41,62 +39,71 @@ import jdk.test.lib.dcmd.JMXExecutor; * jdk.jvmstat/sun.jvmstat.monitor * @build jdk.test.lib.* * @build jdk.test.lib.dcmd.* - * @run testng RunFinalizationTest + * @run main/othervm RunFinalizationTest */ public class RunFinalizationTest { - static ReentrantLock lock = new ReentrantLock(); - static Condition cond = lock.newCondition(); + private static final long TIMEOUT = Utils.adjustTimeout(15000); // 15s + private static final Phaser ph = new Phaser(3); static volatile boolean wasFinalized = false; static volatile boolean wasInitialized = false; - class MyObject { + static class MyObject { public MyObject() { /* Make sure object allocation/deallocation is not optimized out */ wasInitialized = true; } protected void finalize() { - lock.lock(); - wasFinalized = true; - cond.signalAll(); - lock.unlock(); + if (!Thread.currentThread().getName().equals("Finalizer")) { + wasFinalized = true; + ph.arrive(); + } else { + ph.arriveAndAwaitAdvance(); + } } } public static MyObject o; - public void run(CommandExecutor executor) { - lock.lock(); + private static void run(CommandExecutor executor) { o = new MyObject(); o = null; System.gc(); executor.execute("GC.run_finalization"); - int waited = 0; - int waitTime = 15; + System.out.println("Waiting for signal from finalizer"); - try { - System.out.println("Waiting for signal from finalizer"); - - while (!cond.await(waitTime, TimeUnit.SECONDS)) { - waited += waitTime; - System.out.println(String.format("Waited %d seconds", waited)); + long targetTime = System.currentTimeMillis() + TIMEOUT; + while (System.currentTimeMillis() < targetTime) { + try { + ph.awaitAdvanceInterruptibly(ph.arrive(), 200, TimeUnit.MILLISECONDS); + System.out.println("Received signal"); + break; + } catch (InterruptedException e) { + fail("Test error: Interrupted while waiting for signal from finalizer", e); + } catch (TimeoutException e) { + System.out.println("Haven't received signal in 200ms. Retrying ..."); } - - System.out.println("Received signal"); - } catch (InterruptedException e) { - Assert.fail("Test error: Interrupted while waiting for signal from finalizer", e); - } finally { - lock.unlock(); } if (!wasFinalized) { - Assert.fail("Test failure: Object was not finalized"); + fail("Test failure: Object was not finalized"); } } - @Test - public void jmx() { - run(new JMXExecutor()); + public static void main(String ... args) { + MyObject o = new MyObject(); + o = null; + Runtime.getRuntime().addShutdownHook(new Thread(()->{ + run(new JMXExecutor()); + })); + } + + private static void fail(String msg, Exception e) { + throw new Error(msg, e); + } + + private static void fail(String msg) { + throw new Error(msg); } } From 2bf01467e3eb2036967a155ee4d531798fc300a9 Mon Sep 17 00:00:00 2001 From: Staffan Larsen Date: Mon, 3 Aug 2015 11:12:57 +0200 Subject: [PATCH 6/8] 8132876: Increase PerfDataMemorySize to 64K Reviewed-by: sspitsyn --- hotspot/src/share/vm/runtime/globals.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index d2982e0d422..62bb586d98c 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3913,7 +3913,7 @@ public: product(bool, PerfDisableSharedMem, false, \ "Store performance data in standard memory") \ \ - product(intx, PerfDataMemorySize, 32*K, \ + product(intx, PerfDataMemorySize, 64*K, \ "Size of performance data memory region. Will be rounded " \ "up to a multiple of the native os page size.") \ \ From 8dfd822c414db2be27843dcb9f6514eb7e3497c2 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Mon, 3 Aug 2015 16:54:08 -0400 Subject: [PATCH 7/8] 8080298: Clean up os::...::supports_variable_stack_size() Reviewed-by: kbarrett, simonis, stuefe, coleenp --- hotspot/src/os/aix/vm/os_aix.cpp | 46 ++++++++-------- hotspot/src/os/aix/vm/os_aix.hpp | 2 - hotspot/src/os/bsd/vm/os_bsd.cpp | 53 +++++++++---------- hotspot/src/os/bsd/vm/os_bsd.hpp | 4 +- hotspot/src/os/linux/vm/os_linux.cpp | 52 +++++++++--------- hotspot/src/os/linux/vm/os_linux.hpp | 2 - hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp | 6 +-- hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp | 6 +-- .../src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp | 6 +-- .../linux_aarch64/vm/os_linux_aarch64.cpp | 5 +- .../src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp | 2 - .../os_cpu/linux_sparc/vm/os_linux_sparc.cpp | 5 +- .../src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 5 -- .../os_cpu/linux_zero/vm/os_linux_zero.cpp | 6 +-- 14 files changed, 77 insertions(+), 123 deletions(-) diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index c78577c542f..f2c3933f35f 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -971,34 +971,32 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { guarantee(pthread_attr_setsuspendstate_np(&attr, PTHREAD_CREATE_SUSPENDED_NP) == 0, "???"); // calculate stack size if it's not specified by caller - if (os::Aix::supports_variable_stack_size()) { - if (stack_size == 0) { - stack_size = os::Aix::default_stack_size(thr_type); + if (stack_size == 0) { + stack_size = os::Aix::default_stack_size(thr_type); - switch (thr_type) { - case os::java_thread: - // Java threads use ThreadStackSize whose default value can be changed with the flag -Xss. - assert(JavaThread::stack_size_at_create() > 0, "this should be set"); - stack_size = JavaThread::stack_size_at_create(); + switch (thr_type) { + case os::java_thread: + // Java threads use ThreadStackSize whose default value can be changed with the flag -Xss. + assert(JavaThread::stack_size_at_create() > 0, "this should be set"); + stack_size = JavaThread::stack_size_at_create(); + break; + case os::compiler_thread: + if (CompilerThreadStackSize > 0) { + stack_size = (size_t)(CompilerThreadStackSize * K); break; - case os::compiler_thread: - if (CompilerThreadStackSize > 0) { - stack_size = (size_t)(CompilerThreadStackSize * K); - break; - } // else fall through: - // use VMThreadStackSize if CompilerThreadStackSize is not defined - case os::vm_thread: - case os::pgc_thread: - case os::cgc_thread: - case os::watcher_thread: - if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); - break; - } + } // else fall through: + // use VMThreadStackSize if CompilerThreadStackSize is not defined + case os::vm_thread: + case os::pgc_thread: + case os::cgc_thread: + case os::watcher_thread: + if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); + break; } + } - stack_size = MAX2(stack_size, os::Aix::min_stack_allowed); - pthread_attr_setstacksize(&attr, stack_size); - } //else let thread_create() pick the default value (96 K on AIX) + stack_size = MAX2(stack_size, os::Aix::min_stack_allowed); + pthread_attr_setstacksize(&attr, stack_size); pthread_t tid; int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); diff --git a/hotspot/src/os/aix/vm/os_aix.hpp b/hotspot/src/os/aix/vm/os_aix.hpp index faba5c2b45e..8e96dd9f6c5 100644 --- a/hotspot/src/os/aix/vm/os_aix.hpp +++ b/hotspot/src/os/aix/vm/os_aix.hpp @@ -131,8 +131,6 @@ class Aix { static void initialize_libo4(); static void initialize_libperfstat(); - static bool supports_variable_stack_size(); - public: static void init_thread_fpu_state(); static pthread_t main_thread(void) { return _main_thread; } diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index 8f935d85c05..1c243ae387f 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -739,40 +739,35 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - // stack size - if (os::Bsd::supports_variable_stack_size()) { - // calculate stack size if it's not specified by caller - if (stack_size == 0) { - stack_size = os::Bsd::default_stack_size(thr_type); + // calculate stack size if it's not specified by caller + if (stack_size == 0) { + stack_size = os::Bsd::default_stack_size(thr_type); - switch (thr_type) { - case os::java_thread: - // Java threads use ThreadStackSize which default value can be - // changed with the flag -Xss - assert(JavaThread::stack_size_at_create() > 0, "this should be set"); - stack_size = JavaThread::stack_size_at_create(); + switch (thr_type) { + case os::java_thread: + // Java threads use ThreadStackSize which default value can be + // changed with the flag -Xss + assert(JavaThread::stack_size_at_create() > 0, "this should be set"); + stack_size = JavaThread::stack_size_at_create(); + break; + case os::compiler_thread: + if (CompilerThreadStackSize > 0) { + stack_size = (size_t)(CompilerThreadStackSize * K); break; - case os::compiler_thread: - if (CompilerThreadStackSize > 0) { - stack_size = (size_t)(CompilerThreadStackSize * K); - break; - } // else fall through: - // use VMThreadStackSize if CompilerThreadStackSize is not defined - case os::vm_thread: - case os::pgc_thread: - case os::cgc_thread: - case os::watcher_thread: - if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); - break; - } + } // else fall through: + // use VMThreadStackSize if CompilerThreadStackSize is not defined + case os::vm_thread: + case os::pgc_thread: + case os::cgc_thread: + case os::watcher_thread: + if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); + break; } - - stack_size = MAX2(stack_size, os::Bsd::min_stack_allowed); - pthread_attr_setstacksize(&attr, stack_size); - } else { - // let pthread_create() pick the default value. } + stack_size = MAX2(stack_size, os::Bsd::min_stack_allowed); + pthread_attr_setstacksize(&attr, stack_size); + ThreadState state; { diff --git a/hotspot/src/os/bsd/vm/os_bsd.hpp b/hotspot/src/os/bsd/vm/os_bsd.hpp index 8c6dbb78888..8b48cb78cf0 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.hpp +++ b/hotspot/src/os/bsd/vm/os_bsd.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -75,8 +75,6 @@ class Bsd { static julong physical_memory() { return _physical_memory; } static void initialize_system_info(); - static bool supports_variable_stack_size(); - static void rebuild_cpu_to_node_map(); static GrowableArray* cpu_to_node() { return _cpu_to_node; } diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 3b198380646..bd4aa14b32f 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -711,39 +711,35 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); // stack size - if (os::Linux::supports_variable_stack_size()) { - // calculate stack size if it's not specified by caller - if (stack_size == 0) { - stack_size = os::Linux::default_stack_size(thr_type); + // calculate stack size if it's not specified by caller + if (stack_size == 0) { + stack_size = os::Linux::default_stack_size(thr_type); - switch (thr_type) { - case os::java_thread: - // Java threads use ThreadStackSize which default value can be - // changed with the flag -Xss - assert(JavaThread::stack_size_at_create() > 0, "this should be set"); - stack_size = JavaThread::stack_size_at_create(); + switch (thr_type) { + case os::java_thread: + // Java threads use ThreadStackSize which default value can be + // changed with the flag -Xss + assert(JavaThread::stack_size_at_create() > 0, "this should be set"); + stack_size = JavaThread::stack_size_at_create(); + break; + case os::compiler_thread: + if (CompilerThreadStackSize > 0) { + stack_size = (size_t)(CompilerThreadStackSize * K); break; - case os::compiler_thread: - if (CompilerThreadStackSize > 0) { - stack_size = (size_t)(CompilerThreadStackSize * K); - break; - } // else fall through: - // use VMThreadStackSize if CompilerThreadStackSize is not defined - case os::vm_thread: - case os::pgc_thread: - case os::cgc_thread: - case os::watcher_thread: - if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); - break; - } + } // else fall through: + // use VMThreadStackSize if CompilerThreadStackSize is not defined + case os::vm_thread: + case os::pgc_thread: + case os::cgc_thread: + case os::watcher_thread: + if (VMThreadStackSize > 0) stack_size = (size_t)(VMThreadStackSize * K); + break; } - - stack_size = MAX2(stack_size, os::Linux::min_stack_allowed); - pthread_attr_setstacksize(&attr, stack_size); - } else { - // let pthread_create() pick the default value. } + stack_size = MAX2(stack_size, os::Linux::min_stack_allowed); + pthread_attr_setstacksize(&attr, stack_size); + // glibc guard page pthread_attr_setguardsize(&attr, os::Linux::default_guard_size(thr_type)); diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp index 9128344ace2..b8104e75ebc 100644 --- a/hotspot/src/os/linux/vm/os_linux.hpp +++ b/hotspot/src/os/linux/vm/os_linux.hpp @@ -83,8 +83,6 @@ class Linux { static void set_glibc_version(const char *s) { _glibc_version = s; } static void set_libpthread_version(const char *s) { _libpthread_version = s; } - static bool supports_variable_stack_size(); - static void rebuild_cpu_to_node_map(); static GrowableArray* cpu_to_node() { return _cpu_to_node; } diff --git a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp index 9381b5dcd17..d8829b51c6f 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2014 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -489,10 +489,6 @@ void os::Aix::init_thread_fpu_state(void) { size_t os::Aix::min_stack_allowed = 128*K; -// Aix is always in floating stack mode. The stack size for a new -// thread can be set via pthread_attr_setstacksize(). -bool os::Aix::supports_variable_stack_size() { return true; } - // return default stack size for thr_type size_t os::Aix::default_stack_size(os::ThreadType thr_type) { // default stack size (compiler thread needs larger stack) diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp index 4b2da94715a..423fea33748 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -780,9 +780,6 @@ bool os::is_allocatable(size_t bytes) { #ifdef AMD64 size_t os::Bsd::min_stack_allowed = 64 * K; - -// amd64: pthread on amd64 is always in floating stack mode -bool os::Bsd::supports_variable_stack_size() { return true; } #else size_t os::Bsd::min_stack_allowed = (48 DEBUG_ONLY(+4))*K; @@ -790,7 +787,6 @@ size_t os::Bsd::min_stack_allowed = (48 DEBUG_ONLY(+4))*K; #define GET_GS() ({int gs; __asm__ volatile("movw %%gs, %w0":"=q"(gs)); gs&0xffff;}) #endif -bool os::Bsd::supports_variable_stack_size() { return true; } #endif // AMD64 // return default stack size for thr_type diff --git a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp index 0ed05eb9a76..9b2db238c0e 100644 --- a/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp +++ b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -290,10 +290,6 @@ bool os::is_allocatable(size_t bytes) { size_t os::Bsd::min_stack_allowed = 64 * K; -bool os::Bsd::supports_variable_stack_size() { - return true; -} - size_t os::Bsd::default_stack_size(os::ThreadType thr_type) { #ifdef _LP64 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp index 2d116ef212c..3a3ffd9fb30 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -496,9 +496,6 @@ bool os::is_allocatable(size_t bytes) { size_t os::Linux::min_stack_allowed = 64 * K; -// aarch64: pthread on aarch64 is always in floating stack mode -bool os::Linux::supports_variable_stack_size() { return true; } - // return default stack size for thr_type size_t os::Linux::default_stack_size(os::ThreadType thr_type) { // default stack size (compiler thread needs larger stack) diff --git a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp index a605d147bd4..ebf67a09f3a 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp @@ -467,8 +467,6 @@ void os::Linux::set_fpu_control_word(int fpu_control) { size_t os::Linux::min_stack_allowed = 128*K; -bool os::Linux::supports_variable_stack_size() { return true; } - // return default stack size for thr_type size_t os::Linux::default_stack_size(os::ThreadType thr_type) { // default stack size (compiler thread needs larger stack) diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index e733cc9e6ab..0c1c6263586 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -733,9 +733,6 @@ bool os::is_allocatable(size_t bytes) { size_t os::Linux::min_stack_allowed = 128 * K; -// pthread on Ubuntu is always in floating stack mode -bool os::Linux::supports_variable_stack_size() { return true; } - // return default stack size for thr_type size_t os::Linux::default_stack_size(os::ThreadType thr_type) { // default stack size (compiler thread needs larger stack) diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 700c6a762a7..decb51ea74f 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -623,11 +623,6 @@ size_t os::Linux::min_stack_allowed = 64 * K; size_t os::Linux::min_stack_allowed = (48 DEBUG_ONLY(+4))*K; #endif // AMD64 -// Test if pthread library can support variable thread stack size. -bool os::Linux::supports_variable_stack_size() { - return true; -} - // return default stack size for thr_type size_t os::Linux::default_stack_size(os::ThreadType thr_type) { // default stack size (compiler thread needs larger stack) diff --git a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index 08c46153e5f..5473f8aa44d 100644 --- a/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -305,10 +305,6 @@ bool os::is_allocatable(size_t bytes) { size_t os::Linux::min_stack_allowed = 64 * K; -bool os::Linux::supports_variable_stack_size() { - return true; -} - size_t os::Linux::default_stack_size(os::ThreadType thr_type) { #ifdef _LP64 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); From 4673cb217ea7c7e4120454ce85e967e6f71c6135 Mon Sep 17 00:00:00 2001 From: Bengt Rutisson Date: Tue, 4 Aug 2015 12:58:54 +0200 Subject: [PATCH 8/8] 8132953: imageDecompressor.hpp should not include precompiled.hpp Reviewed-by: dholmes --- hotspot/src/share/vm/classfile/imageDecompressor.cpp | 2 +- hotspot/src/share/vm/classfile/imageDecompressor.hpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/classfile/imageDecompressor.cpp b/hotspot/src/share/vm/classfile/imageDecompressor.cpp index 68c5c56f2a4..d6339500234 100644 --- a/hotspot/src/share/vm/classfile/imageDecompressor.cpp +++ b/hotspot/src/share/vm/classfile/imageDecompressor.cpp @@ -22,8 +22,8 @@ * */ -#include "runtime/thread.inline.hpp" #include "precompiled.hpp" +#include "runtime/thread.inline.hpp" #include "classfile/imageDecompressor.hpp" #include "runtime/thread.hpp" #include "utilities/bytes.hpp" diff --git a/hotspot/src/share/vm/classfile/imageDecompressor.hpp b/hotspot/src/share/vm/classfile/imageDecompressor.hpp index c57a8523fdf..6fca341b003 100644 --- a/hotspot/src/share/vm/classfile/imageDecompressor.hpp +++ b/hotspot/src/share/vm/classfile/imageDecompressor.hpp @@ -26,7 +26,6 @@ #define SHARE_VM_CLASSFILE_IMAGEDECOMPRESSOR_HPP #include "runtime/thread.inline.hpp" -#include "precompiled.hpp" #include "classfile/classLoader.hpp" #include "classfile/imageFile.hpp" #include "classfile/symbolTable.hpp"