OSDN Git Service

ART: Register object tagging table
authorAndreas Gampe <agampe@google.com>
Thu, 6 Oct 2016 20:13:30 +0000 (13:13 -0700)
committerAndreas Gampe <agampe@google.com>
Thu, 6 Oct 2016 20:13:30 +0000 (13:13 -0700)
Actually register object tagging table with the runtime so it
gets swept properly.

Bug: 31385027
Test: m test-art-host
Test: m ART_USE_READ_BARRIER=true test-art-host
Change-Id: I4364458ece2893e6a85fe7518df39fb838199f20

runtime/openjdkjvmti/OpenjdkJvmTi.cc
runtime/openjdkjvmti/object_tagging.h

index bebc2fc..bea40c8 100644 (file)
@@ -1035,7 +1035,9 @@ static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) {
 
 // The plugin initialization function. This adds the jvmti environment.
 extern "C" bool ArtPlugin_Initialize() {
-  art::Runtime::Current()->GetJavaVM()->AddEnvironmentHook(GetEnvHandler);
+  art::Runtime* runtime = art::Runtime::Current();
+  runtime->GetJavaVM()->AddEnvironmentHook(GetEnvHandler);
+  runtime->AddSystemWeakHolder(&gObjectTagTable);
   return true;
 }
 
index e276c52..523e15f 100644 (file)
@@ -102,7 +102,7 @@ class ObjectTagTable : public art::gc::SystemWeakHolder {
 
     for (auto it = tagged_objects_.begin(); it != tagged_objects_.end(); ++it) {
       if (!it->first.IsNull()) {
-        art::mirror::Object* original_obj = it->first.Read();
+        art::mirror::Object* original_obj = it->first.Read<art::kWithoutReadBarrier>();
         art::mirror::Object* target_obj = visitor->IsMarked(original_obj);
         if (original_obj != target_obj) {
           it->first = art::GcRoot<art::mirror::Object>(target_obj);