[Git][ghc/ghc][master] rts/Disassembler: Fix encoding of BRK_FUN instruction

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Oct 31 12:38:07 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
721ac00d by Ben Gamari at 2024-10-31T08:37:38-04:00
rts/Disassembler: Fix encoding of BRK_FUN instruction

The offset of the CC field was not updated after the encoding change in
b85b11994e0130ff2401dd4bbdf52330e0bcf776. Fix this.

Fixes #25374.

- - - - -


5 changed files:

- rts/Disassembler.c
- + testsuite/tests/codeGen/should_run/T25374/T25374.hs
- + testsuite/tests/codeGen/should_run/T25374/T25374.script
- + testsuite/tests/codeGen/should_run/T25374/T25374A.hs
- + testsuite/tests/codeGen/should_run/T25374/all.T


Changes:

=====================================
rts/Disassembler.c
=====================================
@@ -67,12 +67,12 @@ disInstr ( StgBCO *bco, int pc )
       case bci_BRK_FUN:
          debugBelch ("BRK_FUN  " );  printPtr( ptrs[instrs[pc]] );
          debugBelch (" %d ", instrs[pc+1]); printPtr( ptrs[instrs[pc+2]] );
-         CostCentre* cc = (CostCentre*)literals[instrs[pc+3]];
+         CostCentre* cc = (CostCentre*)literals[instrs[pc+5]];
          if (cc) {
            debugBelch(" %s", cc->label);
          }
          debugBelch("\n");
-         pc += 4;
+         pc += 6;
          break;
       case bci_SWIZZLE: {
          W_     stkoff = BCO_GET_LARGE_ARG;


=====================================
testsuite/tests/codeGen/should_run/T25374/T25374.hs
=====================================
@@ -0,0 +1,8 @@
+import T25374A
+
+fieldsSam :: NP xs -> NP xs -> Bool
+fieldsSam UNil UNil = True
+
+x :: Bool
+x = fieldsSam UNil UNil
+


=====================================
testsuite/tests/codeGen/should_run/T25374/T25374.script
=====================================
@@ -0,0 +1,2 @@
+:load T25374
+x


=====================================
testsuite/tests/codeGen/should_run/T25374/T25374A.hs
=====================================
@@ -0,0 +1,12 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE UnliftedDatatypes #-}
+
+module T25374A where
+
+import GHC.Exts
+
+type NP :: [UnliftedType] -> UnliftedType
+data NP xs where
+  UNil :: NP '[]
+  (::*) :: x -> NP xs -> NP (x ': xs)
+


=====================================
testsuite/tests/codeGen/should_run/T25374/all.T
=====================================
@@ -0,0 +1,3 @@
+# This shouldn't crash the disassembler
+test('T25374', [extra_hc_opts('+RTS -Di -RTS'), ignore_stderr, unless(debug_rts(), skip)], ghci_script, [''])
+



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/721ac00d63216e5e6512baba09b6ebb3cc456ebf

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/721ac00d63216e5e6512baba09b6ebb3cc456ebf
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241031/700a9b1e/attachment-0001.html>


More information about the ghc-commits mailing list