summaryrefslogtreecommitdiff
path: root/runtime/mirror/object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/mirror/object.cc')
-rw-r--r--runtime/mirror/object.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index 448409c7a7..b28978603c 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -162,11 +162,9 @@ ObjPtr<Object> Object::Clone(Handle<Object> h_this, Thread* self) {
gc::Heap* heap = Runtime::Current()->GetHeap();
size_t num_bytes = h_this->SizeOf();
CopyObjectVisitor visitor(&h_this, num_bytes);
- // Unclear whether this should ever allocate a nonmovable object. This is conservative.
- ObjPtr<Object> copy =
- heap->IsNonMovable(h_this.Get()) ?
- heap->AllocNonMovableObject(self, h_this->GetClass(), num_bytes, visitor) :
- heap->AllocObject(self, h_this->GetClass(), num_bytes, visitor);
+ ObjPtr<Object> copy = heap->IsMovableObject(h_this.Get())
+ ? heap->AllocObject(self, h_this->GetClass(), num_bytes, visitor)
+ : heap->AllocNonMovableObject(self, h_this->GetClass(), num_bytes, visitor);
if (h_this->GetClass()->IsFinalizable()) {
heap->AddFinalizerReference(self, &copy);
}