Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iOS、AndroidアプリをRubyで
Search
Watson
March 05, 2016
1
440
iOS、AndroidアプリをRubyで
RubyMotionの内部について、Hirosima Ruby Conferenceで発表した資料です。
Watson
March 05, 2016
Tweet
Share
More Decks by Watson
See All by Watson
RMagick, migrate to ImageMagick 7 #RubyKaigi #RubyKaigi2019
watson
0
9.6k
ゲストさんのご紹介
watson
1
710
Magick
watson
0
11k
Improve JSON Performance
watson
2
930
fastlane 奮闘記
watson
0
68
How to optimize Ruby internal.
watson
3
2.9k
RubyMotion 2.0
watson
6
2.7k
Differences CRuby/MacRuby/RubyMotion
watson
5
5.6k
Featured
See All Featured
Producing Creativity
orderedlist
PRO
341
39k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Site-Speed That Sticks
csswizardry
2
190
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
94
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
How to Ace a Technical Interview
jacobian
276
23k
GraphQLとの向き合い方2022年版
quramy
44
13k
Transcript
iOSɺAndroidΞϓϦΛRubyͰ HipByte ౻ా ੩உ
ࣗݾհ • 2012͔ΒHipByteࣾͰRubyMotionͷ։ൃɾ αϙʔτ • ͨ·ʹɺRubyͷόάΛݟ͚ͭͨΓ
RubyBiz ಛผ
࣮
RubyMotion ͱʁ
ɺԯͷεϚʔτϑΥϯ͕ग़ՙ
RubyMotion ͱʁ http://www.rubymotion.com/download/ ແྉ
RubyMotion ͱʁ • ωΠςΟϒΞϓϦΛ Ruby Ͱ։ൃՄೳ • iOS, OS X,
tvOS, watchOS • Android • ίϯύΠϥɺϏϧυγεςϜɺϥϯλΠϜ͔Β ͳΔπʔϧνΣʔϯ
• ίϯύΠϥ • Rubyίʔυ͔ΒωΠςΟϒͳόΠφϦΛग़ྗ • ϏϧυγεςϜ • ίϯύΠϧ͞ΕͨόΠφϦɺϥϯλΠϜɺը૾ͳͲ ͷϦιʔεϑΝΠϧΛΞϓϦέʔγϣϯʹ·ͱΊΔ •
ϥϯλΠϜ • DispatcherɺϝϞϦཧɺΈࠐΈΫϥε
; Function Attrs: uwtable define internal i64 @"rb_scope__application:didFinishLaunchingWithOptions:__"(i64 %self, i8*
%sel, i64 %application, i64 %launchOptions) #11 { MainBlock: %argv1 = alloca i64, i32 2 call void @llvm.dbg.declare(metadata i64 %self, metadata !20, metadata !77), !dbg !81 %0 = alloca i64* %1 = alloca i64 store i64* %1, i64** %0 store i64 %application, i64* %1 %2 = alloca i8 store volatile i8 0, i8* %2 call void @llvm.dbg.declare(metadata i64 %application, metadata !21, metadata !77), ! dbg !81 %3 = alloca i64* %4 = alloca i64 store i64* %4, i64** %3 store i64 %launchOptions, i64* %4 %5 = alloca i8 store volatile i8 0, i8* %5 call void @llvm.dbg.declare(metadata i64 %launchOptions, metadata !22, metadata !77), ! dbg !81 LLVM-IR όΠφϦ ϥϯλΠϜ ը૾ ΞϓϦ ίϯύΠϥ ϏϧυγεςϜ
RubyMotion Runtime
"OESPJE4%, %BMWJL"35 3VCZ.PUJPO +/* +BWB J044%, 0CKFDUJWF$SVOUJNF 3VCZ.PUJPO 0CKFDUJWF$ iOS
Android
RubyMotion ϥϯλΠϜ %JTQBUDIFS ϝϞϦཧ ΈࠐΈΫϥε
Dispatcher
Dispatcher entry_point: ; preds = %MainBlock %6 = load i8**
@3 %7 = load i8** @4 %8 = load i32* @1 %9 = load i8** @5 %10 = load i32* @6 %11 = load i8** @2 %12 = call fastcc i32 @vm_get_const(i32 %8, i8* %9, i32 %10, i32 1, i8* %11), !dbg !97 %13 = call fastcc i32 @vm_dispatch(i32 %self, i32 %12, i8* %7, i8* null, i8 0, i32 0, i32* null), !dbg !97
Dispatcher • ίϯύΠϧ͞Εͨશͯͷϝιουݺͼग़͠ Dispatcher Λܦ༝ • Ruby શͯΦϒδΣΫτ • Objective-C
ΦϒδΣΫτҎ֎ʹ C ݴޠ༝དྷͷ int, double, char, long ,… ͳͲܕ͕͋Δ ϝιουݺͼग़͠ɺϦλʔϯ࣌ʹม
Dispatcher • มॲཧͷ༰ίϯύΠϧ࣌ʹຒΊࠐΉ
ϝϞϦཧ ɿ iOS • Objective-C • ίϯύΠϧ࣌ʹɺΦϒδΣΫτ͕ෆཁʹͳΔՕॴ ʹ release ॲཧ͕ຒΊࠐ·ΕΔ
• RubyMotion • ࣮ߦ࣌ʹɺෆཁͳΦϒδΣΫτΛ release ͍ͯ͠Δ
ϝϞϦཧ ɿ iOS • Objective-C • ίϯύΠϧ࣌ʹɺΦϒδΣΫτ͕ෆཁʹͳΔՕॴ ʹ release ͢Δॲཧ͕ຒΊࠐ·ΕΔ
• RubyMotion • ࣮ߦ࣌ʹɺෆཁͳΦϒδΣΫτΛ release ͍ͯ͠Δ ͍ͬͯΔ͜ͱಉ͡
ϝϞϦཧ ɿ Android • RubyMotion • ΦϒδΣΫτશͯ Java ΦϒδΣΫτ •
Java ͷ GC ͕దʹॲཧ͢Δ 3VCZ.PUJPOԿ͍ͯ͠ͳ͍
Ruby? • Ruby1.9 ϕʔε • No GVL
RubyMotion • Objective-C Java Ͱ։ൃ͢ΔͷͱḮ৭͕ͳ ͍ύϑΥʔϚϯεͷΞϓϦΛ։ൃՄೳ • ϓϥοτϑΥʔϜ API
Λࣗ༝ʹ༻Մೳ http://www.rubymotion.com/download/
• iOS ͱ Android ͰίʔυΛ͍ճͤΔʁ
Cross-platform libraries
motion-game • cocos2d-x Λར༻ͨ͠ɺΫϩεϓϥοτϑΥʔϜήʔϜ ΤϯδϯϥΠϒϥϦ
Flow • ΫϩεϓϥοτϑΥʔϜͳɺωοτϫʔΫͳͲར༻ස ͷߴ͍APIΛఏڙ
http://www.rubymotion.com/ download/