Adopt cast notation for CompilerThread conversions

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 17
    • Affects Version/s: 17
    • Component/s: hotspot
    • None
    • b26

      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.

            Assignee:
            Albert Yang
            Reporter:
            Albert Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: