From 95c8a69b0e7a99ec0cd41aa9b6ba033fd3216695 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Fri, 31 May 2024 06:56:57 +0000 Subject: [PATCH] 8332032: C2: Remove ExpandSubTypeCheckAtParseTime flag Reviewed-by: thartmann, rcastanedalo --- src/hotspot/share/opto/c2_globals.hpp | 3 --- src/hotspot/share/opto/graphKit.cpp | 14 ++++---------- .../types/TestSubTypeCheckMacroTrichotomy.java | 3 +-- .../types/TestSubTypeCheckWithBottomArray.java | 2 -- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index baf2256005e..f2445e4f136 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -767,9 +767,6 @@ product(bool, UseProfiledLoopPredicate, true, \ "Move predicates out of loops based on profiling data") \ \ - product(bool, ExpandSubTypeCheckAtParseTime, false, DIAGNOSTIC, \ - "Do not use subtype check macro node") \ - \ develop(uintx, StressLongCountedLoop, 0, \ "if > 0, convert int counted loops to long counted loops" \ "to stress handling of long counted loops: run inner loop" \ diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index bcf4ee40424..614a4123c0d 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -2713,17 +2713,12 @@ Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, No // Here, the type of 'fa' is often exact, so the store check // of fa[1]=x will fold up, without testing the nullness of x. // - // Do not skip the static sub type check with StressReflectiveCode during - // parsing (i.e. with ExpandSubTypeCheckAtParseTime) because the - // associated CheckCastNodePP could already be folded when the type - // system can prove it's an impossible type. Therefore, we should also - // do the static sub type check here to ensure control is folded as well. - // Otherwise, the graph is left in a broken state. // At macro expansion, we would have already folded the SubTypeCheckNode // being expanded here because we always perform the static sub type // check in SubTypeCheckNode::sub() regardless of whether - // StressReflectiveCode is set or not. - switch (C->static_subtype_check(superk, subk, !ExpandSubTypeCheckAtParseTime)) { + // StressReflectiveCode is set or not. We can therefore skip this + // static check when StressReflectiveCode is on. + switch (C->static_subtype_check(superk, subk)) { case Compile::SSC_always_false: { Node* always_fail = *ctrl; @@ -2904,8 +2899,7 @@ Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, No } Node* GraphKit::gen_subtype_check(Node* obj_or_subklass, Node* superklass) { - bool expand_subtype_check = C->post_loop_opts_phase() || // macro node expansion is over - ExpandSubTypeCheckAtParseTime; // forced expansion + bool expand_subtype_check = C->post_loop_opts_phase(); // macro node expansion is over if (expand_subtype_check) { MergeMemNode* mem = merged_memory(); Node* ctrl = control(); diff --git a/test/hotspot/jtreg/compiler/types/TestSubTypeCheckMacroTrichotomy.java b/test/hotspot/jtreg/compiler/types/TestSubTypeCheckMacroTrichotomy.java index ef31bd30bb6..b89b1201139 100644 --- a/test/hotspot/jtreg/compiler/types/TestSubTypeCheckMacroTrichotomy.java +++ b/test/hotspot/jtreg/compiler/types/TestSubTypeCheckMacroTrichotomy.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Red Hat, Inc. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -32,7 +32,6 @@ * @run main/othervm -XX:-BackgroundCompilation TestSubTypeCheckMacroTrichotomy * @run main/othervm -XX:-BackgroundCompilation * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressReflectiveCode - * -XX:+UnlockDiagnosticVMOptions -XX:+ExpandSubTypeCheckAtParseTime * -XX:-TieredCompilation -XX:CompileThreshold=100 TestSubTypeCheckMacroTrichotomy * */ diff --git a/test/hotspot/jtreg/compiler/types/TestSubTypeCheckWithBottomArray.java b/test/hotspot/jtreg/compiler/types/TestSubTypeCheckWithBottomArray.java index a9cb3d7e6c8..6bf2f3b54c6 100644 --- a/test/hotspot/jtreg/compiler/types/TestSubTypeCheckWithBottomArray.java +++ b/test/hotspot/jtreg/compiler/types/TestSubTypeCheckWithBottomArray.java @@ -50,12 +50,10 @@ * either against an interface or an unrelated non-sub-class. * * @run main/othervm -Xcomp -XX:CompileCommand=compileonly,compiler.types.TestSubTypeCheckWithBottomArray::test* - * -XX:+UnlockDiagnosticVMOptions -XX:+ExpandSubTypeCheckAtParseTime * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressReflectiveCode * -XX:CompileCommand=inline,compiler.types.TestSubTypeCheckWithBottomArray::check* * compiler.types.TestSubTypeCheckWithBottomArray * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,compiler.types.TestSubTypeCheckWithBottomArray::test* - * -XX:+UnlockDiagnosticVMOptions -XX:+ExpandSubTypeCheckAtParseTime * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressReflectiveCode * -XX:CompileCommand=inline,compiler.types.TestSubTypeCheckWithBottomArray::check* * compiler.types.TestSubTypeCheckWithBottomArray