Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RubyとJIT

na-o-ys
January 31, 2018

 RubyとJIT

na-o-ys

January 31, 2018
Tweet

More Decks by na-o-ys

Other Decks in Programming

Transcript

  1. Evan Phoenix ʮJITͨ͠Β?ʯ @RubyKaigi 2015 • Evan Phoenix • Rubinius

    ͷ࡞ऀ • Rubinius Ͱ͸ LLVM Λར༻ͨ͠ JIT Λ࣮૷ࡁ Έͩͬͨ
  2. ͍͔ͭ͘ͷ JIT ϓϩδΣΫτ • MJIT • Vladimir Makarovࢯ • YARVΛ୤٫͠,

    ϨδελϕʔεVMʹ • CίʔυΛಈతੜ੒͠, ࠷దԽ, ίϯύΠϧ • YARV-MJIT • k0kubunࢯ • YARV(ελοΫϕʔεVM)ͷ··, MJITͷJITػߏΛಋೖ
  3. MJIT (1/2) • https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch • YARV୤٫ • ελοΫϕʔεVMͷYARVΛࣺͯ, ϨδελϕʔεVMΛߏங •

    Method JIT • ϝιου୯ҐͰͷJITίϯύΠϧ • CίʔυΛಈతੜ੒͠, ࠷దԽ & ίϯύΠϧ͢Δ
  4. MJIT (2/2) • ͳͥϨδελϕʔεVM͔? • ୈҰʹ, ίʔυղੳͱ࠷దԽΛߦ͏ͨΊ • ελοΫϕʔε͸͜Εʹద͞ͳ͍ •

    ୈೋʹ, ॲཧͷߴ଎ԽͷͨΊ • ελοΫϕʔε͸ϝϞϦͷແବͳར༻͕ଟ͍ • ελοΫϕʔε͸໋ྩߦ਺͕ଟ͘ͳΔ
  5. MJITͷਐḿ • RubyKaigi 2017 (2017/10) • http://gihyo.jp/news/report/01/rubykaigi2017/0003? page=2 • TL;DR

    • Ruby 2 ͱൺ΂͔ͯͳΓͷߴ଎Խ (ᐆດ) Λୡ੒ • ʮ࣮૷ͱͯ͠੒ख़͢Δʹ͸͋ͱ1೥΄΅͔͔ΔͩΖ͏ʯ
  6. YARV-MJIT • MJITͷJITػߏͷҰ෦͚ͩΛಋೖ͢Δ • YARV͸࢖͍ଓ͚Δ • ͶΒ͍ • 1. ϨδελϕʔεͷϝϦοτΛ໌֬Խ

    • ελοΫϕʔεͩͱ࣮ࡍͲΕ͘Β͍஗͍ɾਏ͍ʁ • 2. MJIT΁ͷҠߦΛεϜʔζʹ͢Δ • JIT͕ೖΔλΠϛϯάͰ͍͖ͳΓYARV -> ϨδελϕʔεVMͷϦϓϨʔε ͕͓͖Δͷා͘ͳ͍ʁ
  7. ·ͱΊ • RubyʹJIT͕ೖΔʂ • ͍·ͷͱ͜Ζͷະདྷ༧૝ਤ • ·ͣ͸͡Ίʹ, YARVΛҡ࣋ͨ͠··ͰJIT͕ೖΔ • Ruby

    2.6 ʹͰ΋ʁ • ͍ͦͯۙ͠কདྷ, YARV͕Ϩδελϕʔεʹஔ͖׵͑ΒΕͨ ΑΓ଎͍JIT͕ೖΔ