[MacRuby-devel] Error with AOT compiler

Josh Ballanco joshua.ballanco at apple.com
Thu Jul 30 22:58:11 PDT 2009


I've stumbled across a bug with the AOT compiler. Compiling the  
following code causes an "Instruction does not dominate all uses!"  
error from LLVM:

--*begin code*--

def test_method(a_hash)
   a_hash.each{|k,v| puts "Key: #{k} and Value: #{v}"}
end

test_method({:hello => 'world'})

--*end code*--

I haven't had time to add this to test_vm, but I did narrow down the  
issue to this region of the generated llvm assembly:

--*begin code*--

rescue_save_vars:               ; preds = %MainBlock
         %7 = call i8* @llvm.eh.exception()              ; <i8*>  
[#uses=2]
         %8 = call i64 (i8*, i8*, ...)* @llvm.eh.selector.i64(i8* %7,  
i8* bitcast (i8* ()* @__gxx_personality_v0 to i8*), i8*  
null)              ; <i64> [#uses=0]
         %9 = call i8* @__cxa_begin_catch(i8* %7)                ;  
<i8*> [#uses=0]
         %10 = load i8** %1              ; <i8*> [#uses=2]
         %11 = icmp eq i8* %10, null             ; <i1> [#uses=1]
         br i1 %11, label %merge, label %not_null

normal:         ; preds = %MainBlock
         %12 = load i64* @6              ; <i64> [#uses=2]
         %13 = load i8** %1              ; <i8*> [#uses=1]
         call void (i8*, i32, ...)* @rb_vm_keep_vars(i8* %13, i32 1,  
i64 %12, i64* %0)
         ret i64 %6

not_null:               ; preds = %rescue_save_vars
         call void (i8*, i32, ...)* @rb_vm_keep_vars(i8* %10, i32 1,  
i64 %12, i64* %0)
         br label %merge

--*end code*--

Specifically, the issue is that "not_null" can be accessed directly  
from "rescue_save_vars" leaving %12 undefined. I've attached the  
related files.

Cheers,

Josh


-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.rb
Type: text/x-ruby-script
Size: 116 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090730/0d69d483/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ll
Type: application/octet-stream
Size: 6372 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090730/0d69d483/attachment.obj>


More information about the MacRuby-devel mailing list