< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 45,55 ****
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Binding;
import org.graalvm.compiler.runtime.RuntimeProvider;
! import org.graalvm.compiler.serviceprovider.GraalServices;
import org.graalvm.compiler.test.GraalTest;
import org.junit.Test;
import jdk.vm.ci.aarch64.AArch64;
import jdk.vm.ci.amd64.AMD64;
--- 45,55 ----
import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Binding;
import org.graalvm.compiler.runtime.RuntimeProvider;
! import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
import org.graalvm.compiler.test.GraalTest;
import org.junit.Test;
import jdk.vm.ci.aarch64.AArch64;
import jdk.vm.ci.amd64.AMD64;
*** 255,265 ****
// Can share most implementation parts with with
// Unsafe.allocateUninitializedArray0
"java/lang/reflect/Array.newArray(Ljava/lang/Class;I)Ljava/lang/Object;",
// HotSpot MacroAssembler-based intrinsic
"sun/nio/cs/ISO_8859_1$Encoder.encodeISOArray([CI[BII)I",
! // Stub based intrinsics but implementation seems complex in C2
"sun/security/provider/DigestBase.implCompressMultiBlock([BII)I");
// See JDK-8207146.
String oopName = isJDK12OrHigher() ? "Reference" : "Object";
--- 255,266 ----
// Can share most implementation parts with with
// Unsafe.allocateUninitializedArray0
"java/lang/reflect/Array.newArray(Ljava/lang/Class;I)Ljava/lang/Object;",
// HotSpot MacroAssembler-based intrinsic
"sun/nio/cs/ISO_8859_1$Encoder.encodeISOArray([CI[BII)I",
! // We have implemented implCompressMultiBlock0 on JDK9+. Does it worth
! // backporting as corresponding HotSpot stubs are only generated on SPARC?
"sun/security/provider/DigestBase.implCompressMultiBlock([BII)I");
// See JDK-8207146.
String oopName = isJDK12OrHigher() ? "Reference" : "Object";
*** 269,290 ****
"jdk/jfr/internal/JVM.counterTime()J",
"jdk/jfr/internal/JVM.getBufferWriter()Ljava/lang/Object;",
"jdk/jfr/internal/JVM.getClassId(Ljava/lang/Class;)J");
add(toBeInvestigated,
- // Some logic and a stub call
- "com/sun/crypto/provider/CounterMode.implCrypt([BII[BI)I",
- // Stub and very little logic
- "com/sun/crypto/provider/GHASH.processBlocks([BII[J[J)V",
// HotSpot MacroAssembler-based intrinsic
"java/lang/Math.fma(DDD)D",
// HotSpot MacroAssembler-based intrinsic
"java/lang/Math.fma(FFF)F",
// Just check if the argument is a compile time constant
"java/lang/invoke/MethodHandleImpl.isCompileConstant(Ljava/lang/Object;)Z",
- // Some logic and a runtime call
- "java/util/ArraysSupport.vectorizedMismatch(Ljava/lang/Object;JLjava/lang/Object;JII)I",
// Only used as a marker for vectorization?
"java/util/stream/Streams$RangeIntSpliterator.forEachRemaining(Ljava/util/function/IntConsumer;)V",
// Only implemented on non-AMD64 platforms (some logic and runtime call)
"java/util/zip/Adler32.updateByteBuffer(IJII)I",
// Only implemented on non-AMD64 platforms (some logic and runtime call)
--- 270,285 ----
*** 293,305 ****
"jdk/internal/misc/Unsafe.allocateUninitializedArray0(Ljava/lang/Class;I)Ljava/lang/Object;",
// Control flow, deopts, and a cast
"jdk/internal/util/Preconditions.checkIndex(IILjava/util/function/BiFunction;)I",
// HotSpot MacroAssembler-based intrinsic
! "sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray([CI[BII)I",
! // Runtime call and some complex compiler logic
! "sun/security/provider/DigestBase.implCompressMultiBlock0([BII)I");
/*
* Per default, all these operations are mapped to some generic method for which we
* already have compiler intrinsics. Performance-wise it would be better to support them
* explicitly as the more generic method might be more restrictive and therefore slower
--- 288,298 ----
"jdk/internal/misc/Unsafe.allocateUninitializedArray0(Ljava/lang/Class;I)Ljava/lang/Object;",
// Control flow, deopts, and a cast
"jdk/internal/util/Preconditions.checkIndex(IILjava/util/function/BiFunction;)I",
// HotSpot MacroAssembler-based intrinsic
! "sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray([CI[BII)I");
/*
* Per default, all these operations are mapped to some generic method for which we
* already have compiler intrinsics. Performance-wise it would be better to support them
* explicitly as the more generic method might be more restrictive and therefore slower
*** 342,372 ****
"jdk/internal/misc/Unsafe.weakCompareAndSetShortRelease(Ljava/lang/Object;JSS)Z");
// Compact string support - HotSpot MacroAssembler-based intrinsic or complex C2 logic.
add(toBeInvestigated,
"java/lang/StringCoding.hasNegatives([BII)Z",
! "java/lang/StringCoding.implEncodeISOArray([BI[BII)I",
"java/lang/StringLatin1.indexOf([B[B)I",
! "java/lang/StringUTF16.getChar([BI)C",
! "java/lang/StringUTF16.getChars([BII[CI)V",
"java/lang/StringUTF16.indexOf([BI[BII)I",
"java/lang/StringUTF16.indexOf([B[B)I",
"java/lang/StringUTF16.indexOfChar([BIII)I",
"java/lang/StringUTF16.indexOfLatin1([BI[BII)I",
! "java/lang/StringUTF16.indexOfLatin1([B[B)I",
! "java/lang/StringUTF16.putChar([BII)V",
! "java/lang/StringUTF16.toBytes([CII)[B");
! // These are handled through an intrinsic for String.equals itself
! add(ignore,
! "java/lang/StringLatin1.equals([B[B)Z",
! "java/lang/StringUTF16.equals([B[B)Z");
}
if (isJDK10OrHigher()) {
add(toBeInvestigated,
! "java/lang/Math.multiplyHigh(JJ)J",
! "jdk/internal/util/ArraysSupport.vectorizedMismatch(Ljava/lang/Object;JLjava/lang/Object;JII)I");
}
if (isJDK11OrHigher()) {
// Relevant for Java flight recorder
add(toBeInvestigated,
--- 335,383 ----
"jdk/internal/misc/Unsafe.weakCompareAndSetShortRelease(Ljava/lang/Object;JSS)Z");
// Compact string support - HotSpot MacroAssembler-based intrinsic or complex C2 logic.
add(toBeInvestigated,
"java/lang/StringCoding.hasNegatives([BII)Z",
! "java/lang/StringCoding.implEncodeISOArray([BI[BII)I");
! add(ignore,
! // handled through an intrinsic for String.equals itself
! "java/lang/StringLatin1.equals([B[B)Z",
!
! // handled by an intrinsic for StringLatin1.indexOf([BI[BII)I
"java/lang/StringLatin1.indexOf([B[B)I",
!
! // handled through an intrinsic for String.equals itself
! "java/lang/StringUTF16.equals([B[B)Z",
!
! // handled by an intrinsic for StringUTF16.indexOfUnsafe
"java/lang/StringUTF16.indexOf([BI[BII)I",
"java/lang/StringUTF16.indexOf([B[B)I",
+
+ // handled by an intrinsic for StringUTF16.indexOfCharUnsafe
"java/lang/StringUTF16.indexOfChar([BIII)I",
+
+ // handled by an intrinsic for StringUTF16.indexOfLatin1Unsafe
"java/lang/StringUTF16.indexOfLatin1([BI[BII)I",
! "java/lang/StringUTF16.indexOfLatin1([B[B)I");
!
! if (!config.useAESCTRIntrinsics) {
! add(ignore,
! "com/sun/crypto/provider/CounterMode.implCrypt([BII[BI)I");
! }
! if (!config.useGHASHIntrinsics()) {
! add(ignore,
! "com/sun/crypto/provider/GHASH.processBlocks([BII[J[J)V");
! }
! if (!(config.useSHA1Intrinsics() || config.useSHA256Intrinsics() || config.useSHA512Intrinsics())) {
! add(ignore,
! "sun/security/provider/DigestBase.implCompressMultiBlock0([BII)I");
! }
}
if (isJDK10OrHigher()) {
add(toBeInvestigated,
! "java/lang/Math.multiplyHigh(JJ)J");
}
if (isJDK11OrHigher()) {
// Relevant for Java flight recorder
add(toBeInvestigated,
*** 399,412 ****
--- 410,429 ----
if (!(arch instanceof AMD64)) {
// Can we implement these on non-AMD64 platforms? C2 seems to.
add(toBeInvestigated,
"java/lang/String.compareTo(Ljava/lang/String;)I",
+ "java/lang/StringLatin1.indexOf([B[B)I",
"java/lang/StringLatin1.inflate([BI[BII)V",
"java/lang/StringLatin1.inflate([BI[CII)V",
"java/lang/StringUTF16.compress([BI[BII)I",
"java/lang/StringUTF16.compress([CI[BII)I",
+ "java/lang/StringUTF16.indexOf([BI[BII)I",
+ "java/lang/StringUTF16.indexOf([B[B)I",
+ "java/lang/StringUTF16.indexOfChar([BIII)I",
+ "java/lang/StringUTF16.indexOfLatin1([BI[BII)I",
+ "java/lang/StringUTF16.indexOfLatin1([B[B)I",
"jdk/internal/misc/Unsafe.compareAndExchangeByte(Ljava/lang/Object;JBB)B",
"jdk/internal/misc/Unsafe.compareAndExchangeShort(Ljava/lang/Object;JSS)S",
"jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B",
*** 431,450 ****
--- 448,473 ----
"jdk/internal/misc/Unsafe.getAndSetInt(Ljava/lang/Object;JI)I",
"jdk/internal/misc/Unsafe.getAndSetLong(Ljava/lang/Object;JJ)J",
"jdk/internal/misc/Unsafe.getAndSet" + oopName + "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;");
}
add(toBeInvestigated,
+ "com/sun/crypto/provider/CounterMode.implCrypt([BII[BI)I",
"java/lang/Thread.onSpinWait()V",
+ "java/util/ArraysSupport.vectorizedMismatch(Ljava/lang/Object;JLjava/lang/Object;JII)I",
"jdk/internal/misc/Unsafe.getCharUnaligned(Ljava/lang/Object;J)C",
"jdk/internal/misc/Unsafe.getIntUnaligned(Ljava/lang/Object;J)I",
"jdk/internal/misc/Unsafe.getLongUnaligned(Ljava/lang/Object;J)J",
"jdk/internal/misc/Unsafe.getShortUnaligned(Ljava/lang/Object;J)S",
"jdk/internal/misc/Unsafe.putCharUnaligned(Ljava/lang/Object;JC)V",
"jdk/internal/misc/Unsafe.putIntUnaligned(Ljava/lang/Object;JI)V",
"jdk/internal/misc/Unsafe.putLongUnaligned(Ljava/lang/Object;JJ)V",
"jdk/internal/misc/Unsafe.putShortUnaligned(Ljava/lang/Object;JS)V");
}
+ if (isJDK10OrHigher()) {
+ add(toBeInvestigated,
+ "jdk/internal/util/ArraysSupport.vectorizedMismatch(Ljava/lang/Object;JLjava/lang/Object;JII)I");
+ }
}
/*
* The intrinsics down here are known to be implemented but they are not always enabled on
* the HotSpot side (e.g., because they require certain CPU features). So, we are ignoring
*** 533,559 ****
}
}
}
private static boolean isJDK9OrHigher() {
! return GraalServices.JAVA_SPECIFICATION_VERSION >= 9;
}
private static boolean isJDK10OrHigher() {
! return GraalServices.JAVA_SPECIFICATION_VERSION >= 10;
}
private static boolean isJDK11OrHigher() {
! return GraalServices.JAVA_SPECIFICATION_VERSION >= 11;
}
private static boolean isJDK12OrHigher() {
! return GraalServices.JAVA_SPECIFICATION_VERSION >= 12;
}
private static boolean isJDK13OrHigher() {
! return GraalServices.JAVA_SPECIFICATION_VERSION >= 13;
}
public interface Refiner {
void refine(CheckGraalIntrinsics checker);
}
--- 556,582 ----
}
}
}
private static boolean isJDK9OrHigher() {
! return JavaVersionUtil.JAVA_SPECIFICATION_VERSION >= 9;
}
private static boolean isJDK10OrHigher() {
! return JavaVersionUtil.JAVA_SPECIFICATION_VERSION >= 10;
}
private static boolean isJDK11OrHigher() {
! return JavaVersionUtil.JAVA_SPECIFICATION_VERSION >= 11;
}
private static boolean isJDK12OrHigher() {
! return JavaVersionUtil.JAVA_SPECIFICATION_VERSION >= 12;
}
private static boolean isJDK13OrHigher() {
! return JavaVersionUtil.JAVA_SPECIFICATION_VERSION >= 13;
}
public interface Refiner {
void refine(CheckGraalIntrinsics checker);
}
< prev index next >