自分の仮想機械を作る

503 Views

May 14, 26

スライド概要

@Omotesando.rb #121
MEDLEY × mov RubyKaigi事後勉強会との共同開催

profile-image

Professional Ruby and Rails programmer in Tokyo.

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

(ダウンロード不可)

関連スライド

各ページのテキスト
1.

自分の仮想機械を作る @Omotesando.rb #121 MEDLEY × mov RubyKaigi事後勉強会との共同開催

2.

もとつねの日常 @daily_mototsune Ruby on Railsを中心に扱っているフリーランスエンジニア ドメインモデリングからAWSでの運用、スクラム運営やチームビルディ ングなどなど楽しくやらせてもらってます 普段はOmotesando.rbやGinza.rbによくいます 🍷♨✈🏎

3.

RubyKaigi楽しかったですね

4.

お気に入りのセッションは なんでしたか?

5.

私はVM話が好物でした

6.

and more!

7.

mruby in the 8-bit world: mruby VM for Zilog Z80 「Build your own VM」

8.

は?

9.

作るかー

10.

そもそもVMとは - Virtual Machine(仮想機械) ユーザーが書いたコードを元にバイトコードが生成され、VMがバイトコードを 読んで実行する Rubyでは1.9からYARVというスタックVMが採用されている それ以前はtree-walking interpreter

11.

バイトコードを見てみる

13.

2 1

14.

3 2 1

15.

2 1 .*( 3 )

16.

6 1

17.

6 1

18.

1 .+( 6 )

20.

なんかいけそうな気がしてきた

21.

RubyVM::INSTRUCTION_NAMES ["nop", "getlocal", "setlocal", "getblockparam", "setblockparam", "getblockparamproxy", "getspecial", "setspecial", "getinstancevariable", "setinstancevariable", "getclassvariable", "setclassvariable", "opt_getconstant_path", "getconstant", "setconstant", "getglobal", "setglobal", "putnil", "putself", "putobject", "putspecialobject", "putstring", "putchilledstring", "concatstrings", "anytostring", "toregexp", "intern", "newarray", "pushtoarraykwsplat", "duparray", "duphash", "expandarray", "concatarray", "concattoarray", "pushtoarray", "splatarray", "splatkw", "newhash", "newrange", "pop", "dup", "dupn", "swap", "opt_reverse", "topn", "setn", "adjuststack", "defined", "definedivar", "checkmatch", "checkkeyword", "checktype", "defineclass", "definemethod", "definesmethod", "send", "sendforward", "opt_send_without_block", "opt_new", "objtostring", "opt_ary_freeze", "opt_hash_freeze", "opt_str_freeze", "opt_nil_p", "opt_str_uminus", "opt_duparray_send", "opt_newarray_send", "invokesuper", "invokesuperforward", "invokeblock", "leave", "throw", "jump", "branchif", "branchunless", "branchnil", "once", "opt_case_dispatch", "opt_plus", "opt_minus", "opt_mult", "opt_div", "opt_mod", "opt_eq", "opt_neq", "opt_lt", "opt_le", "opt_gt", "opt_ge", "opt_ltlt", "opt_and", "opt_or", "opt_aref",

22.

なんかいけなさそうな 気がしてきた

23.

RubyVM::INSTRUCTION_NAMES ["nop", "getlocal", "setlocal", "getblockparam", "setblockparam", "getblockparamproxy", "getspecial", "setspecial", "getinstancevariable", "setinstancevariable", "getclassvariable", "setclassvariable", "opt_getconstant_path", "getconstant", "setconstant", "getglobal", "setglobal", "putnil", "putself", "putobject", "putspecialobject", "putstring", "putchilledstring", "concatstrings", "anytostring", "toregexp", "intern", "newarray", "pushtoarraykwsplat", "duparray", "duphash", "expandarray", "concatarray", "concattoarray", "pushtoarray", "splatarray", "splatkw", "newhash", "newrange", "pop", "dup", "dupn", "swap", "opt_reverse", "topn", "setn", "adjuststack", "defined", "definedivar", "checkmatch", "checkkeyword", "checktype", "defineclass", "definemethod", "definesmethod", "send", "sendforward", "opt_send_without_block", "opt_new", "objtostring", "opt_ary_freeze", "opt_hash_freeze", "opt_str_freeze", "opt_nil_p", "opt_str_uminus", "opt_duparray_send", "opt_newarray_send", "invokesuper", "invokesuperforward", "invokeblock", "leave", "throw", "jump", "branchif", "branchunless", "branchnil", "once", "opt_case_dispatch", "opt_plus", "opt_minus", "opt_mult", "opt_div", "opt_mod", "opt_eq", "opt_neq", "opt_lt", "opt_le", "opt_gt", "opt_ge", "opt_ltlt", "opt_and", "opt_or", "opt_aref",

24.

とりあえず小さな一歩を

28.

「Build your own VM」

29.

https://blog.youchan-apps.net/2026-04-17