8382057: C2: "assert((ptr->bottom_type() == Type::TOP) || ((base == Compile::current()->top()) == (ptr->bottom_type()->make_ptr()->isa_oopptr() == nullptr))) failed: base input only needed for heap addresses" with -XX:+CountCompiledCalls

Reviewed-by: rcastanedalo, bmaillard, kvn
This commit is contained in:
Christian Hagedorn 2026-04-14 07:50:32 +00:00
parent f2f8828188
commit e71fa9e806
2 changed files with 41 additions and 3 deletions

View File

@ -1081,13 +1081,13 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
#ifndef PRODUCT
void Parse::count_compiled_calls(bool at_method_entry, bool is_inline) {
if( CountCompiledCalls ) {
if( at_method_entry ) {
if (CountCompiledCalls) {
if (at_method_entry) {
// bump invocation counter if top method (for statistics)
if (CountCompiledCalls && depth() == 1) {
const TypePtr* addr_type = TypeMetadataPtr::make(method());
Node* adr1 = makecon(addr_type);
Node* adr2 = basic_plus_adr(adr1, adr1, in_bytes(Method::compiled_invocation_counter_offset()));
Node* adr2 = off_heap_plus_addr(adr1, in_bytes(Method::compiled_invocation_counter_offset()));
increment_counter(adr2);
}
} else if (is_inline) {

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2026, 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 8382057
* @requires vm.debug == true
*
* @run main/othervm -Xbatch -XX:+CountCompiledCalls ${test.main.class}
*/
package compiler.debug;
public class TestCountCompiledCalls {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}