Skip to content

Commit ea3bb50

Browse files
committed
[GR-49240] Update SyncPort info.
PullRequest: graal/17583
2 parents a7f6940 + 4279536 commit ea3bb50

23 files changed

+55
-33
lines changed

compiler/src/jdk.graal.compiler.processor/src/jdk/graal/compiler/lir/processor/SyncPortProcessor.java

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public class SyncPortProcessor extends AbstractProcessor {
7575
// HOTSPOT_PORT_SYNC_CHECK=true HOTSPOT_PORT_SYNC_SHIFT_UPDATE_CMD_FILE="update.sh" mx build &&
7676
// bash update.sh
7777
static final String SYNC_SHIFT_UPDATE_COMMAND_DUMP_FILE_ENV_VAR = "HOTSPOT_PORT_SYNC_SHIFT_UPDATE_CMD_FILE";
78+
// Allows searching code in the range [BEGIN-$HOTSPOT_PORT_SYNC_SEARCH_RANGE,
79+
// END+HOTSPOT_PORT_SYNC_SEARCH_RANGE].
80+
static final String SYNC_SEARCH_RANGE_VAR = "HOTSPOT_PORT_SYNC_SEARCH_RANGE";
7881

7982
static final String JDK_LATEST = "https://raw.githubusercontent.com/openjdk/jdk/master/";
8083
static final String JDK_LATEST_HUMAN = "https://github.com/openjdk/jdk/blob/master/";
@@ -85,7 +88,28 @@ public class SyncPortProcessor extends AbstractProcessor {
8588

8689
static final Pattern URL_PATTERN = Pattern.compile("^https://github.com/openjdk/jdk/blob/(?<commit>[0-9a-fA-F]{40})/(?<path>[-_./A-Za-z0-9]+)#L(?<lineStart>[0-9]+)-L(?<lineEnd>[0-9]+)$");
8790

88-
static final int SEARCH_RANGE = 200;
91+
static final int DEFAULT_SEARCH_RANGE = 200;
92+
93+
private final boolean isEnabled;
94+
private final boolean shouldDump;
95+
private final String dumpUpdateCommandsEnvVar;
96+
private final String overwriteURL;
97+
private final int searchRange;
98+
99+
public SyncPortProcessor() {
100+
this.isEnabled = Boolean.parseBoolean(System.getenv(SYNC_CHECK_ENV_VAR));
101+
this.shouldDump = Boolean.parseBoolean(System.getenv(SYNC_DUMP_ENV_VAR));
102+
this.dumpUpdateCommandsEnvVar = System.getenv(SYNC_SHIFT_UPDATE_COMMAND_DUMP_FILE_ENV_VAR);
103+
this.overwriteURL = System.getenv(SYNC_OVERWRITE_ENV_VAR);
104+
105+
int tempSearchRange = DEFAULT_SEARCH_RANGE;
106+
try {
107+
tempSearchRange = Integer.parseInt(System.getenv(SYNC_SEARCH_RANGE_VAR));
108+
} catch (NumberFormatException e) {
109+
// SYNC_SEARCH_RANGE_VAR not set or illegal
110+
}
111+
this.searchRange = tempSearchRange;
112+
}
89113

90114
@Override
91115
public Set<String> getSupportedAnnotationTypes() {
@@ -109,15 +133,13 @@ private void compareDigest(MessageDigest md, AnnotationMirror annotationMirror,
109133
int lineStart = Integer.parseInt(matcher.group("lineStart"));
110134
int lineEnd = Integer.parseInt(matcher.group("lineEnd"));
111135

112-
String dumpUpdateCommandsEnvVar = System.getenv(SYNC_SHIFT_UPDATE_COMMAND_DUMP_FILE_ENV_VAR);
113136
PrintWriter dumpUpdateCommands;
114137
if (dumpUpdateCommandsEnvVar != null) {
115138
dumpUpdateCommands = new PrintWriter(new FileOutputStream(dumpUpdateCommandsEnvVar, true));
116139
} else {
117140
dumpUpdateCommands = null;
118141
}
119142
try (dumpUpdateCommands) {
120-
String overwriteURL = System.getenv(SYNC_OVERWRITE_ENV_VAR);
121143
boolean isURLOverwritten = overwriteURL != null && !"".equals(overwriteURL);
122144

123145
String urlPrefix = isURLOverwritten ? overwriteURL : JDK_LATEST;
@@ -135,7 +157,7 @@ private void compareDigest(MessageDigest md, AnnotationMirror annotationMirror,
135157

136158
if (sha1.equals(sha1Old)) {
137159
String latestCommit = getLatestCommit(proxy);
138-
int idx = find(proxy, urlOld, url, lineStart - 1, lineEnd, SEARCH_RANGE);
160+
int idx = find(proxy, urlOld, url, lineStart - 1, lineEnd, searchRange);
139161
if (idx != -1) {
140162
int idxInclusive = idx + 1;
141163
kind = NOTE;
@@ -168,7 +190,7 @@ private void compareDigest(MessageDigest md, AnnotationMirror annotationMirror,
168190
latestCommit,
169191
latestCommit,
170192
path);
171-
if (Boolean.parseBoolean(System.getenv(SYNC_DUMP_ENV_VAR))) {
193+
if (shouldDump) {
172194
dump(proxy, urlOld, lineStart - 1, lineEnd, element + ".old");
173195
dump(proxy, url, lineStart - 1, lineEnd, element + ".new");
174196
}
@@ -286,7 +308,7 @@ private String getLatestCommit(Proxy proxy) throws IOException, URISyntaxExcepti
286308

287309
@Override
288310
protected boolean doProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
289-
if (Boolean.parseBoolean(System.getenv(SYNC_CHECK_ENV_VAR))) {
311+
if (isEnabled) {
290312
if (!roundEnv.processingOver()) {
291313
try {
292314
// Set https.protocols explicitly to avoid handshake failure

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
701701
}
702702

703703
// @formatter:off
704-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/share/opto/library_call.cpp#L2876-L2931",
704+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/share/opto/library_call.cpp#L2877-L2932",
705705
sha1 = "5c117a305e90a48f0a6fe86ace2c15942393c0ab")
706706
// @formatter:on
707707
private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config, GraphBuilderContext b, ResolvedJavaMethod targetMethod, ForeignCallDescriptor descriptor,

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/HotSpotHashCodeSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import jdk.graal.compiler.word.Word;
4646

4747
// @formatter:off
48-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/5404b4eafc2eb3291cecf99f98728946388f5d16/src/hotspot/share/opto/library_call.cpp#L4513-L4645",
48+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/share/opto/library_call.cpp#L4514-L4646",
4949
sha1 = "9776f1621d6e2daecd17acf0cd89039339b28a1d")
5050
// @formatter:on
5151
public class HotSpotHashCodeSnippets extends IdentityHashCodeSnippets {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replacements/VirtualThreadUpdateJFRSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* Snippet for updating JFR thread local data on {@code Thread#setCurrentThread} events.
6565
*/
6666
// @formatter:off
67-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/share/opto/library_call.cpp#L3484-L3610",
67+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/share/opto/library_call.cpp#L3485-L3611",
6868
sha1 = "1f980401f5d7d9a363577635fd57fc1e24505d91")
6969
// @formatter:on
7070
public class VirtualThreadUpdateJFRSnippets implements Snippets {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64BigIntegerMulAddOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
@SyncPort(from = "https://github.com/openjdk/jdk/blob/ce8399fd6071766114f5f201b6e44a7abdba9f5a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L4718-L4737",
5252
sha1 = "57f40186d75104a5e607d6fc047bbd50ef246590")
53-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L3672-L3708",
53+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L4014-L4050",
5454
sha1 = "33649be9177daf5f0b4817d807458a5ff8c00365")
5555
// @formatter:on
5656
public final class AArch64BigIntegerMulAddOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64BigIntegerMultiplyToLenOp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
// @formatter:off
6060
@SyncPort(from = "https://github.com/openjdk/jdk/blob/ce8399fd6071766114f5f201b6e44a7abdba9f5a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L4642-L4680",
6161
sha1 = "9c106817eae54d0e6783c1442b26fee08bc7a07a")
62-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L3163-L3172",
62+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L3505-L3514",
6363
sha1 = "376de6fbb2caccaac53c4aa934ce96f8f0dc7f18")
64-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L3360-L3670",
64+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L3702-L4012",
6565
sha1 = "dfdfc5113a04698da12c5cb29bc78ced09a2eb63")
6666
// @formatter:on
6767
public final class AArch64BigIntegerMultiplyToLenOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64CountPositivesOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
* Returns the number of positive bytes.
7070
*/
7171
// @formatter:off
72-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L5121-L5190",
72+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L5463-L5532",
7373
sha1 = "ce54a7cf2fcfe7ccb8f6604c038887fc1c4ebce1")
7474
@SyncPort(from = "https://github.com/openjdk/jdk/blob/ce8399fd6071766114f5f201b6e44a7abdba9f5a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L4971-L5137",
7575
sha1 = "3b4e6edb4372e8babb009763c2d05961348dd723")

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64EncodeArrayOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import jdk.vm.ci.meta.Value;
5252

5353
// @formatter:off
54-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/be2b92bd8b43841cc2b9c22ed4fde29be30d47bb/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L5720-L5833",
54+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L6062-L6175",
5555
sha1 = "80e6323172af5e8a33625b4eb14629cdad500a0f")
5656
// @formatter:on
5757
@Opcode("AArch64_ENCODE_ARRAY")

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64FloatToHalfFloatOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import jdk.vm.ci.meta.Value;
4040

4141
// @formatter:off
42-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/1fc726a8b34fcd41dae12a6d7c63232f9ccef3f4/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp#L517-L520",
42+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp#L527-L530",
4343
sha1 = "95116a9e350c16c09e5eed9db1328a39cb909474")
4444
// @formatter:on
4545
public class AArch64FloatToHalfFloatOp extends AArch64LIRInstruction {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/aarch64/AArch64HalfFloatToFloatOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import jdk.vm.ci.meta.Value;
3939

4040
// @formatter:off
41-
@SyncPort(from = "https://github.com/openjdk/jdk/blob/1fc726a8b34fcd41dae12a6d7c63232f9ccef3f4/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp#L522-L525",
41+
@SyncPort(from = "https://github.com/openjdk/jdk/blob/7bb59dc8da0c61c5da5c3aab5d56a6e4880001ce/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp#L532-L535",
4242
sha1 = "f723de35aeda75e448037a23cd6af82f457c24cf")
4343
// @formatter:on
4444
public class AArch64HalfFloatToFloatOp extends AArch64LIRInstruction {

0 commit comments

Comments
 (0)