Subj : Re: GC question: JS_GetStringBytes To : netscape.public.mozilla.jseng From : Peter Wilson Date : Sun Aug 28 2005 11:28 am Brendan Eich wrote: > Eric Anholt wrote: >> I'm one of the developers of swfdec, and we've been using the >> spidermonkey code for interpreting actionscript with pretty good >> success (primary complaint would be the lack of a build system outside >> of mozilla that properly builds and installs shared libraries). > > > We're taking patches ;-). There's a bug > (https://bugzilla.mozilla.org/show_bug.cgi?id=97954) asking for a > unified, standalone, mozilla-style autoconf build setup. Not sure this > will help, but it might. What OSes are you targeting? > I'd second a request for a standalone build. We're primarily targetting Linux and OpenBSD. It's a little while since I looked at this but one of the bigger stumbling blocks was trying to build spider monkey with multi-thread support using NSPR so we could have Whitebeam working in multi-threaded Apache 2. As I remember SpiderMonkey assumed the specific Mozilla source tree with NSPR having to be in a specific location relative to SpiderMonkey. I think a standalone build env would also require a stand-alone build for NSPR to be truly useful. > >> However, while re-reading the code I realized I was being really >> sloppy with GC, and I had a couple of questions as a result: >> >> - I assume JS_GetStringBytes returns GCed bytes, right? What is the >> guaranteed lifetime of these guys? If it's "as long as the original >> stirng is rooted," I'm fine. > > > That's it. > > >> - What would you do if you have to maintain a stack of jsvals? I'm >> using a manually rooted JS array and setting jsvals into indexes of >> it, but I'm not terribly pleased with this method. > > > You might use the interpreter's stack in the current JSContext. Anent > that idea, what are these jsvals for? When do you push and pop? Can > you bound the size of the stack, or of segments of it that are "chunky" > enough to amortize the costs of managing the allocation and deallocation? > > /be Pete -- http://www.whitebeam.org http://www.yellowhawk.co.uk ---- .