Yesterday we had the following discussion on #perl6-dev about this ticket: ==== start of discussion on IRC -- cmp. http://irclog.perlgeek.de/perl6-dev/2016-09-19#i_13238477 bartolin lizmat: I saw your commit 9b6f2eb543 in the backlog. does that shed a different light on RT #128320 and the related rakudo PR 780? (that PR has conflicts now) synopsebot6 Link: https://rt.perl.org/rt3//Public/Bug/Display.html?id=128320 lizmat bartolin: looking lizmat bartolin: I don't think so, because #128320 is about Arrays not Lists lizmat ah, reading the pull request: perhaps the jvm has problems pushing nqp::null to an array ? timotimo we don't have something like VMNull on JVM? that surprises me arnsholt IIRC nqp::null on JVM is just plain null lizmat well, that's basically what https://github.com/rakudo/rakudo/pull/780/files does: make sure we don't push nqp::null arnsholt There are two potential solutions here, IMO arnsholt Either guard against the null from Rakudo (like in the PR), or find the spot in the Java runtime code that doesn't check for null and add a null check there instead bartolin lizmat: IIRC the problem occured because we used map in the failing code -- and inside map the List iterator is used arnsholt I'd be inclined to go for finding the problem in the Java code, I think bartolin sounds fair. I'll add this discussion to the ticket (and close the PR) bartolin arnsholt++ lizmat++ # thanks for looking lizmat bartolin: if this is still a problem, then I could make it JVM only bartolin lizmat: no, it's not a big problem (not worth a special case IMHO) lizmat ok bartolin (I fudged the failing test as todo some time ago) lizmat well, if it's todoed, is no longer NPEing ? lizmat *it's bartolin it's a 'lives-ok' test :-) lizmat but still, an NPE would exit the test script, wouldn't be catchable ? timotimo not sure if we turn an NPE into a perl6-level catchable exception bartolin well, the test file (S32-array/delete.t) has no passed todos and it does not die, either * lizmat is building an up-to-date JVM backend lizmat bartolin: seems the problem on JVM is now also gone: lizmat $ ./perl6-j -e 'my @a; @a[1] = 42; say @a.map: { 1 }' lizmat (1 1) lizmat oops, it isn't: lizmat $ ./perl6-j -e 'my @a; @a[1] = 42; say map { $_ }, @a' lizmat java.lang.NullPointerException lizmat in block <unit> at -e line 1 bartolin yepp, it's only the sub form of map lizmat m: sub a(+v) { dd v }; a( my @ = ^10 ) camelia rakudo-moar 77a7a4: OUTPUT«(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)» lizmat m: sub a(+@v) { dd @v }; a( my @ = ^10 ) camelia rakudo-moar 77a7a4: OUTPUT«[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]» lizmat seems like adding a sigil makes it an Array, and thus circumvent the issue bartolin lizmat: you mean in multi sub map? lizmat yeah... lizmat testing that now bartolin hmm, Larry introduced the +value there exactly one year ago (d9c21e99f5) lizmat ./perl6-j -e 'my @a; @a[1] = 42; say map { $_ }, @a' lizmat ((Mu) 42) lizmat bartolin: alas, no go lizmat m: my @a = ^10; map { $_ = 42 }, @a; dd @a # this breaks camelia rakudo-moar 77a7a4: OUTPUT«Array @a = [42, 42, 42, 42, 42, 42, 42, 42, 42, 42]» lizmat apparently the array is a copy bartolin ah. bartolin anyway, it's not the biggest problem with the jvm backend ... but thanks for looking! lizmat bartolin: yw ==== end of discussion on IRC -- powered by https://github.com/usev6/dump-irc-logs
[perl #128320] [JVM] NullPointerException when using sub form of map on array with deleted element
Christian Bartolomaeus via RT Tue, 20 Sep 2016 12:45:01 -0700