RFR: 8329421: Native methods can not be selectively printed [v2]

Volker Simonis simonis at openjdk.org
Tue Apr 2 07:23:25 UTC 2024


On Mon, 1 Apr 2024 20:48:10 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Volker Simonis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add test for -XX:+PrintNativeNMethods
>
> src/hotspot/share/runtime/sharedRuntime.cpp line 2790:
> 
>> 2788:         }
>> 2789: 
>> 2790:         DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, CompileBroker::compiler(CompLevel_simple));
> 
> Will it work for when `-XX:+PrintAssembly` used and not `-XX:CompileCommand=print,`?

Yes, it does, because `-XX:+PrintAssembly` sets `PrintAssembly` to true in the default compiler directives so `DirectivesStack::getMatchingDirective()` will return true for every method. There's also a test for this case in `NativeCalls.java`:

 new Variant(List.of("-XX:-TieredCompilation",
                     "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintAssembly"), "true", "true"),

I've now also added another test for `-XX:+PrintNativeNMethods` which as you've correctly observed, also prints native methods, but all of them:

 new Variant(List.of("-XX:-TieredCompilation",
                     "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintNativeNMethods"), "true", "true"),

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18567#discussion_r1547279619


More information about the hotspot-dev mailing list