
#8199: Get rid of HEAP_ALLOCED ----------------------------+---------------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature | Status: new request | Milestone: 7.10.1 Priority: normal | Version: 7.7 Component: | Keywords: Compiler | Architecture: Unknown/Multiple Resolution: | Difficulty: Project (more than a week) Operating System: | Blocked By: 5435 Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | ----------------------------+---------------------------------------------- Comment (by ezyang): Simon and I chatted about how to move this patchset forward last night on IRC, I'm recording the main points here for posterity: * Static closures originally did not work on Windows with shared libs. Since these are now all copied to dynamic heap, it should be possible to reinstate the Int/Char static closure optimization, among other things. * This is a good step towards supporting multiple RTSes. However, we would need to store the indirection table at an offset from BaseReg. It's not obvious to me how to go about doing that, since we still need some cooperation from the linker to manage all the offsets. I ran some quick tests on the impact of this patch on the startup time of GHC. It seems to add something like 0.02s to initialization time, which is quite reasonable. Simon's primary other concern is binary size. The primary things that are inflating binary size in this patch are as follows: * We are using movq (memory-to-register) instead of movl (constant-to- register). * If we were moving a static constructor into memory, we now need to do it in two instructions, since there are no memory-to-memory movs: {{{ - movq $s_closure+1,-24(%rbp) + movq s_static_closure_ind,%rax + movq %rax,-24(%rbp) }}} * The closures stored in the indirection tables are tagged, which means that if the code expects an untagged closure, we need an extra instruction to deal with it: {{{ - movl $Main_and2_closure,%ebx + movq Main_and2_static_closure_ind,%rbx + andq $-8,%rbx }}} * The indirections table takes up one word per static closure * The initialization code imposes a per-module cost I don't know which of these are the biggest offenders yet. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8199#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler