
#11486: info tables are no longer aligned -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Take a simple program like {{{ main = mapM_ print "Hello, world" }}} and build with `-O`. Versions of ghc as late as 7.11.20150806 generate assembly that includes {{{ ... _c3mn: movq $sat_s3m2_info,-16(%r12) movq %r14,(%r12) movq $block_c3mi_info,-16(%rbp) movl $GHC.Types.True_closure+2,%edi movq %rsi,%rax leaq -16(%r12),%rsi movl $GHC.IO.Handle.FD.stdout_closure,%r14d movq %rax,-8(%rbp) addq $-16,%rbp jmp GHC.IO.Handle.Text.hPutStr2_info .text .align 8 .quad 1 .quad 32 block_c3mi_info: _c3mi: movq 8(%rbp),%rbx addq $16,%rbp jmp stg_ap_v_fast ... }}} Note the `.align 8` ensuring that the info table (and the code `_c3mi` itself) is 8-byte aligned. In 8.1.20160107 we instead get {{{ _c5gE: movq $sat_s5g9_info,-16(%r12) movq %r14,(%r12) movq $block_c5gz_info,-16(%rbp) movl $GHC.Types.True_closure+2,%edi movq %rsi,%rax leaq -16(%r12),%rsi movl $GHC.IO.Handle.FD.stdout_closure,%r14d movq %rax,-8(%rbp) addq $-16,%rbp jmp GHC.IO.Handle.Text.hPutStr2_info _c5gF: movq $24,904(%r13) _c5gC: movl $Main.main2_closure,%ebx jmp *-8(%r13) .quad 1 .quad 32 block_c5gz_info: _c5gz: movq 8(%rbp),%rbx addq $16,%rbp jmp stg_ap_v_fast .size Main.main2_info, .-Main.main2_info }}} There is some minor rearrangement, but more importantly there is no longer any `.align 8` before `.quad 1`. That means the info table is not necessarily aligned, and indeed `c5gz_info` ended up at the address `40676f`. I'm guessing this is bad for performance, though I don't know how bad. I'm pretty sure this is due to 4a32bf925b8aba7885d9c745769fe84a10979a53 "Implement function-sections for Haskell code" though I haven't looked at that commit in detail. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11486 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler