JDK-8273591 : [IR Framework] Test VM should not trigger class loading
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-09-10
  • Updated: 2025-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
The IR Test Framework heavily uses getDeclaredClasses on the test class(es) which triggers class loading. That's a problem because some tests are carefully designed to not trigger loading of certain classes to exercise the (JIT) code handling unloaded classes.

One solution could be to use separate class loaders for separate @Test/@Run method invocations. This has the additional benefit of not polluting profiles and possibly making IR matching unstable depending on the order of test execution.
Comments
I've added a workaround with the fix for JDK-8273594 to Valhalla by disabling annotation checking when IGNORE_COMPILER_CONTROLS is disabled: https://github.com/openjdk/valhalla/pull/551/files#diff-da6a34138cfba336eaae6f51b9c69b607d4b28eaf0cbe14185c46377a2fc70e8R243 That works well because it's the only place left where the framework invokes getDeclaredClasses if IGNORE_COMPILER_CONTROLS is set but probably does not make too much sense as a general fix (you still want annotation checking).
10-09-2021