fix allocate in builder

which accessed unknown types.
also moved assert_allocate to support
This commit is contained in:
2020-03-09 19:22:02 +02:00
parent c9fedec230
commit 8abcaa330b
5 changed files with 48 additions and 40 deletions

View File

@ -144,13 +144,13 @@ module Risc
null = load_object Parfait.object_space.nil_object
int = nil
build do
int = factory[:next_object].to_reg
int = factory[:next_object].to_reg.known_type(:Integer)
null.op :- , int
if_not_zero cont_label
factory[:next_object] << factory[:reserve]
call_get_more
add_code cont_label
factory[:next_object] << factory[:next_object][:next_integer]
factory[:next_object] << int[:next_integer]
end
int
end

View File

@ -14,8 +14,8 @@ module SlotMachine
# the code is added to compiler
# the register returned
def to_register(compiler, source)
slots = @slots
left = Risc.message_named_reg
slots = @slots
while( slots )
left = left.resolve_and_add( slots.name , compiler)
slots = slots.next_slot
@ -30,7 +30,6 @@ module SlotMachine
# They are very similar (apart from the final reg_to_slot here) and should
# most likely be united
def reduce_and_load(const_reg , compiler , original_source )
raise "Not Message #{object}" unless known_object == :message
left = Risc.message_named_reg
slot = slots
while( slot.next_slot )