跳到主要内容

JEP 449:弃用 Windows 32 位 x86 端口以便移除

QWen Max 中英对照 JEP 449: Deprecate the Windows 32-bit x86 Port for Removal

总结

弃用 Windows 32 位 x86 端口,并计划在未来的版本中将其移除。

目标

  • 更新构建系统,当尝试配置适用于 Windows 32 位 x86(x86-32)的构建时发出错误消息。该错误消息可通过新的配置选项进行抑制。

  • 在相关文档中标记该端口及相关的端口特定功能,注明为计划移除的已弃用内容。

非目标

  • 本提案的目标并不是更改任何早期版本中受影响端口的状态。此 JEP 可能针对的最早版本是 JDK 21。

  • 本提案的目标并不是弃用任何其他 32 位端口。

动机

  • 允许 OpenJDK 社区中的贡献者加速推动平台发展的新功能和增强功能的开发。

  • JEP 436(虚拟线程) 在 Windows x86-32 上的实现回退到使用内核线程,因此没有带来 Project Loom 的预期优势。

  • 支持 32 位操作的最后一个 Windows 操作系统 Windows 10 将在 2025 年 10 月 达到生命周期结束。

描述

尝试配置 Windows x86-32 构建将产生以下输出:

$ bash ./configure
...
checking compilation type... native
configure: error: The Windows 32-bit x86 port is deprecated and may be removed in a future release. \
Use --enable-deprecated-ports=yes to suppress this error.
configure exiting with result code 1
$

新的构建配置选项 --enable-deprecated-ports=yes 将抑制错误并继续:

$ bash ./configure --enable-deprecated-ports=yes
...
checking compilation type... native
configure: WARNING: The Windows 32-bit x86 port is deprecated and may be removed in a future release.
...
Build performance summary:
* Cores to use: 32
* Memory limit: 96601 MB

The following warnings were produced. Repeated here for convenience:
WARNING: The Windows 32-bit x86 port is deprecated and may be removed in a future release.
$

替代方案

另一种选择是继续支持 Windows x86-32。这需要有积极的维护者,他们能够提供虚拟线程(Virtual Threads)以及未来 JEP 的可持续且高性能的实现,以确保 Windows x86-32 上的 JDK 能够持续满足 Java 开发者的期望。

风险与假设

由于与 32 位原生库(DLL)的集成,Windows 上仍然使用 32 位 JVM。这些用户无法直接迁移到 64 位 JVM,因为 Windows 上的 64 位进程无法加载 32 位 DLL。虽然 Windows x64 能够通过 WOW64 模拟 32 位环境来运行 32 位应用程序,但尽管假定内存占用量有所减少,应用程序仍会遭受 显著的性能下降

因此,我们假设

  • 用户可以继续运行现有的 Windows 32 位 JVM 构建版本,以与原生的 32 位库集成,并且在必要时通过远程 API 暴露 32 位功能,供同一环境中运行在 64 位 JVM 上的应用程序使用;以及

  • 旧版系统不太可能迁移到 Java 21 发布之后的 JDK 版本。