Skip to content

Commit 594e519

Browse files
committed
8346984: Remove ASM-based benchmarks from Class-File API benchmarks
Reviewed-by: liach, redestad, erikj
1 parent c027f2e commit 594e519

File tree

7 files changed

+7
-555
lines changed

7 files changed

+7
-555
lines changed

make/test/BuildMicrobenchmark.gmk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2018, 2024, 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
@@ -96,8 +96,6 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
9696
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
9797
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
9898
--add-exports java.base/jdk.internal.util=ALL-UNNAMED \
99-
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
100-
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
10199
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
102100
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
103101
--add-exports java.base/sun.security.util=ALL-UNNAMED \

test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 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
@@ -44,8 +44,6 @@
4444
@Warmup(iterations = 2)
4545
@Measurement(iterations = 4)
4646
@Fork(value = 1, jvmArgs = {
47-
"--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED",
48-
"--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED",
4947
"--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED",
5048
"--add-exports", "java.base/jdk.internal.classfile.impl=ALL-UNNAMED"})
5149
@State(Scope.Benchmark)

test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 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
@@ -35,10 +35,6 @@ public class AdaptNull extends AbstractCorpusBenchmark {
3535

3636
@Param({
3737
// "ARRAYCOPY",
38-
"ASM_1",
39-
"ASM_3",
40-
"ASM_UNSHARED_3",
41-
// "ASM_TREE",
4238
"SHARED_1",
4339
"SHARED_2",
4440
"SHARED_3",

test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 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
@@ -29,12 +29,6 @@
2929
import java.lang.classfile.CompoundElement;
3030
import java.lang.classfile.MethodModel;
3131
import java.lang.classfile.instruction.LoadInstruction;
32-
import jdk.internal.org.objectweb.asm.ClassReader;
33-
import jdk.internal.org.objectweb.asm.ClassVisitor;
34-
import jdk.internal.org.objectweb.asm.MethodVisitor;
35-
import jdk.internal.org.objectweb.asm.Opcodes;
36-
import jdk.internal.org.objectweb.asm.tree.ClassNode;
37-
import jdk.internal.org.objectweb.asm.tree.MethodNode;
3832
import org.openjdk.jmh.annotations.Benchmark;
3933
import org.openjdk.jmh.annotations.BenchmarkMode;
4034
import org.openjdk.jmh.annotations.Mode;
@@ -45,55 +39,6 @@
4539
*/
4640
public class ReadDeep extends AbstractCorpusBenchmark {
4741

48-
@Benchmark
49-
@BenchmarkMode(Mode.Throughput)
50-
public void asmStreamCountLoads(Blackhole bh) {
51-
for (byte[] bytes : classes) {
52-
ClassReader cr = new ClassReader(bytes);
53-
54-
var mv = new MethodVisitor(Opcodes.ASM9) {
55-
int count = 0;
56-
57-
@Override
58-
public void visitVarInsn(int opcode, int var) {
59-
++count;
60-
}
61-
};
62-
63-
var visitor = new ClassVisitor(Opcodes.ASM9) {
64-
@Override
65-
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
66-
return mv;
67-
}
68-
};
69-
cr.accept(visitor, 0);
70-
bh.consume(mv.count);
71-
}
72-
}
73-
74-
@Benchmark
75-
@BenchmarkMode(Mode.Throughput)
76-
public void asmTreeCountLoads(Blackhole bh) {
77-
for (byte[] bytes : classes) {
78-
var mv = new MethodVisitor(Opcodes.ASM9) {
79-
int count = 0;
80-
81-
@Override
82-
public void visitVarInsn(int opcode, int var) {
83-
++count;
84-
}
85-
};
86-
87-
ClassNode node = new ClassNode();
88-
ClassReader cr = new ClassReader(bytes);
89-
cr.accept(node, 0);
90-
for (MethodNode mn : node.methods) {
91-
mn.accept(mv);
92-
}
93-
bh.consume(mv.count);
94-
}
95-
}
96-
9742
@Benchmark
9843
@BenchmarkMode(Mode.Throughput)
9944
public void jdkElementsCountLoads(Blackhole bh) {

test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 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
@@ -27,42 +27,11 @@
2727
import java.lang.classfile.ClassModel;
2828
import java.lang.classfile.ClassFile;
2929
import java.lang.classfile.FieldModel;
30-
import jdk.internal.org.objectweb.asm.*;
31-
import jdk.internal.org.objectweb.asm.tree.*;
3230
import org.openjdk.jmh.annotations.*;
3331
import org.openjdk.jmh.infra.Blackhole;
3432

3533
public class ReadMetadata extends AbstractCorpusBenchmark {
3634

37-
@Benchmark
38-
@BenchmarkMode(Mode.Throughput)
39-
public void asmStreamReadName(Blackhole bh) {
40-
for (byte[] bytes : classes) {
41-
ClassReader cr = new ClassReader(bytes);
42-
var visitor = new ClassVisitor(Opcodes.ASM9) {
43-
String theName;
44-
45-
@Override
46-
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
47-
theName = name;
48-
}
49-
};
50-
cr.accept(visitor, 0);
51-
bh.consume(visitor.theName);
52-
}
53-
}
54-
55-
@Benchmark
56-
@BenchmarkMode(Mode.Throughput)
57-
public void asmTreeReadName(Blackhole bh) {
58-
for (byte[] bytes : classes) {
59-
ClassNode node = new ClassNode();
60-
ClassReader cr = new ClassReader(bytes);
61-
cr.accept(node, 0);
62-
bh.consume(node.name);
63-
}
64-
}
65-
6635
@Benchmark
6736
@BenchmarkMode(Mode.Throughput)
6837
public void jdkReadName(Blackhole bh) {
@@ -90,43 +59,6 @@ public void jdkReadMemberNames(Blackhole bh) {
9059
}
9160
}
9261

93-
@Benchmark
94-
@BenchmarkMode(Mode.Throughput)
95-
public void asmStreamCountFields(Blackhole bh) {
96-
for (byte[] bytes : classes) {
97-
ClassReader cr = new ClassReader(bytes);
98-
var visitor = new ClassVisitor(Opcodes.ASM9) {
99-
int count;
100-
101-
@Override
102-
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
103-
if ((access & Opcodes.ACC_PUBLIC) != 1) {
104-
++count;
105-
}
106-
return null;
107-
}
108-
};
109-
cr.accept(visitor, 0);
110-
bh.consume(visitor.count);
111-
}
112-
}
113-
114-
@Benchmark
115-
@BenchmarkMode(Mode.Throughput)
116-
public void asmTreeCountFields(Blackhole bh) {
117-
for (byte[] bytes : classes) {
118-
int count = 0;
119-
ClassNode node = new ClassNode();
120-
ClassReader cr = new ClassReader(bytes);
121-
cr.accept(node, 0);
122-
for (FieldNode fn : node.fields)
123-
if ((fn.access & Opcodes.ACC_PUBLIC) != 1) {
124-
++count;
125-
}
126-
bh.consume(count);
127-
}
128-
}
129-
13062
@Benchmark
13163
@BenchmarkMode(Mode.Throughput)
13264
public void jdkTreeCountFields(Blackhole bh) {

0 commit comments

Comments
 (0)