Skip to content

Commit a07044e

Browse files
committed
Replace ASM with ClassFile API
1 parent 35647e1 commit a07044e

File tree

145 files changed

+1966
-2751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1966
-2751
lines changed

compiler/mx.compiler/suite.py

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -85,41 +85,6 @@
8585
"urls" : ["https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/batik-all-1.7.jar"],
8686
},
8787

88-
"ASM_9.7.1" : {
89-
"digest" : "sha512:4767b01603dad5c79cc1e2b5f3722f72b1059d928f184f446ba11badeb1b381b3a3a9a801cc43d25d396df950b09d19597c73173c411b1da890de808b94f1f50",
90-
"sourceDigest" : "sha512:d7c0de5912d04949a3d06cad366ff35a877da2682d9c74579625d62686032ea9349aff6102b17f92e9ec7eb4e9b1cd906b649c6a3ac798bfb9e31e5425de009d",
91-
"maven" : {
92-
"groupId" : "org.ow2.asm",
93-
"artifactId" : "asm",
94-
"version" : "9.7.1",
95-
},
96-
"license" : "BSD-new",
97-
},
98-
99-
"ASM_TREE_9.7.1" : {
100-
"digest" : "sha512:e55008c392fdd35e95d3404766b12dd4b46e13d5c362fcd0ab42a65751a82737eaf0ebc857691d1916190d34407adfde4437615d69c278785416fd911e00978d",
101-
"sourceDigest" : "sha512:3cea80bc7b55679dfa3d2065c6cb6951007cc7817082e9fcf4c5e3cdc073c22eddf7c7899cff60b1092049ec9038e8d3aa9a8828ef731739bda8b5afcec30e86",
102-
"maven" : {
103-
"groupId" : "org.ow2.asm",
104-
"artifactId" : "asm-tree",
105-
"version" : "9.7.1",
106-
},
107-
"dependencies" : ["ASM_9.7.1"],
108-
"license" : "BSD-new",
109-
},
110-
111-
"ASM_UTIL_9.7.1" : {
112-
"digest" : "sha512:522d793d15a2c5ea6504a50222cf0750f1eab7b881cf289675042539b1aba8b3868197b1bebe729de728dd10020eb028ae16252dcd5d84fdcbf7f925832bc269",
113-
"sourceDigest" : "sha512:387aa887bfec24aec287d9aacebfdc0c2e1ab16a4adce933aecac6fc41545ce43a3eea0ed139db52dd0d0af910cfd2162aa4d6330a81b32b64b36f03b49db66a",
114-
"maven" : {
115-
"groupId" : "org.ow2.asm",
116-
"artifactId" : "asm-util",
117-
"version" : "9.7.1",
118-
},
119-
"dependencies" : ["ASM_9.7.1"],
120-
"license" : "BSD-new",
121-
},
122-
12388
"HSDIS" : {
12489
"urlbase" : "https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/hsdis",
12590
"packedResource" : True,
@@ -248,8 +213,6 @@
248213
"dependencies" : [
249214
"jdk.graal.compiler",
250215
"mx:JUNIT",
251-
"ASM_TREE_9.7.1",
252-
"ASM_UTIL_9.7.1",
253216
"JAVA_ALLOCATION_INSTRUMENTER",
254217
"truffle:TRUFFLE_SL_TEST",
255218
"truffle:TRUFFLE_TEST",
@@ -295,7 +258,7 @@
295258
"truffle:TRUFFLE_DSL_PROCESSOR"
296259
],
297260
"checkstyle" : "jdk.graal.compiler",
298-
"javaCompliance" : "21+",
261+
"javaCompliance" : "23+",
299262
"jacoco" : "exclude",
300263
"graalCompilerSourceEdition": "ignore",
301264
},
@@ -336,8 +299,8 @@
336299
},
337300
"jacoco" : "exclude",
338301
"checkstyle": "jdk.graal.compiler",
339-
"javaCompliance" : "21+",
340-
"javaPreviewNeeded": "21+",
302+
"javaCompliance" : "23+",
303+
"javaPreviewNeeded": "23+",
341304
"workingSets" : "Graal,HotSpot,Test",
342305
"graalCompilerSourceEdition": "ignore",
343306
},
@@ -347,7 +310,7 @@
347310
"sourceDirs" : ["src"],
348311
"dependencies" : ["mx:JMH_1_21", "jdk.graal.compiler.microbenchmarks"],
349312
"checkstyle" : "jdk.graal.compiler",
350-
"javaCompliance" : "21+",
313+
"javaCompliance" : "23+",
351314
"annotationProcessors" : ["mx:JMH_1_21"],
352315
"spotbugsIgnoresGenerated" : True,
353316
"workingSets" : "Graal,Bench",
@@ -370,7 +333,7 @@
370333
],
371334
},
372335
"checkstyle" : "jdk.graal.compiler",
373-
"javaCompliance" : "21+",
336+
"javaCompliance" : "23+",
374337
"checkPackagePrefix" : "false",
375338
"annotationProcessors" : ["mx:JMH_1_21"],
376339
"spotbugsIgnoresGenerated" : True,
@@ -519,8 +482,6 @@
519482
"truffle:TRUFFLE_COMPILER",
520483
"truffle:TRUFFLE_RUNTIME",
521484
"regex:TREGEX",
522-
"ASM_TREE_9.7.1",
523-
"ASM_UTIL_9.7.1",
524485
],
525486
"exclude" : [
526487
"mx:JUNIT",

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/api/test/ExportingClassLoader.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/api/test/ModuleSupport.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,6 @@
3939
import java.util.Set;
4040

4141
import jdk.graal.compiler.debug.DebugOptions;
42-
4342
import jdk.internal.module.Modules;
4443

4544
public class ModuleSupport {
@@ -110,7 +109,7 @@ public static List<String> getJRTGraalClassNames() throws IOException {
110109

111110
Path top = fs.getPath("/modules/");
112111
Files.find(top, Integer.MAX_VALUE,
113-
(path, attrs) -> attrs.isRegularFile()).forEach(p -> {
112+
(_, attrs) -> attrs.isRegularFile()).forEach(p -> {
114113
int nameCount = p.getNameCount();
115114
if (nameCount > 2) {
116115
String base = p.getName(nameCount - 1).toString();

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/amd64/test/AMD64MatchRuleTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
2626

2727
import static org.junit.Assume.assumeTrue;
2828

29+
import org.junit.Before;
30+
import org.junit.Test;
31+
2932
import jdk.graal.compiler.core.common.cfg.BasicBlock;
3033
import jdk.graal.compiler.core.test.MatchRuleTest;
3134
import jdk.graal.compiler.lir.LIR;
@@ -37,9 +40,6 @@
3740
import jdk.graal.compiler.lir.amd64.AMD64ControlFlow.CmpConstBranchOp;
3841
import jdk.graal.compiler.lir.amd64.AMD64ControlFlow.CmpDataBranchOp;
3942
import jdk.graal.compiler.lir.amd64.AMD64Unary;
40-
import org.junit.Before;
41-
import org.junit.Test;
42-
4343
import jdk.vm.ci.amd64.AMD64;
4444
import jdk.vm.ci.amd64.AMD64Kind;
4545

@@ -103,7 +103,7 @@ public void testVolatileExtension() {
103103
boolean found = false;
104104
for (LIRInstruction ins : lir.getLIRforBlock(lir.getControlFlowGraph().getBlocks()[lir.codeEmittingOrder()[0]])) {
105105
if (ins instanceof AMD64Unary.MemoryOp) {
106-
ins.visitEachOutput((value, mode, flags) -> assertTrue(value.getPlatformKind().toString(), value.getPlatformKind().equals(AMD64Kind.QWORD)));
106+
ins.visitEachOutput((value, _, _) -> assertTrue(value.getPlatformKind().toString(), value.getPlatformKind().equals(AMD64Kind.QWORD)));
107107
assertFalse("MemoryOp expected only once in first block", found);
108108
found = true;
109109
}
@@ -209,7 +209,7 @@ public void testVolatileExtensionDifferentBlocks() {
209209
boolean found = false;
210210
for (LIRInstruction ins : lir.getLIRforBlock(lir.getControlFlowGraph().getBlocks()[lir.codeEmittingOrder()[0]])) {
211211
if (ins instanceof AMD64Unary.MemoryOp) {
212-
ins.visitEachOutput((value, mode, flags) -> assertTrue(value.getPlatformKind().toString(), value.getPlatformKind().equals(AMD64Kind.QWORD)));
212+
ins.visitEachOutput((value, _, _) -> assertTrue(value.getPlatformKind().toString(), value.getPlatformKind().equals(AMD64Kind.QWORD)));
213213
assertFalse("MemoryOp expected only once in first block", found);
214214
found = true;
215215
}

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/BytecodeDisassemblerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@ private static List<Class<?>> gatherClasses() throws IOException {
5858
FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"), Collections.emptyMap());
5959
Path top = fs.getPath("/modules/");
6060
Files.find(top, Integer.MAX_VALUE,
61-
(path, attrs) -> attrs.isRegularFile()).forEach(p -> {
61+
(_, attrs) -> attrs.isRegularFile()).forEach(p -> {
6262
int nameCount = p.getNameCount();
6363
if (nameCount > 2) {
6464
String base = p.getName(nameCount - 1).toString();

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/CheckGraalInvariants.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -238,7 +238,6 @@ public void test() {
238238
runTest(new InvariantsTool());
239239
}
240240

241-
@SuppressWarnings("try")
242241
public static void runTest(InvariantsTool tool) {
243242
RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
244243
Providers providers = rt.getHostBackend().getProviders();
@@ -383,7 +382,7 @@ public static void runTest(InvariantsTool tool) {
383382
ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
384383
try (DebugContext debug = new Builder(options).build()) {
385384
StructuredGraph graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.YES).method(method).build();
386-
try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("CheckingGraph", graph, method)) {
385+
try (DebugCloseable _ = debug.disableIntercept(); DebugContext.Scope _ = debug.scope("CheckingGraph", graph, method)) {
387386
graphBuilderSuite.apply(graph, context);
388387
// update phi stamps
389388
graph.getNodes().filter(PhiNode.class).forEach(PhiNode::inferStamp);
@@ -437,7 +436,7 @@ public static void runTest(InvariantsTool tool) {
437436
try (DebugContext debug = new Builder(options).build()) {
438437
boolean isSubstitution = method.getAnnotation(Snippet.class) != null;
439438
StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).setIsSubstitution(isSubstitution).build();
440-
try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("CheckingGraph", graph, method)) {
439+
try (DebugCloseable _ = debug.disableIntercept(); DebugContext.Scope _ = debug.scope("CheckingGraph", graph, method)) {
441440
checkMethod(method);
442441
graphBuilderSuite.apply(graph, context);
443442
// update phi stamps

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/CompilationWatchDogTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,6 @@ protected InstalledCode getCode(ResolvedJavaMethod installedCodeOwner, Structure
104104
}
105105
}
106106

107-
@SuppressWarnings("try")
108107
private InstalledCode getCodeHelper(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, boolean forceCompile, boolean installAsDefault, OptionValues options) {
109108
CompilationIdentifier compilation = new CompilationIdentifier() {
110109
@Override
@@ -138,9 +137,9 @@ public void onStuckCompilation(CompilationWatchDog watchDog, Thread watched, Com
138137
};
139138

140139
CompilationWatchDog watch = CompilationWatchDog.watch(compilation, options, false, longCompilationHandler, null);
141-
try (CompilationWatchDog watchScope = watch) {
140+
try (CompilationWatchDog _ = watch) {
142141
event("start compiling");
143-
try (TTY.Filter f = new TTY.Filter()) {
142+
try (TTY.Filter _ = new TTY.Filter()) {
144143
return super.getCode(installedCodeOwner, graph, forceCompile, installAsDefault, options);
145144
}
146145
} finally {

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ConditionalEliminationTestBase.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -61,15 +61,14 @@ protected void testConditionalElimination(String snippet, String referenceSnippe
6161
testConditionalElimination(snippet, referenceSnippet, false, false);
6262
}
6363

64-
@SuppressWarnings("try")
6564
protected void testConditionalElimination(String snippet, String referenceSnippet, boolean applyConditionalEliminationOnReference, boolean applyLowering) {
6665
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
6766
DebugContext debug = graph.getDebug();
6867
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
6968
CoreProviders context = getProviders();
7069
CanonicalizerPhase canonicalizer1 = createCanonicalizerPhase();
7170
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
72-
try (DebugContext.Scope scope = debug.scope("ConditionalEliminationTest", graph)) {
71+
try (DebugContext.Scope _ = debug.scope("ConditionalEliminationTest", graph)) {
7372
prepareGraph(graph, canonicalizer1, context, applyLowering);
7473
new IterativeConditionalEliminationPhase(canonicalizer, true).apply(graph, context);
7574
canonicalizer.apply(graph, context);
@@ -78,7 +77,7 @@ protected void testConditionalElimination(String snippet, String referenceSnippe
7877
debug.handle(t);
7978
}
8079
StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.YES);
81-
try (DebugContext.Scope scope = debug.scope("ConditionalEliminationTest.ReferenceGraph", referenceGraph)) {
80+
try (DebugContext.Scope _ = debug.scope("ConditionalEliminationTest.ReferenceGraph", referenceGraph)) {
8281
prepareGraph(referenceGraph, canonicalizer, context, applyLowering);
8382
if (applyConditionalEliminationOnReference) {
8483
new ConditionalEliminationPhase(canonicalizer, true).apply(referenceGraph, context);

0 commit comments

Comments
 (0)