[Feature] Enable CDS support - #153
Open
sendaoYan wants to merge 1 commit into
Open
Conversation
Fix CDS (Class Data Sharing) to work correctly when the JDK17 VM is compiled with --with-hotspot-target-classlib=8 (JDK8 class library).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix CDS (Class Data Sharing) to work correctly when the JDK17 VM is compiled with --with-hotspot-target-classlib=8 (JDK8 class library).
Issue: #150
背景
CompoundVM 项目使用 JDK17 HotSpot VM + JDK8 类库的混合构建(--with-hotspot-target-classlib=8)。在此构建模式下,JDK8 没有模块化的 lib/modules jimage 文件,而 JDK17 的 CDS 实现在多处假定该文件一定存在,导致 -Xshare:dump 失败并报错 "CDS is not supported in exploded JDK build"。
修改概要
共修改 7 个 C++ 文件 + 1 个 Java 文件:
JDK17 CDS 代码中有多处检查 has_jimage() 和 has_jrt_entry() 的地方,这些检查对 JDK9+ 模块化构建是正确的,但对 JDK8 类库构建不适用。修改策略:用 #if !defined(HOTSPOT_TARGET_CLASSLIB) || HOTSPOT_TARGET_CLASSLIB >= 9 守卫这些检查点,使它们在 classlib=8 时被跳过。
具体改动包括:
本地测试验证
如下几个测试在本地已经全部测试通过,没有新增测试失败
已知限制