[GHC] #10383: AArch64: get GHC Calling convention working

GHC ghc-devs at haskell.org
Wed Jun 3 01:18:53 UTC 2015


#10383: AArch64: get GHC Calling convention working
----------------------------------------+----------------------------------
        Reporter:  erikd                |                   Owner:  erikd
            Type:  feature request      |                  Status:  new
        Priority:  normal               |               Milestone:  7.12.1
       Component:  Compiler             |                 Version:  7.11
      Resolution:                       |                Keywords:
Operating System:  Unknown/Multiple     |            Architecture:  aarch64
 Type of failure:  Building GHC failed  |               Test Case:
      Blocked By:                       |                Blocking:
 Related Tickets:                       |  Differential Revisions:
----------------------------------------+----------------------------------

Comment (by erikd):

 The `xchg` issue above was fixed in git commit
 f6ca6959e54ede0b28735ab7e011c16b3cb172db.

 Running `inplace/bin/ghc-stage2 +RTS -Da` under GDB now results in:

 {{{
 .....
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 stg_ap_0_ret... FUN/4(0x7fb46fcc28)
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 stg_ap_0_ret... FUN/4(0x7fb46fcc28)
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 stg_ap_0_ret... FUN/4(0x7fb46fcc28)
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 stg_ap_0_ret... FUN/4(0x7fb46fcc28)
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 stg_ap_0_ret... FUN/4(0x7fb46fcc28)
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 [New Thread 0x7fb39ff1f0 (LWP 25080)]
 stg_ap_v_ret... FUN/1(0x7fb47b8c78, 0x7fb3a041b9, 0x7fb3a05448,
 0x7fb3a084c8
 , 0x7fb3a084d8, 0x7fb3e96861, 0x7fb3a08558, (nil)d#, (nil)d#, 0x1fd#,
 0x4d#
 , 0x5d#, 0x6d#)
 stg_ap_0_ret... base:GHC.Event.Manager.Created()

 Program received signal SIGSEGV, Segmentation fault.
 0x0000007fb3dac244 in stg_ap_p_fast$def () from /home/erikd/ghc-
 upstream/rts/
 dist/build/libHSrts_thr_debug-ghc7.11.20150602.so
 (gdb) bt
 #0  0x0000007fb3dac244 in stg_ap_p_fast$def () from /home/erikd/ghc-
 upstream/
 rts/dist/build/libHSrts_thr_debug-ghc7.11.20150602.so
 Backtrace stopped: previous frame identical to this frame (corrupt stack?)
 }}}

 By hacking on `utils/genapply/GenApply.hs` I was able to add some more
 debug to the generated file `rts/dist/build/AutoApply.cmm` so that the
 generaed code for `stg_ap_pv_fast` looks like:

 {{{
 stg_ap_pv_fast
 {   W_ info;
     W_ arity;
     W_ xxxx;
     if (GETTAG(R1)==2) {
         Sp_adj(0);
         jump %GET_ENTRY(R1-2) [R1,R2];
     }
     #ifdef PROFILING
     if (Sp - WDS(3) < SpLim) {
         Sp_adj(-2);
         W_[Sp+WDS(1)] = R2;
         Sp(0) = stg_ap_pv_info;
         jump __stg_gc_enter_1 [R1];
     }
     #else
     if (Sp - WDS(2) < SpLim) {
         Sp_adj(-2);
         W_[Sp+WDS(1)] = R2;
         Sp(0) = stg_ap_pv_info;
         jump __stg_gc_enter_1 [R1];
     }
     #endif
     R1 = UNTAG(R1);
     info = %GET_STD_INFO(R1);
     IF_DEBUG(apply,foreign "C" debugBelch("genApplyFast before\n"););
     xxxx = TO_W_(%INFO_TYPE(info));
     IF_DEBUG(apply,foreign "C" debugBelch("genApplyFast after\n"););
     switch [INVALID_OBJECT .. N_CLOSURE_TYPES] (xxxx) {
 ....
 }}}

 With thjis debug the backtrace in GDB now looks like:

 {{{
 stg_ap_0_ret... FUN/4(0x7fb46fcc28)
 stg_ap_pppv_ret... FUN/4(0x7fb46fcc28)
 [New Thread 0x7fb39ff1f0 (LWP 25080)]
 stg_ap_v_ret... FUN/1(0x7fb47b8c78, 0x7fb3a041b9, 0x7fb3a05448,
 0x7fb3a084c8
 , 0x7fb3a084d8, 0x7fb3e96861, 0x7fb3a08558, (nil)d#, (nil)d#, 0x1fd#,
 0x4d#
 , 0x5d#, 0x6d#)
 stg_ap_0_ret... base:GHC.Event.Manager.Created()
 genApplyFast before
 genApplyFast after
 genApplyFast before

 Program received signal SIGSEGV, Segmentation fault.
 0x0000007fb3dac244 in stg_ap_p_fast$def () from /home/erikd/ghc-
 upstream/rts/
 dist/build/libHSrts_thr_debug-ghc7.11.20150602.so
 }}}

 suggesting it is segfaulting on the line:

 {{{
 xxxx = TO_W_(%INFO_TYPE(info));
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10383#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list