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

Method combinations broken after commit bcc113cfb0 #6002

Closed
p6rt opened this issue Jan 14, 2017 · 8 comments
Closed

Method combinations broken after commit bcc113cfb0 #6002

p6rt opened this issue Jan 14, 2017 · 8 comments
Labels
JVM Related to Rakudo-JVM

Comments

@p6rt
Copy link

p6rt commented Jan 14, 2017

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

Searchable as RT130556$

@p6rt
Copy link
Author

p6rt commented Jan 14, 2017

From @usev6

With Rakudo commit bcc113cfb0 (Migrate combinations(n,k) logic to
Iterator.Combinations) I get some aborted tests for combinations
during spectest (running rakudo-j).

I think it comes down to this failure​:

$ ./perl6-j -e '(2).combinations(0)'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
  in method pull-one at gen/jvm/CORE.setting line 2931
  in method sink-all at gen/jvm/CORE.setting line 2821
  in method sink at gen/jvm/CORE.setting line 17172
  in block <unit> at -e line 1

This works as expected, so the (0) case seems to be the culprint​:

$ ./perl6-j -e 'say (1, 2, 3).combinations(1..3).list.perl'
((1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3))

The full backtrace looks like this​:

$ ./perl6-j --ll-exception -e '(2).combinations'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
  in pull-one (gen/jvm/CORE.setting​:2931)
  in pull-one (gen/jvm/CORE.setting​:2964)
  in sink-all (gen/jvm/CORE.setting​:2821)
  in sink (gen/jvm/CORE.setting​:17172)
  in <unit> (-e​:1)
  in <unit-outer> (-e​:1)
  in eval (gen/jvm/stage2/NQPHLL.nqp​:1165)
  in (gen/jvm/stage2/NQPHLL.nqp​:1255)
  in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1252)
  in command_eval (src/Perl6/Compiler.nqp​:27)
  in command_line (gen/jvm/stage2/NQPHLL.nqp​:1236)
  in MAIN (gen/jvm/main.nqp​:47)
  in <mainline> (gen/jvm/main.nqp​:38)
  in (gen/jvm/main.nqp)

@p6rt
Copy link
Author

p6rt commented Jan 14, 2017

From @lizmat

Hopefully fixed in 00c3551c86 . Cannot check because building JVM backend fails on MacOS.

On 14 Jan 2017, at 11​:24, Christian Bartolomaeus (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Christian Bartolomaeus
# Please include the string​: [perl #​130556]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130556 >

With Rakudo commit bcc113cfb0 (Migrate combinations(n,k) logic to
Iterator.Combinations) I get some aborted tests for combinations
during spectest (running rakudo-j).

I think it comes down to this failure​:

$ ./perl6-j -e '(2).combinations(0)'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
in method pull-one at gen/jvm/CORE.setting line 2931
in method sink-all at gen/jvm/CORE.setting line 2821
in method sink at gen/jvm/CORE.setting line 17172
in block <unit> at -e line 1

This works as expected, so the (0) case seems to be the culprint​:

$ ./perl6-j -e 'say (1, 2, 3).combinations(1..3).list.perl'
((1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3))

The full backtrace looks like this​:

$ ./perl6-j --ll-exception -e '(2).combinations'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
in pull-one (gen/jvm/CORE.setting​:2931)
in pull-one (gen/jvm/CORE.setting​:2964)
in sink-all (gen/jvm/CORE.setting​:2821)
in sink (gen/jvm/CORE.setting​:17172)
in <unit> (-e​:1)
in <unit-outer> (-e​:1)
in eval (gen/jvm/stage2/NQPHLL.nqp​:1165)
in (gen/jvm/stage2/NQPHLL.nqp​:1255)
in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1252)
in command_eval (src/Perl6/Compiler.nqp​:27)
in command_line (gen/jvm/stage2/NQPHLL.nqp​:1236)
in MAIN (gen/jvm/main.nqp​:47)
in <mainline> (gen/jvm/main.nqp​:38)
in (gen/jvm/main.nqp)

@p6rt
Copy link
Author

p6rt commented Jan 14, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 14, 2017

From @lizmat

Hopefully fixed in 00c3551c86 . Cannot check because building JVM backend fails on MacOS.

