RFR: 8264207: CodeStrings does not honour fixed address assumption.

Patric Hedlin phedlin at openjdk.java.net
Fri Aug 27 15:25:57 UTC 2021


Please review this change that addresses an issue originally found in JDK-8259590,
where the error message should read
`fatal error: DEBUG MESSAGE: verify_oop: r10: broken oop in decode_heap_oop`
but is lost since the code generated refers to a fixed (string) address, a string
(address) no longer available when **CodeStrings** have been propagated (copied)
between code buffers/blobs.

Background

**CodeStrings** used to be **CodeComments**. The solution to JDK-8008555 introduced
this change and added a new use-case for **CodeStrings**, not only as comments, but
as strings with a fixed address used in the code generated with support for debug
string printouts.

The changes introduced with JDK-8255208 breaks the fixed address assumption made
in the code generated with support for debug string printouts. Some of the (necessary)
move semantics have been replaced by copy semantics when **CodeStrings** are
propagated between code buffers/blobs (i.e. **CodeBuffer** and **CodeBlob** objects).

Additional issue addressed

+ Broken printout (i.e. missing  remarks) when multiple stubs are generated within
  the same primary buffer.

The following steps have been taken to provide fixed address (debug) strings.

+ Introduce a simple _gtest_ for **CodeString/s** support with **CodeBuffer/CodeBlob**.
+ Split **CodeStrings**  into two different abstractions;  strings associated with an offset,
  and strings with a fixed address.
  - Let the  first be  _Assembly Code  Remarks_, **AsmRemarks**, providing a simple
    1:N mapping, _offset_ -> _remark_.
  - Let the second be _Debug  Printout Strings_, **DbgStrings**, supporting a fixed
    address assumption such that:
      for each string A and B, if A = B -> &A = &B.
  - Use a  reference counting scheme to  ensure that both types  of strings are
    deallocated properly, when no longer in use.
+ Remove **CodeStrings** from **Stub** interface.
  - Replace with internal use in the interpreter code, propagating the code
    (assembly) remarks directly to the final codelet.
+ Remove  **CodeBuffer** self destruction, overwriting memory before  all
  deconstructors have been executed.
  - Replace with sentinel deconstructor to do the bidding.
+ Stub code generated into a single common **CodeBuffer**  (holding a number
  of stubs) will  not print the assembly remarks correctly  (except for the very first
  stub code section).
  - Introduce a displacement to correct the offset.
+ Remove old **CodeString/s** implementation.

Testing

Tier1-3 in debug mode, using debug strings, _without_ collecting remarks.
Tier1-3 in debug mode, using debug strings, _with_ collecting remarks (regardless of options).
Manual inspection of results (linux-x64 and linux-aarch64 only) for the following command line options:
`-XX:+PrintSignatureHandlers -XX:+PrintInterpreter -XX:+PrintStubCode -XX:+PrintAssembly`

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

Commit messages:
 - 8264207: CodeStrings does not honour fixed address assumption.

Changes: https://git.openjdk.java.net/jdk/pull/5281/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5281&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264207
  Stats: 891 lines in 16 files changed: 536 ins; 128 del; 227 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5281.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5281/head:pull/5281

PR: https://git.openjdk.java.net/jdk/pull/5281


More information about the hotspot-dev mailing list