# HG changeset patch # User Takahiro SHIMIZU # Date 1525760770 -32400 # Node ID 7c19d3c0d027df915768d425ee3b42fb97833a7e # Parent deed6fa2e4893a8b93cbda50f10f14b9a0a48583 auto-Update generated slides by script diff -r deed6fa2e489 -r 7c19d3c0d027 lib/CLI.pm --- a/lib/CLI.pm Tue May 08 15:24:58 2018 +0900 +++ b/lib/CLI.pm Tue May 08 15:26:10 2018 +0900 @@ -84,7 +84,6 @@ $target =~ s/\.md$/\.html/; } else { my @targets = $self->_search_recently_day()->children(qr/(?cmd_open(path($target)); diff -r deed6fa2e489 -r 7c19d3c0d027 slides/2018/05/08/slide.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/slides/2018/05/08/slide.md Tue May 08 15:26:10 2018 +0900 @@ -0,0 +1,213 @@ +title: CbCによるMoarVMの改良 +author: Takahiro Shimizu +profile: +lang: Japanese + + +# 研究内容 +- Perl5の後継言語として開発されているPerl6はMoarVMと呼ばれるVMを搭載している. +- Perl6はMoarVM,JVM上で動くRakudoと呼ばれる実装と,コンパイラ開発者用のサブセットであるNQPが主な実装となっている. +- 現在Perl6及びMoarVMは全体的な速度がPerl5と比較し低下しており,実務として利用できるレベルに達していない. +- またPerl6の実装自体巨大なcase-switch文など見通しが悪くなっている. +- 本研究では継続を中心に開発されたContinuation based Cを用いてMoarVMの改良を検討する. + +# 今週の進捗 + +- dalmoreでCbCgccでMoarVM/NQPが動きました + +# MoarVMのclone + +- MoarVMをgithubからcloneする + +``` +$ git clone https://github.com/MoarVM/MoarVM.git +``` + +# MoarVMのmake + +- Perlの`Configure.pl`を叩いてMakefileを生成する + - 別のディレクトリからは叩け無い仕様に成っていた + +``` +./Configure.pl --cc /usr/local/x86-cbc/bin/gcc --debug --compiler gcc --prefix=/mnt/dalmore-home/one/src/build_perl6/MoarVM` +``` + +- オプション +- cc + - コンパイラのパスを設定する +- debug + - debugオプション +- compiler + - コンパイラの種類を指定する + - gcc, clang, clをサポートしている +- toolchain + - "posix", "gnu", "bsd" and "msvc"のツールチェインを選択可能 +- prefix + - make installの先を指定 + +# llvmでの実行 + +``` +(dalmore) ./Configure.pl --cc /usr/local/cbclang/bin/clang +``` + +- セグフォで死ぬ + +``` +0. Program arguments: /net/open/CentOS/local/cbclang/bin/clang-7.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-f +ile-name io.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse +-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -momit-leaf-frame-pointer -c +overage-notes-file /mnt/dalmore-home/one/src/MoarVM/src/platform/posix/io.gcno -resource-dir /net/open/CentOS/local/cbclang/lib/clang/7.0.0 - +D NDEBUG -D _REENTRANT -D _FILE_OFFSET_BITS=64 -D DEBUG_HELPERS -D MVM_TRACING=0 -D MVM_CGOTO=1 -D MVM_RDTSCP=1 -D MVM_BUILD_SHARED -I 3rdpar +ty/libuv/include -I 3rdparty/libuv/src -I 3rdparty/libatomicops/src -I 3rdparty/libtommath -I 3rdparty/dyncall/dynload -I 3rdparty/dyncall/dy +ncall -I 3rdparty/dyncall/dyncallback -I 3rdparty/sha1 -I 3rdparty/tinymt -I 3rdparty/dynasm -I 3rdparty/cmp -I 3rdparty -I src -internal-isy +stem /usr/local/include -internal-isystem /net/open/CentOS/local/cbclang/lib/clang/7.0.0/include -internal-externc-isystem /include -internal +-externc-isystem /usr/include -O3 -Werror=declaration-after-statement -Werror=pointer-arith -fdebug-compilation-dir /mnt/dalmore-home/one/src +/MoarVM -ferror-limit 19 -fmessage-length 136 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-sl +p -o src/platform/posix/io.o -x c src/platform/posix/io.c +1. parser at end of file +clang-7.0: error: unable to execute command: Segmentation fault +clang-7.0: error: clang frontend command failed due to signal (use -v to see invocation) +clang version 7.0.0 +Target: x86_64-unknown-linux-gnu +Thread model: posix +InstalledDir: /usr/local/cbclang/bin +clang-7.0: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, a +nd associated run script. +clang-7.0: note: diagnostic msg: +******************** + +PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: +Preprocessed source(s) and associated run script(s) are located at: +clang-7.0: note: diagnostic msg: /tmp/io-e696e2.c +clang-7.0: note: diagnostic msg: /tmp/io-e696e2.sh +clang-7.0: note: diagnostic msg: + +******************** +``` + +# make + +``` +$ make -j 50 && make install +``` + +- 何故かsrc側にもmoarのバイナリが生成された +- `/mnt/dalmore-home/one/src/build_perl6/MoarVM/bin`にMoarのバイナリが生成 + + +# NQPのmake + + +``` ++dalmore+one ./Configure.pl --prefix=/mnt/dalmore-home/one/src/build_perl6/nqp --backends=moar --with-moar=/mnt/dalmore-home/one/src/build_perl6/MoarVM/bin/moar +``` + +- オプション +- `prefix` + - ビルド先 +- `backends` + - NQPが走るVMを選択する +- `--with-moar` + - MoarVMを使う場合MoarVMのパス + +# バージョン + +``` +Creating tools/build/install-jvm-runner.pl ... + +===SORRY!=== +Found /mnt/dalmore-home/one/src/build_perl6/MoarVM/bin/moar version 2018.04-1-g577857a, which is too old. Wanted at least 2018.04-18-ge7d79d8 +69 + +No suitable MoarVM (moar executable) found using the --prefix +(You can get a MoarVM built automatically with --gen-moar.) +``` + +- MoarVMとバージョンが異なるらしくエラーが発生した + +``` +/mnt/dalmore-home/one/src/build_perl6/MoarVM/bin/moar --libpath=src/vm/moar/stage0 src/vm/moar/stage0/nqp.moarvm --bootstrap --module-path=ge +n/moar/stage1 --setting-path=gen/moar/stage1 \ + --setting=NQPCORE --no-regex-lib --target=mbc \ + --output=gen/moar/stage1/NQPP6QRegex.moarvm gen/moar/stage1/NQPP6QRegex.nqp +/usr/bin/perl -MExtUtils::Command -e mkpath gen/moar/stage1/gen +/usr/bin/perl tools/build/gen-version.pl /mnt/dalmore-home/one/src/build_perl6/nqp /mnt/dalmore-home/one/src/build_perl6/nqp/share/nqp/lib > +gen/moar/stage1/nqp-config.nqp +Can't locate Digest/SHA.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl +5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at tools/build/gen-version.pl line 9. +BEGIN failed--compilation aborted at tools/build/gen-version.pl line 9. +make: *** [gen/moar/stage1/nqp.moarvm] Error 2 +``` + +- バージョンを更新したところ`Digest::SHA`が入っていないエラーが発生した + +# Perlモジュールの追加 + +- 最近のPerlのモジュールinstallツールのcpanmをoneにいれました +- `yum install perl-devel`を実行してperlのコアモジュールを追加した +- `curl -L https://cpanmin.us | perl - --sudo App::cpanminus ` +- `cpanm --force Digest::SHA` + + +# MacOSX上でのgccのエラー + +``` +$./Configure.pl --prefix=/Users/anatofuz/workspace/cr/Basic/build_perl6 --cc /Users/anatofuz/workspace/cr/build_gcc/bin/gcc --compiler gcc +``` + +これを実行すると + +``` +compiling 3rdparty/libuv/src/unix/darwin-proctitle.o +compiling 3rdparty/libuv/src/unix/fsevents.o +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22, + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0, + from /System/Library/Frameworks/Security.framework/Headers/Security.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23, + from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22, + from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39, + from 3rdparty/libuv/src/unix/fsevents.c:49: +/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope + char bytes[kAuthorizationExternalFormLength]; + ^~~~~ +make: *** [3rdparty/libuv/src/unix/fsevents.o] Error 1 +make: *** Waiting for unfinished jobs.... +In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:18:0, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h:53:40: error: initializer element is not constant + static const CGFontIndex kCGGlyphMax = kCGFontIndexMax; + ^~~~~~~~~~~~~~~ +In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21:0, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9, + from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11, + from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35, + from 3rdparty/libuv/src/unix/darwin-proctitle.c:33: +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token + typedef void (^CGPathApplyBlock)(const CGPathElement * element); + ^ +/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock' + CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block) + ^~~~~~~~~~~~~~~~ +make: *** [3rdparty/libuv/src/unix/darwin-proctitle.o] Error 1 +``` + + +とフレームワークのコンパイルエラーが発生する. +これはbrew経由で入れたgcc-7でも発生した