On Sat Apr 23 01:51:35 2016, barto...@gmx.de wrote:
> The following code (from S06-advanced/wrap.t, test skipped for rakudo-
> j) dies on rakudo-jvm:
> 
> $ perl6-j -e 'my @t = gather { sub triangle { take "=" x 3; }; for
> reverse ^3 -> $n { &triangle.wrap({ take "=" x $n; callsame; take "="
> x $n; }); }; triangle(); };'
> control operator crossed continuation barrier
>   in any call_with_capture at gen/jvm/Metamodel.nqp line 3843
>   in block  at -e line 1
>   in block <unit> at -e line 1
> 
> I did a bisect and found that commit
> https://github.com/rakudo/rakudo/commit/f3fe819621 broke it.

Here is a golfed example:

$ ./perl6-j -e 'gather { sub a { take "=" }; &a.wrap({ callsame }); a() }'
control operator crossed continuation barrier
  in any call_with_capture at gen/jvm/Metamodel.nqp line 3914
  in block  at -e line 1
  in block <unit> at -e line 1

With the following change to nqp the code works as expected (and there are no 
new spectest failures):

====
diff --git a/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java 
b/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
index fb95495..b0b4ba4 100644
--- a/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
+++ b/src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
@@ -2386,8 +2386,6 @@ public final class Ops {
             ArgsExpectation.invokeByExpectation(tc, cr, csd, args);
         }
         catch (ControlException e) {
-            if (barrier && (e instanceof SaveStackException))
-                ExceptionHandling.dieInternal(tc, "control operator crossed 
continuation barrier");
             throw e;
         }
         catch (Throwable e) {
====

$ ./perl6-j -e 'say gather { sub a { take "=" }; &a.wrap({ callsame }); a() }'
(=)

My (wild) guess why the problem surfaced with commit f3fe819621 is this: We use 
.pull-one now, that method uses 'nqp::continuationreset' and the combination of 
that op, a control exception (from 'take') and 'callsame' leads to the 
SaveStackException.

Reply via email to