RFR: 8257700: Add logging for sealed classes in JVM_GetPermittedSubclasses

Lois Foltan lfoltan at openjdk.java.net
Tue Dec 15 17:36:00 UTC 2020


On Tue, 15 Dec 2020 15:45:25 GMT, Harold Seigel <hseigel at openjdk.org> wrote:

> Please review this small fix for JDK-8257700 to add logging to JVM_GetPermittedSubclasses().  The fix was tested with Mach5 tiers 1 and 2 on Linux, MacOS, and WIndows, tiers 3-5 on Linux x64, and by running the hotspot runtime sealed tests with -Xlog:class+sealed=trace and looking at the output.
> 
> Thanks, Harold

Looks good, one minor comment.
Lois

src/hotspot/share/prims/jvm.cpp line 2179:

> 2177:     return (jobjectArray)JNIHandles::make_local(THREAD, result());
> 2178:   } else {
> 2179:     log_trace(class, sealed)("Type %s is not sealed", ik->external_name());

I would remove this line in favor of adding adding an indication of sealed or not sealed to line #2129.  See my suggested change above.

src/hotspot/share/prims/jvm.cpp line 2129:

> 2127:   assert(c->is_instance_klass(), "must be");
> 2128:   InstanceKlass* ik = InstanceKlass::cast(c);
> 2129:   log_trace(class, sealed)("Calling GetPermittedSubclasses for type %s", ik->external_name());

Consider adding a sealed indication to this log_trace which would allow you to delete line #2179.  Something like:
("Calling GetPermittedSubclasses for %s type %s", ik->external_name(), (ik->is_sealed() ? "sealed" : "non-sealed"))

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

Marked as reviewed by lfoltan (Reviewer).

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


More information about the hotspot-dev mailing list