Template interpreter::notice_safepoints()

Andrew Haley aph at redhat.com
Fri Feb 20 09:35:04 PST 2009


I'm having a little difficulty understanding how the template interpreter
is safe on SMP machines.

notice_safepoints() looks like this:

void TemplateInterpreter::notice_safepoints() {
  if (!_notice_safepoints) {
    // switch to safepoint dispatch table
    _notice_safepoints = true;
    copy_table((address*)&_safept_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address));
  }
}

So, the dispatch table is rewritten.  But on an SMP machine with
weak cache coherency, how does this work?  A thread could be
executing bytecodes in a loop but never see the change to _active_table
because there's nothing to cause its cache to be updated.  Is it
simply that this code doesn't work on such architectures?

Andrew.



More information about the hotspot-dev mailing list