RFR: 8274322: Problems with oopDesc construction [v3]
Kim Barrett
kbarrett at openjdk.java.net
Fri Oct 1 00:29:13 UTC 2021
> Please review this change to the default constructor for markWord and
> associated "change" to construction of oopDesc.
>
> The current code never invokes the constructor for oopDesc or any of its
> derived classes. For that to be permissible according to the Standard,
> those classes must be trivially default constructible. And for that to be
> the case, the markWord default constructor must be trivial.
>
> This change consists of three parts.
>
> (1) The markWord default constructor is changed to be trivial, so the
> default constructors for oopDesc and classes derived from it will also be
> trivial. It wasn't previously trivial because the mechanism for making it so
> (a default definition) is a C++11 feature that wasn't yet supported when the
> previous constructor was defined.
>
> (2) This change also adds static asserts to verify the relevant classes have
> trivial default constructors, to prevent later changes from unintentionally
> breaking this.
>
> (3) This change also makes oopDesc noncopyable, to prevent inadvertent usage
> of these operations that don't make any sense.
>
> A different approach would be to always use placement new with an
> appropriate constructor to perform the initialization, perhaps encapsulated
> in factory functions. I did some exploration in that direction. It's a much
> larger and more complex change, though the final behavior (use constructors
> for initialization) is simpler.
>
> Testing:
> tier1
Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge branch 'master' into oopdesc_construct
- explicitly default markWord special functions
- dholmes review
- improve oopDesc and markWord construction
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/5729/files
- new: https://git.openjdk.java.net/jdk/pull/5729/files/5197b2c6..07c0d159
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5729&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5729&range=01-02
Stats: 6100 lines in 249 files changed: 4307 ins; 1092 del; 701 mod
Patch: https://git.openjdk.java.net/jdk/pull/5729.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5729/head:pull/5729
PR: https://git.openjdk.java.net/jdk/pull/5729
More information about the hotspot-dev
mailing list