Use the term "compile" in different places

This commit is contained in:
Takashi Kokubun 2022-12-30 22:05:53 -08:00
parent c51baf9404
commit 7abff797b4
4 changed files with 16 additions and 8 deletions

View file

@ -10,8 +10,6 @@ module RubyVM::MJIT
# REX = 0100WR0B
REX_W = 0b01001000
attr_reader :comments
def initialize
@bytes = []
@labels = {}
@ -19,7 +17,7 @@ module RubyVM::MJIT
@comments = Hash.new { |h, k| h[k] = [] }
end
def compile(addr)
def assemble(addr)
link_labels
writer = ByteWriter.new(addr)
# If you pack bytes containing \x00, Ruby fails to recognize bytes after \x00.
@ -36,6 +34,10 @@ module RubyVM::MJIT
@bytes.size
end
#
# Instructions
#
def add(dst, src)
case [dst, src]
# ADD r/m64, imm8 (Mod 11)
@ -228,6 +230,12 @@ module RubyVM::MJIT
end
end
#
# Utilities
#
attr_reader :comments
def comment(message)
@comments[@bytes.size] << message
end