// This is only safe if 'this' is on the first block of the object - because GC::GetGC() is // not reliable otherwise. See bugzilla 525875. To destroy objects beyond the first block, // use the safe version of setMultiname() with an empty Multiname argument. HeapMultiname::~HeapMultiname() { // Our embedded Multiname will zero itself, but we should call WBRC to // adjust the refcounts correctly... WBRC_NULL(&name.name); if (!name.isNsset()) WBRC_NULL(&name.ns); }
void HeapMultiname::setMultiname(const Multiname& that) { MMgc::GC* gc = this->gc(); const void *container = gc->FindBeginningFast(this); WBRC(gc, container, &name.name, that.name); bool const this_nsset = name.isNsset() != 0; bool const that_nsset = that.isNsset() != 0; if (this_nsset != that_nsset) { // gc->rc or vice versa... we have to explicitly null out // any existing value (before setting a new one) because WB/WBRC // assume any existing value is a GCObject/RCObject respectively. if (this_nsset) WB_NULL(&name.ns); else WBRC_NULL(&name.ns); } if (that_nsset) { WB(gc, container, &name.nsset, that.nsset); } else { WBRC(gc, container, &name.ns, that.ns); } name.flags = that.flags; name.next_index = that.next_index; }