summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2013-12-11 12:06:28 +0100
committerSebastien Hertz <shertz@google.com>2013-12-12 10:03:39 +0100
commite96060aa2483529d087031f7cdcc0405f1ef9218 (patch)
tree72812d15a71818a8b197b17e48199560bc83a8ae /runtime/jdwp
parent315ab6c077c4db2031f1ffa40b78722d8269dc9b (diff)
downloadart-e96060aa2483529d087031f7cdcc0405f1ef9218.zip
art-e96060aa2483529d087031f7cdcc0405f1ef9218.tar.gz
art-e96060aa2483529d087031f7cdcc0405f1ef9218.tar.bz2
Manage JDWP errors related to garbage collection.
Returns INVALID_OBJECT error in case of invalid object ID or null object ID in commands ObjectReference.DisableCollection, ObjectReference.EnableCollection and ObjectReference.IsCollected. Note: JDWP specs do not state ObjectReference.EnableCollection must return any error code. We choose to be more strict so these three commands all behave the same. Change-Id: I06fb75b75f7d33cf4d23e121d9541bfd70b778bb
Diffstat (limited to 'runtime/jdwp')
-rw-r--r--runtime/jdwp/object_registry.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/runtime/jdwp/object_registry.cc b/runtime/jdwp/object_registry.cc
index be2219c..b2371e8 100644
--- a/runtime/jdwp/object_registry.cc
+++ b/runtime/jdwp/object_registry.cc
@@ -130,9 +130,7 @@ void ObjectRegistry::DisableCollection(JDWP::ObjectId id) {
Thread* self = Thread::Current();
MutexLock mu(self, lock_);
id_iterator it = id_to_entry_.find(id);
- if (it == id_to_entry_.end()) {
- return;
- }
+ CHECK(it != id_to_entry_.end());
Promote(*(it->second));
}
@@ -140,9 +138,7 @@ void ObjectRegistry::EnableCollection(JDWP::ObjectId id) {
Thread* self = Thread::Current();
MutexLock mu(self, lock_);
id_iterator it = id_to_entry_.find(id);
- if (it == id_to_entry_.end()) {
- return;
- }
+ CHECK(it != id_to_entry_.end());
Demote(*(it->second));
}
@@ -172,9 +168,7 @@ bool ObjectRegistry::IsCollected(JDWP::ObjectId id) {
Thread* self = Thread::Current();
MutexLock mu(self, lock_);
id_iterator it = id_to_entry_.find(id);
- if (it == id_to_entry_.end()) {
- return true; // TODO: can we report that this was an invalid id?
- }
+ CHECK(it != id_to_entry_.end());
ObjectRegistryEntry& entry = *(it->second);
if (entry.jni_reference_type == JNIWeakGlobalRefType) {