fix releasing in allocator
fell into hash new trap, which reuses the object you give it. not good for mutable objects like the array. also previous logic was broken in terms of machine vs ssa names
This commit is contained in:
@ -37,6 +37,10 @@ module Risc
|
||||
assert_equal Symbol, @allocator.use_reg(:r1, :some).class
|
||||
assert @allocator.used_regs.include?(:r1)
|
||||
end
|
||||
def test_reverse_check
|
||||
assert_equal Symbol, @allocator.use_reg(:r1, :some).class
|
||||
assert_equal :r1 , @allocator.reverse_used(:some)
|
||||
end
|
||||
def test_add_fail
|
||||
assert_raises{ @allocator.use_reg(1)}
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ module Risc
|
||||
end
|
||||
def test_allocate_runs
|
||||
assert_nil @allocator.allocate_regs
|
||||
assert_equal 10 , @allocator.used_regs.length
|
||||
assert_equal 0 , @allocator.used_regs.length
|
||||
end
|
||||
def test_live_length
|
||||
live = @allocator.walk_and_mark(@compiler.risc_instructions)
|
||||
|
Reference in New Issue
Block a user