On Thu, 13 May 2021 13:24:17 GMT, Kevin Walls <[email protected]> wrote:

>> This change enables debug.cpp's find() utility to print Java Objects with 
>> their fields.
>> 
>> find() calls os::print_location, and Java heap objects are printed with 
>> instanceKlass oop_print_on.
>> Removing the ifdef for defining oop_print_on for instanceKlass, and also on 
>> methods in FieldPrinter and FieldDescriptor, make this work.
>> 
>> 
>> Checking other uses of os::print_location this might affect:
>> 
>> macroAssembler_x86.cpp has MacroAssembler::print_state32 and 
>> MacroAssembler::print_state64
>> which use os::print_location to print register contents and print words at 
>> top of stack.
>> These will be more verbose, as it already is in non-PRODUCT builds.
>> 
>> vmError uses os::print_location when showing the stack, i.e. this output:
>> 
>> Stack slot to memory mapping:
>> stack at sp + 0 slots: 0x0000000000000002 is an unknown value
>> ..etc...
>> 
>> ...will be more verbose when Java object references are found (for the 8 
>> stack slots it tries to show).
>> 
>> 
>> Shenandoah uses os::print_location once, but for non-Java heap objects so 
>> nothing changes.
>> 
>> 
>> Manual testing on Linux-x64 and Windows: old behaviour shows these two lines 
>> only:
>> 
>> "Executing find"
>> 0x00000000ff0a03e0 is an oop: jdk.internal.loader.ClassLoaders$AppClassLoader
>> {0x00000000ff0a03e0} - klass: 
>> 'jdk/internal/loader/ClassLoaders$AppClassLoader'
>> 
>> ...then with the change the full info:
>> 
>> "Executing find"
>> 0x00000000ff0a03e0 is an oop: jdk.internal.loader.ClassLoaders$AppClassLoader
>> {0x00000000ff0a03e0} - klass: 
>> 'jdk/internal/loader/ClassLoaders$AppClassLoader'
>>  - ---- fields (total size 13 words):
>>  - private 'defaultAssertionStatus' 'Z' @12  false
>>  - private final 'parent' 'Ljava/lang/ClassLoader;' @24  a 
>> 'jdk/internal/loader/ClassLoaders$PlatformClassLoader'{0x00000000ff0a0a
>> 40} (ff0a0a40)
>>  - private final 'name' 'Ljava/lang/String;' @28  "app"{0x00000000ff0d0060} 
>> (ff0d0060)
>>  - private final 'unnamedModule' 'Ljava/lang/Module;' @32  a 
>> 'java/lang/Module'{0x00000000ff0a0448} (ff0a0448)
>> ...etc...
>
> Kevin Walls has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   ifdef correction

Hi Kevin,
The fix looks okay to me.
Thanks,
Serguei

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

Marked as reviewed by sspitsyn (Reviewer).

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

Reply via email to