I opened <https://bugzilla.mozilla.org/show_bug.cgi?id=405654> to  
track this.

Note that even after I fix this, for security reasons, if a security  
controller is being used then the continuations will keep breaking  
when execution crosses security domains. That's unfortunately an  
inevitable side effect of the Java security model...

Of course, if you either don't use a security controller, or all JS  
code on the interpreter stack comes from the same security domain when  
you capture the continuation, it will work as expected.

Attila.

On 2007.11.23., at 9:47, Thomas wrote:

> Dear Attila
>
> Sure, nothing is bug free and I really appreciate the effort you put  
> into
> Rhino.
> Good to know that there are people already having experience with
> continuations and serialization - I'm just starting to look into the
> challenge of adding persistence support to my application.
> Again, thanks for shedding light on this.
>
> Regards, Thomas
>
> "Attila Szegedi" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED] 
> ...
>>
>> On 2007.11.22., at 18:01, Thomas wrote:
>>
>>> Thanks! This explains the strange behavior.
>>> Anyhow, it should be documented somewhere that the implementation of
>>> continuations in Rhino is only half done and only works on a  
>>> language
>>> subset. I mean, how can a normal user know that.
>>
>> He can't and is not expected to. This is clearly a bug, one we didn't
>> realize was there before. If we did, we wouldn't have documented  
>> it,  we
>> would have fixed it. It's true that I immediately figured out  what's
>> wrong with it when you reported the problem, but that doesn't  mean  
>> I was
>> consciously aware of this before. I wasn't.
>>
>> I have a production system myself that heavily uses continuations,  
>> and
>> you can imagine I did run into a fair amount of problems myself; I'm
>> fixing them when I can. I.e. there was an issue that capturing a
>> continuation in a loop and then trying to serialize it bombed  
>> because  the
>> loop iterator wasn't serializable. Then we had a similar problem   
>> where
>> capturing a continuation in a catch() block or in a with() block  and
>> trying to serialize it also bombed because - you guessed - the   
>> object
>> used for representing the catch and with scopes wasn't   
>> serializable. And
>> so on.
>>
>> We're making things better on the go, as we can afford to spend  
>> our  spare
>> time on it. I'm sorry for your inconvenience (and everyone  else's  
>> who
>> runs into a Rhino bug), but it's a fact that not everything  is  
>> always bug
>> free.
>>
>> Attila.
>>
>>
>>> It took me quite a while
>>> just to find out what causes the problem. Also, why leaving the
>>> interpreter
>>> loop at this point? What's so different to a normal function call   
>>> (other
>>> than the explicitely defined this object)?
>>>
>>> Thanks for your help!
>>> Cheers, Thomas
>>>
>>> "Attila Szegedi" <[EMAIL PROTECTED]> wrote in message
>>> news:[EMAIL PROTECTED]
>>> ...
>>>> Hm... that's indeed a problem. Without looking at the code, I   
>>>> actually
>>>> have an idea why it doesn't work. Continuations work only within a
>>>> single
>>>> invocation of Rhino's stackless interpreter loop. If you call   
>>>> out  of
>>>> the
>>>> interpreter loop into Java code (which call() and apply()  will   
>>>> do),
>>>> and
>>>> then back into a new instance of interpreter loop (which  an
>>>> interpreted
>>>> function will do to run its implementation), a  continuation  
>>>> will  not
>>>> work
>>>> correctly. It can only capture/unwind  within the current   
>>>> interpreter
>>>> loop
>>>> invocation.
>>>>
>>>> It'd be possible to apply a bit of a trickery in interpreter loop  
>>>> to
>>>> detect when call/apply is invoked for an InterpretedFunction   
>>>> instance,
>>>> and run it in the current interpreter loop.
>>>>
>>>> Attila.
>>>>
>>>> --
>>>> home: http://www.szegedi.org
>>>> weblog: http://constc.blogspot.com
>>>>
>>>> On 2007.11.22., at 17:03, Thomas wrote:
>>>>
>>>>> I'm heavily using continuations and noticed that they don't work
>>>>> correctly
>>>>> if my code uses the call() or apply() functions on Function   
>>>>> objectes
>>>>> to
>>>>> invoke a function. Just wondering if anybody had similar  
>>>>> experience?
>
>
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Attila.

--
home: http://www.szegedi.org
weblog: http://constc.blogspot.com



_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to