@article{oai:ipsj.ixsq.nii.ac.jp:00083510, author = {芝, 哲史 and 笹田, 耕一 and 平木, 敬 and Satoshi, Shiba and Koichi, Sasada and Kei, Hiraki}, issue = {3}, journal = {情報処理学会論文誌プログラミング(PRO)}, month = {Aug}, note = {近年,様々なスクリプト言語処理系に対してコンパイラが開発されている.これらのコンパイラは処理系に組み込む形で実装されることが多く,新しくコンパイラを開発するために,処理系そのものの再実装や,処理系の大幅な改変が行われている.このため,スクリプト言語処理系に対する新たなコンパイラの開発には多大な労力をともなう.そこで我々は,スクリプト言語RubyのCによって実装された処理系(CRuby)の機能を活用することで,処理系に対して新たに手を加えることなく動作するコンパイラCastOffを開発した.CastOffは,実行時コンパイル,コンパイル済みコードの再利用,プロファイル実行,アノテーションのサポート,脱最適化,再コンパイルなどの機能を持つ.これらの機能を,CastOffはCRubyのCによる拡張ライブラリ(C拡張)としてCRubyにいっさいの変更を加えずに実現している.本稿ではCastOffの設計と実装を述べ,CastOffの機能をRubyのC拡張でどう実現したかを詳細に解説する.そして,CastOffのようにライブラリとしてコンパイラを実装するために,どのような機能が必要かを議論する., There are many compilers for scripting languages aiming at faster execution. In most cases, these compilers have been developed by modifying runtime system or by re-implementing runtime system. Therefore a large amount of development cost is needed to develop compilers for scripting languages. On this background, we developed CastOff, a compiler for the Ruby scripting language. By using features in Ruby, we developed CastOff without modifying the Ruby runtime system. CastOff has a lot of functions such as runtime compilation, reuse of compiled codes, profiling execution, annotation support, deoptimization and re-compilation. CastOff is a Ruby compiler with the above features provided as a Ruby's C extension library. In this paper, we show the detailed design and implementation of CastOff, how we implemented functions of CastOff by Ruby's C extension library. Moreover, we discuss functions required in the runtime system for developing a compiler as a library like CastOff.}, pages = {1--22}, title = {CastOff:Ruby用コンパイラのライブラリとしての実装}, volume = {5}, year = {2012} }