ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/cfperl.xs
(Generate patch)

Comparing deliantra/server/server/cfperl.xs (file contents):
Revision 1.195 by root, Tue Apr 24 00:42:02 2007 UTC vs.
Revision 1.196 by root, Fri Apr 27 02:23:07 2007 UTC

111 111
112unordered_vector<attachable *> attachable::mortals; 112unordered_vector<attachable *> attachable::mortals;
113 113
114attachable::~attachable () 114attachable::~attachable ()
115{ 115{
116 flags |=0x3300;//D
117 assert (!self); 116 assert (!self);
118 assert (!cb); 117 assert (!cb);
119} 118}
120 119
121int 120int
137 sv_unmagic ((SV *)self, PERL_MAGIC_ext); 136 sv_unmagic ((SV *)self, PERL_MAGIC_ext);
138 SvREFCNT_dec (self); 137 SvREFCNT_dec (self);
139 138
140 // self *must* be null now because thats sv_unmagic's job. 139 // self *must* be null now because thats sv_unmagic's job.
141 assert (!this->self); 140 assert (!this->self);
142 flags |= 0x80; // severed //D
143 } 141 }
144} 142}
145 143
146void 144void
147attachable::optimise () 145attachable::optimise ()
148{ 146{
149 if (self 147 if (self
150 && SvREFCNT (self) == 1 148 && SvREFCNT (self) == 1
151 && !HvTOTALKEYS (self)) 149 && !HvTOTALKEYS (self))
152 flags |= 0x40,//D
153 sever_self (); 150 sever_self ();
154} 151}
155 152
156// check wether the object really is dead 153// check wether the object really is dead
157void 154void
175 } 172 }
176 173
177 if (self) 174 if (self)
178 sever_self (); 175 sever_self ();
179 176
180 flags |= 0x20; //D
181 mortals.push_back (this); 177 mortals.push_back (this);
182} 178}
183 179
184void 180void
185attachable::destroy () 181attachable::destroy ()
210 206
211 attachable *obj = mortals [i]; 207 attachable *obj = mortals [i];
212 208
213 obj->refcnt_chk (); // unborrow from perl, if necessary 209 obj->refcnt_chk (); // unborrow from perl, if necessary
214 210
215 //if (obj->refcnt > 0 || obj->self)
216 if (obj->refcnt || obj->self) 211 if (obj->refcnt || obj->self)
217 { 212 {
218//printf ("%p rc %d\n", obj, obj->refcnt_cnt ());//D
219 ++i; // further delay freeing 213 ++i; // further delay freeing
220 214
221 if (!(i & 0x3ff)) 215 if (!(i & 0x3ff))
222 break; 216 break;
223 } 217 }
280 274
281 if (!obj->self) 275 if (!obj->self)
282 { 276 {
283 obj->self = newHV (); 277 obj->self = newHV ();
284 sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0); 278 sv_magicext ((SV *)obj->self, 0, PERL_MAGIC_ext, &attachable::vtbl, (char *)obj, 0);
285 obj->flags |= (obj->flags & 0xc0) << 8;
286 obj->flags &= ~0xc0;//D
287 obj->flags |= 0x10;//D
288 279
289 // now bless the object _once_ 280 // now bless the object _once_
290 return sv_bless (newRV_inc ((SV *)obj->self), stash); 281 return sv_bless (newRV_inc ((SV *)obj->self), stash);
291 } 282 }
292 else 283 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines