On Mon, 9 Jan 2023 03:34:55 GMT, Glavo <d...@openjdk.org> wrote: > `JavaLangAccess::newStringUTF8NoRepl` and > `JavaLangAccess::getBytesUTF8NoRepl` are not implemented correctly. They > always copy arrays, rather than avoiding copying as much as possible as > javadoc says. > > I ran the tier1 test without any new errors.
`newStringUTF*NoRepl` is not described or expected to optimizing the array allocation. Nor does it mandate that callers must guarantee that the array is not re-used or modified. The access to this method through JavaLangAccess is solely for the convenience of the algorithm. I don't see the performance improvement as sufficient to offset the risk of mis-use and its possible loss of integrity. ------------- PR: https://git.openjdk.org/jdk/pull/11897