Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230517

UnifiedOop invokes undefined behavior

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 14
    • 14
    • hotspot
    • jfr

      UnifiedOop may attempt to construct oop* values that are misaligned. That has unspecified behavior. Any further manipulation of the value (such as attempting to convert back to a narrowOop*) can't remove that. And dereferencing a pointer with unspecified value is undefined behavior.

      It is generally a bad idea to lie to the type system the way this class is doing. An alternative would be to have a distinct type that carried around the internal (tagged) pointer as a void* or the like. Make it a thin, trivially copyable class, and there's no additional overhead.

            mgronlun Markus Grönlund
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: