Skip to content

Commit

Permalink
8332032: C2: Remove ExpandSubTypeCheckAtParseTime flag
Browse files Browse the repository at this point in the history
Reviewed-by: thartmann, rcastanedalo
  • Loading branch information
chhagedorn committed May 31, 2024
1 parent ba323b5 commit 95c8a69
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/hotspot/share/opto/c2_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
14 changes: 4 additions & 10 deletions src/hotspot/share/opto/graphKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 95c8a69

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.