Subj : Re: Bit size of variables in argv To : Sterling Bates From : Brendan Eich Date : Thu Oct 30 2003 09:42 pm Sterling Bates wrote: > "John Bandhauer" wrote in message > news:bnse5j$pbl1@ripley.netscape.com... > >>Native methods' argv array is *always* populated with pointer-sized >>jsvals. jsdoubles are passed by reference (to an immutable instance) not >>by value. The JSVAL_* types described at the top of jsapi.h are the only >>types that matter for argv. > > > By immutable, are you referring simply to its location in memory? If you know that jsval * is the type of argv, and you know that argv[-2] through argv[argc-1] (at least -- JSFunctionSpec.nargs and .extra can be used to guarantee up to argv[nargs+extra-1] as the last valid element in the argv vector), then there's no question about uint64, etc. A jsval is a pointer-sized signed integral type. A jsdouble is IEEE754 double precision floating point. Since on most machines today, a pointer is 32 bits, you can't fit a jsdouble directly in a jsval. So jsdoubles are encoded in jsvals by their address, and are GC-things allocated from the gargage-collected heap. A jsdouble in the GC-heap has only one value throughout its lifetime. Hence "immutable". The GC currently does not copy, but if we implement a copying collector, then the jsdouble's address could change -- but only under certainly well-defined conditions, and any argv entries live during the copying GC would be updated to point to the new location. /be .