Rakudo: [JVM] build is broken (error in stage parse during generation of CORE.d.setting.jar)

Created on 19 Jan 2019  路  4Comments  路  Source: rakudo/rakudo

The Problem

Trying to build rakudo-jvm on current head (304feae9f0) leads to this error during generation of CORE.d.setting.jar:

NQP_LIB=blib java -Xss1m -Xms500m -Xmx3000m -cp .:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/runtime/asm-4.1.jar:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/runtime/asm-tree-4.1.jar:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/runtime/jline-1.0.jar:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/runtime/jna-4.0.0.jar:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/runtime/nqp-runtime.jar:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/lib/nqp.jar:rakudo-runtime.jar:perl6.jar:/usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d/install/share/nqp/lib perl6 --setting=NULL.d --ll-exception --optimize=3 --target=jar --stagestats --output=CORE.d.setting.jar --nqp-lib=blib gen/jvm/CORE.d.setting
Stage start      :   0.001
Stage parse      : Method 'CORE' not found for invocant of class 'QAST::SVal'
  in set (gen/jvm/stage2/QASTNode.nqp:142)
  in new (gen/jvm/stage2/QASTNode.nqp:447)
  in perl6_module_loader_code (src/Perl6/World.nqp:1412)
  in load_setting (src/Perl6/World.nqp:853)
  in loading_and_symbol_setup (src/Perl6/World.nqp:608)
  in comp_unit (gen/jvm/Perl6-Grammar.nqp:827)
  in TOP (gen/jvm/Perl6-Grammar.nqp:559)
  in parse (gen/jvm/stage2/QRegex.nqp:2303)
  in parse (gen/jvm/stage2/NQPHLL.nqp:1546)
  in execute_stage (gen/jvm/stage2/NQPHLL.nqp:1462)
  in run (gen/jvm/stage2/NQPHLL.nqp:1495)
  in <anon> (gen/jvm/stage2/NQPHLL.nqp:1498)
  in compile (gen/jvm/stage2/NQPHLL.nqp:1484)
  in eval (gen/jvm/stage2/NQPHLL.nqp:1178)
  in evalfiles (gen/jvm/stage2/NQPHLL.nqp:1439)
  in command_eval (gen/jvm/stage2/NQPHLL.nqp:1329)
  in command_eval (src/Perl6/Compiler.nqp:48)
  in command_line (gen/jvm/stage2/NQPHLL.nqp:1288)
  in MAIN (gen/jvm/main.nqp:54)
  in <mainline> (gen/jvm/main.nqp:42)
  in <anon> (gen/jvm/main.nqp)
*** Error code 1

Stop.
make: stopped in /usr/home/christian/perl6/tmp/rakudo_jvm_constant_6d

The build succeeds after reverting two commits: 5540212cfc8805f869ce566c94c406f5cb18224b and 7d3b7e1111c84f856a9d700d522a6af46ae48d4a

As far as I can see, the error happens if one declares a constant with a nqp::hash.

I tried different variations by adding a single line near the start of a random source code file (in my case src/core/Date.pm6).

my constant $foo = nqp::hash('bar', 42);   # dies with Method 'bar' not found for invocant of class 'QAST::SVal'

The same error occurs without the 'my':

constant $foo = nqp::hash('bar', 42);  # dies

None of the following lines lead to an error (I tested them one at a time):

BEGIN my $foo = nqp::hash('bar', 42);   ## works
my $foo = nqp::hash('bar', 42);   #works
my constant $foo = %('bar', 42);  #works
my constant $foo = 42;   #works

So to me it looks like constant $foo ... is evaluated somewhat earlier than BEGIN my $foo ... and at that earlier time nqp::hash() isn't parsed correctly.

Please not that CORE.setting.jar is build correctly in all cases -- the error only happens for CORE.setting.d.

Environment

  • Operating system: FreeBSD 11.2-RELEASE-p4
  • Java: openjdk version 1.8.0_181
JVM

Most helpful comment

Hopefully debe6b6ea4 will fix the build on JVM and JS

All 4 comments

Those commits cause problem with the js backed too (I have them locally
reverted till I got round to figuring out how to handle that). The problem
is that native nqp hashes are usually special cased during serialization
but if they are used as constants they are forcefully serialized as objects.

Hopefully debe6b6ea4 will fix the build on JVM and JS

Hopefully debe6b6 will fix the build on JVM and JS

It helps for the JVM backend. Thanks! And also thanks to @pmurias for explaining what goes wrong.

The problem with the JVM build has been fixed long ago. The info about the underlying problem is valuable, but I don't think we have to keep this issue open.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raiph picture raiph  路  3Comments

codesections picture codesections  路  3Comments

rbt picture rbt  路  3Comments

Altai-man picture Altai-man  路  5Comments

alabamenhu picture alabamenhu  路  5Comments