From e01f6da1b8e7de19f90c7cb21b3cd1ff2ab29cb7 Mon Sep 17 00:00:00 2001 From: Emanuel Peter Date: Tue, 16 Jan 2024 10:15:00 +0000 Subject: [PATCH] 8320175: [BACKOUT] 8316533: C2 compilation fails with assert(verify(phase)) failed: missing Value() optimization Reviewed-by: thartmann, chagedorn --- src/hotspot/share/opto/subtypenode.cpp | 12 ---- .../types/TestSubTypeOfAbstractClass.java | 64 ------------------- 2 files changed, 76 deletions(-) delete mode 100644 test/hotspot/jtreg/compiler/types/TestSubTypeOfAbstractClass.java diff --git a/src/hotspot/share/opto/subtypenode.cpp b/src/hotspot/share/opto/subtypenode.cpp index 1011cb54245..393585d453c 100644 --- a/src/hotspot/share/opto/subtypenode.cpp +++ b/src/hotspot/share/opto/subtypenode.cpp @@ -43,18 +43,6 @@ const Type* SubTypeCheckNode::sub(const Type* sub_t, const Type* super_t) const if (!superklass->is_interface() && superklass->is_abstract() && !superklass->as_instance_klass()->has_subklass()) { Compile::current()->dependencies()->assert_leaf_type(superklass); - if (subk->is_same_java_type_as(superk) && !sub_t->maybe_null()) { - // The super_t has no subclasses, and sub_t has the same type and is not null, - // hence the check should always evaluate to EQ. However, this is an impossible - // situation since super_t is also abstract, and hence sub_t cannot have the - // same type and be non-null. - // Still, if the non-static method of an abstract class without subclasses is - // force-compiled, the Param0 has the self/this pointer with NotNull. This - // method would now never be called, because of the leaf-type dependency. Hence, - // just for consistency with verification, we return EQ. - return TypeInt::CC_EQ; - } - // subk is either a supertype of superk, or null. In either case, superk is a subtype. return TypeInt::CC_GT; } } diff --git a/test/hotspot/jtreg/compiler/types/TestSubTypeOfAbstractClass.java b/test/hotspot/jtreg/compiler/types/TestSubTypeOfAbstractClass.java deleted file mode 100644 index 63274b86e72..00000000000 --- a/test/hotspot/jtreg/compiler/types/TestSubTypeOfAbstractClass.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2023, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * 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 8316533 - * @summary Oop of abstract class A with no subclass is subtype checked after null-check - * @run driver compiler.types.TestSubTypeOfAbstractClass - */ - -/** - * @test - * @bug 8316533 - * @summary Oop of abstract class A is subtype checked after null-check - * @requires vm.compiler2.enabled - * @run main/othervm -XX:CompileCommand=compileonly,*A::test - * -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+StressReflectiveCode - * compiler.types.TestSubTypeOfAbstractClass - */ - -package compiler.types; - -public class TestSubTypeOfAbstractClass { - - abstract class A { - public static A get_null() { - return null; - } - - public static boolean test() { - // NullCheck -> CastPP with type A:NotNull - // But A is abstract with no subclass, hence this type is impossible - return get_null() instanceof A; - } - } - - public static void main(String[] args) { - for (int i = 0; i < 10_000; i++ ) { - A.test(); - } - } -}