In Rhino-in-Spring I have serialization logic that both stubs the prototype scope and also stubs the function bodies of all (interpreted) functions, whether loaded into the prototype scope or otherwise. The starting point is:
<http://rhinoinspring.svn.sourceforge.net/viewvc/rhinoinspring/trunk/rhinoInSpring/src/java/org/szegedi/spring/web/jsflow/support/FlowStateSerializer.java?view=markup > and the code for mapping function bodies to stubs is found here: <http://rhinoinspring.svn.sourceforge.net/viewvc/rhinoinspring/trunk/rhinoInSpring/src/java/org/szegedi/spring/web/jsflow/support/FlowStateSerializer.java?view=markup >, search for "createFunctionStubs" There's also a facility for digital fingerprinting of function bodies, which might or might not be necessary in your case - it is important with continuations to detect that the function on continuation stack changed (i.e. reloaded script), as it invalidates the return addresses on the continuation call stack, so failing cleanly early is preferred to failing nondeterministically because of returning to a no longer valid instruction offset in the caller... Attila. On 2008.02.13., at 9:04, Hannes Wallnoefer wrote: > Hi Ben, > > On 12 Feb., 21:21, [EMAIL PROTECTED] wrote: >> >> I've instrumented my ScriptableOutputStream to log all of the objects >> it is asked to replace, and from this log it seems clear that the >> objects in the global scope (compiled functions mostly) to which my >> session is maintaining references are still being offered for >> serialization even though their parent scope is stubbed with the >> proxy. >> > > I found a possible explanation for what you're describing. If you > serialize a function defined in a script file, the whole compiled > script will be serialized as well. So if you have both your local/per > session code and the global code in the same script file, breaking the > code up in two or more files may help. Maybe this fixes it, and I'm > glad I also learned something new along the way :-) > > Hannes _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