On 14 Jan 2017, at 11​:24, Christian Bartolomaeus (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Christian Bartolomaeus
# Please include the string​: [perl #​130556]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130556 >

With Rakudo commit bcc113cfb0 (Migrate combinations(n,k) logic to
Iterator.Combinations) I get some aborted tests for combinations
during spectest (running rakudo-j).

I think it comes down to this failure​:

$ ./perl6-j -e '(2).combinations(0)'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
in method pull-one at gen/jvm/CORE.setting line 2931
in method sink-all at gen/jvm/CORE.setting line 2821
in method sink at gen/jvm/CORE.setting line 17172
in block <unit> at -e line 1

This works as expected, so the (0) case seems to be the culprint​:

$ ./perl6-j -e 'say (1, 2, 3).combinations(1..3).list.perl'
((1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3))

The full backtrace looks like this​:

$ ./perl6-j --ll-exception -e '(2).combinations'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
in pull-one (gen/jvm/CORE.setting​:2931)
in pull-one (gen/jvm/CORE.setting​:2964)
in sink-all (gen/jvm/CORE.setting​:2821)
in sink (gen/jvm/CORE.setting​:17172)
in <unit> (-e​:1)
in <unit-outer> (-e​:1)
in eval (gen/jvm/stage2/NQPHLL.nqp​:1165)
in (gen/jvm/stage2/NQPHLL.nqp​:1255)
in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1252)
in command_eval (src/Perl6/Compiler.nqp​:27)
in command_line (gen/jvm/stage2/NQPHLL.nqp​:1236)
in MAIN (gen/jvm/main.nqp​:47)
in <mainline> (gen/jvm/main.nqp​:38)
in (gen/jvm/main.nqp)

@p6rt
Copy link
Author

p6rt commented Jan 14, 2017

From @usev6

On Sat, 14 Jan 2017 03​:06​:52 -0800, elizabeth wrote​:

Hopefully fixed in 00c3551c86 . Cannot check because building JVM
backend fails on MacOS.

As discussed on #perl6-dev [1] this didn't fix the issue, unfortunately.

I think, I've found the underlying reason for the breakage. This is a golf of the error (the following evaluations are run on commit 502fc77a68)​:

$ ./perl6-j --version
This is Rakudo version 2016.12-320-g502fc77 built on JVM
implementing Perl 6.c.

$ ./perl6-j -e 'say Rakudo​::Internals.ListsFromSeq( (2,3), combinations(2,0))'
java.lang.RuntimeException​: No such attribute '$!reified' for this object
  in method pull-one at gen/jvm/CORE.setting line 2931
  in method push-exactly at gen/jvm/CORE.setting line 2734
  in method push-at-least at gen/jvm/CORE.setting line 2753
  in method reify-at-least at gen/jvm/CORE.setting line 18753
  in method pull-one at gen/jvm/CORE.setting line 19246
  in method pull-one at gen/jvm/CORE.setting line 6730
  in method join at gen/jvm/CORE.setting line 17261
  in method gist at gen/jvm/CORE.setting line 19448
  in method gist at gen/jvm/CORE.setting line 17240
  in sub say at gen/jvm/CORE.setting line 36238
  in block <unit> at -e line 1

Now 'combinations(2,0)' is nothing else than 'Seq.new(Rakudo​::Iterator.Combinations(2,0,0))'

At first glance the following looks ok​:

$ ./perl6-j -e 'dd combinations(2,0)' # same output as on perl6-m
((),).Seq

But this looks wrong​:

$ ./perl6-j -e 'dd combinations(2,0)[0..1]'
((), Mu)

Compare to perl6-m​:

$ ./perl6-m -e 'dd combinations(2,0)[0..1]'
((), Nil)

And calling 'Seq.new(Rakudo​::Iterator.Combinations(2,0,0))' reveals the problem​:

$ ./perl6-j -e 'say Seq.new(Rakudo​::Iterator.Combinations(2,0,0))'
(() (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) ...)

Under the hood Rakudo​::Iterator.OneValue is called like so​:

$ ./perl6-j -e 'say Seq.new(Rakudo​::Iterator.OneValue(List.new))'
(() (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) (Mu) ...)

And within Rakudo​::Iterator.OneValue we execute something like this (same bug as in https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130532):

$ ./perl6-j -e 'use nqp; class A { has Mu $!foo; method bar () { $!foo := nqp​::null; say nqp​::isnull($!foo) ?? "null" !! $!foo } }.new.bar'
(Mu)

So, as far as I understand Rakudo​::Iterator.OneValue does not work correctly on rakudo-j, and that surfaces at different points due to lizmat's refactoring.

[1] https://irclog.perlgeek.de/perl6-dev/2017-01-14#i_13920333

@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

From @usev6

This seems to be resolved now​:

$ ./perl6-j --version
This is Rakudo version 2017.08-104-g76f1d8970 built on JVM
implementing Perl 6.c.

$ ./perl6-j -e 'say (2).combinations(0)'
(())

Since there are tests for this behaviour in S32-list/combinations.t, I'm closing this ticket as 'resolved' without adding another test.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

From @usev6

This seems to be resolved now​:

$ ./perl6-j --version
This is Rakudo version 2017.08-104-g76f1d8970 built on JVM
implementing Perl 6.c.

$ ./perl6-j -e 'say (2).combinations(0)'
(())

Since there are tests for this behaviour in S32-list/combinations.t, I'm closing this ticket as 'resolved' without adding another test.

@p6rt
Copy link
Author

p6rt commented Sep 10, 2017

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

@p6rt p6rt closed this as completed Sep 10, 2017
@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