diff --git a/experiments/placer/layout.h b/experiments/placer/layout.h index a440d6274e1..7dd08b3cc4b 100644 --- a/experiments/placer/layout.h +++ b/experiments/placer/layout.h @@ -116,7 +116,6 @@ class ArenaContainer : public Container { } } - // Allocation function. void* Place(int size) { ArenaContainerHeader* header = reinterpret_cast(header_); @@ -132,7 +131,8 @@ class ArenaContainer : public Container { ObjHeader* PlaceObject(const TypeInfo* type_info); // Places an array of certain type in this container. Note that array_type_info - // is type infor for an array, not for an individual element. + // is type info for an array, not for an individual element. Also note that exactly + // same operation could be used to place strings. ArrayHeader* PlaceArray(const TypeInfo* array_type_info, int count); // Dispose whole container ignoring non-zero refcount. Use with care. @@ -247,10 +247,6 @@ class ObjRef : public AnyObjRef { ObjRef(const ObjRef& other) : AnyObjRef(nullptr) { Assign(other); } - ObjRef& operator=(const ObjRef& other) { - Assign(other); - return *this; - } void Assign(const ObjRef& other) { AnyObjRef::Assign(other); } diff --git a/experiments/placer/placer.cc b/experiments/placer/placer.cc index 308539f919f..6a47c12ebd5 100644 --- a/experiments/placer/placer.cc +++ b/experiments/placer/placer.cc @@ -42,7 +42,7 @@ void ReturnByValue(ObjRef value) { } ObjRef ReturnByRef(ArenaContainer* container) { - auto result = ObjRef::Alloc(container); + ObjRef result(ObjRef::Alloc(container)); result.at().set(30); return result; } @@ -88,18 +88,18 @@ void test_placer() { // Pass by reference. while (!cur.null()) { UpdateElement(cur); - cur = cur.at, next_offset>().get(); + cur.Assign(cur.at, next_offset>().get()); } // Pass by value. while (!cur.null()) { // We could place clone on stack as well. DoNotUpdateElement(cur.Clone(&heap)); - cur = cur.at, next_offset>().get(); + cur.Assign(cur.at, next_offset>().get()); } cur = head; while (!cur.null()) { printf("next is %d\n", cur.at().get()); - cur = cur.at, next_offset>().get(); + cur.Assign(cur.at, next_offset>().get()); } } heap.Dispose();