Recommended
PDF
PPT
How to debug a perl script using gdb
PDF
PDF
Go言語で作る webアプリ@gocon 2013 spring
PDF
Everyday Life with clojure.spec
KEY
PDF
PPT
CPANの依存モジュールをもう少し正しく検出したい
PDF
ReVIEWとLibreOfficeとOMakeで本を書きましょう!
PDF
PDF
Apacheの展望とmod_perlの超絶技巧 #yapcasia
PDF
PDF
PDF
PDF
GNU awk (gawk) を用いた Apache ログ解析方法
KEY
PPTX
PDF
KEY
20120516 第7回ウフィカ社内ハンズオン Git基礎
PDF
debexpo(mentors.d.n)をハックするには
PDF
PDF
Go言語入門者が Webアプリケーション を作ってみた話 #devfest #gdgkyoto
PDF
Dockerのディスクについて ~ファイルシステム・マウント方法など~
PPT
PDF
mbedではじめる組み込みHaskellプログラミング
PDF
PDF
PPTX
オンプレ&HTTP Proxyな環境でRancherOS入れてみた話
PDF
Tread Gently – Go Green - Ideas and Activities For Youth Groups
PDF
More Related Content
PDF
PPT
How to debug a perl script using gdb
PDF
PDF
Go言語で作る webアプリ@gocon 2013 spring
PDF
Everyday Life with clojure.spec
KEY
PDF
PPT
CPANの依存モジュールをもう少し正しく検出したい
What's hot
PDF
ReVIEWとLibreOfficeとOMakeで本を書きましょう!
PDF
PDF
Apacheの展望とmod_perlの超絶技巧 #yapcasia
PDF
PDF
PDF
PDF
GNU awk (gawk) を用いた Apache ログ解析方法
KEY
PPTX
PDF
KEY
20120516 第7回ウフィカ社内ハンズオン Git基礎
PDF
debexpo(mentors.d.n)をハックするには
PDF
PDF
Go言語入門者が Webアプリケーション を作ってみた話 #devfest #gdgkyoto
PDF
Dockerのディスクについて ~ファイルシステム・マウント方法など~
PPT
PDF
mbedではじめる組み込みHaskellプログラミング
PDF
PDF
PPTX
オンプレ&HTTP Proxyな環境でRancherOS入れてみた話
Viewers also liked
PDF
Tread Gently – Go Green - Ideas and Activities For Youth Groups
PDF
PPT
SyMAP Master's Thesis Presentation
PDF
Samsung Camera i85 User Manual
PDF
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
PDF
Similar to ocamloptの全体像
PDF
PDF
PDF
clu2cは64ビットOSでも使えます (OSC 2012 Hiroshima LT用資料)
PPT
PDF
PDF
組込向けHaskellコンパイラAjhc / POSIX依存から脱出しよう編
PDF
Write good parser in perl
PDF
デブサミ2013【15-E-2】Ruby開発者のみなさん、mrubyで楽しく快適な組み込みアプリ開発を始めませんか?
PPTX
PPTX
PDF
PPTX
20130228 Goノススメ(BPStudy #66)
PDF
PDF
PPTX
ODP
PDF
Devsumi2013 Ruby開発者のみなさん、mrubyで楽しく快適な組み込みアプリ開発を始めませんか?
PPTX
PDF
PPTX
Boost jp9 program_options
Recently uploaded
PPTX
楽々ナレッジベース「楽ナレ」3種比較 - Dify / AWS S3 Vector / Google File Search Tool
PDF
エンジニアが選ぶべきAIエディタ & Antigravity 活用例@ウェビナー「触ってみてどうだった?Google Antigravity 既存IDEと...
PDF
Machine Tests Benchmark Suite. Explain github.com/alexziskind1/machine_tests #2
PDF
20251210_MultiDevinForEnterprise on Devin 1st Anniv Meetup
PDF
Machine Tests Benchmark Suite. Explain github.com/alexziskind1/machine_tests #1
PDF
流行りに乗っかるClaris FileMaker 〜AI関連機能の紹介〜 by 合同会社イボルブ
ocamloptの全体像 1. 2. 私は誰?私は誰?私は誰?私は誰?私は誰?
☆ Twitter: @master_q☆ Twitter: @master_q☆ Twitter: @master_q☆ Twitter: @master_q☆ Twitter: @master_q
☆ Metasepiプロジェクト主催☆ Metasepiプロジェクト主催☆ Metasepiプロジェクト主催☆ Metasepiプロジェクト主催☆ Metasepiプロジェクト主催
☆ Ajhc Haskellコンパイラ開発者☆ Ajhc Haskellコンパイラ開発者☆ Ajhc Haskellコンパイラ開発者☆ Ajhc Haskellコンパイラ開発者☆ Ajhc Haskellコンパイラ開発者
☆ Debian Maintainer☆ Debian Maintainer☆ Debian Maintainer☆ Debian Maintainer☆ Debian Maintainer
☆ 前はデジタルサイネージの開発してました☆ 前はデジタルサイネージの開発してました☆ 前はデジタルサイネージの開発してました☆ 前はデジタルサイネージの開発してました☆ 前はデジタルサイネージの開発してました
☆ その昔はNetBSDでコピー機作ってた☆ その昔はNetBSDでコピー機作ってた☆ その昔はNetBSDでコピー機作ってた☆ その昔はNetBSDでコピー機作ってた☆ その昔はNetBSDでコピー機作ってた
3. ぼくとOCamlぼくとOCamlぼくとOCamlぼくとOCamlぼくとOCaml
☆ 最初の会社で社内勉強会☆ 最初の会社で社内勉強会☆ 最初の会社で社内勉強会☆ 最初の会社で社内勉強会☆ 最初の会社で社内勉強会
☆ letの嵐にとまどう☆ letの嵐にとまどう☆ letの嵐にとまどう☆ letの嵐にとまどう☆ letの嵐にとまどう
☆ 数年後にPFDSを読む☆ 数年後にPFDSを読む☆ 数年後にPFDSを読む☆ 数年後にPFDSを読む☆ 数年後にPFDSを読む
☆ lazyきもちいい!☆ lazyきもちいい!☆ lazyきもちいい!☆ lazyきもちいい!☆ lazyきもちいい!
☆ camlp4に脳味噌を焼きはらわれる...☆ camlp4に脳味噌を焼きはらわれる...☆ camlp4に脳味噌を焼きはらわれる...☆ camlp4に脳味噌を焼きはらわれる...☆ camlp4に脳味噌を焼きはらわれる...
☆ camloebaさんに脅されてocamlopt読む☆ camloebaさんに脅されてocamlopt読む☆ camloebaさんに脅されてocamlopt読む☆ camloebaさんに脅されてocamlopt読む☆ camloebaさんに脅されてocamlopt読む
☆ OCamlコードわかりやすい! <= イマココ☆ OCamlコードわかりやすい! <= イマココ☆ OCamlコードわかりやすい! <= イマココ☆ OCamlコードわかりやすい! <= イマココ☆ OCamlコードわかりやすい! <= イマココ
4. 今日のもくじ今日のもくじ今日のもくじ今日のもくじ今日のもくじ
☆ [1] ocamloptについて簡単に☆ [1] ocamloptについて簡単に☆ [1] ocamloptについて簡単に☆ [1] ocamloptについて簡単に☆ [1] ocamloptについて簡単に
☆ [2] ソース探検のシナリオ☆ [2] ソース探検のシナリオ☆ [2] ソース探検のシナリオ☆ [2] ソース探検のシナリオ☆ [2] ソース探検のシナリオ
☆ [3] プログラムの起動☆ [3] プログラムの起動☆ [3] プログラムの起動☆ [3] プログラムの起動☆ [3] プログラムの起動
☆ [4] 文字列を画面に印字☆ [4] 文字列を画面に印字☆ [4] 文字列を画面に印字☆ [4] 文字列を画面に印字☆ [4] 文字列を画面に印字
☆ [5] シグナルの扱い☆ [5] シグナルの扱い☆ [5] シグナルの扱い☆ [5] シグナルの扱い☆ [5] シグナルの扱い
5. [1] ocamloptについて簡単に[1] ocamloptについて簡単に[1] ocamloptについて簡単に[1] ocamloptについて簡単に[1] ocamloptについて簡単に
まずはOCaml 4.00.1をインストールまずはOCaml 4.00.1をインストールまずはOCaml 4.00.1をインストールまずはOCaml 4.00.1をインストールまずはOCaml 4.00.1をインストール
$ git clone git@github.com:ocaml/ocaml.git
$ cd ocaml
$ git checkout 4.00.1
$ sudo apt-get build-dep ocaml
$ ./configure -with-debug-runtime
$ make world.opt
$ sudo make install
$ which ocamlopt
/usr/local/bin/ocamlopt
$ ocamlopt -version
4.00.1
$ git clone git@github.com:ocaml/ocaml.git
$ cd ocaml
$ git checkout 4.00.1
$ sudo apt-get build-dep ocaml
$ ./configure -with-debug-runtime
$ make world.opt
$ sudo make install
$ which ocamlopt
/usr/local/bin/ocamlopt
$ ocamlopt -version
4.00.1
$ git clone git@github.com:ocaml/ocaml.git
$ cd ocaml
$ git checkout 4.00.1
$ sudo apt-get build-dep ocaml
$ ./configure -with-debug-runtime
$ make world.opt
$ sudo make install
$ which ocamlopt
/usr/local/bin/ocamlopt
$ ocamlopt -version
4.00.1
$ git clone git@github.com:ocaml/ocaml.git
$ cd ocaml
$ git checkout 4.00.1
$ sudo apt-get build-dep ocaml
$ ./configure -with-debug-runtime
$ make world.opt
$ sudo make install
$ which ocamlopt
/usr/local/bin/ocamlopt
$ ocamlopt -version
4.00.1
$ git clone git@github.com:ocaml/ocaml.git
$ cd ocaml
$ git checkout 4.00.1
$ sudo apt-get build-dep ocaml
$ ./configure -with-debug-runtime
$ make world.opt
$ sudo make install
$ which ocamlopt
/usr/local/bin/ocamlopt
$ ocamlopt -version
4.00.1
想定環境想定環境想定環境想定環境想定環境
☆ Debian GNU/Linux sid amd64☆ Debian GNU/Linux sid amd64☆ Debian GNU/Linux sid amd64☆ Debian GNU/Linux sid amd64☆ Debian GNU/Linux sid amd64
6. ocamloptってなんどすか?ocamloptってなんどすか?ocamloptってなんどすか?ocamloptってなんどすか?ocamloptってなんどすか?
OCamlソースを実行バイナリにするコンパイラOCamlソースを実行バイナリにするコンパイラOCamlソースを実行バイナリにするコンパイラOCamlソースを実行バイナリにするコンパイラOCamlソースを実行バイナリにするコンパイラ
$ cat hello.ml
let hello _ = print_endline "Hello world!";;
let _ = hello ();
$ ocamlopt -g -runtime-variant d -o hello.bin hello.ml
$ file hello.bin
hello.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=402030a9bb82606a9d38f73e6ec25455f96d3caf, not
stripped
$ ./hello.bin
### OCaml runtime: debug mode ###
Initial minor heap size: 2048k bytes
Initial major heap size: 992k bytes
Initial space overhead: 80%
Initial max overhead: 500%
Initial heap increment: 992k bytes
Initial allocation policy: 0
Hello world!
$ cat hello.ml
let hello _ = print_endline "Hello world!";;
let _ = hello ();
$ ocamlopt -g -runtime-variant d -o hello.bin hello.ml
$ file hello.bin
hello.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=402030a9bb82606a9d38f73e6ec25455f96d3caf, not
stripped
$ ./hello.bin
### OCaml runtime: debug mode ###
Initial minor heap size: 2048k bytes
Initial major heap size: 992k bytes
Initial space overhead: 80%
Initial max overhead: 500%
Initial heap increment: 992k bytes
Initial allocation policy: 0
Hello world!
$ cat hello.ml
let hello _ = print_endline "Hello world!";;
let _ = hello ();
$ ocamlopt -g -runtime-variant d -o hello.bin hello.ml
$ file hello.bin
hello.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=402030a9bb82606a9d38f73e6ec25455f96d3caf, not
stripped
$ ./hello.bin
### OCaml runtime: debug mode ###
Initial minor heap size: 2048k bytes
Initial major heap size: 992k bytes
Initial space overhead: 80%
Initial max overhead: 500%
Initial heap increment: 992k bytes
Initial allocation policy: 0
Hello world!
$ cat hello.ml
let hello _ = print_endline "Hello world!";;
let _ = hello ();
$ ocamlopt -g -runtime-variant d -o hello.bin hello.ml
$ file hello.bin
hello.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=402030a9bb82606a9d38f73e6ec25455f96d3caf, not
stripped
$ ./hello.bin
### OCaml runtime: debug mode ###
Initial minor heap size: 2048k bytes
Initial major heap size: 992k bytes
Initial space overhead: 80%
Initial max overhead: 500%
Initial heap increment: 992k bytes
Initial allocation policy: 0
Hello world!
$ cat hello.ml
let hello _ = print_endline "Hello world!";;
let _ = hello ();
$ ocamlopt -g -runtime-variant d -o hello.bin hello.ml
$ file hello.bin
hello.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=402030a9bb82606a9d38f73e6ec25455f96d3caf, not
stripped
$ ./hello.bin
### OCaml runtime: debug mode ###
Initial minor heap size: 2048k bytes
Initial major heap size: 992k bytes
Initial space overhead: 80%
Initial max overhead: 500%
Initial heap increment: 992k bytes
Initial allocation policy: 0
Hello world!
7. 8. 9. 10. [3] プログラムの起動[3] プログラムの起動[3] プログラムの起動[3] プログラムの起動[3] プログラムの起動
☆ main関数から実行が開始されて☆ main関数から実行が開始されて☆ main関数から実行が開始されて☆ main関数から実行が開始されて☆ main関数から実行が開始されて
☆ camlHello__entry関数がプログラム入口☆ camlHello__entry関数がプログラム入口☆ camlHello__entry関数がプログラム入口☆ camlHello__entry関数がプログラム入口☆ camlHello__entry関数がプログラム入口
$ ocamlopt -o hello.bin hello.ml
$ gdb hello.bin
(gdb) b camlHello__entry
Breakpoint 1 at 0x402260
(gdb) run
...
Breakpoint 1, 0x0000000000402260 in camlHello__entry ()
(gdb) bt
#0 0x0000000000402260 in camlHello__entry ()
#1 0x0000000000401e89 in caml_program ()
#2 0x0000000000410d82 in caml_start_program ()
#3 0x0000000000411245 in caml_main ()
#4 0x000000000040414e in main ()
$ ocamlopt -o hello.bin hello.ml
$ gdb hello.bin
(gdb) b camlHello__entry
Breakpoint 1 at 0x402260
(gdb) run
...
Breakpoint 1, 0x0000000000402260 in camlHello__entry ()
(gdb) bt
#0 0x0000000000402260 in camlHello__entry ()
#1 0x0000000000401e89 in caml_program ()
#2 0x0000000000410d82 in caml_start_program ()
#3 0x0000000000411245 in caml_main ()
#4 0x000000000040414e in main ()
$ ocamlopt -o hello.bin hello.ml
$ gdb hello.bin
(gdb) b camlHello__entry
Breakpoint 1 at 0x402260
(gdb) run
...
Breakpoint 1, 0x0000000000402260 in camlHello__entry ()
(gdb) bt
#0 0x0000000000402260 in camlHello__entry ()
#1 0x0000000000401e89 in caml_program ()
#2 0x0000000000410d82 in caml_start_program ()
#3 0x0000000000411245 in caml_main ()
#4 0x000000000040414e in main ()
$ ocamlopt -o hello.bin hello.ml
$ gdb hello.bin
(gdb) b camlHello__entry
Breakpoint 1 at 0x402260
(gdb) run
...
Breakpoint 1, 0x0000000000402260 in camlHello__entry ()
(gdb) bt
#0 0x0000000000402260 in camlHello__entry ()
#1 0x0000000000401e89 in caml_program ()
#2 0x0000000000410d82 in caml_start_program ()
#3 0x0000000000411245 in caml_main ()
#4 0x000000000040414e in main ()
$ ocamlopt -o hello.bin hello.ml
$ gdb hello.bin
(gdb) b camlHello__entry
Breakpoint 1 at 0x402260
(gdb) run
...
Breakpoint 1, 0x0000000000402260 in camlHello__entry ()
(gdb) bt
#0 0x0000000000402260 in camlHello__entry ()
#1 0x0000000000401e89 in caml_program ()
#2 0x0000000000410d82 in caml_start_program ()
#3 0x0000000000411245 in caml_main ()
#4 0x000000000040414e in main ()
11. main関数はどこに?main関数はどこに?main関数はどこに?main関数はどこに?main関数はどこに?
☆ "byterun/main.c"です☆ "byterun/main.c"です☆ "byterun/main.c"です☆ "byterun/main.c"です☆ "byterun/main.c"です
☆ え?バイトコード?☆ え?バイトコード?☆ え?バイトコード?☆ え?バイトコード?☆ え?バイトコード?
☆ "{byte,asm}run"のディレクトリがある☆ "{byte,asm}run"のディレクトリがある☆ "{byte,asm}run"のディレクトリがある☆ "{byte,asm}run"のディレクトリがある☆ "{byte,asm}run"のディレクトリがある
☆ でもなんかきっちり分離されていない☆ でもなんかきっちり分離されていない☆ でもなんかきっちり分離されていない☆ でもなんかきっちり分離されていない☆ でもなんかきっちり分離されていない
☆ バイナリでも適宜byterunの下を使います☆ バイナリでも適宜byterunの下を使います☆ バイナリでも適宜byterunの下を使います☆ バイナリでも適宜byterunの下を使います☆ バイナリでも適宜byterunの下を使います
12. main関数ソースmain関数ソースmain関数ソースmain関数ソースmain関数ソース
デバッグ機能なしだとこんなんデバッグ機能なしだとこんなんデバッグ機能なしだとこんなんデバッグ機能なしだとこんなんデバッグ機能なしだとこんなん
/* File: byterun/main.c */
int main(int argc, char **argv)
{
caml_main(argv);
caml_sys_exit(Val_int(0));
return 0;
}
/* File: byterun/main.c */
int main(int argc, char **argv)
{
caml_main(argv);
caml_sys_exit(Val_int(0));
return 0;
}
/* File: byterun/main.c */
int main(int argc, char **argv)
{
caml_main(argv);
caml_sys_exit(Val_int(0));
return 0;
}
/* File: byterun/main.c */
int main(int argc, char **argv)
{
caml_main(argv);
caml_sys_exit(Val_int(0));
return 0;
}
/* File: byterun/main.c */
int main(int argc, char **argv)
{
caml_main(argv);
caml_sys_exit(Val_int(0));
return 0;
}
むちゃくちゃ簡単ですむちゃくちゃ簡単ですむちゃくちゃ簡単ですむちゃくちゃ簡単ですむちゃくちゃ簡単です
13. 14. caml_init_ieee_floats関数caml_init_ieee_floats関数caml_init_ieee_floats関数caml_init_ieee_floats関数caml_init_ieee_floats関数
/* File: byterun/floats.c */
/* The [caml_init_ieee_float] function should initialize
floating-point hardware so that it behaves as much as possible
like the IEEE standard.
In particular, return special numbers like Infinity and NaN
instead of signalling exceptions. Currently, everyone is in
IEEE mode at program startup, except FreeBSD prior to 4.0R. */
/* --snip-- */
void caml_init_ieee_floats(void)
{
#if defined(__FreeBSD__) && (__FreeBSD_version < 400017)
fpsetmask(0);
#endif
}
/* File: byterun/floats.c */
/* The [caml_init_ieee_float] function should initialize
floating-point hardware so that it behaves as much as possible
like the IEEE standard.
In particular, return special numbers like Infinity and NaN
instead of signalling exceptions. Currently, everyone is in
IEEE mode at program startup, except FreeBSD prior to 4.0R. */
/* --snip-- */
void caml_init_ieee_floats(void)
{
#if defined(__FreeBSD__) && (__FreeBSD_version < 400017)
fpsetmask(0);
#endif
}
/* File: byterun/floats.c */
/* The [caml_init_ieee_float] function should initialize
floating-point hardware so that it behaves as much as possible
like the IEEE standard.
In particular, return special numbers like Infinity and NaN
instead of signalling exceptions. Currently, everyone is in
IEEE mode at program startup, except FreeBSD prior to 4.0R. */
/* --snip-- */
void caml_init_ieee_floats(void)
{
#if defined(__FreeBSD__) && (__FreeBSD_version < 400017)
fpsetmask(0);
#endif
}
/* File: byterun/floats.c */
/* The [caml_init_ieee_float] function should initialize
floating-point hardware so that it behaves as much as possible
like the IEEE standard.
In particular, return special numbers like Infinity and NaN
instead of signalling exceptions. Currently, everyone is in
IEEE mode at program startup, except FreeBSD prior to 4.0R. */
/* --snip-- */
void caml_init_ieee_floats(void)
{
#if defined(__FreeBSD__) && (__FreeBSD_version < 400017)
fpsetmask(0);
#endif
}
/* File: byterun/floats.c */
/* The [caml_init_ieee_float] function should initialize
floating-point hardware so that it behaves as much as possible
like the IEEE standard.
In particular, return special numbers like Infinity and NaN
instead of signalling exceptions. Currently, everyone is in
IEEE mode at program startup, except FreeBSD prior to 4.0R. */
/* --snip-- */
void caml_init_ieee_floats(void)
{
#if defined(__FreeBSD__) && (__FreeBSD_version < 400017)
fpsetmask(0);
#endif
}
☆ FreeBSDへのバグ対策?☆ FreeBSDへのバグ対策?☆ FreeBSDへのバグ対策?☆ FreeBSDへのバグ対策?☆ FreeBSDへのバグ対策?
☆ 気にしないことにしましょう☆ 気にしないことにしましょう☆ 気にしないことにしましょう☆ 気にしないことにしましょう☆ 気にしないことにしましょう
15. caml_init_custom_operations #1caml_init_custom_operations #1caml_init_custom_operations #1caml_init_custom_operations #1caml_init_custom_operations #1
ボックス化されたintのプリミティブ関数を登録ボックス化されたintのプリミティブ関数を登録ボックス化されたintのプリミティブ関数を登録ボックス化されたintのプリミティブ関数を登録ボックス化されたintのプリミティブ関数を登録
/* File: byterun/custom.c */
void caml_init_custom_operations(void)
{
caml_register_custom_operations(&caml_int32_ops);
caml_register_custom_operations(&caml_nativeint_ops);
caml_register_custom_operations(&caml_int64_ops);
}
/* File: byterun/custom.c */
void caml_init_custom_operations(void)
{
caml_register_custom_operations(&caml_int32_ops);
caml_register_custom_operations(&caml_nativeint_ops);
caml_register_custom_operations(&caml_int64_ops);
}
/* File: byterun/custom.c */
void caml_init_custom_operations(void)
{
caml_register_custom_operations(&caml_int32_ops);
caml_register_custom_operations(&caml_nativeint_ops);
caml_register_custom_operations(&caml_int64_ops);
}
/* File: byterun/custom.c */
void caml_init_custom_operations(void)
{
caml_register_custom_operations(&caml_int32_ops);
caml_register_custom_operations(&caml_nativeint_ops);
caml_register_custom_operations(&caml_int64_ops);
}
/* File: byterun/custom.c */
void caml_init_custom_operations(void)
{
caml_register_custom_operations(&caml_int32_ops);
caml_register_custom_operations(&caml_nativeint_ops);
caml_register_custom_operations(&caml_int64_ops);
}
16. caml_init_custom_operations #2caml_init_custom_operations #2caml_init_custom_operations #2caml_init_custom_operations #2caml_init_custom_operations #2
でもたぶんこれバイトコードでだけ必要?でもたぶんこれバイトコードでだけ必要?でもたぶんこれバイトコードでだけ必要?でもたぶんこれバイトコードでだけ必要?でもたぶんこれバイトコードでだけ必要?
$ grep "caml_.*_ops" asmcomp/cmmgen.ml
Pnativeint -> "caml_nativeint_ops"
| Pint32 -> "caml_int32_ops"
| Pint64 -> "caml_int64_ops"
Csymbol_address("caml_int32_ops") :: Cint32 n :: Cint32 0n ::
cont
Csymbol_address("caml_int32_ops") :: Cint n :: cont
Csymbol_address("caml_nativeint_ops") :: Cint n :: cont
Csymbol_address("caml_int64_ops") :: Cint lo :: cont
Csymbol_address("caml_int64_ops") :: Cint hi :: Cint lo ::
cont
Csymbol_address("caml_int64_ops") :: Cint lo :: Cint hi ::
cont
$ grep "caml_.*_ops" asmcomp/cmmgen.ml
Pnativeint -> "caml_nativeint_ops"
| Pint32 -> "caml_int32_ops"
| Pint64 -> "caml_int64_ops"
Csymbol_address("caml_int32_ops") :: Cint32 n :: Cint32 0n ::
cont
Csymbol_address("caml_int32_ops") :: Cint n :: cont
Csymbol_address("caml_nativeint_ops") :: Cint n :: cont
Csymbol_address("caml_int64_ops") :: Cint lo :: cont
Csymbol_address("caml_int64_ops") :: Cint hi :: Cint lo ::
cont
Csymbol_address("caml_int64_ops") :: Cint lo :: Cint hi ::
cont
$ grep "caml_.*_ops" asmcomp/cmmgen.ml
Pnativeint -> "caml_nativeint_ops"
| Pint32 -> "caml_int32_ops"
| Pint64 -> "caml_int64_ops"
Csymbol_address("caml_int32_ops") :: Cint32 n :: Cint32 0n ::
cont
Csymbol_address("caml_int32_ops") :: Cint n :: cont
Csymbol_address("caml_nativeint_ops") :: Cint n :: cont
Csymbol_address("caml_int64_ops") :: Cint lo :: cont
Csymbol_address("caml_int64_ops") :: Cint hi :: Cint lo ::
cont
Csymbol_address("caml_int64_ops") :: Cint lo :: Cint hi ::
cont
$ grep "caml_.*_ops" asmcomp/cmmgen.ml
Pnativeint -> "caml_nativeint_ops"
| Pint32 -> "caml_int32_ops"
| Pint64 -> "caml_int64_ops"
Csymbol_address("caml_int32_ops") :: Cint32 n :: Cint32 0n ::
cont
Csymbol_address("caml_int32_ops") :: Cint n :: cont
Csymbol_address("caml_nativeint_ops") :: Cint n :: cont
Csymbol_address("caml_int64_ops") :: Cint lo :: cont
Csymbol_address("caml_int64_ops") :: Cint hi :: Cint lo ::
cont
Csymbol_address("caml_int64_ops") :: Cint lo :: Cint hi ::
cont
$ grep "caml_.*_ops" asmcomp/cmmgen.ml
Pnativeint -> "caml_nativeint_ops"
| Pint32 -> "caml_int32_ops"
| Pint64 -> "caml_int64_ops"
Csymbol_address("caml_int32_ops") :: Cint32 n :: Cint32 0n ::
cont
Csymbol_address("caml_int32_ops") :: Cint n :: cont
Csymbol_address("caml_nativeint_ops") :: Cint n :: cont
Csymbol_address("caml_int64_ops") :: Cint lo :: cont
Csymbol_address("caml_int64_ops") :: Cint hi :: Cint lo ::
cont
Csymbol_address("caml_int64_ops") :: Cint lo :: Cint hi ::
cont
ocamloptではシンボルから直接呼び出しにocamloptではシンボルから直接呼び出しにocamloptではシンボルから直接呼び出しにocamloptではシンボルから直接呼び出しにocamloptではシンボルから直接呼び出しに
17. parse_camlrunparam関数parse_camlrunparam関数parse_camlrunparam関数parse_camlrunparam関数parse_camlrunparam関数
OCAMLRUNPARAM環境変数を見るだけOCAMLRUNPARAM環境変数を見るだけOCAMLRUNPARAM環境変数を見るだけOCAMLRUNPARAM環境変数を見るだけOCAMLRUNPARAM環境変数を見るだけ
http://caml.inria.fr/pub/docs/manual-ocaml/manual024.htmlhttp://caml.inria.fr/pub/docs/manual-ocaml/manual024.htmlhttp://caml.inria.fr/pub/docs/manual-ocaml/manual024.htmlhttp://caml.inria.fr/pub/docs/manual-ocaml/manual024.htmlhttp://caml.inria.fr/pub/docs/manual-ocaml/manual024.html
/* File: asmrun/startup.c */
static void parse_camlrunparam(void)
{
char *opt = getenv ("OCAMLRUNPARAM");
uintnat p;
if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
if (opt != NULL){
while (*opt != '0'){
switch (*opt++){
case 's': scanmult (opt, &minor_heap_init); break;
case 'i': scanmult (opt, &heap_chunk_init); break;
case 'h': scanmult (opt, &heap_size_init); break;
case 'l': scanmult (opt, &max_stack_init); break;
case 'o': scanmult (opt, &percent_free_init); break;
case 'O': scanmult (opt, &max_percent_free_init); break;
case 'v': scanmult (opt, &caml_verb_gc); break;
/* File: asmrun/startup.c */
static void parse_camlrunparam(void)
{
char *opt = getenv ("OCAMLRUNPARAM");
uintnat p;
if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
if (opt != NULL){
while (*opt != '0'){
switch (*opt++){
case 's': scanmult (opt, &minor_heap_init); break;
case 'i': scanmult (opt, &heap_chunk_init); break;
case 'h': scanmult (opt, &heap_size_init); break;
case 'l': scanmult (opt, &max_stack_init); break;
case 'o': scanmult (opt, &percent_free_init); break;
case 'O': scanmult (opt, &max_percent_free_init); break;
case 'v': scanmult (opt, &caml_verb_gc); break;
/* File: asmrun/startup.c */
static void parse_camlrunparam(void)
{
char *opt = getenv ("OCAMLRUNPARAM");
uintnat p;
if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
if (opt != NULL){
while (*opt != '0'){
switch (*opt++){
case 's': scanmult (opt, &minor_heap_init); break;
case 'i': scanmult (opt, &heap_chunk_init); break;
case 'h': scanmult (opt, &heap_size_init); break;
case 'l': scanmult (opt, &max_stack_init); break;
case 'o': scanmult (opt, &percent_free_init); break;
case 'O': scanmult (opt, &max_percent_free_init); break;
case 'v': scanmult (opt, &caml_verb_gc); break;
/* File: asmrun/startup.c */
static void parse_camlrunparam(void)
{
char *opt = getenv ("OCAMLRUNPARAM");
uintnat p;
if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
if (opt != NULL){
while (*opt != '0'){
switch (*opt++){
case 's': scanmult (opt, &minor_heap_init); break;
case 'i': scanmult (opt, &heap_chunk_init); break;
case 'h': scanmult (opt, &heap_size_init); break;
case 'l': scanmult (opt, &max_stack_init); break;
case 'o': scanmult (opt, &percent_free_init); break;
case 'O': scanmult (opt, &max_percent_free_init); break;
case 'v': scanmult (opt, &caml_verb_gc); break;
/* File: asmrun/startup.c */
static void parse_camlrunparam(void)
{
char *opt = getenv ("OCAMLRUNPARAM");
uintnat p;
if (opt == NULL) opt = getenv ("CAMLRUNPARAM");
if (opt != NULL){
while (*opt != '0'){
switch (*opt++){
case 's': scanmult (opt, &minor_heap_init); break;
case 'i': scanmult (opt, &heap_chunk_init); break;
case 'h': scanmult (opt, &heap_size_init); break;
case 'l': scanmult (opt, &max_stack_init); break;
case 'o': scanmult (opt, &percent_free_init); break;
case 'O': scanmult (opt, &max_percent_free_init); break;
case 'v': scanmult (opt, &caml_verb_gc); break;
18. 19. init_atoms関数init_atoms関数init_atoms関数init_atoms関数init_atoms関数
☆ これよくわからなかったです orz☆ これよくわからなかったです orz☆ これよくわからなかったです orz☆ これよくわからなかったです orz☆ これよくわからなかったです orz
☆ caml_data_segmentsと☆ caml_data_segmentsと☆ caml_data_segmentsと☆ caml_data_segmentsと☆ caml_data_segmentsと
☆ caml_code_segmentsを解析している?☆ caml_code_segmentsを解析している?☆ caml_code_segmentsを解析している?☆ caml_code_segmentsを解析している?☆ caml_code_segmentsを解析している?
☆ 目的がよくわからない...☆ 目的がよくわからない...☆ 目的がよくわからない...☆ 目的がよくわからない...☆ 目的がよくわからない...
20. caml_init_signals関数caml_init_signals関数caml_init_signals関数caml_init_signals関数caml_init_signals関数
SEGVシグナルハンドラを通常コンテキストと
は別のスタックで実行するように設定
SEGVシグナルハンドラを通常コンテキストと
は別のスタックで実行するように設定
SEGVシグナルハンドラを通常コンテキストと
は別のスタックで実行するように設定
SEGVシグナルハンドラを通常コンテキストと
は別のスタックで実行するように設定
SEGVシグナルハンドラを通常コンテキストと
は別のスタックで実行するように設定
/* File: asmrun/signals_asm.c */
void caml_init_signals(void)
{
/* Stack overflow handling */
stack_t stk;
struct sigaction act;
stk.ss_sp = sig_alt_stack;
stk.ss_size = SIGSTKSZ;
stk.ss_flags = 0;
SET_SIGACT(act, segv_handler);
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
sigemptyset(&act.sa_mask);
system_stack_top = (char *) &act;
if (sigaltstack(&stk, NULL) == 0) {
sigaction(SIGSEGV, &act, NULL);
}
}
/* File: asmrun/signals_asm.c */
void caml_init_signals(void)
{
/* Stack overflow handling */
stack_t stk;
struct sigaction act;
stk.ss_sp = sig_alt_stack;
stk.ss_size = SIGSTKSZ;
stk.ss_flags = 0;
SET_SIGACT(act, segv_handler);
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
sigemptyset(&act.sa_mask);
system_stack_top = (char *) &act;
if (sigaltstack(&stk, NULL) == 0) {
sigaction(SIGSEGV, &act, NULL);
}
}
/* File: asmrun/signals_asm.c */
void caml_init_signals(void)
{
/* Stack overflow handling */
stack_t stk;
struct sigaction act;
stk.ss_sp = sig_alt_stack;
stk.ss_size = SIGSTKSZ;
stk.ss_flags = 0;
SET_SIGACT(act, segv_handler);
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
sigemptyset(&act.sa_mask);
system_stack_top = (char *) &act;
if (sigaltstack(&stk, NULL) == 0) {
sigaction(SIGSEGV, &act, NULL);
}
}
/* File: asmrun/signals_asm.c */
void caml_init_signals(void)
{
/* Stack overflow handling */
stack_t stk;
struct sigaction act;
stk.ss_sp = sig_alt_stack;
stk.ss_size = SIGSTKSZ;
stk.ss_flags = 0;
SET_SIGACT(act, segv_handler);
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
sigemptyset(&act.sa_mask);
system_stack_top = (char *) &act;
if (sigaltstack(&stk, NULL) == 0) {
sigaction(SIGSEGV, &act, NULL);
}
}
/* File: asmrun/signals_asm.c */
void caml_init_signals(void)
{
/* Stack overflow handling */
stack_t stk;
struct sigaction act;
stk.ss_sp = sig_alt_stack;
stk.ss_size = SIGSTKSZ;
stk.ss_flags = 0;
SET_SIGACT(act, segv_handler);
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
sigemptyset(&act.sa_mask);
system_stack_top = (char *) &act;
if (sigaltstack(&stk, NULL) == 0) {
sigaction(SIGSEGV, &act, NULL);
}
}
21. 22. 23. 24. つまり?つまり?つまり?つまり?つまり?
OCamlサイドOCamlサイドOCamlサイドOCamlサイドOCamlサイド
☆ r14レジスタ: try時スタック☆ r14レジスタ: try時スタック☆ r14レジスタ: try時スタック☆ r14レジスタ: try時スタック☆ r14レジスタ: try時スタック
☆ r15レジスタ: GCヒープへのポインタ☆ r15レジスタ: GCヒープへのポインタ☆ r15レジスタ: GCヒープへのポインタ☆ r15レジスタ: GCヒープへのポインタ☆ r15レジスタ: GCヒープへのポインタ
C言語サイドC言語サイドC言語サイドC言語サイドC言語サイド
☆ caml_exception_pointer: try時スタック☆ caml_exception_pointer: try時スタック☆ caml_exception_pointer: try時スタック☆ caml_exception_pointer: try時スタック☆ caml_exception_pointer: try時スタック
☆ caml_young_ptr: GCヒープへのポインタ☆ caml_young_ptr: GCヒープへのポインタ☆ caml_young_ptr: GCヒープへのポインタ☆ caml_young_ptr: GCヒープへのポインタ☆ caml_young_ptr: GCヒープへのポインタ
いつでも戻れますねいつでも戻れますねいつでも戻れますねいつでも戻れますねいつでも戻れますね
25. 26. caml_sys_init関数caml_sys_init関数caml_sys_init関数caml_sys_init関数caml_sys_init関数
プログラム名と引数の保管プログラム名と引数の保管プログラム名と引数の保管プログラム名と引数の保管プログラム名と引数の保管
/* File: byterun/sys.c */
void caml_sys_init(char * exe_name, char **argv)
{
caml_exe_name = exe_name;
caml_main_argv = argv;
}
/* File: byterun/sys.c */
void caml_sys_init(char * exe_name, char **argv)
{
caml_exe_name = exe_name;
caml_main_argv = argv;
}
/* File: byterun/sys.c */
void caml_sys_init(char * exe_name, char **argv)
{
caml_exe_name = exe_name;
caml_main_argv = argv;
}
/* File: byterun/sys.c */
void caml_sys_init(char * exe_name, char **argv)
{
caml_exe_name = exe_name;
caml_main_argv = argv;
}
/* File: byterun/sys.c */
void caml_sys_init(char * exe_name, char **argv)
{
caml_exe_name = exe_name;
caml_main_argv = argv;
}
まぁありがちまぁありがちまぁありがちまぁありがちまぁありがち
27. 28. caml_start_program関数caml_start_program関数caml_start_program関数caml_start_program関数caml_start_program関数
☆ calleeのレジスタ退避☆ calleeのレジスタ退避☆ calleeのレジスタ退避☆ calleeのレジスタ退避☆ calleeのレジスタ退避
☆ caml_gc_regsをpush☆ caml_gc_regsをpush☆ caml_gc_regsをpush☆ caml_gc_regsをpush☆ caml_gc_regsをpush
☆ caml_last_return_addressをpush☆ caml_last_return_addressをpush☆ caml_last_return_addressをpush☆ caml_last_return_addressをpush☆ caml_last_return_addressをpush
☆ caml_bottom_of_stackをpush☆ caml_bottom_of_stackをpush☆ caml_bottom_of_stackをpush☆ caml_bottom_of_stackをpush☆ caml_bottom_of_stackをpush
☆ caml_young_ptrを%r15に☆ caml_young_ptrを%r15に☆ caml_young_ptrを%r15に☆ caml_young_ptrを%r15に☆ caml_young_ptrを%r15に
☆ caml_exception_pointerを%r14に☆ caml_exception_pointerを%r14に☆ caml_exception_pointerを%r14に☆ caml_exception_pointerを%r14に☆ caml_exception_pointerを%r14に
☆ caml_program関数呼び出し☆ caml_program関数呼び出し☆ caml_program関数呼び出し☆ caml_program関数呼び出し☆ caml_program関数呼び出し
29. 30. 31. 32. 33. [4] 文字列を画面に印字[4] 文字列を画面に印字[4] 文字列を画面に印字[4] 文字列を画面に印字[4] 文字列を画面に印字
☆ print_endlineが開始☆ print_endlineが開始☆ print_endlineが開始☆ print_endlineが開始☆ print_endlineが開始
34. 35. [5] シグナルの扱い[5] シグナルの扱い[5] シグナルの扱い[5] シグナルの扱い[5] シグナルの扱い
blocking_sectionって何?blocking_sectionって何?blocking_sectionって何?blocking_sectionって何?blocking_sectionって何?
/* File: byterun/io.c */
CAMLexport struct channel * caml_open_descriptor_in(int fd)
{
struct channel * channel;
channel = (struct channel *)
caml_stat_alloc(sizeof(struct channel));
channel->fd = fd;
caml_enter_blocking_section();
channel->offset = lseek(fd, 0, SEEK_CUR);
caml_leave_blocking_section();
channel->curr = channel->max = channel->buff;
channel->end = channel->buff + IO_BUFFER_SIZE;
/* File: byterun/io.c */
CAMLexport struct channel * caml_open_descriptor_in(int fd)
{
struct channel * channel;
channel = (struct channel *)
caml_stat_alloc(sizeof(struct channel));
channel->fd = fd;
caml_enter_blocking_section();
channel->offset = lseek(fd, 0, SEEK_CUR);
caml_leave_blocking_section();
channel->curr = channel->max = channel->buff;
channel->end = channel->buff + IO_BUFFER_SIZE;
/* File: byterun/io.c */
CAMLexport struct channel * caml_open_descriptor_in(int fd)
{
struct channel * channel;
channel = (struct channel *)
caml_stat_alloc(sizeof(struct channel));
channel->fd = fd;
caml_enter_blocking_section();
channel->offset = lseek(fd, 0, SEEK_CUR);
caml_leave_blocking_section();
channel->curr = channel->max = channel->buff;
channel->end = channel->buff + IO_BUFFER_SIZE;
/* File: byterun/io.c */
CAMLexport struct channel * caml_open_descriptor_in(int fd)
{
struct channel * channel;
channel = (struct channel *)
caml_stat_alloc(sizeof(struct channel));
channel->fd = fd;
caml_enter_blocking_section();
channel->offset = lseek(fd, 0, SEEK_CUR);
caml_leave_blocking_section();
channel->curr = channel->max = channel->buff;
channel->end = channel->buff + IO_BUFFER_SIZE;
/* File: byterun/io.c */
CAMLexport struct channel * caml_open_descriptor_in(int fd)
{
struct channel * channel;
channel = (struct channel *)
caml_stat_alloc(sizeof(struct channel));
channel->fd = fd;
caml_enter_blocking_section();
channel->offset = lseek(fd, 0, SEEK_CUR);
caml_leave_blocking_section();
channel->curr = channel->max = channel->buff;
channel->end = channel->buff + IO_BUFFER_SIZE;
システムコールを囲むように配置されている...システムコールを囲むように配置されている...システムコールを囲むように配置されている...システムコールを囲むように配置されている...システムコールを囲むように配置されている...
36. 37. 38. 宣伝: Ajhc Haskellコンパイラ宣伝: Ajhc Haskellコンパイラ宣伝: Ajhc Haskellコンパイラ宣伝: Ajhc Haskellコンパイラ宣伝: Ajhc Haskellコンパイラ
☆ http://ajhc.metasepi.org/☆ http://ajhc.metasepi.org/☆ http://ajhc.metasepi.org/☆ http://ajhc.metasepi.org/☆ http://ajhc.metasepi.org/
☆ 組込を狙ったHaskellコンパイラ☆ 組込を狙ったHaskellコンパイラ☆ 組込を狙ったHaskellコンパイラ☆ 組込を狙ったHaskellコンパイラ☆ 組込を狙ったHaskellコンパイラ
☆ Haskell => C言語 への変換器☆ Haskell => C言語 への変換器☆ Haskell => C言語 への変換器☆ Haskell => C言語 への変換器☆ Haskell => C言語 への変換器
☆ jhc Haskellコンパイラのfork☆ jhc Haskellコンパイラのfork☆ jhc Haskellコンパイラのfork☆ jhc Haskellコンパイラのfork☆ jhc Haskellコンパイラのfork
☆ mbedプラットフォームなどで動作☆ mbedプラットフォームなどで動作☆ mbedプラットフォームなどで動作☆ mbedプラットフォームなどで動作☆ mbedプラットフォームなどで動作
☆ 要求RAMサイズ = 30kBぐらい☆ 要求RAMサイズ = 30kBぐらい☆ 要求RAMサイズ = 30kBぐらい☆ 要求RAMサイズ = 30kBぐらい☆ 要求RAMサイズ = 30kBぐらい
☆ もちろんPOSIXの上でも動きます☆ もちろんPOSIXの上でも動きます☆ もちろんPOSIXの上でも動きます☆ もちろんPOSIXの上でも動きます☆ もちろんPOSIXの上でも動きます
39. 宣伝: 「簡約!?λカ娘 Go!」はイカが?宣伝: 「簡約!?λカ娘 Go!」はイカが?宣伝: 「簡約!?λカ娘 Go!」はイカが?宣伝: 「簡約!?λカ娘 Go!」はイカが?宣伝: 「簡約!?λカ娘 Go!」はイカが?
http://www.paraiso-lang.org/ikmsm/http://www.paraiso-lang.org/ikmsm/http://www.paraiso-lang.org/ikmsm/http://www.paraiso-lang.org/ikmsm/http://www.paraiso-lang.org/ikmsm/
☆ Lensライブラリの解説☆ Lensライブラリの解説☆ Lensライブラリの解説☆ Lensライブラリの解説☆ Lensライブラリの解説
☆ パーサの解説☆ パーサの解説☆ パーサの解説☆ パーサの解説☆ パーサの解説
☆ 圏論とモナド☆ 圏論とモナド☆ 圏論とモナド☆ 圏論とモナド☆ 圏論とモナド
☆ 囲碁AI☆ 囲碁AI☆ 囲碁AI☆ 囲碁AI☆ 囲碁AI
☆ Ajhcコンパイラの開発秘話☆ Ajhcコンパイラの開発秘話☆ Ajhcコンパイラの開発秘話☆ Ajhcコンパイラの開発秘話☆ Ajhcコンパイラの開発秘話
などなどの話題を掲載!などなどの話題を掲載!などなどの話題を掲載!などなどの話題を掲載!などなどの話題を掲載!