< prev index next >
src/share/vm/prims/jvmtiTagMap.cpp
Print this page
rev 9028 : 8223177: Data race on JvmtiEnvBase::_tag_map in double-checked locking
Summary: Add memory fences on accesses to JvmtiEnvBase::_tag_map
Reviewed-by: dholmes, jcbeyler, sspitsyn
*** 428,438 ****
assert(((JvmtiEnvBase *)env)->tag_map() == NULL, "tag map already exists for environment");
_hashmap = new JvmtiTagHashmap();
// finally add us to the environment
! ((JvmtiEnvBase *)env)->set_tag_map(this);
}
// destroy a JvmtiTagMap
JvmtiTagMap::~JvmtiTagMap() {
--- 428,438 ----
assert(((JvmtiEnvBase *)env)->tag_map() == NULL, "tag map already exists for environment");
_hashmap = new JvmtiTagHashmap();
// finally add us to the environment
! ((JvmtiEnvBase *)env)->release_set_tag_map(this);
}
// destroy a JvmtiTagMap
JvmtiTagMap::~JvmtiTagMap() {
*** 497,507 ****
}
// returns the tag map for the given environments. If the tag map
// doesn't exist then it is created.
JvmtiTagMap* JvmtiTagMap::tag_map_for(JvmtiEnv* env) {
! JvmtiTagMap* tag_map = ((JvmtiEnvBase*)env)->tag_map();
if (tag_map == NULL) {
MutexLocker mu(JvmtiThreadState_lock);
tag_map = ((JvmtiEnvBase*)env)->tag_map();
if (tag_map == NULL) {
tag_map = new JvmtiTagMap(env);
--- 497,507 ----
}
// returns the tag map for the given environments. If the tag map
// doesn't exist then it is created.
JvmtiTagMap* JvmtiTagMap::tag_map_for(JvmtiEnv* env) {
! JvmtiTagMap* tag_map = ((JvmtiEnvBase*)env)->acquire_tag_map();
if (tag_map == NULL) {
MutexLocker mu(JvmtiThreadState_lock);
tag_map = ((JvmtiEnvBase*)env)->tag_map();
if (tag_map == NULL) {
tag_map = new JvmtiTagMap(env);
*** 3280,3290 ****
SafepointSynchronize::is_at_safepoint(),
"must be executed at a safepoint");
if (JvmtiEnv::environments_might_exist()) {
JvmtiEnvIterator it;
for (JvmtiEnvBase* env = it.first(); env != NULL; env = it.next(env)) {
! JvmtiTagMap* tag_map = env->tag_map();
if (tag_map != NULL && !tag_map->is_empty()) {
tag_map->do_weak_oops(is_alive, f);
}
}
}
--- 3280,3290 ----
SafepointSynchronize::is_at_safepoint(),
"must be executed at a safepoint");
if (JvmtiEnv::environments_might_exist()) {
JvmtiEnvIterator it;
for (JvmtiEnvBase* env = it.first(); env != NULL; env = it.next(env)) {
! JvmtiTagMap* tag_map = env->acquire_tag_map();
if (tag_map != NULL && !tag_map->is_empty()) {
tag_map->do_weak_oops(is_alive, f);
}
}
}
< prev index next >