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

Tobias Hartmann thartmann at openjdk.java.net
Fri Sep 3 06:53:26 UTC 2021


On Fri, 27 Aug 2021 15:19:42 GMT, Patric Hedlin <phedlin at openjdk.org> wrote:

> 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`

Hard to review but looks good to me.

src/hotspot/share/asm/codeBuffer.hpp line 284:

> 282: // the generated assembly  code are unique, i.e. there is  very little gain in
> 283: // trying to  share the  strings between  the different  offsets tracked  in a
> 284: // buffer (or blob).

Noticed some double whitespaces in many of the code comments, for example "assembly__code", "different__offsets".

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

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


More information about the hotspot-dev mailing list