[MacRuby] #1010: NSPoint/CGpoint =>NaN

MacRuby ruby-noreply at macosforge.org
Fri Nov 26 13:12:31 PST 2010


#1010: NSPoint/CGpoint =>NaN
--------------------------------------+-------------------------------------
 Reporter:  zalavariandris@…          |       Owner:  lsansonetti@…                        
     Type:  defect                    |      Status:  new                                  
 Priority:  trivial                   |   Milestone:                                       
Component:  MacRuby                   |    Keywords:  NSPoint, CGPoint, 32Bit, NaN, NSEVent
--------------------------------------+-------------------------------------

Comment(by lsansonetti@…):

 Looks like yet another 32-bit ABI issue.

 The IR code we emit:

 {{{
 %1 = type { float, float }
 define i32 @1(i8*, i32, i8*, i32, i32*) {
 EntryBlock:
   %5 = bitcast i8* %0 to %1 (i32, i8*)*           ; <%1 (i32, i8*)*>
 [#uses=1]
   %6 = tail call %1 %5(i32 %1, i8* %2)            ; <%1> [#uses=2]
   %7 = extractvalue %1 %6, 0                      ; <float> [#uses=1]
   %8 = tail call i32 @vm_float_to_rval(float %7)  ; <i32> [#uses=1]
   %9 = extractvalue %1 %6, 1                      ; <float> [#uses=1]
   %10 = tail call i32 @vm_float_to_rval(float %9) ; <i32> [#uses=1]
   %11 = tail call i32 (i32, i32, ...)* @rb_vm_new_struct(i32 36883328, i32
 2, i32 %8, i32 %10) ; <i32> [#uses=1]
   ret i32 %11
 }
 }}}

 IR code emitted by llvm-gcc for a similar expression:

 {{{
 %struct._NSPoint = type { float, float }

   %1 = alloca %struct._NSPoint                    ; <%struct._NSPoint*>
 [#uses=3]
   %6 = call i64 bitcast (%struct.objc_object* (%struct.objc_object*,
 %struct.objc_selector*, ...)* @objc_msgSend to i64 (%struct.objc_object*,
 %struct.objc_selector*)*)(%struct.objc_object* %5, %struct.objc_selector*
 %4) nounwind ; <i64> [#uses=1]
   %7 = bitcast %struct._NSPoint* %1 to i64*       ; <i64*> [#uses=1]
   store i64 %6, i64* %7, align 4
 }}}

 llvm-gcc seems to return the NSPoint struct into a 64-bit integer.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1010#comment:3>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list