src/java.base/share/classes/java/lang/String.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8076112 Cdiff src/java.base/share/classes/java/lang/String.java

src/java.base/share/classes/java/lang/String.java

Print this page
rev 12262 : 8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
Summary: Annotate possibly intrinsified methods with @HotSpotIntrinsicCandidate. Add checks omitted by intrinsics to the library code. Add CheckIntrinsics flags to check consistency of intrinsics.
Reviewed-by: jrose, kvn, thartmann, vlivanov, abuckley, darcy, ascarpino, briangoetz, alanb, aph, dnsimon

*** 40,49 **** --- 40,50 ---- import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import java.util.stream.IntStream; import java.util.stream.StreamSupport; + import jdk.internal.HotSpotIntrinsicCandidate; /** * The {@code String} class represents character strings. All * string literals in Java programs, such as {@code "abc"}, are * implemented as instances of this class.
*** 150,159 **** --- 151,161 ---- * unnecessary since Strings are immutable. * * @param original * A {@code String} */ + @HotSpotIntrinsicCandidate public String(String original) { this.value = original.value; this.hash = original.hash; }
*** 976,985 **** --- 978,988 ---- * equivalent to this string, {@code false} otherwise * * @see #compareTo(String) * @see #equalsIgnoreCase(String) */ + @HotSpotIntrinsicCandidate public boolean equals(Object anObject) { if (this == anObject) { return true; } if (anObject instanceof String) {
*** 1152,1161 **** --- 1155,1165 ---- * this string; a value less than {@code 0} if this string * is lexicographically less than the string argument; and a * value greater than {@code 0} if this string is * lexicographically greater than the string argument. */ + @HotSpotIntrinsicCandidate public int compareTo(String anotherString) { char[] v1 = value; char[] v2 = anotherString.value; int len1 = v1.length; int len2 = v2.length;
*** 1694,1703 **** --- 1698,1708 ---- * * @param str the substring to search for. * @return the index of the first occurrence of the specified substring, * or {@code -1} if there is no such occurrence. */ + @HotSpotIntrinsicCandidate public int indexOf(String str) { return indexOf(str, 0); } /**
src/java.base/share/classes/java/lang/String.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File