RFR: 8258961: move some fields of SafePointNode from public to protected

Xin Liu xliu at openjdk.java.net
Fri Jan 15 17:57:06 UTC 2021


On Fri, 8 Jan 2021 17:30:20 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> Yes, I did modify the JBS title. I found it's hard to hide out _jvms because offset_of(klass, field) needs to access the field. 
>> 
>> I plan to see if we can use template metaprogramming or constexpr to workaround it(https://gist.github.com/graphitemaster/494f21190bb2c63c5516). I will file a separate issue if I figure out how.
>
> I found Node::jvms() is virtual, so it's useless to remove keyword "virtual" in SafePointNode::jvms(). I need another revision to fix it.  
> 
> Paul asked me to hide away those public fields into protected. I discover a straightforward solution --  just declare friend class VMStructs. Other classes do that.

I took back the devirtual attempt because it's not worth it.   there're 3 nodes override Node::jvms(). 
non-virtual jvms() looks more expensive to access vtable. 

JVMState* Node::jvms() const {
  if (is_SafePoint()) {
    return as_SafePoint()->jvms();
  } else if (is_MachSafePoint()) {
    return as_MachSafePoint()->jvms();
  } else if (is_MachHalt()) {
   return as_MachHalt()->jvms();
  }
  return nullptr;
}

-------------

PR: https://git.openjdk.java.net/jdk/pull/1899


More information about the hotspot-compiler-dev mailing list