This PR fixes a couple of aligned accesses when reading/writing strings. Such 
aligned accesses crept in when we optimized string read/write operations to 
work in bulk. As a result, depending on the maximum alignment constraints 
supported by the heap segment, some string operations might fail.

I've added some tests to make sure that all operations work as expected with 
unaligned semantics.

Note: I've considered inferring an alignment constraint from the provided 
charset, and then use aligned operations (and document that behavior), but I 
found that to be unsatisfactory: memory operations typically accept a layout, 
which allow clients to opt out from alignment checks if needed. But if we 
always infer an alignment constraint from the provided charset, clients would 
find themselves w/o an escape hatch. For this reason, I think the best way to 
fix this is to use unaligned operations when reading/writing the string.

-------------

Commit messages:
 - Initial push

Changes: https://git.openjdk.org/jdk/pull/16999/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16999&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8321467
  Stats: 79 lines in 2 files changed: 69 ins; 6 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/16999.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16999/head:pull/16999

PR: https://git.openjdk.org/jdk/pull/16999

Reply via email to