Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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.
|