< prev index next >
src/hotspot/share/interpreter/templateInterpreter.cpp
Print this page
@@ -29,11 +29,13 @@
#include "interpreter/templateInterpreter.hpp"
#include "interpreter/templateInterpreterGenerator.hpp"
#include "interpreter/templateTable.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
+#include "runtime/safepoint.hpp"
#include "runtime/timerTrace.hpp"
+#include "utilities/copy.hpp"
#ifndef CC_INTERP
# define __ _masm->
@@ -273,15 +275,21 @@
return (int)state;
}
//------------------------------------------------------------------------------------------------------------------------
-// Safepoint suppport
+// Safepoint support
static inline void copy_table(address* from, address* to, int size) {
- // Copy non-overlapping tables. The copy has to occur word wise for MT safety.
- while (size-- > 0) *to++ = *from++;
+ // Copy non-overlapping tables.
+ if (SafepointSynchronize::is_at_safepoint()) {
+ // Nothing is using the table at a safepoint so skip atomic word copy.
+ Copy::disjoint_words((HeapWord*)from, (HeapWord*)to, (size_t)size);
+ } else {
+ // Use atomic word copy when not at a safepoint for safety.
+ Copy::disjoint_words_atomic((HeapWord*)from, (HeapWord*)to, (size_t)size);
+ }
}
void TemplateInterpreter::notice_safepoints() {
if (!_notice_safepoints) {
log_debug(interpreter, safepoint)("switching active_table to safept_table.");
< prev index next >