8311906: Improve robustness of String constructors with mutable array inputs

Co-authored-by: Damon Fenacci <dfenacci@openjdk.org>
Co-authored-by: Claes Redestad <redestad@openjdk.org>
Co-authored-by: Amit Kumar <amitkumar@openjdk.org>
Co-authored-by: Martin Doerr <mdoerr@openjdk.org>
Reviewed-by: rgiulietti, thartmann, redestad, dfenacci
This commit is contained in:
Roger Riggs 2023-12-04 18:28:59 +00:00
parent 316b78336c
commit 155abc576a
15 changed files with 1300 additions and 248 deletions

View file

@ -44,6 +44,11 @@ public class Helper {
return dst;
}
@jdk.internal.vm.annotation.ForceInline
public static int compress(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
return StringUTF16.compress(src, srcOff, dst, dstOff, len);
}
@jdk.internal.vm.annotation.ForceInline
public static byte[] compressChar(char[] src, int srcOff, int dstSize, int dstOff, int len) {
byte[] dst = new byte[dstSize];
@ -51,6 +56,11 @@ public class Helper {
return dst;
}
@jdk.internal.vm.annotation.ForceInline
public static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) {
return StringUTF16.compress(src, srcOff, dst, dstOff, len);
}
@jdk.internal.vm.annotation.ForceInline
public static byte[] inflateByte(byte[] src, int srcOff, int dstSize, int dstOff, int len) {
byte[] dst = new byte[dstSize];