示例#1
0
文件: Sys2GL.cpp 项目: zephyrer/mgcl
//replace gel_old to gel_new.
//If gel_old is not included in this, do nothing.
void mgSys2GL::replace(
	const MGGel* gel_old,	//gel_old must be a MGCurve.
	const MGGel* gel_new	//gel_new must be a MGFSurface.
){
	if(gel_old==object_id()){
		set_object_id(const_cast<MGGel*>(gel_new));
	}else{
		if(m_gel2==gel_old){
			m_gel2=gel_new;
		}
	}
}
示例#2
0
文件: oop.cpp 项目: MarkusQ/rubinius
  void ObjectHeader::initialize_copy(Object* other, unsigned int new_age) {
    /* Even though we dup it, we have to be careful to maintain
     * the zone. */

    // DO NOT, EVER, CHANGE obj_type_.
    // obj_type_ indicates the shape of the object in memory. There are
    // f****d up cases where this is called where other is another type
    // (that, btw, is likely a bug in itself), but we should never,
    // MUST never change obj_type_ to make them match. This causes the GC
    // to get confused about the memory shape of the object!
    assert(type_id() == other->type_id());
    set_age(new_age);
    klass_ = other->klass_;
    ivars_ = other->ivars_;

#ifdef RBX_OBJECT_ID_IN_HEADER
    set_object_id(other->object_id());
#endif

    clear_forwarded();

    if(other->is_tainted_p()) set_tainted();
  }