8264207: CodeStrings does not honour fixed address assumption.#5281
Conversation
+ Introduce a simple gtest for CodeString/s support in CodeBuffer/CodeBlob.
+ Split /CodeStrings/ into two different abstractions; strings associated
by an offset, and strings with a fixed address.
- Let the first be /Assembly Code Remarks/, *AsmRemarks*, providing a
simple 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.
|
👋 Welcome back phedlin! A progress list of the required criteria for merging this PR into |
|
@phedlin The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
cl4es
left a comment
There was a problem hiding this comment.
FWIW (from someone who helped messing this up) I think this looks great. Clearly separates conflicting concerns and removes all trace of debug-only facilities in release code.
|
@phedlin This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 91 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
TobiHartmann
left a comment
There was a problem hiding this comment.
Hard to review but looks good to me.
| // The assumption made here is that most code remarks (or comments) added to | ||
| // the generated assembly code are unique, i.e. there is very little gain in | ||
| // trying to share the strings between the different offsets tracked in a | ||
| // buffer (or blob). |
There was a problem hiding this comment.
Noticed some double whitespaces in many of the code comments, for example "assembly__code", "different__offsets".
There was a problem hiding this comment.
Comments are (fully) justified for readability (within limits, not using hyphenation), same as text in books, newspapers and reports.
There was a problem hiding this comment.
As we discussed off-thread, I would prefer to not manually enforce block text layout by inserting extra whitespace because it is tedious and increases the burden on anyone later modifying (parts of) that comment.
Although I do understand that this layout might be easier to read for some people, I think it's the IDE's responsibility to display the comment in the user preferred way. If at all, line length restrictions and such should be part of the HotSpot Style Guide to guarantee consistency.
|
Mailing list message from David Holmes on hotspot-dev: On 3/09/2021 6:19 pm, Patric Hedlin wrote:
It is not at all usual to justify comments in this way, and not part of Cheers, |
| _nm->print_block_comment(st, p); | ||
| } | ||
| if (_codeBlob != NULL) { | ||
| else if (_codeBlob != nullptr) { |
There was a problem hiding this comment.
This isn't code that you have changed - but still - why is _nm and _codeblob separate? print_block_comment is virtual and nmethod is a codeblob.
|
Thanks for reviewing. |
|
Going to push as commit 7bd4f49.
Your commit was automatically rebased without conflicts. |
|
@phedlin Pushed as commit 7bd4f49. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
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_oopbut 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
the same primary buffer.
The following steps have been taken to provide fixed address (debug) strings.
and strings with a fixed address.
1:N mapping, offset -> remark.
address assumption such that:
for each string A and B, if A = B -> &A = &B.
deallocated properly, when no longer in use.
(assembly) remarks directly to the final codelet.
deconstructors have been executed.
of stubs) will not print the assembly remarks correctly (except for the very first
stub code section).
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:+PrintAssemblyProgress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5281/head:pull/5281$ git checkout pull/5281Update a local copy of the PR:
$ git checkout pull/5281$ git pull https://git.openjdk.java.net/jdk pull/5281/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5281View PR using the GUI difftool:
$ git pr show -t 5281Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5281.diff