Skip to content

Instantly share code, notes, and snippets.

@toolforger
Last active February 6, 2017 05:39
Show Gist options
  • Save toolforger/b87b3019babdcc073dd4ad4d176fc195 to your computer and use it in GitHub Desktop.
Save toolforger/b87b3019babdcc073dd4ad4d176fc195 to your computer and use it in GitHub Desktop.
Steps to reproduce MasterDuke's AIOOBE from scratch
# Setup installation directory
mkdir install
# Create an environment setup shell file for sourcing
# Make it so that it can be repeated with no ill effects
cat >setup-vars.inc.sh <<EOF
if [ ".\$perl6_prefix" = "." ]; then
export perl6_prefix=`pwd`/install
export PATH=\$perl6_prefix/bin:\$PATH
fi
EOF
# ... and source it for the rest of this script
source setup-vars.inc.sh
# Try to be somewhat offline-ready: Download first, then build.
# Download all relevant repositories
git clone --recurse-submodules https://github.com/MoarVM/MoarVM.git
git clone https://github.com/MasterDuke17/nqp
git clone https://github.com/rakudo/rakudo.git
# Alternate: Update existing repositories
# We rebase the line number branch to freshly checked-out master
# just 12 hours between nqp and rakudo were enough to make rakudo complain about outdated nqp...
cd MoarVM
git pull --recurse-submodules
cd ../nqp
git checkout master
git pull
git checkout source_file_line_numbers_on_jvm
git pull
cd ../rakudo
git pull
cd ..
# Build and install MoarVM
cd MoarVM
# The following still wants to be online for the submodules,
# even though we have a current copy.
# I'd like to avoid this but don't yet know how.
perl Configure.pl --prefix=$perl6_prefix --make-install
cd ..
# Build and install NQP
cd nqp
# get the branch that shows the problem
git checkout source_file_line_numbers_on_jvm
perl Configure.pl --backends=moar,jvm --prefix=$perl6_prefix --make-install
cd ..
# Build and install Rakudo
cd rakudo
perl Configure.pl --backends=moar,jvm --prefix=$perl6_prefix --make-install
# FAILS with a complaint that nqp-j is too old. Dangit.
# ===SORRY!===
# nqp-j is too old
# The nqp-m binary is too old
#
# To automatically clone (git) and build a copy of NQP 2017.01-64-gf21c8f1,
# try re-running Configure.pl with the '--gen-moar' option.
# Or, use '--prefix=' to explicitly specify the path where the NQP and MoarVM
# executables can be found that are use to build Rakudo.
cd ..
# "from scratch" is done, onwards to "reproduce"!
perl6-j --ll-exception -e 'say 1/0'
@MasterDuke17
Copy link

No, we're using 4.1 of asm.

Did you re-run rakudo's Configure.pl after checking out at the right version?

@toolforger
Copy link
Author

toolforger commented Feb 5, 2017

git clone https://github.com/rakudo/rakudo.git
cd rakudo
perl Configure.pl --backends=jvm,moar --gen-nqp --gen-moar
# Installs to rakudo/install, which is fine.
./perl6-j --ll-exception -e 'say 1/0'
# Fails with Attempt to divide 1 by zero using div, which is fine.
cat perl6-j

Mmmm... more fragilities.
It uses -noverify. I.e. if the generated bytecode is invalid, you will get crashes instead of a nice error message.
$CLASSPATH near the start of the -cp - mmm, did you install asm as a package, maybe? If your distro puts installed jars into CLASSPATH, this will override the asm lib used by rakudo.

Now that I have a working standard rakudo, what did you exactly do to get the exception?
Which jars did you unpack, did you vary the command line you used to run Perl6?

@toolforger
Copy link
Author

toolforger commented Feb 5, 2017

I didn't check out your nqp yet. First thing I wanted to try is whether I can reproduce the problem without line numbers, if only to see how things should look like normally.
One thing I noted is that leaving out -noverify does not cause any errors. So if you want to build confidence in your asm usage, remove that option and the JVM will tell you whether any class file is invalid right when it tries to load it.

@toolforger
Copy link
Author

Not sure whether I re-ran Configure.pl. I usually use Configure.pl, but sometimes (rarely) I just use make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment