Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test in S06-advanced/wrap.t dies with "control operator crossed continuation barrier" #5257

Closed
p6rt opened this issue Apr 23, 2016 · 5 comments
Labels
JVM Related to Rakudo-JVM

Comments

@p6rt
Copy link

p6rt commented Apr 23, 2016

Migrated from rt.perl.org#127967 (status was 'resolved')

Searchable as RT127967$

@p6rt
Copy link
Author

p6rt commented Apr 23, 2016

From @usev6

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 rakudo/rakudo@f3fe819621 broke it.

@p6rt
Copy link
Author

p6rt commented Sep 19, 2016

From @usev6

On Sat Apr 23 01​:51​:35 2016, bartolin@​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
rakudo/rakudo@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)​:

====

Inline Patch
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.

@p6rt
Copy link
Author

p6rt commented Sep 28, 2016

From @usev6

I made a PR for my suggested change and with NQP commit 9da2705b1b the test passes on JVM.

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 28, 2016

From @usev6

I made a PR for my suggested change and with NQP commit 9da2705b1b the test passes on JVM.

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Sep 28, 2016

@usev6 - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Sep 28, 2016
@p6rt p6rt added the JVM Related to Rakudo-JVM label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JVM Related to Rakudo-JVM
Projects
None yet
Development

No branches or pull requests

1 participant