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

Adopt cast notation for CompilerThread conversions

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • 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.

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

              Created:
              Updated:
              Resolved: