Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8138732: Rename @HotSpotIntrinsicCandidate to @IntrinsicCandidate and…
… move it to the jdk.internal.vm.annotation package

Reviewed-by: dholmes, alanb, psandoz, kvn, egahlin
  • Loading branch information
marschall authored and Vladimir Kozlov committed Sep 30, 2020
1 parent 4b16f8a commit 2a406f3
Show file tree
Hide file tree
Showing 64 changed files with 488 additions and 488 deletions.
10 changes: 5 additions & 5 deletions make/data/characterdata/CharacterDataLatin1.java.template
Expand Up @@ -25,7 +25,7 @@

package java.lang;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;

/** The CharacterData class encapsulates the large tables found in
Java.lang.Character. */
Expand Down Expand Up @@ -80,18 +80,18 @@ class CharacterDataLatin1 extends CharacterData {
return props;
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
boolean isDigit(int ch) {
return '0' <= ch && ch <= '9';
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
boolean isLowerCase(int ch) {
int props = getProperties(ch);
return (props & $$maskType) == Character.LOWERCASE_LETTER;
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
boolean isUpperCase(int ch) {
int props = getProperties(ch);
return (props & $$maskType) == Character.UPPERCASE_LETTER;
Expand Down Expand Up @@ -232,7 +232,7 @@ class CharacterDataLatin1 extends CharacterData {
return retval;
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
boolean isWhitespace(int ch) {
int props = getProperties(ch);
return ((props & $$maskIdentifierInfo) == $$valueJavaWhitespace);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
Expand Up @@ -2258,7 +2258,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
// Search for Non-ASCII character (Negative byte value) in a byte array,
// return true if it has any and false otherwise.
// ..\jdk\src\java.base\share\classes\java\lang\StringCoding.java
// @HotSpotIntrinsicCandidate
// @IntrinsicCandidate
// private static boolean hasNegatives(byte[] ba, int off, int len) {
// for (int i = off; i < off + len; i++) {
// if (ba[i] < 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/x86/macroAssembler_x86.cpp
Expand Up @@ -5133,7 +5133,7 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned,
}

// encode char[] to byte[] in ISO_8859_1
//@HotSpotIntrinsicCandidate
//@IntrinsicCandidate
//private static int implEncodeISOArray(byte[] sa, int sp,
//byte[] da, int dp, int len) {
// int i = 0;
Expand Down Expand Up @@ -7510,7 +7510,7 @@ void MacroAssembler::crc32c_ipl_alg2_alt2(Register in_out, Register in1, Registe

// Compress char[] array to byte[].
// ..\jdk\src\java.base\share\classes\java\lang\StringUTF16.java
// @HotSpotIntrinsicCandidate
// @IntrinsicCandidate
// private static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) {
// for (int i = 0; i < len; i++) {
// int c = src[srcOff++];
Expand Down Expand Up @@ -7726,7 +7726,7 @@ void MacroAssembler::char_array_compress(Register src, Register dst, Register le

// Inflate byte[] array to char[].
// ..\jdk\src\java.base\share\classes\java\lang\StringLatin1.java
// @HotSpotIntrinsicCandidate
// @IntrinsicCandidate
// private static void inflate(byte[] src, int srcOff, char[] dst, int dstOff, int len) {
// for (int i = 0; i < len; i++) {
// dst[dstOff++] = (char)(src[srcOff++] & 0xff);
Expand Down
16 changes: 8 additions & 8 deletions src/hotspot/share/classfile/classFileParser.cpp
Expand Up @@ -1079,7 +1079,7 @@ class AnnotationCollector : public ResourceObj{
_method_InjectedProfile,
_method_LambdaForm_Compiled,
_method_Hidden,
_method_HotSpotIntrinsicCandidate,
_method_IntrinsicCandidate,
_jdk_internal_vm_annotation_Contended,
_field_Stable,
_jdk_internal_vm_annotation_ReservedStackAccess,
Expand Down Expand Up @@ -2102,10 +2102,10 @@ AnnotationCollector::annotation_index(const ClassLoaderData* loader_data,
if (!privileged) break; // only allow in privileged code
return _method_Hidden;
}
case vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_HotSpotIntrinsicCandidate_signature): {
case vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_vm_annotation_IntrinsicCandidate_signature): {
if (_location != _in_method) break; // only allow for methods
if (!privileged) break; // only allow in privileged code
return _method_HotSpotIntrinsicCandidate;
return _method_IntrinsicCandidate;
}
case vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_vm_annotation_Stable_signature): {
if (_location != _in_field) break; // only allow for fields
Expand Down Expand Up @@ -2159,7 +2159,7 @@ void MethodAnnotationCollector::apply_to(const methodHandle& m) {
m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
if (has_annotation(_method_Hidden))
m->set_hidden(true);
if (has_annotation(_method_HotSpotIntrinsicCandidate) && !m->is_synthetic())
if (has_annotation(_method_IntrinsicCandidate) && !m->is_synthetic())
m->set_intrinsic_candidate(true);
if (has_annotation(_jdk_internal_vm_annotation_ReservedStackAccess))
m->set_has_reserved_stack_access(true);
Expand Down Expand Up @@ -5165,22 +5165,22 @@ static void check_methods_for_intrinsics(const InstanceKlass* ik,

if (CheckIntrinsics) {
// Check if an intrinsic is defined for method 'method',
// but the method is not annotated with @HotSpotIntrinsicCandidate.
// but the method is not annotated with @IntrinsicCandidate.
if (method->intrinsic_id() != vmIntrinsics::_none &&
!method->intrinsic_candidate()) {
tty->print("Compiler intrinsic is defined for method [%s], "
"but the method is not annotated with @HotSpotIntrinsicCandidate.%s",
"but the method is not annotated with @IntrinsicCandidate.%s",
method->name_and_sig_as_C_string(),
NOT_DEBUG(" Method will not be inlined.") DEBUG_ONLY(" Exiting.")
);
tty->cr();
DEBUG_ONLY(vm_exit(1));
}
// Check is the method 'method' is annotated with @HotSpotIntrinsicCandidate,
// Check is the method 'method' is annotated with @IntrinsicCandidate,
// but there is no intrinsic available for it.
if (method->intrinsic_candidate() &&
method->intrinsic_id() == vmIntrinsics::_none) {
tty->print("Method [%s] is annotated with @HotSpotIntrinsicCandidate, "
tty->print("Method [%s] is annotated with @IntrinsicCandidate, "
"but no compiler intrinsic is defined for the method.%s",
method->name_and_sig_as_C_string(),
NOT_DEBUG("") DEBUG_ONLY(" Exiting.")
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/vmIntrinsics.hpp
Expand Up @@ -76,7 +76,7 @@
// in the (Java) source code and the semantics of the method as defined
// by the code in the VM, intrinsic methods must be explicitly marked.
//
// Intrinsic methods are marked by the jdk.internal.HotSpotIntrinsicCandidate
// Intrinsic methods are marked by the jdk.internal.vm.annotation.IntrinsicCandidate
// annotation. If CheckIntrinsics is enabled, the VM performs the following
// checks when a class C is loaded: (1) all intrinsics defined by the VM for
// class C are present in the loaded class file and are marked;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/vmSymbols.hpp
Expand Up @@ -284,10 +284,10 @@
template(type_annotations_name, "typeAnnotations") \
\
/* Intrinsic Annotation (JDK 9 and above) */ \
template(jdk_internal_HotSpotIntrinsicCandidate_signature, "Ljdk/internal/HotSpotIntrinsicCandidate;") \
template(jdk_internal_vm_annotation_DontInline_signature, "Ljdk/internal/vm/annotation/DontInline;") \
template(jdk_internal_vm_annotation_ForceInline_signature, "Ljdk/internal/vm/annotation/ForceInline;") \
template(jdk_internal_vm_annotation_Hidden_signature, "Ljdk/internal/vm/annotation/Hidden;") \
template(jdk_internal_vm_annotation_IntrinsicCandidate_signature, "Ljdk/internal/vm/annotation/IntrinsicCandidate;") \
template(jdk_internal_vm_annotation_Stable_signature, "Ljdk/internal/vm/annotation/Stable;") \
\
/* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */ \
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/runtime/globals.hpp
Expand Up @@ -2421,10 +2421,10 @@ const intx ObjectAlignmentInBytes = 8;
"When a class C is loaded, check that " \
"(1) all intrinsics defined by the VM for class C are present "\
"in the loaded class file and are marked with the " \
"@HotSpotIntrinsicCandidate annotation, that " \
"@IntrinsicCandidate annotation, that " \
"(2) there is an intrinsic registered for all loaded methods " \
"that are annotated with the @HotSpotIntrinsicCandidate " \
"annotation, and that " \
"that are annotated with the @IntrinsicCandidate annotation, " \
"and that " \
"(3) no orphan methods exist for class C (i.e., methods for " \
"which the VM declares an intrinsic but that are not declared "\
"in the loaded class C. " \
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
Expand Down Expand Up @@ -40,7 +40,7 @@
import java.security.MessageDigest;
import java.util.Arrays;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;

/**
* Rijndael --pronounced Reindaal-- is a symmetric cipher with a 128-bit
Expand Down Expand Up @@ -356,7 +356,7 @@ void encryptBlock(byte[] in, int inOffset,
}

// Encryption operation. Possibly replaced with a compiler intrinsic.
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private void implEncryptBlock(byte[] in, int inOffset,
byte[] out, int outOffset)
{
Expand Down Expand Up @@ -435,7 +435,7 @@ void decryptBlock(byte[] in, int inOffset,
}

// Decrypt operation. Possibly replaced with a compiler intrinsic.
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private void implDecryptBlock(byte[] in, int inOffset,
byte[] out, int outOffset)
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
Expand Down Expand Up @@ -29,7 +29,7 @@
import java.security.ProviderException;
import java.util.Objects;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;
import sun.security.util.ArrayUtil;


Expand Down Expand Up @@ -153,7 +153,7 @@ int encrypt(byte[] plain, int plainOffset, int plainLen,
cipher, cipherOffset);
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private int implEncrypt(byte[] plain, int plainOffset, int plainLen,
byte[] cipher, int cipherOffset)
{
Expand Down Expand Up @@ -203,7 +203,7 @@ int decrypt(byte[] cipher, int cipherOffset, int cipherLen,
return implDecrypt(cipher, cipherOffset, cipherLen, plain, plainOffset);
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private int implDecrypt(byte[] cipher, int cipherOffset, int cipherLen,
byte[] plain, int plainOffset)
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
Expand Down Expand Up @@ -27,7 +27,7 @@

import java.security.InvalidKeyException;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;
import sun.security.util.ArrayUtil;

/**
Expand Down Expand Up @@ -182,7 +182,7 @@ private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
}

// Implementation of crpyt() method. Possibly replaced with a compiler intrinsic.
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
int result = len;
while (len-- > 0) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
Expand Down Expand Up @@ -29,7 +29,7 @@
import java.security.ProviderException;
import sun.security.util.ArrayUtil;
import java.util.Objects;
import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;

/**
* This class represents ciphers in electronic codebook (ECB) mode.
Expand Down Expand Up @@ -97,7 +97,7 @@ void init(boolean decrypting, String algorithm, byte[] key, byte[] iv)
embeddedCipher.init(decrypting, algorithm, key);
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private int implECBEncrypt(byte [] in, int inOff, int len, byte[] out, int outOff) {
for (int i = len; i >= blockSize; i -= blockSize) {
embeddedCipher.encryptBlock(in, inOff, out, outOff);
Expand Down Expand Up @@ -131,7 +131,7 @@ int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
return implECBEncrypt(in, inOff, len, out, outOff);
}

@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private int implECBDecrypt(byte [] in, int inOff, int len, byte[] out, int outOff) {
for (int i = len; i >= blockSize; i -= blockSize) {
embeddedCipher.decryptBlock(in, inOff, out, outOff);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -31,7 +31,7 @@

import java.security.ProviderException;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;

/**
* This class represents the GHASH function defined in NIST 800-38D
Expand Down Expand Up @@ -229,7 +229,7 @@ private static void ghashRangeCheck(byte[] in, int inOfs, int inLen, long[] st,
* the hotspot signature. This method and methods called by it, cannot
* throw exceptions or allocate arrays as it will breaking intrinsics
*/
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
private static void processBlocks(byte[] data, int inOfs, int blocks, long[] st, long[] subH) {
int offset = inOfs;
while (blocks > 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/lang/Boolean.java
Expand Up @@ -25,7 +25,7 @@

package java.lang;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.vm.annotation.IntrinsicCandidate;

import java.lang.constant.Constable;
import java.lang.constant.ConstantDesc;
Expand Down Expand Up @@ -148,7 +148,7 @@ public static boolean parseBoolean(String s) {
*
* @return the primitive {@code boolean} value of this object.
*/
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
public boolean booleanValue() {
return value;
}
Expand All @@ -167,7 +167,7 @@ public boolean booleanValue() {
* @return a {@code Boolean} instance representing {@code b}.
* @since 1.4
*/
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
public static Boolean valueOf(boolean b) {
return (b ? TRUE : FALSE);
}
Expand Down
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/lang/Byte.java
Expand Up @@ -25,8 +25,8 @@

package java.lang;

import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.CDS;
import jdk.internal.vm.annotation.IntrinsicCandidate;

import java.lang.constant.Constable;
import java.lang.constant.DynamicConstantDesc;
Expand Down Expand Up @@ -134,7 +134,7 @@ private ByteCache() {}
* @return a {@code Byte} instance representing {@code b}.
* @since 1.5
*/
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
public static Byte valueOf(byte b) {
final int offset = 128;
return ByteCache.cache[(int)b + offset];
Expand Down Expand Up @@ -369,7 +369,7 @@ public Byte(String s) throws NumberFormatException {
* Returns the value of this {@code Byte} as a
* {@code byte}.
*/
@HotSpotIntrinsicCandidate
@IntrinsicCandidate
public byte byteValue() {
return value;
}
Expand Down

1 comment on commit 2a406f3

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 2a406f3 Sep 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Issues

Please sign in to comment.