VM ͱʁ - CPU ໋ྩηοτʹैͬͯಈ࡞͠·͢ɻ͜ͷ໋ྩηοτۙͳͷͰݴ͑ Intel ARM ͳͲʹ͋ΓɼͦΕͧΕҟͳΓ·͢ɻ - ͜ͷ CPU ͷ໋ྩηοτΛஞ࣮࣍ߦͤ͞Δ͜ͱ͕ίϯϐϡʔλʔ͕ಈ͘ݪཧͷ ҰͭͰ͕͢ɼZend VM JVMɼRubyVM ʹ໋ྩηοτ͕͋Γɼ·ΔͰίϯ ϐϡʔλʔ͕ಈ͘ݪཧʹଇ࣮ͬͯߦ͞Ε͍ͯ·͢ɻ - ͦͷͨΊɼΤϛϡϨʔγϣϯͱ͍͏จ຺Ͱ VM Ͱ͋ΔͱղऍͰ͖ΔͷͰ͢ɻ
The header section (36 bytes) The payload section The instruction sequence offsets section (The information is each of instruction sequence offsets; N>0 * 4 bytes) The global object offsets section (The information is each of global object offsets; N>0 * 4 bytes) The extra data (if embedded extra data; N>=0 bytes) A part of instruction sequences A part of global objects The RUBY_PLATFORM name section (string) An information of string / class / fi xed number / bool types and data An information of instruction sequence section (In normally, 44 info * 4 bytes = 176 bytes notice: no considered hamming weight) ộ A code section (N>0 bytes) ộ A local table section (N>=0 bytes) A call info entry section (N>=0 bytes) ộ The structure of YARV The alignment section (Filled by 0xff to align every 2 bytes) ※ Ruby ຊମͷ C ࣮ΛಡΜͰࢲ͕ղऍͨ͠ͷΛςΩετɾਤʹදͨ͠ͷͰ͢ɻ
magic major version minor version size extra size global object list size iseq list offset global object list offset YARV ͷϔομʔ 4 byte 4 byte 4 byte 4 byte 4 byte 4 byte 4 byte 4 byte YARB (Yet Another Ruby Binary) ͱ͍͏
iseq list offset ʹΧʔιϧΛҠಈ iseq list size ϧʔϓΛճ͠ 4 όΠτ͝ͱͷ
ΦϑηοτใΛऔಘ͢Δ global object list offset ʹΧʔιϧΛҠಈ global object list size ϧʔϓΛճ͠ 4 όΠτ͝ͱ ͷΦϑηοτใΛऔಘ͢Δ Instruction Sequence ͷΦϑηοτใϦετΛऔಘ Global Object ͷΦϑηοτใϦετΛऔಘ