RFR: 8265129: Add intrinsic support for JVM.getClassId
Denghui Dong
ddong at openjdk.java.net
Wed Apr 21 15:24:42 UTC 2021
On Tue, 13 Apr 2021 16:52:44 GMT, Denghui Dong <ddong at openjdk.org> wrote:
> 8265129: Add intrinsic support for JVM.getClassId
Hi,
Could I have a review of this change that adding intrinsic support for JVM.getClassId.
In the current patch, I didn't completely implement c1 intrinsic support on arm/ppc/s390 platform, but I believe it can be easily achieved,
but before that, I hope someone can do a preliminary review of this patch because I am not familiar with the implementation of jit.
JMH benchmark:
@State(Scope.Benchmark)
public class MyBenchmark {
@Setup
public void setup() {
JVM.getJVM().createNativeJFR();
}
@Benchmark
@Fork(value=1, jvmArgs = {"--add-exports", "jdk.jfr/jdk.jfr.internal=ALL-UNNAMED"})
@Warmup(iterations = 5, time = 1)
public void testIntrinsic(Blackhole bh) {
bh.consume(JVM.getClassId(boolean.class));
bh.consume(JVM.getClassId(void.class));
bh.consume(JVM.getClassId(MyBenchmark.class));
}
@Benchmark
@Fork(value=1, jvmArgs = {"--add-exports", "jdk.jfr/jdk.jfr.internal=ALL-UNNAMED"})
@Warmup(iterations = 5, time = 1)
public void testNoIntrinsic(Blackhole bh) {
bh.consume(JVM.getClassIdNonIntrinsic(boolean.class));
bh.consume(JVM.getClassIdNonIntrinsic(void.class));
bh.consume(JVM.getClassIdNonIntrinsic(MyBenchmark.class));
}
@TearDown
public void tearDown() {
if (JVM.getClassIdNonIntrinsic(boolean.class) != JVM.getClassId(boolean.class)
|| JVM.getClassIdNonIntrinsic(void.class) != JVM.getClassId(void.class)
|| JVM.getClassIdNonIntrinsic(MyBenchmark.class) != JVM.getClassId(MyBenchmark.class)) {
throw new RuntimeException();
}
}
}
result on x86_64:
Benchmark Mode Samples Score Score error Units
o.s.MyBenchmark.testIntrinsic thrpt 20 195662934.056 566744.281 ops/s
o.s.MyBenchmark.testNoIntrinsic thrpt 20 7997200.373 6424.038 ops/s
-------------
PR: https://git.openjdk.java.net/jdk/pull/3470
More information about the hotspot-jfr-dev
mailing list