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

compile to jar files / moarvm files (without revealing original source code) #5756

Open
p6rt opened this issue Oct 18, 2016 · 10 comments
Open
Labels
RFC Request For Comments

Comments

@p6rt
Copy link

p6rt commented Oct 18, 2016

Migrated from rt.perl.org#129909 (status was 'open')

Searchable as RT129909$

@p6rt
Copy link
Author

p6rt commented Oct 18, 2016

From dataf5l@gmail.com

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

@p6rt
Copy link
Author

p6rt commented Oct 18, 2016

From @lizmat

What happens if you add --ll-exception to the command line?

On 18 Oct 2016, at 05​:42, Felipe Valdes (via RT) <perl6-bugs-followup@​perl.org> wrote​:

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

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

@p6rt
Copy link
Author

p6rt commented Oct 18, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 19, 2016

From dataf5l@gmail.com

perl6 --target=jvm --ll-exception --output=guess.jar guess.p6

java.lang.NullPointerException

  in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1217)

  in command_eval (src/Perl6/Compiler.nqp​:27)

  in command_line (gen/jvm/stage2/NQPHLL.nqp​:1181)

  in MAIN (gen/jvm/main.nqp​:47)

  in <mainline> (gen/jvm/main.nqp​:38)

  in (gen/jvm/main.nqp)

On Tue, Oct 18, 2016 at 4​:43 PM, Elizabeth Mattijsen via RT <
perl6-bugs-followup@​perl.org> wrote​:

What happens if you add --ll-exception to the command line?

On 18 Oct 2016, at 05​:42, Felipe Valdes (via RT) <
perl6-bugs-followup@​perl.org> wrote​:

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

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

@p6rt
Copy link
Author

p6rt commented Oct 19, 2016

From @peschwa

On Tue Oct 18 18​:07​:05 2016, dataf5l@​gmail.com wrote​:

perl6 --target=jvm --ll-exception --output=guess.jar guess.p6

java.lang.NullPointerException

in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1217)

in command_eval (src/Perl6/Compiler.nqp​:27)

in command_line (gen/jvm/stage2/NQPHLL.nqp​:1181)

in MAIN (gen/jvm/main.nqp​:47)

in <mainline> (gen/jvm/main.nqp​:38)

in (gen/jvm/main.nqp)

On Tue, Oct 18, 2016 at 4​:43 PM, Elizabeth Mattijsen via RT <
perl6-bugs-followup@​perl.org> wrote​:

What happens if you add --ll-exception to the command line?

On 18 Oct 2016, at 05​:42, Felipe Valdes (via RT) <
perl6-bugs-followup@​perl.org> wrote​:

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

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

The feature you're asking for does not exist at the moment.

You can get the precompiled compilation unit of a Perl 6 program as a .jar with C<--target=jar>, but that doesn't help you, because it a compilation unit that can be understood by a Rakudo executable, not a jar file that can be understood by any JVM.

The file at [1] is a shell script that includes the step that will eventually be integrated into the perl6 binary to generate a self-contained jar file from Perl 6 code, albeit in the simplest way possible. That is, bundle the whole interpreter and make that run a predefined compilation unit. There is a corresponding Rakudo branch

Note though that the branch hasn't been updated in quite a while and might not necessarily merge cleanly against current HEAD.

[1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/one-jar-script.sh

@p6rt
Copy link
Author

p6rt commented Oct 19, 2016

From dataf5l@gmail.com

Thank you for the prompt response.

I'll review the JVM script provided, it may run!

Since the feature isn't finished, is there a way to generate a MOAR file I
can provide my users which "just runs" but doesn't include the secret sauce?

or is this an unreasonable expectation?

On Wed, Oct 19, 2016 at 12​:00 PM, Pepe Schwarz via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Tue Oct 18 18​:07​:05 2016, dataf5l@​gmail.com wrote​:

perl6 --target=jvm --ll-exception --output=guess.jar guess.p6

java.lang.NullPointerException

in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1217)

