Merge
This commit is contained in:
commit
99cba80808
hotspot
src/share/vm
test/runtime/logging
@ -33,7 +33,8 @@
|
||||
#define LOG_TAG_LIST \
|
||||
LOG_TAG(defaultmethods) \
|
||||
LOG_TAG(logging) \
|
||||
LOG_TAG(safepoint)
|
||||
LOG_TAG(safepoint) \
|
||||
LOG_TAG(vmoperation)
|
||||
|
||||
#define PREFIX_LOG_TAG(T) (LogTag::T)
|
||||
|
||||
|
@ -1073,9 +1073,6 @@ public:
|
||||
develop(bool, BreakAtWarning, false, \
|
||||
"Execute breakpoint upon encountering VM warning") \
|
||||
\
|
||||
develop(bool, TraceVMOperation, false, \
|
||||
"Trace VM operations") \
|
||||
\
|
||||
develop(bool, UseFakeTimers, false, \
|
||||
"Tell whether the VM should use system time or a fake timer") \
|
||||
\
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "code/codeCacheExtensions.hpp"
|
||||
#include "compiler/compileBroker.hpp"
|
||||
#include "gc/shared/isGCActiveMark.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "memory/heapInspection.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
@ -55,13 +56,19 @@ void VM_Operation::set_calling_thread(Thread* thread, ThreadPriority priority) {
|
||||
|
||||
void VM_Operation::evaluate() {
|
||||
ResourceMark rm;
|
||||
if (TraceVMOperation) {
|
||||
tty->print("[");
|
||||
NOT_PRODUCT(print();)
|
||||
outputStream* debugstream;
|
||||
bool enabled = log_is_enabled(Debug, vmoperation);
|
||||
if (enabled) {
|
||||
debugstream = LogHandle(vmoperation)::debug_stream();
|
||||
debugstream->print("begin ");
|
||||
print_on_error(debugstream);
|
||||
debugstream->cr();
|
||||
}
|
||||
doit();
|
||||
if (TraceVMOperation) {
|
||||
tty->print_cr("]");
|
||||
if (enabled) {
|
||||
debugstream->print("end ");
|
||||
print_on_error(debugstream);
|
||||
debugstream->cr();
|
||||
}
|
||||
}
|
||||
|
||||
|
46
hotspot/test/runtime/logging/VMOperationTest.java
Normal file
46
hotspot/test/runtime/logging/VMOperationTest.java
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8143157
|
||||
* @summary vmoperation=debug should have logging output
|
||||
* @library /testlibrary
|
||||
* @compile VMOperationTestMain.java
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* @run main VMOperationTest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.*;
|
||||
|
||||
public class VMOperationTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-Xlog:vmoperation=debug", "-Xmx64m", "-Xms64m", "VMOperationTestMain");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("VM_Operation (");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
}
|
||||
|
43
hotspot/test/runtime/logging/VMOperationTestMain.java
Normal file
43
hotspot/test/runtime/logging/VMOperationTestMain.java
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 java.lang.ref.WeakReference;
|
||||
|
||||
public class VMOperationTestMain {
|
||||
public static byte[] garbage;
|
||||
public static volatile WeakReference<Object> weakref;
|
||||
|
||||
public static void createweakref() {
|
||||
Object o = new Object();
|
||||
weakref = new WeakReference<>(o);
|
||||
}
|
||||
|
||||
// Loop until a GC runs.
|
||||
public static void main(String[] args) throws Exception {
|
||||
createweakref();
|
||||
while (weakref.get() != null) {
|
||||
garbage = new byte[8192];
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user