JDK-8277216 : Examine InstanceKlass::_misc_flags for concurrency issues
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-11-16
  • Updated: 2023-11-30
  • Resolved: 2021-12-17
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.
JDK 19
19 b03Fixed
Related Reports
Relates :  
Description
The _misc flags are set via OR operations which aren't safe to do concurrently.    We should make setting these flags safe.  Besides linked-to bug, there aren't any known bugs with them right now.

Atomically set all of them? Most are set during classfile parsing or loading.

    _misc_rewritten                       -> set during linking with exclusive access
    _misc_has_nonstatic_fields     -> classfile parsing
    _misc_should_verify_class      -> classfile parsing
    _misc_unused                          -> not used
    _misc_is_contended                -> classfile parsing
    _misc_has_nonstatic_concrete_methods      -> classfile parsing
    _misc_declares_nonstatic_concrete_methods -> classfile parsing
    _misc_has_been_redefined       -> set in a redefinition safepoint
    _misc_shared_loading_failed    -> set during class loading (exclusive access to InstanceKlass?)
    _misc_is_scratch_class             -> set during the redefinition safepoint
    _misc_is_shared_boot_class     -> assign_class_loader_type() calls at a safepoint for CDS
    _misc_is_shared_platform_class   "
    _misc_is_shared_app_class          "
    _misc_has_resolved_methods    -> This is unsafe and called during linkResolver
    _misc_has_contended_annotations    -> classfile parsing

Maybe has_resolved_methods should be moved to AccessFlags for atomic setting.
Comments
Fix Request (17u) Strengthens the resolved methods flag handling (while doing other cleanups). Applies cleanly. Tests pass.
19-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1469 Date: 2023-06-19 09:45:53 +0000
19-06-2023

Changeset: 3607a5cd Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2021-12-17 13:42:54 +0000 URL: https://git.openjdk.java.net/jdk/commit/3607a5cdd9a3013851c8faefd346f04934f897e6
17-12-2021