in command_eval (src/Perl6/Compiler.nqp​:27)

in command_line (gen/jvm/stage2/NQPHLL.nqp​:1181)

in MAIN (gen/jvm/main.nqp​:47)

in <mainline> (gen/jvm/main.nqp​:38)

in (gen/jvm/main.nqp)

On Tue, Oct 18, 2016 at 4​:43 PM, Elizabeth Mattijsen via RT <
perl6-bugs-followup@​perl.org> wrote​:

What happens if you add --ll-exception to the command line?

On 18 Oct 2016, at 05​:42, Felipe Valdes (via RT) <
perl6-bugs-followup@​perl.org> wrote​:

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

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

The feature you're asking for does not exist at the moment.

You can get the precompiled compilation unit of a Perl 6 program as a .jar
with C<--target=jar>, but that doesn't help you, because it a compilation
unit that can be understood by a Rakudo executable, not a jar file that can
be understood by any JVM.

The file at [1] is a shell script that includes the step that will
eventually be integrated into the perl6 binary to generate a self-contained
jar file from Perl 6 code, albeit in the simplest way possible. That is,
bundle the whole interpreter and make that run a predefined compilation
unit. There is a corresponding Rakudo branch

Note though that the branch hasn't been updated in quite a while and might
not necessarily merge cleanly against current HEAD.

[1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/
one-jar-script.sh

@p6rt
Copy link
Author

p6rt commented Nov 8, 2016

From @zoffixznet

There are plans to make that a possibility eventually, but as far as I know that's not a priority of what the developers are focusing on at the moment.

On Wed, 19 Oct 2016 13​:55​:47 -0700, dataf5l@​gmail.com wrote​:

Thank you for the prompt response.

I'll review the JVM script provided, it may run!

Since the feature isn't finished, is there a way to generate a MOAR
file I
can provide my users which "just runs" but doesn't include the secret
sauce?

or is this an unreasonable expectation?

On Wed, Oct 19, 2016 at 12​:00 PM, Pepe Schwarz via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Tue Oct 18 18​:07​:05 2016, dataf5l@​gmail.com wrote​:

perl6 --target=jvm --ll-exception --output=guess.jar guess.p6

java.lang.NullPointerException

in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1217)

in command_eval (src/Perl6/Compiler.nqp​:27)

in command_line (gen/jvm/stage2/NQPHLL.nqp​:1181)

in MAIN (gen/jvm/main.nqp​:47)

in <mainline> (gen/jvm/main.nqp​:38)

in (gen/jvm/main.nqp)

On Tue, Oct 18, 2016 at 4​:43 PM, Elizabeth Mattijsen via RT <
perl6-bugs-followup@​perl.org> wrote​:

What happens if you add --ll-exception to the command line?

On 18 Oct 2016, at 05​:42, Felipe Valdes (via RT) <
perl6-bugs-followup@​perl.org> wrote​:

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

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

The feature you're asking for does not exist at the moment.

You can get the precompiled compilation unit of a Perl 6 program as a
.jar
with C<--target=jar>, but that doesn't help you, because it a
compilation
unit that can be understood by a Rakudo executable, not a jar file
that can
be understood by any JVM.

The file at [1] is a shell script that includes the step that will
eventually be integrated into the perl6 binary to generate a self-
contained
jar file from Perl 6 code, albeit in the simplest way possible. That
is,
bundle the whole interpreter and make that run a predefined
compilation
unit. There is a corresponding Rakudo branch

Note though that the branch hasn't been updated in quite a while and
might
not necessarily merge cleanly against current HEAD.

