comparison slides/2018/05/01/slide.md @ 36:74859abd87cc

update cli tool
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Mon, 07 May 2018 12:59:27 +0900
parents 0d0c8ed9adb4
children
comparison
equal deleted inserted replaced
35:0d0c8ed9adb4 36:74859abd87cc
1 title: 近況報告 1 title: CbCによるMoarVMの改良
2 author: Takahiro Shimizu 2 author: Takahiro Shimizu
3 profile: 3 profile:
4 lang: Japanese 4 lang: Japanese
5 5
6 6
7 # 研究内容 7 # 研究内容
8 * OS 8 - Perl5の後継言語として開発されているPerl6はMoarVMと呼ばれるVMを搭載している.
9 9 - Perl6はMoarVM,JVM上で動くRakudoと呼ばれる実装と,コンパイラ開発者用のサブセットであるNQPが主な実装となっている.
10 # hoge 10 - 現在Perl6及びMoarVMは全体的な速度がPerl5と比較し低下しており,実務として利用できるレベルに達していない.
11 * foo 11 - またPerl6の実装自体巨大なcase-switch文など見通しが悪くなっている.
12 * puyo 12 - 本研究では継続を中心に開発されたContinuation based Cを用いてMoarVMの改良を検討する.
13
14 # 今週の進捗
15
16 - dalmoreでCbCgccでMoarVM/NQPが動きました
17
18 # MoarVMのclone
19
20 - MoarVMをgithubからcloneする
21
22 ```
23 $ git clone https://github.com/MoarVM/MoarVM.git
24 ```
25
26 # MoarVMのmake
27
28 - Perlの`Configure.pl`を叩いてMakefileを生成する
29 - 別のディレクトリからは叩け無い仕様に成っていた
30
31 ```
32 ./Configure.pl --cc /usr/local/x86-cbc/bin/gcc --debug --compiler gcc --prefix=/mnt/dalmore-home/one/src/build_perl6/MoarVM`
33 ```
34
35 - オプション
36 - cc
37 - コンパイラのパスを設定する
38 - debug
39 - debugオプション
40 - compiler
41 - コンパイラの種類を指定する
42 - gcc, clang, clをサポートしている
43 - toolchain <toolchain>
44 - "posix", "gnu", "bsd" and "msvc"のツールチェインを選択可能
45 - prefix
46 - make installの先を指定
47
48 # llvmでの実行
49
50 ```
51 (dalmore) ./Configure.pl --cc /usr/local/cbclang/bin/clang
52 ```
53
54 - セグフォで死ぬ
55
56 ```
57 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
58 ile-name io.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse
59 -init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -momit-leaf-frame-pointer -c
60 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 -
61 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
62 ty/libuv/include -I 3rdparty/libuv/src -I 3rdparty/libatomicops/src -I 3rdparty/libtommath -I 3rdparty/dyncall/dynload -I 3rdparty/dyncall/dy
63 ncall -I 3rdparty/dyncall/dyncallback -I 3rdparty/sha1 -I 3rdparty/tinymt -I 3rdparty/dynasm -I 3rdparty/cmp -I 3rdparty -I src -internal-isy
64 stem /usr/local/include -internal-isystem /net/open/CentOS/local/cbclang/lib/clang/7.0.0/include -internal-externc-isystem /include -internal
65 -externc-isystem /usr/include -O3 -Werror=declaration-after-statement -Werror=pointer-arith -fdebug-compilation-dir /mnt/dalmore-home/one/src
66 /MoarVM -ferror-limit 19 -fmessage-length 136 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-sl
67 p -o src/platform/posix/io.o -x c src/platform/posix/io.c
68 1. <eof> parser at end of file
69 clang-7.0: error: unable to execute command: Segmentation fault
70 clang-7.0: error: clang frontend command failed due to signal (use -v to see invocation)
71 clang version 7.0.0
72 Target: x86_64-unknown-linux-gnu
73 Thread model: posix
74 InstalledDir: /usr/local/cbclang/bin
75 clang-7.0: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, a
76 nd associated run script.
77 clang-7.0: note: diagnostic msg:
78 ********************
79
80 PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
81 Preprocessed source(s) and associated run script(s) are located at:
82 clang-7.0: note: diagnostic msg: /tmp/io-e696e2.c
83 clang-7.0: note: diagnostic msg: /tmp/io-e696e2.sh
84 clang-7.0: note: diagnostic msg:
85
86 ********************
87 ```
88
89 # make
90
91 ```
92 $ make -j 50 && make install
93 ```
94
95 - 何故かsrc側にもmoarのバイナリが生成された
96 - `/mnt/dalmore-home/one/src/build_perl6/MoarVM/bin`にMoarのバイナリが生成
97
98
99 # NQPのmake
100
101
102 ```
103 +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
104 ```
105
106 - オプション
107 - `prefix`
108 - ビルド先
109 - `backends`
110 - NQPが走るVMを選択する
111 - `--with-moar`
112 - MoarVMを使う場合MoarVMのパス
113
114 # バージョン
115
116 ```
117 Creating tools/build/install-jvm-runner.pl ...
118
119 ===SORRY!===
120 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
121 69
122
123 No suitable MoarVM (moar executable) found using the --prefix
124 (You can get a MoarVM built automatically with --gen-moar.)
125 ```
126
127 - MoarVMとバージョンが異なるらしくエラーが発生した
128
129 ```
130 /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
131 n/moar/stage1 --setting-path=gen/moar/stage1 \
132 --setting=NQPCORE --no-regex-lib --target=mbc \
133 --output=gen/moar/stage1/NQPP6QRegex.moarvm gen/moar/stage1/NQPP6QRegex.nqp
134 /usr/bin/perl -MExtUtils::Command -e mkpath gen/moar/stage1/gen
135 /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 >
136 gen/moar/stage1/nqp-config.nqp
137 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
138 5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at tools/build/gen-version.pl line 9.
139 BEGIN failed--compilation aborted at tools/build/gen-version.pl line 9.
140 make: *** [gen/moar/stage1/nqp.moarvm] Error 2
141 ```
142
143 - バージョンを更新したところ`Digest::SHA`が入っていないエラーが発生した
144
145 # Perlモジュールの追加
146
147 - 最近のPerlのモジュールinstallツールのcpanmをoneにいれました
148 - `yum install perl-devel`を実行してperlのコアモジュールを追加した
149 - `curl -L https://cpanmin.us | perl - --sudo App::cpanminus `
150 - `cpanm --force Digest::SHA`
151
152
153 # MacOSX上でのgccのエラー
154
155 ```
156 $./Configure.pl --prefix=/Users/anatofuz/workspace/cr/Basic/build_perl6 --cc /Users/anatofuz/workspace/cr/build_gcc/bin/gcc --compiler gcc
157 ```
158
159 これを実行すると
160
161 ```
162 compiling 3rdparty/libuv/src/unix/darwin-proctitle.o
163 compiling 3rdparty/libuv/src/unix/fsevents.o
164 In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0,
165 from /System/Library/Frameworks/Security.framework/Headers/Security.h:43,
166 from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
167 from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27,
168 from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
169 from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22,
170 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39,
171 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23,
172 from 3rdparty/libuv/src/unix/darwin-proctitle.c:33:
173 /System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
174 char bytes[kAuthorizationExternalFormLength];
175 ^~~~~
176 In file included from /System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32:0,
177 from /System/Library/Frameworks/Security.framework/Headers/Security.h:43,
178 from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
179 from /System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:27,
180 from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
181 from /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:22,
182 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39,
183 from 3rdparty/libuv/src/unix/fsevents.c:49:
184 /System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
185 char bytes[kAuthorizationExternalFormLength];
186 ^~~~~
187 make: *** [3rdparty/libuv/src/unix/fsevents.o] Error 1
188 make: *** Waiting for unfinished jobs....
189 In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:18:0,
190 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
191 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
192 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
193 from 3rdparty/libuv/src/unix/darwin-proctitle.c:33:
194 /System/Library/Frameworks/CoreGraphics.framework/Headers/CGFont.h:53:40: error: initializer element is not constant
195 static const CGFontIndex kCGGlyphMax = kCGFontIndexMax;
196 ^~~~~~~~~~~~~~~
197 In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21:0,
198 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
199 from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
200 from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
201 from 3rdparty/libuv/src/unix/darwin-proctitle.c:33:
202 /System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token
203 typedef void (^CGPathApplyBlock)(const CGPathElement * element);
204 ^
205 /System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock'
206 CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block)
207 ^~~~~~~~~~~~~~~~
208 make: *** [3rdparty/libuv/src/unix/darwin-proctitle.o] Error 1
209 ```
210
211
212 とフレームワークのコンパイルエラーが発生する.
213 これはbrew経由で入れたgcc-7でも発生した