Skip to content

Commit

Permalink
8027711: Unify wildcarding syntax for CompileCommand and CompileOnly
Browse files Browse the repository at this point in the history
Reviewed-by: kvn, thartmann, chagedorn
  • Loading branch information
tobiasholenstein committed Jun 12, 2023
1 parent 4d66d97 commit f5cbe53
Show file tree
Hide file tree
Showing 73 changed files with 307 additions and 347 deletions.
99 changes: 21 additions & 78 deletions src/hotspot/share/compiler/compilerOracle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,90 +1035,33 @@ bool compilerOracle_init() {
}

bool CompilerOracle::parse_compile_only(char* line) {
int i;
char name[1024];
const char* className = nullptr;
const char* methodName = nullptr;

bool have_colon = (strstr(line, "::") != nullptr);
char method_sep = have_colon ? ':' : '.';

if (Verbose) {
tty->print_cr("%s", line);
if (line[0] == '\0') {
return true;
}

ResourceMark rm;
while (*line != '\0') {
MethodMatcher::Mode c_match = MethodMatcher::Exact;
MethodMatcher::Mode m_match = MethodMatcher::Exact;

for (i = 0;
i < 1024 && *line != '\0' && *line != method_sep && *line != ',' && !isspace(*line);
line++, i++) {
name[i] = *line;
if (name[i] == '.') name[i] = '/'; // package prefix uses '/'
char error_buf[1024] = {0};
LineCopy original(line);
char* method_pattern;
do {
if (line[0] == '\0') {
break;
}

if (i > 0) {
char* newName = NEW_RESOURCE_ARRAY( char, i + 1);
if (newName == nullptr) {
return false;
}
strncpy(newName, name, i);
newName[i] = '\0';

if (className == nullptr) {
className = newName;
} else {
methodName = newName;
method_pattern = strtok_r(line, ",", &line);
if (method_pattern != nullptr) {
TypedMethodOptionMatcher* matcher = TypedMethodOptionMatcher::parse_method_pattern(method_pattern, error_buf, sizeof(error_buf));
if (matcher != nullptr) {
register_command(matcher, CompileCommand::CompileOnly, true);
continue;
}
}

if (*line == method_sep) {
if (className == nullptr) {
className = "";
c_match = MethodMatcher::Any;
}
} else {
// got foo or foo/bar
if (className == nullptr) {
ShouldNotReachHere();
} else {
// missing class name handled as "Any" class match
if (className[0] == '\0') {
c_match = MethodMatcher::Any;
}
}
}

// each directive is terminated by , or NUL or . followed by NUL
if (*line == ',' || *line == '\0' || (line[0] == '.' && line[1] == '\0')) {
if (methodName == nullptr) {
methodName = "";
if (*line != method_sep) {
m_match = MethodMatcher::Any;
}
}

EXCEPTION_MARK;
Symbol* c_name = SymbolTable::new_symbol(className);
Symbol* m_name = SymbolTable::new_symbol(methodName);
Symbol* signature = nullptr;

TypedMethodOptionMatcher* tom = new TypedMethodOptionMatcher();
tom->init_matcher(c_name, c_match, m_name, m_match, signature);
register_command(tom, CompileCommand::CompileOnly, true);
if (PrintVMOptions) {
tty->print("CompileOnly: compileonly ");
tom->print();
}

className = nullptr;
methodName = nullptr;
ttyLocker ttyl;
tty->print_cr("CompileOnly: An error occurred during parsing");
if (*error_buf != '\0') {
tty->print_cr("Error: %s", error_buf);
}

line = *line == '\0' ? line : line + 1;
}
tty->print_cr("Line: '%s'", original.get());
return false;
} while (method_pattern != nullptr && line != nullptr);
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions test/hotspot/jtreg/compiler/c1/TestArrayCopyToFromObject.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
Expand All @@ -25,8 +25,8 @@
* @test
* @bug 8160591
* @summary C1-generated code for System.arraycopy() does not throw an ArrayStoreException if 'dst' is no a "proper" array (i.e., it is java.lang.Object)
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xcomp -XX:-UseCompressedClassPointers -XX:CompileOnly=TestArrayCopyToFromObject.test TestArrayCopyToFromObject
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xcomp -XX:+UseCompressedClassPointers -XX:CompileOnly=TestArrayCopyToFromObject.test TestArrayCopyToFromObject
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xcomp -XX:-UseCompressedClassPointers -XX:CompileOnly=TestArrayCopyToFromObject::test TestArrayCopyToFromObject
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xcomp -XX:+UseCompressedClassPointers -XX:CompileOnly=TestArrayCopyToFromObject::test TestArrayCopyToFromObject
*/
public class TestArrayCopyToFromObject {

Expand Down
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/compiler/c2/TestCMoveHasTopInput.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Alibaba Group Holding Limited. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -27,7 +28,7 @@
* @bug 8270307
* @summary C2: assert(false) failed: bad AD file after JDK-8267687
* @library /test/lib
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestCMoveHasTopInput.vMeth TestCMoveHasTopInput
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestCMoveHasTopInput::vMeth TestCMoveHasTopInput
*/

public class TestCMoveHasTopInput {
Expand Down Expand Up @@ -56,4 +57,4 @@ public static void main(String... args) {
test.vMeth(i);
}
}
}
}
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/compiler/c2/TestCondAddDeadBranch.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -27,8 +28,8 @@
* @summary C2: assert(false) failed: unscheduable graph
* Error mixing types with -XX:+UseCMoveUnconditionally -XX:+UseVectorCmov
* @requires vm.compiler2.enabled
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestCondAddDeadBranch TestCondAddDeadBranch
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestCondAddDeadBranch
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestCondAddDeadBranch::* TestCondAddDeadBranch
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestCondAddDeadBranch::*
* -XX:+UseCMoveUnconditionally -XX:+UseVectorCmov -XX:MaxVectorSize=32 TestCondAddDeadBranch
*
*/
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/compiler/c2/TestMatcherLargeOffset.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
Expand All @@ -26,7 +26,7 @@
* @bug 8202952
* @summary C2: Unexpected dead nodes after matching
*
* @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileOnly=::test
* @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileOnly=*TestMatcherLargeOffset::test
* compiler.c2.TestMatcherLargeOffset
*/
package compiler.c2;
Expand Down
5 changes: 3 additions & 2 deletions test/hotspot/jtreg/compiler/c2/TestModDivTopInput.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -26,9 +27,9 @@
* @bug 8283451
* @summary C2: assert(_base == Long) failed: Not a Long
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN
* -Xcomp -XX:CompileOnly=TestModDivTopInput -XX:-TieredCompilation -XX:StressSeed=87628618 TestModDivTopInput
* -Xcomp -XX:CompileOnly=TestModDivTopInput::* -XX:-TieredCompilation -XX:StressSeed=87628618 TestModDivTopInput
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM -XX:+StressGCM -XX:+StressCCP -XX:+StressIGVN
* -Xcomp -XX:CompileOnly=TestModDivTopInput -XX:-TieredCompilation TestModDivTopInput
* -Xcomp -XX:CompileOnly=TestModDivTopInput::* -XX:-TieredCompilation TestModDivTopInput
*/

public class TestModDivTopInput {
Expand Down
6 changes: 3 additions & 3 deletions test/hotspot/jtreg/compiler/c2/TestSqrt.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -30,8 +31,8 @@
* @requires vm.debug
*
* @run main/othervm -XX:-TieredCompilation -Xcomp
* -XX:CompileOnly=compiler/c2/TestSqrt
* -XX:CompileOnly=java/lang/Math
* -XX:CompileOnly=compiler.c2.TestSqrt::*
* -XX:CompileOnly=java.lang.Math::*
* compiler.c2.TestSqrt
*/
public class TestSqrt {
Expand All @@ -51,4 +52,3 @@ public static void main(String args[]) {
}
}
}

12 changes: 6 additions & 6 deletions test/hotspot/jtreg/compiler/codegen/TestGCMStorePlacement.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 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
Expand Down Expand Up @@ -32,11 +32,11 @@
* compilations, reducible and irreducible CFGs).
* @library /test/lib /
* @run main/othervm -Xbatch compiler.codegen.TestGCMStorePlacement regularReducible1
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement:: compiler.codegen.TestGCMStorePlacement regularReducible2
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement:: compiler.codegen.TestGCMStorePlacement regularReducible3
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement:: compiler.codegen.TestGCMStorePlacement regularReducible4
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement:: compiler.codegen.TestGCMStorePlacement osrReducible1
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement:: compiler.codegen.TestGCMStorePlacement osrReducible2
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement::* compiler.codegen.TestGCMStorePlacement regularReducible2
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement::* compiler.codegen.TestGCMStorePlacement regularReducible3
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement::* compiler.codegen.TestGCMStorePlacement regularReducible4
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement::* compiler.codegen.TestGCMStorePlacement osrReducible1
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler.codegen.TestGCMStorePlacement::* compiler.codegen.TestGCMStorePlacement osrReducible2
* @run main/othervm -Xbatch compiler.codegen.TestGCMStorePlacement osrIrreducible1
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
Expand Down Expand Up @@ -27,7 +27,7 @@
* @library /test/lib
*
* @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
* -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort
* -XX:CompileOnly=*::valueOf,*::byteValue,*::shortValue,*::testUnsignedByte,*::testUnsignedShort
* compiler.eliminateAutobox.UnsignedLoads
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Arm Limited. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -32,11 +32,11 @@
* @run main/othervm -Xint compiler.intrinsics.math.TestFpMinMaxIntrinsics sanityTests 1
* @run main/othervm -XX:+UnlockDiagnosticVMOptions
* -Xcomp -XX:TieredStopAtLevel=1
* -XX:CompileOnly=java/lang/Math
* -XX:CompileOnly=java.lang.Math::*
* compiler.intrinsics.math.TestFpMinMaxIntrinsics sanityTests 1
* @run main/othervm -XX:+UnlockDiagnosticVMOptions
* -Xcomp -XX:-TieredCompilation
* -XX:CompileOnly=java/lang/Math
* -XX:CompileOnly=java.lang.Math::*
* compiler.intrinsics.math.TestFpMinMaxIntrinsics sanityTests 1
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:-TieredCompilation -XX:CompileThresholdScaling=0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 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
Expand Down Expand Up @@ -36,17 +36,17 @@
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=positive.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/MD5
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.MD5::*
* -XX:+UseMD5Intrinsics
* -Dalgorithm=MD5
* compiler.intrinsics.sha.sanity.TestMD5Intrinsics
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=negative.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/MD5
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.MD5::*
* -XX:-UseMD5Intrinsics
* -Dalgorithm=MD5
* compiler.intrinsics.sha.sanity.TestMD5Intrinsics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 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
Expand Down Expand Up @@ -36,8 +36,8 @@
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=positive.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/MD5
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.MD5::*
* -XX:+UseMD5Intrinsics -XX:-UseSHA1Intrinsics
* -XX:-UseSHA256Intrinsics -XX:-UseSHA512Intrinsics
* -Dalgorithm=MD5
Expand All @@ -46,16 +46,16 @@
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=positive_def.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/MD5
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.MD5::*
* -XX:+UseMD5Intrinsics -Dalgorithm=MD5
* compiler.intrinsics.sha.sanity.TestMD5MultiBlockIntrinsics
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=negative.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/MD5
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.MD5::*
* -Dalgorithm=MD5
* compiler.intrinsics.sha.sanity.TestMD5MultiBlockIntrinsics
* @run main/othervm -DverificationStrategy=VERIFY_INTRINSIC_USAGE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
Expand Down Expand Up @@ -36,17 +36,17 @@
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=positive.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/SHA
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.SHA::*
* -XX:+UseSHA1Intrinsics
* -Dalgorithm=SHA-1
* compiler.intrinsics.sha.sanity.TestSHA1Intrinsics
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -Xbatch -XX:CompileThreshold=500
* -XX:Tier4InvocationThreshold=500
* -XX:+LogCompilation -XX:LogFile=negative.log
* -XX:CompileOnly=sun/security/provider/DigestBase
* -XX:CompileOnly=sun/security/provider/SHA
* -XX:CompileOnly=sun.security.provider.DigestBase::*
* -XX:CompileOnly=sun.security.provider.SHA::*
* -XX:-UseSHA1Intrinsics
* -Dalgorithm=SHA-1
* compiler.intrinsics.sha.sanity.TestSHA1Intrinsics
Expand Down

1 comment on commit f5cbe53

@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.