8326376: java -version failed with CONF=fastdebug -XX:InitialCodeCacheSize=1024K -XX:ReservedCodeCacheSize=1200k

Reviewed-by: kvn, jwaters
This commit is contained in:
Thomas Stuefe 2024-02-22 17:45:34 +00:00
parent 9f9a732c38
commit d695af89f6
3 changed files with 21 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -42,11 +42,16 @@
#include "utilities/ostream.hpp" #include "utilities/ostream.hpp"
#include "utilities/nativeCallStack.hpp" #include "utilities/nativeCallStack.hpp"
int CompilationFailureInfo::current_compile_id_or_0() {
ciEnv* env = ciEnv::current();
return (env != nullptr) ? env->compile_id() : 0;
}
CompilationFailureInfo::CompilationFailureInfo(const char* failure_reason) : CompilationFailureInfo::CompilationFailureInfo(const char* failure_reason) :
_stack(2), _stack(2),
_failure_reason(os::strdup(failure_reason)), _failure_reason(os::strdup(failure_reason)),
_elapsed_seconds(os::elapsedTime()), _elapsed_seconds(os::elapsedTime()),
_compile_id(ciEnv::current()->task()->compile_id()) _compile_id(current_compile_id_or_0())
{} {}
CompilationFailureInfo::~CompilationFailureInfo() { CompilationFailureInfo::~CompilationFailureInfo() {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,6 +40,7 @@ class CompilationFailureInfo : public CHeapObj<mtCompiler> {
char* const _failure_reason; char* const _failure_reason;
const double _elapsed_seconds; const double _elapsed_seconds;
const int _compile_id; const int _compile_id;
static int current_compile_id_or_0();
public: public:
CompilationFailureInfo(const char* failure_reason); CompilationFailureInfo(const char* failure_reason);
~CompilationFailureInfo(); ~CompilationFailureInfo();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -55,5 +55,14 @@ public class StartupOutput {
if (exitCode != 1 && exitCode != 0) { if (exitCode != 1 && exitCode != 0) {
throw new Exception("VM crashed with exit code " + exitCode); throw new Exception("VM crashed with exit code " + exitCode);
} }
pb = ProcessTools.createLimitedTestJavaProcessBuilder("-XX:InitialCodeCacheSize=1024K", "-XX:ReservedCodeCacheSize=1200k", "-version");
out = new OutputAnalyzer(pb.start());
// The VM should not crash but will probably fail with a "CodeCache is full. Compiler has been disabled." message
out.stdoutShouldNotContain("# A fatal error");
exitCode = out.getExitValue();
if (exitCode != 1 && exitCode != 0) {
throw new Exception("VM crashed with exit code " + exitCode);
}
} }
} }