Hi guys. I think I've figured out what's causing the segfaults in the UI on OS X x86-64. It looks like the %rbx register, which should be callee-preserved, is getting clobbered by the code Factor generates for -[FactorView drawRect:] (from ui.cocoa.views). As you can see in the following disassembly, it saves %rbx to the stack but never restores it before returning:
0x0000000109411040: pushq $0x50 0x0000000109411045: push %rbx 0x0000000109411046: sub $0x38,%rsp 0x000000010941104a: mov %rdi,(%rsp) 0x000000010941104e: mov %rsi,0x8(%rsp) 0x0000000109411053: mov 0x50(%rsp),%rbx 0x0000000109411058: mov %rbx,0x10(%rsp) 0x000000010941105d: mov 0x58(%rsp),%rbx 0x0000000109411062: mov %rbx,0x18(%rsp) 0x0000000109411067: mov 0x60(%rsp),%rbx 0x000000010941106c: mov %rbx,0x20(%rsp) 0x0000000109411071: mov 0x68(%rsp),%rbx 0x0000000109411076: mov %rbx,0x28(%rsp) 0x000000010941107b: mov $0x100018660,%rbx 0x0000000109411085: rex.W callq *%rbx 0x0000000109411088: mov (%rsp),%rdi 0x000000010941108c: mov $0x100006810,%rbx 0x0000000109411096: rex.W callq *%rbx 0x0000000109411099: mov 0x8(%rsp),%rdi 0x000000010941109e: mov $0x100006810,%rbx 0x00000001094110a8: rex.W callq *%rbx 0x00000001094110ab: mov $0x20,%rsi 0x00000001094110b5: lea 0x10(%rsp),%rdi 0x00000001094110ba: mov $0x100006010,%rbx 0x00000001094110c4: rex.W callq *%rbx 0x00000001094110c7: mov 0x6a(%rip),%rdi # 0x109411138 0x00000001094110ce: mov $0x100005fcc,%rbx 0x00000001094110d8: rex.W callq *%rbx 0x00000001094110db: mov $0x100018370,%rbx 0x00000001094110e5: rex.W callq *%rbx 0x00000001094110e8: add $0x48,%rsp 0x00000001094110ec: retq For reference, the full set of callee-preserved registers is %rbx, %rsp, %rbp, %r12, %r13, %r14, %r15. Let me know when you all start getting sick of x86-64 bug reports. -Joe ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
