move to parfait integers in risc layer
loading constants means loading parfait objects objects have to me collected in machine integer ok, string/true/false/nil next
This commit is contained in:
@ -55,6 +55,11 @@ module Risc
|
||||
@objects ||= Collector.collect_space
|
||||
end
|
||||
|
||||
# add a constant (which get created during compilatio and need to be linked)
|
||||
def add_constant(const)
|
||||
raise "Must be Parfait #{const}" unless const.is_a?(Parfait::Object)
|
||||
@constants << const
|
||||
end
|
||||
# To create binaries, objects (and labels) need to have a position
|
||||
# (so objects can be loaded and branches know where to jump)
|
||||
#
|
||||
|
@ -92,7 +92,7 @@ module Risc
|
||||
|
||||
# for computationally building code (ie writing assembler) these short cuts
|
||||
# help to instantiate risc instructions and add them immediately
|
||||
[:label, :reg_to_slot , :slot_to_reg , :load_constant, :load_data,
|
||||
[:label, :reg_to_slot , :slot_to_reg , :load_constant, :load_data,
|
||||
:function_return , :function_call,
|
||||
:transfer , :reg_to_slot , :byte_to_reg , :reg_to_byte].each do |method|
|
||||
define_method("add_#{method}".to_sym) do |*args|
|
||||
@ -132,5 +132,8 @@ module Risc
|
||||
@regs.clear
|
||||
end
|
||||
|
||||
def add_constant(const)
|
||||
Risc.machine.add_constant(const)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user