--- /dev/null 2013-04-15 12:30:09.841410950 +0400 +++ new/test/compiler/ciReplay/TestSA.sh 2013-04-17 20:14:24.914654602 +0400 @@ -0,0 +1,93 @@ +#!/bin/sh +# +# Copyright (c) 2013, 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 8011675 +## @summary testing of ciReplay with using generated by SA replay.txt +## @author igor.ignatyev@oracle.com +## @run shell TestSA.sh +## + +if [ "${TESTSRC}" = "" ] +then + TESTSRC=${PWD} + echo "TESTSRC not set. Using "${TESTSRC}" as default" +fi +echo "TESTSRC=${TESTSRC}" + +## Adding common setup Variables for running shell tests. +. ${TESTSRC}/../../test_env.sh + +. ${TESTSRC}/common.sh + +generate_replay + +${MV} ${replay_data} replay_vm.txt + +if [ -z "${core_file}" -o ! -r "${core_file}" ] +then + # skip test if MacOS host isn't configured for core dumping + if [ "$OS" = "Darwin" ] + then + if [ ! -d "/cores" ] + then + echo TEST SKIPPED: \'/cores\' dir doens\'t exist + exit 0 + fi + if [ ! -w "/cores" ] + then + echo TEST SKIPPED: \'/cores\' dir exists but is not writable + exit 0 + fi + fi + + test_fail 2 "CHECK :: CORE GENERATION" "core wasn't generated" +fi + +echo "dumpreplaydata -a > ${replay_data}" | \ + ${JAVA} ${TESTVMOPTS} \ + -cp ${TESTJAVA}${FS}lib${FS}sa-jdi.jar \ + sun.jvm.hotspot.CLHSDB ${JAVA} ${core_file} + +if [ ! -s ${replay_data} ] +then + test_fail 1 "CHECK :: REPLAY DATA GENERATION" \ + "replay data wasn't generated by SA" +fi + +diff --brief ${replay_data} replay_vm.txt +if [ $? -ne 0 ] +then + echo WARNING: replay.txt from SA != replay.txt from VM +fi + +common_tests 10 +${VM_TYPE}_tests 20 + +cleanup + +echo TEST PASSED + --- old/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java 2013-04-17 20:14:25.242654589 +0400 +++ new/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java 2013-04-17 20:14:24.938654601 +0400 @@ -46,10 +46,12 @@ Type type = db.lookupType("CompileTask"); methodField = type.getAddressField("_method"); osrBciField = new CIntField(type.getCIntegerField("_osr_bci"), 0); + compLevelField = new CIntField(type.getCIntegerField("_comp_level"), 0); } private static AddressField methodField; private static CIntField osrBciField; + private static CIntField compLevelField; public CompileTask(Address addr) { super(addr); @@ -63,4 +65,8 @@ public int osrBci() { return (int)osrBciField.getValue(getAddress()); } + + public int compLevel() { + return (int)compLevelField.getValue(getAddress()); + } } --- old/src/share/vm/ci/ciEnv.cpp 2013-04-17 20:14:25.302654587 +0400 +++ new/src/share/vm/ci/ciEnv.cpp 2013-04-17 20:14:25.014654598 +0400 @@ -1178,13 +1178,15 @@ for (int i = 0; i < objects->length(); i++) { objects->at(i)->dump_replay_data(out); } - Method* method = task()->method(); - int entry_bci = task()->osr_bci(); + CompileTask* task = this->task(); + Method* method = task->method(); + int entry_bci = task->osr_bci(); + int comp_level = task->comp_level(); // Klass holder = method->method_holder(); - out->print_cr("compile %s %s %s %d", + out->print_cr("compile %s %s %s %d %d", method->klass_name()->as_quoted_ascii(), method->name()->as_quoted_ascii(), method->signature()->as_quoted_ascii(), - entry_bci); + entry_bci, comp_level); out->flush(); } --- old/agent/doc/clhsdb.html 2013-04-17 20:14:25.270654588 +0400 +++ new/agent/doc/clhsdb.html 2013-04-17 20:14:24.958654600 +0400 @@ -15,7 +15,7 @@
There is also JavaScript based SA command line interface called jsdb. But, CLHSDB supports Unix shell-like (or dbx/gdb-like) command line interface with -support for output redirection/appending (familiar >, >>), command history and so on. +support for output redirection/appending (familiar >, >>), command history and so on. Each CLHSDB command can have zero or more arguments and optionally end with output redirection (or append) to a file. Commands may be stored in a file and run using source command. help command prints usage message for all supported commands (or a specific command) @@ -49,7 +49,7 @@ dumpheap [ file ] dump heap in hprof binary format dumpideal -a | id dump ideal graph like debug flag -XX:+PrintIdeal dumpilt -a | id dump inline tree for C2 compilation - dumpreplaydata
| -a |Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set +
Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set
by implementing more commands in a JavaScript file and by loading it by jsload command. jseval
command may be used to evaluate arbitrary JavaScript expression from a string. Any JavaScript function
may be exposed as a CLHSDB command by registering it using JavaScript registerCommand
-function. This function accepts command name, usage and name of the JavaScript implementation function
+function. This function accepts command name, usage and name of the JavaScript implementation function
as arguments.
When a java process crashes in compiled method, usually a core file is saved. -The C2 replay function can reproduce the compiling process in the core. -c2replay.html +The replay function can reproduce the compiling process in the core. +cireplay.html