RFR: 8272586: emit abstract machine code in hs-err logs [v2]

David Holmes dholmes at openjdk.java.net
Thu Oct 7 01:55:08 UTC 2021


On Wed, 6 Oct 2021 16:41:39 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> This enhances hs-err logs to:
>> * Show the [abstract machine code](https://bugs.openjdk.java.net/browse/JDK-8213084) of the crashing frame if a disassembler is not installed.
>> * Show machine code for the top frames on the native stack.
>> 
>> An interpreter or stub frame is only shown if it is the crashing frame.
>> 
>> A sample of the enhanced hs-err log can be seen [here](https://bugs.openjdk.java.net/secure/attachment/96664/hs_err_pid7179.log).
>
> Doug Simon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use nullptr instead of 0 or implicit NULL tests

Hi Doug,

Seems okay from a  runtime perspective. A few minor code nits below - and the test needs a change.

Thanks,
David

src/hotspot/share/utilities/vmError.cpp line 259:

> 257:       return false;
> 258:     }
> 259:     if (printed[i] == 0) {

I assume 0 is a null check so please use nullptr.

src/hotspot/share/utilities/vmError.cpp line 260:

> 258:     }
> 259:     if (printed[i] == 0) {
> 260:       printed[i] = owner;

Seems odd to have this side-effect in what appears to be a query - perhaps `add_to_printed` would be more apt: adds `owner` to the list of printed owners, unless already present. Returns `true` if owner was added, and false it if was already present, or else we've exceeded the printing limit. ?

src/hotspot/share/utilities/vmError.cpp line 277:

> 275:  */
> 276: static bool print_code(outputStream* st, Thread* thread, address pc, bool is_crash_pc,
> 277:                             address* printed, int printed_len) {

Nit: Please align the parameters with the line above

src/hotspot/share/utilities/vmError.cpp line 282:

> 280:       // The interpreter CodeBlob is very large so try to print the codelet instead.
> 281:       InterpreterCodelet* codelet = Interpreter::codelet_containing(pc);
> 282:       if (codelet != NULL) {

Please use `nullptr` in new code.

test/hotspot/jtreg/runtime/ErrorHandling/MachCodeFramesInErrorFile.java line 107:

> 105:             "-Xcomp",
> 106:             "-XX:CompileCommand=compileonly,MachCodeFramesInErrorFile$Crasher.*",
> 107:             "-XX:CompileCommand=dontinline,MachCodeFramesInErrorFile$Crasher.*",

This looks like it requires C2, so there should be an `@requires` for that in case the test is run under Zero or a MinimalVM build.

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

Changes requested by dholmes (Reviewer).

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


More information about the hotspot-dev mailing list