Subj : Re: SetPrivate and live objects To : Sterling Bates From : Brendan Eich Date : Wed Nov 12 2003 11:16 pm Sterling Bates wrote: >Is it possible that the private_to_jsval macro will affect live objects, >particularly when they tear down? For instance, Delphi will access the >virtual method table to find the Destroy method of an object. When the >object is added to the private slot of a JSObject it will sometimes fail >when attempting to free itself. I'm wondering if changing any of the bits >of the pointer could cause this kind of symptom. > > Of course -- it's not a pointer, anyway, it's a jsval (long). You are responsible for freeing private data, from your class finalizer. The engine has no idea how to do it, and any type information that one language runtime has associated with the pointer you set as private data is lost when the tagged pointer is stored as an integral type into the private slot. >Another question: If I change the private_to_jsval and jsval_to_private >macros to do nothing, will that affect anything else? (I ask #2 since I >understand the pointer to be technically private, and not for use inside the >engine...) > You don't know enough to hack around with those macros, so please don't. Of course they need to tag and untag, or they wouldn't waste cycles doing so. You remove the tagging, you'll cause the GC to scan whatever the private slot points to, even though it is not a JSObject. /be .