RFR: 8262227: Change SystemDictionary::find() to return an InstanceKlass*.

Ioi Lam iklam at openjdk.java.net
Wed Feb 24 20:17:46 UTC 2021


On Wed, 24 Feb 2021 19:32:29 GMT, Harold Seigel <hseigel at openjdk.org> wrote:

> Please review this fix for JDK-8262227.  This fix changes SystemDictionary::find() to return an InstanceKlass* to reduce InstanceKlass casts, it renames find() to find_instance_klass(), removes its unneeded TRAP parameter, and changes its callers as appropriate.
> 
> It also changed the get_java_...() methods, in thread.cpp, to take an InstanceKlass* parameter and removed their now unneeded TRAPS parameter.
> 
> The fix was tested with mach5 tiers 1 and 2 on Linux, Windows, and Mac OS, and tiers 3-5 on Linux x64 (still in progress).
> 
> Thanks to Coleen and David for their helpful suggestions.
> 
> Thanks, Harold

Changes requested by iklam (Reviewer).

src/hotspot/share/ci/ciEnv.cpp line 450:

> 448:       kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader,
> 449:                                                                        CHECK_AND_CLEAR_(fail_type));
> 450:     } else {

I think SystemDictionary::find_constrained_instance_or_array_klass can also be changed to accept a `Thread*` instead `TRAPS`, since now it can no longer throw, and the thread is used only for Mutexes.

src/hotspot/share/runtime/thread.cpp line 3017:

> 3015:   InstanceKlass* ik = SystemDictionary::find_instance_klass(vmSymbols::java_lang_VersionProps(),
> 3016:                                                             Handle(), Handle());
> 3017:   JDK_Version::set_java_version(get_java_version(ik));

The various get_java_xxx() functions all seem to do the same thing. I am wondering if they can be combined into a single utility function, so that you can do something like:

JDK_Version::set_runtime_name(get_version_info(ik, vmSymbols::java_version_name(),
                              java_version, sizeof(java_version)));

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

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


More information about the hotspot-dev mailing list