JDK-8219010 : Copy class should use templates
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 13
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2019-02-14
  • Updated: 2020-07-28
  • Resolved: 2020-07-28
Related Reports
Relates :  
Description
Instead of casting things to HeapWord*.
eg.
template <typename T> Copy::fill_to_words(T* p, size_t count, const T& value) {
   STATIC_ASSERT(is_aligned(sizeof(T), sizeof(void*));
    call fill_to_words_impl(void*, count, value);  // that takes a void* arg
}

For example, these aren't HeapWords!
utilities/copy.hpp:  inline static void conjoint_words_to_higher(const HeapWord* from, HeapWord* to, size_t byte_count) {
opto/node.cpp:    Copy::conjoint_words_to_higher((HeapWord*)&_in[_cnt], (HeapWord*)&_in[_cnt+m], ((i-_cnt)*sizeof(Node*)));
opto/node.cpp:    Copy::conjoint_words_to_higher((HeapWord*)&_in[idx], (HeapWord*)&_in[idx+1], ((_cnt-idx-1)*sizeof(Node*)));
opto/node.cpp:  Copy::conjoint_words_to_higher((HeapWord*)&_nodes[i], (HeapWord*)&_nodes[i+1], ((_max-i-1)*sizeof(Node*)));
opto/block.cpp:  Copy::conjoint_words_to_higher((HeapWord*)&_blocks[i], (HeapWord*)&_blocks[i+1], ((_cnt-i-1)*sizeof(Block*)));

Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
28-07-2020