The "well-known classes" API in systemDictionary.hpp [1] is for accessing a fixed set of classes defined by the bootstrap loader. The rest of systemDictionary.hpp is for finding/defining arbitrary classes in arbitrary class loaders. For modularity, we should separate these two sets of APIs, and make them independent of each other.
The proposed API follows the existing pattern of accessing known symbols/intrinsics in vmSymbols.hpp [2] and vmIntrinsics.hpp [3]:
#include "classfile/vmClasses.hpp"
#include "classfile/vmIntrinsics.hpp"
#include "classfile/vmSymbols.hpp" // NEW
Symbol* s = vmSymbols::java_lang_Object();
vmIntrinsics::ID id = vmIntrinsics::_linkToSpecial;
Klass* k = vmClasses::Object_klass(); // NEW
Note: to help the review process and limit the amount of boiler-place changes, within this RFE, we do not change existing calls like SystemDictionary::Object_klass() to vmClasses::Object_klass(). That will be done in a subtask (JDK-8260471).
Within this RFE, we subclass SystemDictionary from vmClasses, so SystemDictionary::Object_klass() will continue to work.
[1] https://github.com/openjdk/jdk/blob/19b6f61bd2f49f06ef6b8e9b6ecd2fd910070035/src/hotspot/share/classfile/systemDictionary.hpp#L103
[2] https://github.com/openjdk/jdk/blob/19b6f61bd2f49f06ef6b8e9b6ecd2fd910070035/src/hotspot/share/classfile/vmSymbols.hpp#L53
[3] https://github.com/openjdk/jdk/blob/19b6f61bd2f49f06ef6b8e9b6ecd2fd910070035/src/hotspot/share/classfile/vmIntrinsics.hpp#L108