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
// 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;
}
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);