[1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/
one-jar-script.sh

@p6rt
Copy link
Author

p6rt commented Nov 8, 2016

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

@p6rt
Copy link
Author

p6rt commented Nov 8, 2016

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

@p6rt
Copy link
Author

p6rt commented Nov 9, 2016

From dataf5l@gmail.com

This breaks my heart, since I was planning on delivering a compiled binary
to my clients, I was planning on this since I saw the feature in the docs.

Is there a way to compile using MOARVM and build a "moarvm" file, similar
to a jar file, which can be run by the client without them having the
sources?

Is this planned for this year?
Should I use a compiled language instead?

On Tue, Nov 8, 2016 at 12​:35 PM, Zoffix Znet via RT <
perl6-bugs-followup@​perl.org> wrote​:

There are plans to make that a possibility eventually, but as far as I
know that's not a priority of what the developers are focusing on at the
moment.

On Wed, 19 Oct 2016 13​:55​:47 -0700, dataf5l@​gmail.com wrote​:

Thank you for the prompt response.

I'll review the JVM script provided, it may run!

Since the feature isn't finished, is there a way to generate a MOAR
file I
can provide my users which "just runs" but doesn't include the secret
sauce?

or is this an unreasonable expectation?

On Wed, Oct 19, 2016 at 12​:00 PM, Pepe Schwarz via RT <
perl6-bugs-followup@​perl.org> wrote​:

On Tue Oct 18 18​:07​:05 2016, dataf5l@​gmail.com wrote​:

perl6 --target=jvm --ll-exception --output=guess.jar guess.p6

java.lang.NullPointerException

in command_eval (gen/jvm/stage2/NQPHLL.nqp​:1217)

in command_eval (src/Perl6/Compiler.nqp​:27)

in command_line (gen/jvm/stage2/NQPHLL.nqp​:1181)

in MAIN (gen/jvm/main.nqp​:47)

in <mainline> (gen/jvm/main.nqp​:38)

in (gen/jvm/main.nqp)

On Tue, Oct 18, 2016 at 4​:43 PM, Elizabeth Mattijsen via RT <
perl6-bugs-followup@​perl.org> wrote​:

What happens if you add --ll-exception to the command line?

On 18 Oct 2016, at 05​:42, Felipe Valdes (via RT) <
perl6-bugs-followup@​perl.org> wrote​:

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

I want my clients to be able to run jar files
generated by the perl6 command​:

The program​:

my $num = (1..100).pick;

my $guess_count = 0;

loop {

my $guess = prompt("guess");

if $guess == $num {

say "Well done";

last;

}

if $guess > $num {

say "Lower";

}

if $guess < $num {

say "Higher";

}

if $guess_count == 7 {

say "you suck!";

last;

}

$guess_count++;

}

the compilation command​:

perl6 --target=jvm --output=guess.jar guess.p6

the result​:

===SORRY!===

java.lang.NullPointerException

The version​:

This is Rakudo version 2016.10-9-g906719c built on JVM

implementing Perl 6.c.

I think the error message is less than awesome.

Felipes-MacBook-Pro​:backend2 a$ perl6 --stagestats --target=jvm
--output=guess.jar guess.p6

Stage start : 0.000

Stage parse : 3.405

Stage syntaxcheck​: 0.001

Stage ast : 0.001

Stage optimize : 0.140

Stage jast : 0.395

Stage classfile : 0.081

Stage jar : 0.000

Stage jvm : 0.006

===SORRY!===

java.lang.NullPointerException

Felipes-MacBook-Pro​:backend2 a$

The feature you're asking for does not exist at the moment.

You can get the precompiled compilation unit of a Perl 6 program as a
.jar
with C<--target=jar>, but that doesn't help you, because it a
compilation
unit that can be understood by a Rakudo executable, not a jar file
that can
be understood by any JVM.

The file at [1] is a shell script that includes the step that will
eventually be integrated into the perl6 binary to generate a self-
contained
jar file from Perl 6 code, albeit in the simplest way possible. That
is,
bundle the whole interpreter and make that run a predefined
compilation
unit. There is a corresponding Rakudo branch

Note though that the branch hasn't been updated in quite a while and
might
not necessarily merge cleanly against current HEAD.

[1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/
one-jar-script.sh

@p6rt p6rt added the RFC Request For Comments label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comments
Projects
None yet
Development

No branches or pull requests

1 participant