8292561: Make "ReplayCompiles" a diagnostic product switch
Reviewed-by: kvn, xliu
This commit is contained in:
parent
2fbb936203
commit
f9004fe443
src/hotspot/share
ci
compiler
prims
runtime
test/hotspot/jtreg/compiler/ciReplay
@ -647,12 +647,10 @@ ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
|
||||
// It is known to be accessible, since it was found in the constant pool.
|
||||
ciKlass* ciKlass = get_klass(klass);
|
||||
is_accessible = true;
|
||||
#ifndef PRODUCT
|
||||
if (ReplayCompiles && ciKlass == _unloaded_ciinstance_klass) {
|
||||
// Klass was unresolved at replay dump time and therefore not accessible.
|
||||
is_accessible = false;
|
||||
}
|
||||
#endif
|
||||
return ciKlass;
|
||||
}
|
||||
|
||||
@ -943,11 +941,9 @@ ciMethod* ciEnv::get_method_by_index_impl(const constantPoolHandle& cpool,
|
||||
: !m->method_holder()->is_loaded())) {
|
||||
m = NULL;
|
||||
}
|
||||
#ifdef ASSERT
|
||||
if (m != NULL && ReplayCompiles && !ciReplay::is_loaded(m)) {
|
||||
m = NULL;
|
||||
}
|
||||
#endif
|
||||
if (m != NULL) {
|
||||
// We found the method.
|
||||
return get_method(m);
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "ci/ciClassList.hpp"
|
||||
#include "ci/ciObjectFactory.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "classfile/vmClassMacros.hpp"
|
||||
#include "code/debugInfoRec.hpp"
|
||||
#include "code/dependencies.hpp"
|
||||
@ -192,15 +191,6 @@ private:
|
||||
if (o == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
#ifndef PRODUCT
|
||||
if (ReplayCompiles && o->is_klass()) {
|
||||
Klass* k = (Klass*)o;
|
||||
if (k->is_instance_klass() && ciReplay::is_klass_unresolved((InstanceKlass*)k)) {
|
||||
// Klass was unresolved at replay dump time. Simulate this case.
|
||||
return ciEnv::_unloaded_ciinstance_klass;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return _factory->get_metadata(o);
|
||||
}
|
||||
}
|
||||
|
@ -156,11 +156,9 @@ ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
|
||||
if (_interpreter_invocation_count == 0)
|
||||
_interpreter_invocation_count = 1;
|
||||
_instructions_size = -1;
|
||||
#ifdef ASSERT
|
||||
if (ReplayCompiles) {
|
||||
ciReplay::initialize(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,14 +261,12 @@ bool ciMethodData::load_data() {
|
||||
_arg_local = mdo->arg_local();
|
||||
_arg_stack = mdo->arg_stack();
|
||||
_arg_returned = mdo->arg_returned();
|
||||
#ifndef PRODUCT
|
||||
if (ReplayCompiles) {
|
||||
ciReplay::initialize(this);
|
||||
if (is_empty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "ci/ciObjArrayKlass.hpp"
|
||||
#include "ci/ciObject.hpp"
|
||||
#include "ci/ciObjectFactory.hpp"
|
||||
#include "ci/ciReplay.hpp"
|
||||
#include "ci/ciSymbol.hpp"
|
||||
#include "ci/ciSymbols.hpp"
|
||||
#include "ci/ciTypeArray.hpp"
|
||||
@ -285,6 +286,14 @@ ciMetadata* ciObjectFactory::cached_metadata(Metadata* key) {
|
||||
ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
|
||||
ASSERT_IN_VM;
|
||||
|
||||
if (ReplayCompiles && key->is_klass()) {
|
||||
Klass* k = (Klass*)key;
|
||||
if (k->is_instance_klass() && ciReplay::is_klass_unresolved((InstanceKlass*)k)) {
|
||||
// Klass was unresolved at replay dump time. Simulate this case.
|
||||
return ciEnv::_unloaded_ciinstance_klass;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
if (CIObjectFactoryVerify) {
|
||||
Metadata* last = NULL;
|
||||
|
@ -57,8 +57,6 @@
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/utf8.hpp"
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
||||
// ciReplay
|
||||
|
||||
typedef struct _ciMethodDataRecord {
|
||||
@ -1585,7 +1583,6 @@ bool ciReplay::is_klass_unresolved(const InstanceKlass* klass) {
|
||||
ciInstanceKlassRecord* rec = replay_state->find_ciInstanceKlass(klass);
|
||||
return rec == NULL;
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
oop ciReplay::obj_field(oop obj, Symbol* name) {
|
||||
InstanceKlass* ik = InstanceKlass::cast(obj->klass());
|
||||
|
@ -99,7 +99,6 @@
|
||||
class ciReplay {
|
||||
CI_PACKAGE_ACCESS
|
||||
|
||||
#ifndef PRODUCT
|
||||
private:
|
||||
static int replay_impl(TRAPS);
|
||||
|
||||
@ -123,7 +122,6 @@ class ciReplay {
|
||||
static bool should_not_inline(ciMethod* method);
|
||||
static bool should_inline(void* data, ciMethod* method, int bci, int inline_depth, bool& should_delay);
|
||||
static bool should_not_inline(void* data, ciMethod* method, int bci, int inline_depth);
|
||||
#endif
|
||||
|
||||
public:
|
||||
static oop obj_field(oop obj, Symbol* name);
|
||||
|
@ -305,7 +305,7 @@
|
||||
product(ccstrlist, CompileCommand, "", \
|
||||
"Prepend to .hotspot_compiler; e.g. log,java/lang/String.<init>") \
|
||||
\
|
||||
develop(bool, ReplayCompiles, false, \
|
||||
product(bool, ReplayCompiles, false, DIAGNOSTIC, \
|
||||
"Enable replay of compilations from ReplayDataFile") \
|
||||
\
|
||||
product(ccstr, ReplayDataFile, NULL, \
|
||||
@ -316,7 +316,7 @@
|
||||
"File containing inlining replay information" \
|
||||
"[default: ./inline_pid%p.log] (%p replaced with pid)") \
|
||||
\
|
||||
develop(intx, ReplaySuppressInitializers, 2, \
|
||||
product(intx, ReplaySuppressInitializers, 2, DIAGNOSTIC, \
|
||||
"Control handling of class initialization during replay: " \
|
||||
"0 - don't do anything special; " \
|
||||
"1 - treat all class initializers as empty; " \
|
||||
@ -325,7 +325,7 @@
|
||||
" pretend they are empty after starting replay") \
|
||||
range(0, 3) \
|
||||
\
|
||||
develop(bool, ReplayIgnoreInitErrors, false, \
|
||||
product(bool, ReplayIgnoreInitErrors, false, DIAGNOSTIC, \
|
||||
"Ignore exceptions thrown during initialization for replay") \
|
||||
\
|
||||
product(bool, DumpReplayDataOnError, true, \
|
||||
|
@ -3657,9 +3657,7 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
|
||||
|
||||
post_thread_start_event(thread);
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (ReplayCompiles) ciReplay::replay(thread);
|
||||
#endif
|
||||
|
||||
#ifdef ASSERT
|
||||
// Some platforms (like Win*) need a wrapper around these test
|
||||
|
@ -3872,9 +3872,12 @@ bool Arguments::handle_deprecated_print_gc_flags() {
|
||||
}
|
||||
|
||||
static void apply_debugger_ergo() {
|
||||
#ifndef PRODUCT
|
||||
// UseDebuggerErgo is notproduct
|
||||
if (ReplayCompiles) {
|
||||
FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UseDebuggerErgo) {
|
||||
// Turn on sub-flags
|
||||
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2020, 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
|
||||
* @summary Test that VM rejects and invalid replay file.
|
||||
* @library /test/lib
|
||||
* @requires vm.compMode != "Xint"
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* java.management
|
||||
* @run driver TestInvalidReplayFile
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
||||
public class TestInvalidReplayFile {
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// This test also serves as a very basic sanity test for release VMs (accepting the replay options and
|
||||
// attempting to read the replay file). Most of the tests in ciReplay use -XX:CICrashAt to induce artificial
|
||||
// crashes into the compiler, and that option is not available for release VMs. Therefore we cannot generate
|
||||
// replay files as a test in release builds.
|
||||
|
||||
File f = new File("bogus-replay-file.txt");
|
||||
FileWriter w = new FileWriter(f);
|
||||
w.write("Bogus 123");
|
||||
w.flush();
|
||||
w.close();
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
"-XX:+UnlockDiagnosticVMOptions",
|
||||
"-Xmx100M",
|
||||
"-XX:+ReplayCompiles", "-XX:ReplayDataFile=./bogus-replay-file.txt");
|
||||
|
||||
OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
|
||||
output_detail.shouldNotHaveExitValue(0);
|
||||
output_detail.shouldContain("Error while parsing");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user