[Git][ghc/ghc][wip/T25374] 2 commits: rts/Disassembler: Fix encoding of BRK_FUN instruction
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Wed Oct 16 01:42:11 UTC 2024
Ben Gamari pushed to branch wip/T25374 at Glasgow Haskell Compiler / GHC
Commits:
4e1d8e80 by Ben Gamari at 2024-10-15T20:17:36-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.
- - - - -
d7e80814 by Ben Gamari at 2024-10-15T21:25:43-04:00
testsuite: Add test for #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/-/compare/a69c8d6698549ec3007d934e7e4817c1983b00b8...d7e80814967923b97f4acc1322dce69c66e60a76
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a69c8d6698549ec3007d934e7e4817c1983b00b8...d7e80814967923b97f4acc1322dce69c66e60a76
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/20241015/2a4a64e0/attachment-0001.html>
More information about the ghc-commits
mailing list