Example #1
0
	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;
	}
Example #2
0
void ST_mmgc_basics::test8() {
    MMGC_GCENTER(gc);
    MyGCObject *mygcobject;
    mygcobject = (MyGCObject *)new (gc) MyGCObject();
verifyPass((MyGCObject *)gc->FindBeginningGuarded(mygcobject)==mygcobject, "(MyGCObject *)gc->FindBeginningGuarded(mygcobject)==mygcobject", __FILE__, __LINE__);
verifyPass((MyGCObject *)gc->FindBeginningFast(mygcobject)==mygcobject, "(MyGCObject *)gc->FindBeginningFast(mygcobject)==mygcobject", __FILE__, __LINE__);

}
Example #3
0
 // NOTE NOTE NOTE
 // Write barrier note: the container for a HeapMultiname is *not* 'this';
 // HeapMultiname figures as a field in eg QNameObject and XMLListObject.
 // You *must* call FindBeginningFast(this) to get the right container.
 //
 // NOTE NOTE NOTE
 // This version is only safe if 'this' is on the first block of the object - because
 // GC::GetGC() is not reliable otherwise.  See bugzilla 525875.  Use the more
 // reliable version below if in doubt.
 void HeapMultiname::setMultiname(const Multiname& that)
 {
     MMgc::GC* gc = this->gc();
     const void *container = gc->FindBeginningFast(this);
     setMultiname(gc, container, that);
 }