JDK-8267916 : Adopt cast notation for CompilerThread conversions
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-05-28
  • Updated: 2021-06-11
  • Resolved: 2021-06-03
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 17
17 b26Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
During the review of JDK-8252476, it's suggested to perform some refactoring around `as_CompilerThread` so that all  `as_*_thread` methods could be consistent (name and location of definition).

The refactoring will basically be:

1. rename `as_CompilerThread` to `as_Compiler_thread`
2. move it to `thread.inline.hpp` (its declaration is in thread.hpp)

Edit: moving the definition to `thread.inline.hpp` causes some circular dependencies, which are non-trivial to solve. Alternatively, one could place a static cast method in the child class, like:

```
// inside CompilerThread class
static CompilerThread* CompilerThread::cast(Thread* t) {
  return static_cast<CompilerThread*>(t);
}
```

The same technique is also used for the `heap()` method in the `CollectedHeap` hierachy.
Comments
Changeset: a52a08d2 Author: Albert Mingkun Yang <ayang@openjdk.org> Date: 2021-06-03 08:21:39 +0000 URL: https://git.openjdk.java.net/jdk/commit/a52a08d20be13721fcde65cad3567bbfa04f45cd
03-06-2021