Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
91b6be10
by Julian Ospald at 2025-10-20T18:21:03-04:00
-
6c5269da
by Sven Tennie at 2025-10-20T18:21:44-04:00
-
3d305889
by Sven Tennie at 2025-10-20T18:21:44-04:00
-
38d65187
by Matthew Pickering at 2025-10-21T13:12:20+01:00
-
17231bfb
by fendor at 2025-10-21T13:12:20+01:00
-
ad88789e
by Simon Peyton Jones at 2025-10-24T19:34:27-04:00
16 changed files:
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/Tc/Errors.hs
- hadrian/src/Rules/Gmp.hs
- hadrian/src/Rules/Libffi.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Common.hs
- hadrian/src/Settings/Builders/DeriveConstants.hs
- hadrian/src/Settings/Builders/Hsc2Hs.hs
- libraries/ghc-internal/cbits/Stack_c.c
- libraries/ghc-internal/ghc-internal.cabal.in
- + libraries/ghc-internal/src/GHC/Internal/Stack/ConstantsProf.hsc
- libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs
- + libraries/ghc-internal/tests/backtraces/T26507.hs
- + libraries/ghc-internal/tests/backtraces/T26507.stderr
- libraries/ghc-internal/tests/backtraces/all.T
- libraries/ghc-internal/tests/stack-annotation/all.T
Changes:
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | {-# LANGUAGE TupleSections #-}
|
| 3 | 3 | {-# LANGUAGE LambdaCase #-}
|
| 4 | 4 | {-# LANGUAGE BlockArguments #-}
|
| 5 | +{-# LANGUAGE MultiWayIf #-}
|
|
| 5 | 6 | |
| 6 | 7 | -----------------------------------------------------------------------------
|
| 7 | 8 | -- |
|
| ... | ... | @@ -666,12 +667,19 @@ renderLinkerStats s = |
| 666 | 667 | |
| 667 | 668 | |
| 668 | 669 | getPackageArchives :: StgToJSConfig -> UnitEnv -> [UnitId] -> IO [FilePath]
|
| 669 | -getPackageArchives cfg unit_env units =
|
|
| 670 | - filterM doesFileExist [ ST.unpack p </> "lib" ++ ST.unpack l ++ profSuff <.> "a"
|
|
| 671 | - | u <- units
|
|
| 672 | - , p <- getInstalledPackageLibDirs ue_state u
|
|
| 673 | - , l <- getInstalledPackageHsLibs ue_state u
|
|
| 674 | - ]
|
|
| 670 | +getPackageArchives cfg unit_env units = do
|
|
| 671 | + fmap concat $ forM units $ \u -> do
|
|
| 672 | + let archives = [ ST.unpack p </> "lib" ++ ST.unpack l ++ profSuff <.> "a"
|
|
| 673 | + | p <- getInstalledPackageLibDirs ue_state u
|
|
| 674 | + , l <- getInstalledPackageHsLibs ue_state u
|
|
| 675 | + ]
|
|
| 676 | + foundArchives <- filterM doesFileExist archives
|
|
| 677 | + if | not (null archives)
|
|
| 678 | + , null foundArchives
|
|
| 679 | + -> do
|
|
| 680 | + throwGhcExceptionIO (InstallationError $ "Could not find any library archives for unit-id: " <> (renderWithContext (csContext cfg) $ ppr u))
|
|
| 681 | + | otherwise
|
|
| 682 | + -> pure foundArchives
|
|
| 675 | 683 | where
|
| 676 | 684 | ue_state = ue_homeUnitState unit_env
|
| 677 | 685 |
| ... | ... | @@ -557,9 +557,9 @@ reportWanteds ctxt tc_lvl wc@(WC { wc_simple = simples, wc_impl = implics |
| 557 | 557 | -- if there's a *given* insoluble here (= inaccessible code)
|
| 558 | 558 | |
| 559 | 559 | -- If there are no other errors to report, report suppressed errors.
|
| 560 | - -- See Note [Suppressing confusing errors]. NB: with -fdefer-type-errors
|
|
| 561 | - -- we might have reported warnings only from `reportable_items`, but we
|
|
| 562 | - -- still want to suppress the `suppressed_items`.
|
|
| 560 | + -- See (SCE3) in Note [Suppressing confusing errors].
|
|
| 561 | + -- NB: with -fdefer-type-errors we might have reported warnings only from
|
|
| 562 | + -- reportable_items`, but we still want to suppress the `suppressed_items`.
|
|
| 563 | 563 | ; when (null reportable_items) $
|
| 564 | 564 | do { (_, more_leftovers) <- tryReporters ctxt_for_insols (report1++report2)
|
| 565 | 565 | suppressed_items
|
| ... | ... | @@ -762,7 +762,7 @@ isTyFun_maybe ty = case tcSplitTyConApp_maybe ty of |
| 762 | 762 | Certain errors we might encounter are potentially confusing to users.
|
| 763 | 763 | If there are any other errors to report, at all, we want to suppress these.
|
| 764 | 764 | |
| 765 | -Which errors are suppressed?
|
|
| 765 | +Which errors should be suppressed?
|
|
| 766 | 766 | |
| 767 | 767 | (SCE1) Superclasses of Wanteds. These are generated only in case they trigger functional
|
| 768 | 768 | dependencies. If such a constraint is unsolved, then its "parent" constraint must
|
| ... | ... | @@ -777,9 +777,6 @@ Which errors are suppressed? |
| 777 | 777 | We definitely want to report d1 and not d2! Happily it's easy to filter out those
|
| 778 | 778 | superclass-Wanteds, becuase their Origin betrays them.
|
| 779 | 779 | |
| 780 | - See test T18851 for an example of how it is (just, barely) possible for the /only/
|
|
| 781 | - errors to be superclass-of-Wanted constraints.
|
|
| 782 | - |
|
| 783 | 780 | (SCE2) Errors which arise from the interaction of two Wanted fun-dep constraints.
|
| 784 | 781 | Example:
|
| 785 | 782 | |
| ... | ... | @@ -810,9 +807,15 @@ Which errors are suppressed? |
| 810 | 807 | |
| 811 | 808 | Mechanism:
|
| 812 | 809 | |
| 813 | -We use the `suppress` function within reportWanteds to filter out these two
|
|
| 814 | -cases, then report all other errors. Lastly, we return to these suppressed
|
|
| 815 | -ones and report them only if there have been no errors so far.
|
|
| 810 | +We use the `suppress` function within reportWanteds to filter out these
|
|
| 811 | +"suppress" cases, then report all other errors. After doing so, we return to these
|
|
| 812 | +suppressed ones and report them only if there have been no errors so far.
|
|
| 813 | + |
|
| 814 | +(SCE3) How can it happen that there are /only/ suppressed errors? See test T18851
|
|
| 815 | + for an example of how it is (just, barely) possible for the /only/ errors to
|
|
| 816 | + be superclass-of-Wanted constraints.
|
|
| 817 | + |
|
| 818 | + |
|
| 816 | 819 | |
| 817 | 820 | Note [Constraints to ignore]
|
| 818 | 821 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -11,7 +11,7 @@ import Target |
| 11 | 11 | import Utilities
|
| 12 | 12 | import Hadrian.BuildPath
|
| 13 | 13 | import Hadrian.Expression
|
| 14 | -import Settings.Builders.Common (cArgs, getStagedCCFlags)
|
|
| 14 | +import Settings.Builders.Common (getStagedCCFlags)
|
|
| 15 | 15 | |
| 16 | 16 | -- | Build in-tree GMP library objects (if GmpInTree flag is set) and return
|
| 17 | 17 | -- their paths.
|
| ... | ... | @@ -125,8 +125,7 @@ gmpRules = do |
| 125 | 125 | cFlags <-
|
| 126 | 126 | interpretInContext ctx $
|
| 127 | 127 | mconcat
|
| 128 | - [ cArgs
|
|
| 129 | - , getStagedCCFlags
|
|
| 128 | + [ getStagedCCFlags
|
|
| 130 | 129 | -- gmp symbols are only used by bignum logic in
|
| 131 | 130 | -- ghc-internal and shouldn't be exported by the
|
| 132 | 131 | -- ghc-internal shared library.
|
| ... | ... | @@ -130,17 +130,14 @@ fixLibffiMakefile top = |
| 130 | 130 | configureEnvironment :: Stage -> Action [CmdOption]
|
| 131 | 131 | configureEnvironment stage = do
|
| 132 | 132 | context <- libffiContext stage
|
| 133 | - cFlags <- interpretInContext context $ mconcat
|
|
| 134 | - [ cArgs
|
|
| 135 | - , getStagedCCFlags ]
|
|
| 136 | - ldFlags <- interpretInContext context ldArgs
|
|
| 133 | + cFlags <- interpretInContext context getStagedCCFlags
|
|
| 137 | 134 | sequence [ builderEnvironment "CC" $ Cc CompileC stage
|
| 138 | 135 | , builderEnvironment "CXX" $ Cc CompileC stage
|
| 139 | - , builderEnvironment "AR" (Ar Unpack stage)
|
|
| 136 | + , builderEnvironment "AR" $ Ar Unpack stage
|
|
| 140 | 137 | , builderEnvironment "NM" Nm
|
| 141 | 138 | , builderEnvironment "RANLIB" Ranlib
|
| 142 | 139 | , return . AddEnv "CFLAGS" $ unwords cFlags ++ " -w"
|
| 143 | - , return . AddEnv "LDFLAGS" $ unwords ldFlags ++ " -w" ]
|
|
| 140 | + , return . AddEnv "LDFLAGS" $ "-w" ]
|
|
| 144 | 141 | |
| 145 | 142 | -- Need the libffi archive and `trackAllow` all files in the build directory.
|
| 146 | 143 | -- See [Libffi indicating inputs].
|
| ... | ... | @@ -188,18 +188,16 @@ configureArgs cFlags' ldFlags' = do |
| 188 | 188 | values <- unwords <$> expr
|
| 189 | 189 | not (null values) ?
|
| 190 | 190 | arg ("--configure-option=" ++ key ++ "=" ++ values)
|
| 191 | - cFlags = mconcat [ remove ["-Werror"] cArgs
|
|
| 192 | - , getStagedCCFlags
|
|
| 191 | + cFlags = mconcat [ getStagedCCFlags
|
|
| 193 | 192 | -- See https://github.com/snowleopard/hadrian/issues/523
|
| 194 | 193 | , arg $ "-iquote"
|
| 195 | 194 | |
| 196 | 195 | , arg $ top -/- pkgPath pkg
|
| 197 | 196 | , cFlags'
|
| 198 | 197 | ]
|
| 199 | - ldFlags = ldArgs <> ldFlags'
|
|
| 200 | 198 | mconcat
|
| 201 | 199 | [ conf "CFLAGS" cFlags
|
| 202 | - , conf "LDFLAGS" ldFlags
|
|
| 200 | + , conf "LDFLAGS" ldFlags'
|
|
| 203 | 201 | , conf "--with-iconv-includes" $ arg =<< getSetting IconvIncludeDir
|
| 204 | 202 | , conf "--with-iconv-libraries" $ arg =<< getSetting IconvLibDir
|
| 205 | 203 | , conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir
|
| ... | ... | @@ -5,7 +5,7 @@ module Settings.Builders.Common ( |
| 5 | 5 | module Oracles.Setting,
|
| 6 | 6 | module Settings,
|
| 7 | 7 | module UserSettings,
|
| 8 | - cIncludeArgs, ldArgs, cArgs, cppArgs, cWarnings,
|
|
| 8 | + cIncludeArgs, cWarnings,
|
|
| 9 | 9 | packageDatabaseArgs, bootPackageDatabaseArgs,
|
| 10 | 10 | getStagedCCFlags, wayCcArgs
|
| 11 | 11 | ) where
|
| ... | ... | @@ -38,15 +38,6 @@ cIncludeArgs = do |
| 38 | 38 | , pure [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
|
| 39 | 39 | , pure [ "-I" ++ unifyPath dir | dir <- depDirs ] ]
|
| 40 | 40 | |
| 41 | -ldArgs :: Args
|
|
| 42 | -ldArgs = mempty
|
|
| 43 | - |
|
| 44 | -cArgs :: Args
|
|
| 45 | -cArgs = mempty
|
|
| 46 | - |
|
| 47 | -cppArgs :: Args
|
|
| 48 | -cppArgs = mempty
|
|
| 49 | - |
|
| 50 | 41 | -- TODO: should be in a different file
|
| 51 | 42 | cWarnings :: Args
|
| 52 | 43 | cWarnings = mconcat
|
| ... | ... | @@ -40,8 +40,7 @@ includeCcArgs :: Args |
| 40 | 40 | includeCcArgs = do
|
| 41 | 41 | stage <- getStage
|
| 42 | 42 | rtsPath <- expr $ rtsBuildPath stage
|
| 43 | - mconcat [ cArgs
|
|
| 44 | - , cWarnings
|
|
| 43 | + mconcat [ cWarnings
|
|
| 45 | 44 | , prgFlags . ccProgram . tgtCCompiler <$> expr (targetStage Stage1)
|
| 46 | 45 | , queryTargetTarget tgtUnregisterised ? arg "-DUSE_MINIINTERPRETER"
|
| 47 | 46 | , arg "-Irts"
|
| ... | ... | @@ -50,7 +50,7 @@ getCFlags = do |
| 50 | 50 | autogen <- expr $ autogenPath context
|
| 51 | 51 | let cabalMacros = autogen -/- "cabal_macros.h"
|
| 52 | 52 | expr $ need [cabalMacros]
|
| 53 | - mconcat [ remove ["-O"] (cArgs <> getStagedCCFlags)
|
|
| 53 | + mconcat [ remove ["-O"] getStagedCCFlags
|
|
| 54 | 54 | -- Either "-E" is not part of the configured cpp args, or we can't add those args to invocations of things like this
|
| 55 | 55 | -- ROMES:TODO: , prgFlags . cppProgram . tgtCPreprocessor <$> getStagedTargetConfig
|
| 56 | 56 | , cIncludeArgs
|
| ... | ... | @@ -64,6 +64,5 @@ getCFlags = do |
| 64 | 64 | getLFlags :: Expr [String]
|
| 65 | 65 | getLFlags =
|
| 66 | 66 | mconcat [ prgFlags . ccLinkProgram . tgtCCompilerLink <$> getStagedTarget
|
| 67 | - , ldArgs
|
|
| 68 | 67 | , getContextData ldOpts
|
| 69 | 68 | , getContextData depLdOpts ] |
| ... | ... | @@ -9,13 +9,13 @@ |
| 9 | 9 | #include "rts/storage/InfoTables.h"
|
| 10 | 10 | |
| 11 | 11 | StgWord stackFrameSize(StgStack *stack, StgWord offset) {
|
| 12 | - StgClosure *c = (StgClosure *)stack->sp + offset;
|
|
| 12 | + StgClosure *c = (StgClosure *)(stack->sp + offset);
|
|
| 13 | 13 | ASSERT(LOOKS_LIKE_CLOSURE_PTR(c));
|
| 14 | 14 | return stack_frame_sizeW(c);
|
| 15 | 15 | }
|
| 16 | 16 | |
| 17 | 17 | StgStack *getUnderflowFrameStack(StgStack *stack, StgWord offset) {
|
| 18 | - StgClosure *frame = (StgClosure *)stack->sp + offset;
|
|
| 18 | + StgClosure *frame = (StgClosure *)(stack->sp + offset);
|
|
| 19 | 19 | ASSERT(LOOKS_LIKE_CLOSURE_PTR(frame));
|
| 20 | 20 | const StgRetInfoTable *info = get_ret_itbl((StgClosure *)frame);
|
| 21 | 21 |
| ... | ... | @@ -300,6 +300,7 @@ Library |
| 300 | 300 | GHC.Internal.Stack.CCS
|
| 301 | 301 | GHC.Internal.Stack.CloneStack
|
| 302 | 302 | GHC.Internal.Stack.Constants
|
| 303 | + GHC.Internal.Stack.ConstantsProf
|
|
| 303 | 304 | GHC.Internal.Stack.Decode
|
| 304 | 305 | GHC.Internal.Stack.Types
|
| 305 | 306 | GHC.Internal.Stats
|
| 1 | +{-# LANGUAGE CPP #-}
|
|
| 2 | +{-# LANGUAGE DerivingStrategies #-}
|
|
| 3 | +{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
| 4 | +module GHC.Internal.Stack.ConstantsProf where
|
|
| 5 | + |
|
| 6 | +import GHC.Internal.Base
|
|
| 7 | +import GHC.Internal.Enum
|
|
| 8 | +import GHC.Internal.Num
|
|
| 9 | +import GHC.Internal.Show
|
|
| 10 | +import GHC.Internal.Real
|
|
| 11 | + |
|
| 12 | +-- This file is a copy of GHC.Internal.Stack.Constants, but compiled with PROFILING
|
|
| 13 | +-- defined, since hsc is only invoked once per build in the vanilla way.
|
|
| 14 | +--
|
|
| 15 | +-- Also see GHC.Internal.Heap.InfoTable{Prof}
|
|
| 16 | +#define PROFILING
|
|
| 17 | +#include "Rts.h"
|
|
| 18 | +#undef BLOCK_SIZE
|
|
| 19 | +#undef MBLOCK_SIZE
|
|
| 20 | +#undef BLOCKS_PER_MBLOCK
|
|
| 21 | +#include "DerivedConstants.h"
|
|
| 22 | + |
|
| 23 | +newtype ByteOffset = ByteOffset { offsetInBytes :: Int }
|
|
| 24 | + deriving newtype (Eq, Show, Integral, Real, Num, Enum, Ord)
|
|
| 25 | + |
|
| 26 | +newtype WordOffset = WordOffset { offsetInWords :: Int }
|
|
| 27 | + deriving newtype (Eq, Show, Integral, Real, Num, Enum, Ord)
|
|
| 28 | + |
|
| 29 | +offsetStgCatchFrameHandler :: WordOffset
|
|
| 30 | +offsetStgCatchFrameHandler = byteOffsetToWordOffset $
|
|
| 31 | + (#const OFFSET_StgCatchFrame_handler) + (#size StgHeader)
|
|
| 32 | + |
|
| 33 | +sizeStgCatchFrame :: Int
|
|
| 34 | +sizeStgCatchFrame = bytesToWords $
|
|
| 35 | + (#const SIZEOF_StgCatchFrame_NoHdr) + (#size StgHeader)
|
|
| 36 | + |
|
| 37 | +offsetStgCatchSTMFrameCode :: WordOffset
|
|
| 38 | +offsetStgCatchSTMFrameCode = byteOffsetToWordOffset $
|
|
| 39 | + (#const OFFSET_StgCatchSTMFrame_code) + (#size StgHeader)
|
|
| 40 | + |
|
| 41 | +offsetStgCatchSTMFrameHandler :: WordOffset
|
|
| 42 | +offsetStgCatchSTMFrameHandler = byteOffsetToWordOffset $
|
|
| 43 | + (#const OFFSET_StgCatchSTMFrame_handler) + (#size StgHeader)
|
|
| 44 | + |
|
| 45 | +sizeStgCatchSTMFrame :: Int
|
|
| 46 | +sizeStgCatchSTMFrame = bytesToWords $
|
|
| 47 | + (#const SIZEOF_StgCatchSTMFrame_NoHdr) + (#size StgHeader)
|
|
| 48 | + |
|
| 49 | +offsetStgUpdateFrameUpdatee :: WordOffset
|
|
| 50 | +offsetStgUpdateFrameUpdatee = byteOffsetToWordOffset $
|
|
| 51 | + (#const OFFSET_StgUpdateFrame_updatee) + (#size StgHeader)
|
|
| 52 | + |
|
| 53 | +sizeStgUpdateFrame :: Int
|
|
| 54 | +sizeStgUpdateFrame = bytesToWords $
|
|
| 55 | + (#const SIZEOF_StgUpdateFrame_NoHdr) + (#size StgHeader)
|
|
| 56 | + |
|
| 57 | +offsetStgAtomicallyFrameCode :: WordOffset
|
|
| 58 | +offsetStgAtomicallyFrameCode = byteOffsetToWordOffset $
|
|
| 59 | + (#const OFFSET_StgAtomicallyFrame_code) + (#size StgHeader)
|
|
| 60 | + |
|
| 61 | +offsetStgAtomicallyFrameResult :: WordOffset
|
|
| 62 | +offsetStgAtomicallyFrameResult = byteOffsetToWordOffset $
|
|
| 63 | + (#const OFFSET_StgAtomicallyFrame_result) + (#size StgHeader)
|
|
| 64 | + |
|
| 65 | +sizeStgAtomicallyFrame :: Int
|
|
| 66 | +sizeStgAtomicallyFrame = bytesToWords $
|
|
| 67 | + (#const SIZEOF_StgAtomicallyFrame_NoHdr) + (#size StgHeader)
|
|
| 68 | + |
|
| 69 | +offsetStgCatchRetryFrameRunningAltCode :: WordOffset
|
|
| 70 | +offsetStgCatchRetryFrameRunningAltCode = byteOffsetToWordOffset $
|
|
| 71 | + (#const OFFSET_StgCatchRetryFrame_running_alt_code) + (#size StgHeader)
|
|
| 72 | + |
|
| 73 | +offsetStgCatchRetryFrameRunningFirstCode :: WordOffset
|
|
| 74 | +offsetStgCatchRetryFrameRunningFirstCode = byteOffsetToWordOffset $
|
|
| 75 | + (#const OFFSET_StgCatchRetryFrame_first_code) + (#size StgHeader)
|
|
| 76 | + |
|
| 77 | +offsetStgCatchRetryFrameAltCode :: WordOffset
|
|
| 78 | +offsetStgCatchRetryFrameAltCode = byteOffsetToWordOffset $
|
|
| 79 | + (#const OFFSET_StgCatchRetryFrame_alt_code) + (#size StgHeader)
|
|
| 80 | + |
|
| 81 | +sizeStgCatchRetryFrame :: Int
|
|
| 82 | +sizeStgCatchRetryFrame = bytesToWords $
|
|
| 83 | + (#const SIZEOF_StgCatchRetryFrame_NoHdr) + (#size StgHeader)
|
|
| 84 | + |
|
| 85 | +offsetStgRetFunFrameSize :: WordOffset
|
|
| 86 | +-- StgRetFun has no header, but only a pointer to the info table at the beginning.
|
|
| 87 | +offsetStgRetFunFrameSize = byteOffsetToWordOffset (#const OFFSET_StgRetFun_size)
|
|
| 88 | + |
|
| 89 | +offsetStgRetFunFrameFun :: WordOffset
|
|
| 90 | +offsetStgRetFunFrameFun = byteOffsetToWordOffset (#const OFFSET_StgRetFun_fun)
|
|
| 91 | + |
|
| 92 | +offsetStgRetFunFramePayload :: WordOffset
|
|
| 93 | +offsetStgRetFunFramePayload = byteOffsetToWordOffset (#const OFFSET_StgRetFun_payload)
|
|
| 94 | + |
|
| 95 | +sizeStgRetFunFrame :: Int
|
|
| 96 | +sizeStgRetFunFrame = bytesToWords (#const SIZEOF_StgRetFun)
|
|
| 97 | + |
|
| 98 | +sizeStgAnnFrame :: Int
|
|
| 99 | +sizeStgAnnFrame = bytesToWords $
|
|
| 100 | + (#const SIZEOF_StgAnnFrame_NoHdr) + (#size StgHeader)
|
|
| 101 | + |
|
| 102 | +offsetStgAnnFrameAnn :: WordOffset
|
|
| 103 | +offsetStgAnnFrameAnn = byteOffsetToWordOffset $
|
|
| 104 | + (#const OFFSET_StgAnnFrame_ann) + (#size StgHeader)
|
|
| 105 | + |
|
| 106 | +offsetStgBCOFrameInstrs :: ByteOffset
|
|
| 107 | +offsetStgBCOFrameInstrs = (#const OFFSET_StgBCO_instrs) + (#size StgHeader)
|
|
| 108 | + |
|
| 109 | +offsetStgBCOFrameLiterals :: ByteOffset
|
|
| 110 | +offsetStgBCOFrameLiterals = (#const OFFSET_StgBCO_literals) + (#size StgHeader)
|
|
| 111 | + |
|
| 112 | +offsetStgBCOFramePtrs :: ByteOffset
|
|
| 113 | +offsetStgBCOFramePtrs = (#const OFFSET_StgBCO_ptrs) + (#size StgHeader)
|
|
| 114 | + |
|
| 115 | +offsetStgBCOFrameArity :: ByteOffset
|
|
| 116 | +offsetStgBCOFrameArity = (#const OFFSET_StgBCO_arity) + (#size StgHeader)
|
|
| 117 | + |
|
| 118 | +offsetStgBCOFrameSize :: ByteOffset
|
|
| 119 | +offsetStgBCOFrameSize = (#const OFFSET_StgBCO_size) + (#size StgHeader)
|
|
| 120 | + |
|
| 121 | +offsetStgClosurePayload :: WordOffset
|
|
| 122 | +offsetStgClosurePayload = byteOffsetToWordOffset $
|
|
| 123 | + (#const OFFSET_StgClosure_payload) + (#size StgHeader)
|
|
| 124 | + |
|
| 125 | +sizeStgClosure :: Int
|
|
| 126 | +sizeStgClosure = bytesToWords (#size StgHeader)
|
|
| 127 | + |
|
| 128 | +byteOffsetToWordOffset :: ByteOffset -> WordOffset
|
|
| 129 | +byteOffsetToWordOffset = WordOffset . bytesToWords . fromInteger . toInteger
|
|
| 130 | + |
|
| 131 | +bytesToWords :: Int -> Int
|
|
| 132 | +bytesToWords b =
|
|
| 133 | + if b `mod` bytesInWord == 0 then
|
|
| 134 | + fromIntegral $ b `div` bytesInWord
|
|
| 135 | + else
|
|
| 136 | + error "Unexpected struct alignment!"
|
|
| 137 | + |
|
| 138 | +bytesInWord :: Int
|
|
| 139 | +bytesInWord = (#const SIZEOF_VOID_P)
|
|
| 140 | + |
| ... | ... | @@ -54,9 +54,19 @@ import GHC.Internal.Heap.Closures |
| 54 | 54 | GenStackField(..)
|
| 55 | 55 | )
|
| 56 | 56 | import GHC.Internal.Heap.Constants (wORD_SIZE_IN_BITS)
|
| 57 | -import GHC.Internal.Heap.InfoTable
|
|
| 58 | 57 | import GHC.Internal.Stack.Annotation
|
| 58 | +-- See Note [No way-dependent imports]
|
|
| 59 | +#if defined(PROFILING)
|
|
| 60 | +import GHC.Internal.Stack.Constants ()
|
|
| 61 | +import GHC.Internal.Stack.ConstantsProf
|
|
| 62 | +import GHC.Internal.Heap.InfoTable ()
|
|
| 63 | +import GHC.Internal.Heap.InfoTableProf
|
|
| 64 | +#else
|
|
| 65 | +import GHC.Internal.Heap.InfoTable
|
|
| 66 | +import GHC.Internal.Heap.InfoTableProf ()
|
|
| 59 | 67 | import GHC.Internal.Stack.Constants
|
| 68 | +import GHC.Internal.Stack.ConstantsProf ()
|
|
| 69 | +#endif
|
|
| 60 | 70 | import GHC.Internal.Stack.CloneStack
|
| 61 | 71 | import GHC.Internal.InfoProv.Types (InfoProv (..), ipLoc, lookupIPE)
|
| 62 | 72 |
| 1 | +import GHC.Internal.Control.Exception
|
|
| 2 | +import GHC.Internal.Exception.Backtrace
|
|
| 3 | + |
|
| 4 | +main :: IO ()
|
|
| 5 | +main = do
|
|
| 6 | + setBacktraceMechanismState IPEBacktrace True
|
|
| 7 | + throwIO $ ErrorCall "Throw error" |
| 1 | +T26507: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
|
|
| 2 | + |
|
| 3 | +Throw error
|
|
| 4 | + |
|
| 5 | +IPE backtrace:
|
|
| 6 | +HasCallStack backtrace:
|
|
| 7 | + throwIO, called at T26507.hs:7:3 in main:Main
|
|
| 8 | + |
| 1 | 1 | test('T14532a', [], compile_and_run, [''])
|
| 2 | 2 | test('T14532b', [], compile_and_run, [''])
|
| 3 | +test('T26507', [ when(have_profiling(), extra_ways(['prof']))
|
|
| 4 | + , when(js_arch(), skip)
|
|
| 5 | + , exit_code(1)], compile_and_run, [''])
|
|
| 6 | + |
| 1 | 1 | # Javascript backend don't support annotation frames, yet
|
| 2 | -setTestOpts(when(js_arch(), skip))
|
|
| 2 | +# and test with profiling way if available (#26507)
|
|
| 3 | +ann_frame_opts = [ when(js_arch(), skip)
|
|
| 4 | + , when(have_profiling(), extra_ways(['prof']))
|
|
| 5 | + , extra_files(['TestUtils.hs'])]
|
|
| 3 | 6 | |
| 4 | -test('ann_frame001', [extra_files(['TestUtils.hs'])], compile_and_run, [''])
|
|
| 5 | -test('ann_frame002', [extra_files(['TestUtils.hs'])], compile_and_run, [''])
|
|
| 6 | -test('ann_frame003', [extra_files(['TestUtils.hs'])], compile_and_run, [''])
|
|
| 7 | -test('ann_frame004', [extra_files(['TestUtils.hs'])], compile_and_run, ['']) |
|
| 7 | +test('ann_frame001', ann_frame_opts, compile_and_run, [''])
|
|
| 8 | +test('ann_frame002', ann_frame_opts, compile_and_run, [''])
|
|
| 9 | +test('ann_frame003', ann_frame_opts, compile_and_run, [''])
|
|
| 10 | +test('ann_frame004', ann_frame_opts, compile_and_run, ['']) |