Implement asm comments

This commit is contained in:
Takashi Kokubun 2022-12-26 22:06:43 -08:00
parent 652d63789f
commit 4fe5efbf7f
5 changed files with 36 additions and 7 deletions

View file

@ -10,10 +10,13 @@ module RubyVM::MJIT
# REX = 0100WR0B
REX_W = 0b01001000
attr_reader :comments
def initialize
@bytes = []
@label_id = 0
@labels = {}
@label_id = 0
@comments = Hash.new { |h, k| h[k] = [] }
end
def compile(addr)
@ -173,6 +176,10 @@ module RubyVM::MJIT
end
end
def comment(message)
@comments[@bytes.size] << message
end
def new_label(name)
Label.new(id: @label_id += 1, name:)
end