summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/basicTypes/Name.lhs6
-rw-r--r--compiler/cmm/CmmSink.hs7
-rw-r--r--compiler/coreSyn/CorePrep.lhs47
-rw-r--r--compiler/deSugar/Desugar.lhs4
-rw-r--r--compiler/iface/LoadIface.lhs1
-rw-r--r--compiler/iface/MkIface.lhs10
-rw-r--r--compiler/iface/TcIface.lhs2
-rw-r--r--compiler/main/DriverPhases.hs64
-rw-r--r--compiler/main/DriverPipeline.hs21
-rw-r--r--compiler/main/DynFlags.hs50
-rw-r--r--compiler/main/Finder.lhs2
-rw-r--r--compiler/main/GhcMake.hs103
-rw-r--r--compiler/main/HscMain.hs2
-rw-r--r--compiler/main/HscTypes.lhs33
-rw-r--r--compiler/main/TidyPgm.lhs46
-rw-r--r--compiler/prelude/PrelNames.lhs22
-rw-r--r--compiler/prelude/TysWiredIn.lhs38
-rw-r--r--compiler/rename/RnBinds.lhs2
-rw-r--r--compiler/rename/RnEnv.lhs90
-rw-r--r--compiler/rename/RnNames.lhs187
-rw-r--r--compiler/stranal/DmdAnal.lhs3
-rw-r--r--compiler/typecheck/Inst.lhs65
-rw-r--r--compiler/typecheck/TcBinds.lhs4
-rw-r--r--compiler/typecheck/TcDeriv.lhs2
-rw-r--r--compiler/typecheck/TcEnv.lhs2
-rw-r--r--compiler/typecheck/TcInstDcls.lhs11
-rw-r--r--compiler/typecheck/TcMType.lhs8
-rw-r--r--compiler/typecheck/TcRnDriver.lhs217
-rw-r--r--compiler/typecheck/TcRnMonad.lhs11
-rw-r--r--compiler/typecheck/TcRnTypes.lhs52
-rw-r--r--compiler/typecheck/TcSimplify.lhs21
-rw-r--r--compiler/typecheck/TcTyClsDecls.lhs8
-rw-r--r--compiler/typecheck/TcType.lhs2
-rw-r--r--compiler/types/Coercion.lhs36
-rw-r--r--compiler/types/FamInstEnv.lhs30
-rw-r--r--compiler/types/InstEnv.lhs8
-rw-r--r--docs/backpack/backpack-impl.pdfbin0 -> 436890 bytes
-rw-r--r--docs/backpack/backpack-manual.pdfbin0 -> 181875 bytes
-rw-r--r--docs/backpack/backpack-manual.tex259
-rw-r--r--docs/users_guide/7.10.1-notes.xml12
-rw-r--r--docs/users_guide/ghci.xml2
-rw-r--r--docs/users_guide/glasgow_exts.xml2
-rw-r--r--docs/users_guide/separate_compilation.xml96
-rw-r--r--libffi/ghc.mk1
-rw-r--r--libraries/base/Data/Bifunctor.hs103
-rw-r--r--libraries/base/Data/Bool.hs35
-rw-r--r--libraries/base/Data/Char.hs12
-rw-r--r--libraries/base/Data/Foldable.hs2
-rw-r--r--libraries/base/Data/Functor.hs105
-rw-r--r--libraries/base/Data/IORef.hs6
-rw-r--r--libraries/base/Data/OldList.hs115
-rw-r--r--libraries/base/GHC/Arr.lhs16
-rw-r--r--libraries/base/GHC/Exception.lhs8
-rw-r--r--libraries/base/GHC/Float.lhs6
-rw-r--r--libraries/base/GHC/IO/Buffer.hs22
-rw-r--r--libraries/base/GHC/IO/Encoding/Iconv.hs30
-rw-r--r--libraries/base/GHC/List.lhs419
-rw-r--r--libraries/base/GHC/Num.lhs2
-rw-r--r--libraries/base/GHC/Real.lhs4
-rw-r--r--libraries/base/GHC/TopHandler.lhs26
-rw-r--r--libraries/base/GHC/Unicode.hs37
-rw-r--r--libraries/base/System/Mem/StableName.hs28
-rw-r--r--libraries/base/System/Mem/Weak.hs52
-rw-r--r--libraries/base/Text/Printf.hs2
-rw-r--r--libraries/base/Text/Show/Functions.hs6
-rw-r--r--libraries/base/base.cabal1
-rw-r--r--libraries/base/cbits/WCsubst.c7286
-rw-r--r--libraries/base/cbits/ubconfc1
-rw-r--r--libraries/base/changelog.md3
-rw-r--r--libraries/base/tests/all.T1
-rw-r--r--libraries/base/tests/isSuffixOf.hs10
-rw-r--r--libraries/base/tests/isSuffixOf.stdout84
-rw-r--r--libraries/base/tests/unicode002.stdout196
m---------libraries/dph0
-rw-r--r--libraries/ghc-prim/cbits/popcnt.c9
m---------libraries/primitive0
m---------libraries/vector0
-rw-r--r--mk/validate-settings.mk9
-rw-r--r--rts/Capability.c296
-rw-r--r--rts/Capability.h36
-rw-r--r--rts/CheckUnload.c192
-rw-r--r--rts/Exception.cmm90
-rw-r--r--rts/HeapStackCheck.cmm74
-rw-r--r--rts/Interpreter.c1744
-rw-r--r--rts/LdvProfile.h14
-rw-r--r--rts/Linker.c14
-rw-r--r--rts/ProfHeap.c901
-rw-r--r--rts/Profiling.c98
-rw-r--r--rts/Proftimer.c12
-rw-r--r--rts/RaiseAsync.c456
-rw-r--r--rts/RaiseAsync.h23
-rw-r--r--rts/RetainerProfile.c1626
-rw-r--r--rts/RtsMessages.c88
-rw-r--r--rts/Schedule.c886
-rw-r--r--rts/Schedule.h23
-rw-r--r--rts/Stats.c280
-rw-r--r--rts/Threads.c116
-rw-r--r--rts/sm/Compact.c686
-rw-r--r--rts/sm/Compact.h18
-rw-r--r--rts/sm/Evac.c246
-rw-r--r--rts/sm/GC.c328
-rw-r--r--rts/sm/Sanity.c330
-rw-r--r--rts/sm/Scav.c1550
-rw-r--r--testsuite/.gitignore17
-rw-r--r--testsuite/driver/testlib.py128
-rw-r--r--testsuite/mk/test.mk8
-rw-r--r--testsuite/tests/array/should_run/arr016.hs10
-rw-r--r--testsuite/tests/cabal/all.T3
-rw-r--r--testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs2
-rw-r--r--testsuite/tests/codeGen/should_run/cgrun068.hs2
-rw-r--r--testsuite/tests/deSugar/should_compile/all.T4
-rw-r--r--testsuite/tests/driver/recomp014/Makefile27
-rw-r--r--testsuite/tests/driver/recomp014/all.T4
-rw-r--r--testsuite/tests/driver/recomp014/recomp014.stdout3
-rw-r--r--testsuite/tests/driver/sigof01/A.hs10
-rw-r--r--testsuite/tests/driver/sigof01/B.hsig6
-rw-r--r--testsuite/tests/driver/sigof01/Main.hs6
-rw-r--r--testsuite/tests/driver/sigof01/Makefile23
-rw-r--r--testsuite/tests/driver/sigof01/all.T9
-rw-r--r--testsuite/tests/driver/sigof01/sigof01.stdout3
-rw-r--r--testsuite/tests/driver/sigof01/sigof01m.stdout7
-rw-r--r--testsuite/tests/driver/sigof02/Double.hs13
-rw-r--r--testsuite/tests/driver/sigof02/Main.hs11
-rw-r--r--testsuite/tests/driver/sigof02/Makefile75
-rw-r--r--testsuite/tests/driver/sigof02/Map.hsig133
-rw-r--r--testsuite/tests/driver/sigof02/MapAsSet.hsig11
-rw-r--r--testsuite/tests/driver/sigof02/all.T41
-rw-r--r--testsuite/tests/driver/sigof02/sigof02.stderr1
-rw-r--r--testsuite/tests/driver/sigof02/sigof02.stdout3
-rw-r--r--testsuite/tests/driver/sigof02/sigof02d.stdout4
-rw-r--r--testsuite/tests/driver/sigof02/sigof02dm.stdout8
-rw-r--r--testsuite/tests/driver/sigof02/sigof02dmt.stderr8
-rw-r--r--testsuite/tests/driver/sigof02/sigof02dmt.stdout3
-rw-r--r--testsuite/tests/driver/sigof02/sigof02dt.stderr8
-rw-r--r--testsuite/tests/driver/sigof02/sigof02m.stderr1
-rw-r--r--testsuite/tests/driver/sigof02/sigof02m.stdout9
-rw-r--r--testsuite/tests/driver/sigof02/sigof02mt.stdout2
-rw-r--r--testsuite/tests/driver/sigof03/A.hs3
-rw-r--r--testsuite/tests/driver/sigof03/ASig1.hsig3
-rw-r--r--testsuite/tests/driver/sigof03/ASig2.hsig3
-rw-r--r--testsuite/tests/driver/sigof03/Main.hs3
-rw-r--r--testsuite/tests/driver/sigof03/Makefile30
-rw-r--r--testsuite/tests/driver/sigof03/all.T11
-rw-r--r--testsuite/tests/driver/sigof04/Makefile14
-rw-r--r--testsuite/tests/driver/sigof04/Sig.hsig2
-rw-r--r--testsuite/tests/driver/sigof04/all.T4
-rw-r--r--testsuite/tests/driver/sigof04/sigof04.stderr3
-rw-r--r--testsuite/tests/ghci/scripts/T5979.stderr6
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T11
-rw-r--r--testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs9
-rw-r--r--testsuite/tests/indexed-types/should_compile/all.T2
-rw-r--r--testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs37
-rw-r--r--testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr22
-rw-r--r--testsuite/tests/indexed-types/should_fail/T1897b.stderr8
-rw-r--r--testsuite/tests/indexed-types/should_fail/T4093a.hs4
-rw-r--r--testsuite/tests/indexed-types/should_fail/T4093a.stderr17
-rw-r--r--testsuite/tests/module/all.T2
-rw-r--r--testsuite/tests/perf/compiler/T4007.stdout2
-rw-r--r--testsuite/tests/perf/compiler/all.T45
-rw-r--r--testsuite/tests/safeHaskell/check/pkg01/all.T14
-rw-r--r--testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout6
-rw-r--r--testsuite/tests/simplCore/should_compile/T3772.stdout26
-rw-r--r--testsuite/tests/simplCore/should_compile/T7360.stderr8
-rw-r--r--testsuite/tests/th/T9692.hs2
-rw-r--r--testsuite/tests/typecheck/should_compile/all.T1
-rw-r--r--testsuite/tests/typecheck/should_compile/tc264.hsig2
-rw-r--r--testsuite/tests/typecheck/should_compile/tc264.stderr1
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T5
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail219.hsig2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail219.stderr3
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail220.hsig5
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail220.stderr13
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail221.hsig3
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail221.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail222.hsig2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail222.stderr4
-rw-r--r--testsuite/tests/warnings/should_compile/T9230.hs5
-rw-r--r--testsuite/tests/warnings/should_compile/T9230.stderr2
-rw-r--r--testsuite/tests/warnings/should_compile/all.T3
-rw-r--r--utils/deriveConstants/DeriveConstants.hs6
m---------utils/haddock0
181 files changed, 11712 insertions, 9603 deletions
diff --git a/compiler/basicTypes/Name.lhs b/compiler/basicTypes/Name.lhs
index c4f10fb876..d7c18fcfce 100644
--- a/compiler/basicTypes/Name.lhs
+++ b/compiler/basicTypes/Name.lhs
@@ -48,6 +48,7 @@ module Name (
-- ** Manipulating and deconstructing 'Name's
nameUnique, setNameUnique,
nameOccName, nameModule, nameModule_maybe,
+ setNameLoc,
tidyNameOcc,
localiseName,
mkLocalisedOccName,
@@ -317,6 +318,11 @@ mkFCallName uniq str = mkInternalName uniq (mkVarOcc str) noSrcSpan
setNameUnique :: Name -> Unique -> Name
setNameUnique name uniq = name {n_uniq = getKeyFastInt uniq}
+-- This is used for hsigs: we want to use the name of the originally exported
+-- entity, but edit the location to refer to the reexport site
+setNameLoc :: Name -> SrcSpan -> Name
+setNameLoc name loc = name {n_loc = loc}
+
tidyNameOcc :: Name -> OccName -> Name
-- We set the OccName of a Name when tidying
-- In doing so, we change System --> Internal, so that when we print
diff --git a/compiler/cmm/CmmSink.hs b/compiler/cmm/CmmSink.hs
index 4dced9afd2..22f4d2ec92 100644
--- a/compiler/cmm/CmmSink.hs
+++ b/compiler/cmm/CmmSink.hs
@@ -10,6 +10,7 @@ import CmmLive
import CmmUtils
import Hoopl
import CodeGen.Platform
+import Platform (isARM, platformArch)
import DynFlags
import UniqFM
@@ -235,8 +236,10 @@ isSmall _ = False
isTrivial :: DynFlags -> CmmExpr -> Bool
isTrivial _ (CmmReg (CmmLocal _)) = True
isTrivial dflags (CmmReg (CmmGlobal r)) = -- see Note [Inline GlobalRegs?]
- isJust (globalRegMaybe (targetPlatform dflags) r)
- -- GlobalRegs that are loads from BaseReg are not trivial
+ if isARM (platformArch (targetPlatform dflags))
+ then True -- CodeGen.Platform.ARM does not have globalRegMaybe
+ else isJust (globalRegMaybe (targetPlatform dflags) r)
+ -- GlobalRegs that are loads from BaseReg are not trivial
isTrivial _ (CmmLit _) = True
isTrivial _ _ = False
diff --git a/compiler/coreSyn/CorePrep.lhs b/compiler/coreSyn/CorePrep.lhs
index 6d794629b2..374b98ece9 100644
--- a/compiler/coreSyn/CorePrep.lhs
+++ b/compiler/coreSyn/CorePrep.lhs
@@ -9,7 +9,7 @@ Core pass to saturate constructors and PrimOps
module CorePrep (
corePrepPgm, corePrepExpr, cvtLitInteger,
- lookupMkIntegerName,
+ lookupMkIntegerName, lookupIntegerSDataConName
) where
#include "HsVersions.h"
@@ -479,7 +479,8 @@ cpeRhsE :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeRhs)
cpeRhsE _env expr@(Type {}) = return (emptyFloats, expr)
cpeRhsE _env expr@(Coercion {}) = return (emptyFloats, expr)
cpeRhsE env (Lit (LitInteger i _))
- = cpeRhsE env (cvtLitInteger (cpe_dynFlags env) (getMkIntegerId env) i)
+ = cpeRhsE env (cvtLitInteger (cpe_dynFlags env) (getMkIntegerId env)
+ (cpe_integerSDataCon env) i)
cpeRhsE _env expr@(Lit {}) = return (emptyFloats, expr)
cpeRhsE env expr@(Var {}) = cpeApp env expr
@@ -529,18 +530,17 @@ cpeRhsE env (Case scrut bndr ty alts)
; rhs' <- cpeBodyNF env2 rhs
; return (con, bs', rhs') }
-cvtLitInteger :: DynFlags -> Id -> Integer -> CoreExpr
+cvtLitInteger :: DynFlags -> Id -> Maybe DataCon -> Integer -> CoreExpr
-- Here we convert a literal Integer to the low-level
-- represenation. Exactly how we do this depends on the
-- library that implements Integer. If it's GMP we
-- use the S# data constructor for small literals.
-- See Note [Integer literals] in Literal
-cvtLitInteger dflags mk_integer i
- | cIntegerLibraryType == IntegerGMP
- , inIntRange dflags i -- Special case for small integers in GMP
- = mkConApp integerGmpSDataCon [Lit (mkMachInt dflags i)]
+cvtLitInteger dflags _ (Just sdatacon) i
+ | inIntRange dflags i -- Special case for small integers
+ = mkConApp sdatacon [Lit (mkMachInt dflags i)]
- | otherwise
+cvtLitInteger dflags mk_integer _ i
= mkApps (Var mk_integer) [isNonNegative, ints]
where isNonNegative = if i < 0 then mkConApp falseDataCon []
else mkConApp trueDataCon []
@@ -1110,25 +1110,40 @@ allLazyNested is_rec (Floats IfUnboxedOk _) = isNonRec is_rec
data CorePrepEnv = CPE {
cpe_dynFlags :: DynFlags,
cpe_env :: (IdEnv Id), -- Clone local Ids
- cpe_mkIntegerId :: Id
+ cpe_mkIntegerId :: Id,
+ cpe_integerSDataCon :: Maybe DataCon
}
lookupMkIntegerName :: DynFlags -> HscEnv -> IO Id
lookupMkIntegerName dflags hsc_env
- = if thisPackage dflags == primPackageKey
- then return $ panic "Can't use Integer in ghc-prim"
- else if thisPackage dflags == integerPackageKey
- then return $ panic "Can't use Integer in integer"
- else liftM tyThingId
- $ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
+ = guardIntegerUse dflags $ liftM tyThingId $
+ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
+
+lookupIntegerSDataConName :: DynFlags -> HscEnv -> IO (Maybe DataCon)
+lookupIntegerSDataConName dflags hsc_env = case cIntegerLibraryType of
+ IntegerGMP -> guardIntegerUse dflags $ liftM Just $
+ initTcForLookup hsc_env (tcLookupDataCon integerSDataConName)
+
+ IntegerSimple -> return Nothing
+
+-- | Helper for 'lookupMkIntegerName' and 'lookupIntegerSDataConName'
+guardIntegerUse :: DynFlags -> IO a -> IO a
+guardIntegerUse dflags act
+ | thisPackage dflags == primPackageKey
+ = return $ panic "Can't use Integer in ghc-prim"
+ | thisPackage dflags == integerPackageKey
+ = return $ panic "Can't use Integer in integer-*"
+ | otherwise = act
mkInitialCorePrepEnv :: DynFlags -> HscEnv -> IO CorePrepEnv
mkInitialCorePrepEnv dflags hsc_env
= do mkIntegerId <- lookupMkIntegerName dflags hsc_env
+ integerSDataCon <- lookupIntegerSDataConName dflags hsc_env
return $ CPE {
cpe_dynFlags = dflags,
cpe_env = emptyVarEnv,
- cpe_mkIntegerId = mkIntegerId
+ cpe_mkIntegerId = mkIntegerId,
+ cpe_integerSDataCon = integerSDataCon
}
extendCorePrepEnv :: CorePrepEnv -> Id -> Id -> CorePrepEnv
diff --git a/compiler/deSugar/Desugar.lhs b/compiler/deSugar/Desugar.lhs
index 0b4ac3c596..e2170e7dd4 100644
--- a/compiler/deSugar/Desugar.lhs
+++ b/compiler/deSugar/Desugar.lhs
@@ -109,7 +109,7 @@ deSugar hsc_env
_ -> True)
; (binds_cvr, ds_hpc_info, modBreaks)
- <- if want_ticks && not (isHsBoot hsc_src)
+ <- if want_ticks && not (isHsBootOrSig hsc_src)
then addTicksToBinds dflags mod mod_loc export_set
(typeEnvTyCons type_env) binds
else return (binds, hpcInfo, emptyModBreaks)
@@ -166,7 +166,7 @@ deSugar hsc_env
; let mod_guts = ModGuts {
mg_module = mod,
- mg_boot = isHsBoot hsc_src,
+ mg_boot = hsc_src == HsBootFile,
mg_exports = exports,
mg_deps = deps,
mg_used_names = used_names,
diff --git a/compiler/iface/LoadIface.lhs b/compiler/iface/LoadIface.lhs
index fa6f603d8e..faaea6c456 100644
--- a/compiler/iface/LoadIface.lhs
+++ b/compiler/iface/LoadIface.lhs
@@ -745,6 +745,7 @@ pprModIface iface
, nest 2 (text "export-list hash:" <+> ppr (mi_exp_hash iface))
, nest 2 (text "orphan hash:" <+> ppr (mi_orphan_hash iface))
, nest 2 (text "flag hash:" <+> ppr (mi_flag_hash iface))
+ , nest 2 (text "sig of:" <+> ppr (mi_sig_of iface))
, nest 2 (text "used TH splices:" <+> ppr (mi_used_th iface))
, nest 2 (ptext (sLit "where"))
, ptext (sLit "exports:")
diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs
index ec41f0ddd2..7198b710ea 100644
--- a/compiler/iface/MkIface.lhs
+++ b/compiler/iface/MkIface.lhs
@@ -191,7 +191,8 @@ mkIfaceTc hsc_env maybe_old_fingerprint safe_mode mod_details
used_th <- readIORef tc_splice_used
dep_files <- (readIORef dependent_files)
mkIface_ hsc_env maybe_old_fingerprint
- this_mod (isHsBoot hsc_src) used_names used_th deps rdr_env
+ this_mod (hsc_src == HsBootFile) used_names
+ used_th deps rdr_env
fix_env warns hpc_info (imp_mods imports)
(imp_trust_own_pkg imports) dep_files safe_mode mod_details
@@ -279,9 +280,11 @@ mkIface_ hsc_env maybe_old_fingerprint
iface_vect_info = flattenVectInfo vect_info
trust_info = setSafeMode safe_mode
annotations = map mkIfaceAnnotation anns
+ sig_of = getSigOf dflags (moduleName this_mod)
intermediate_iface = ModIface {
mi_module = this_mod,
+ mi_sig_of = sig_of,
mi_boot = is_boot,
mi_deps = deps,
mi_usages = usages,
@@ -1259,6 +1262,9 @@ checkVersions hsc_env mod_summary iface
; recomp <- checkFlagHash hsc_env iface
; if recompileRequired recomp then return (recomp, Nothing) else do {
+ ; if getSigOf (hsc_dflags hsc_env) (moduleName (mi_module iface))
+ /= mi_sig_of iface
+ then return (RecompBecause "sig-of changed", Nothing) else do {
; recomp <- checkDependencies hsc_env mod_summary iface
; if recompileRequired recomp then return (recomp, Just iface) else do {
@@ -1278,7 +1284,7 @@ checkVersions hsc_env mod_summary iface
; updateEps_ $ \eps -> eps { eps_is_boot = mod_deps }
; recomp <- checkList [checkModUsage this_pkg u | u <- mi_usages iface]
; return (recomp, Just iface)
- }}}
+ }}}}
where
this_pkg = thisPackage (hsc_dflags hsc_env)
-- This is a bit of a hack really
diff --git a/compiler/iface/TcIface.lhs b/compiler/iface/TcIface.lhs
index bb5186931d..3fea3aedbb 100644
--- a/compiler/iface/TcIface.lhs
+++ b/compiler/iface/TcIface.lhs
@@ -321,7 +321,7 @@ tcHiBootIface :: HscSource -> Module -> TcRn ModDetails
-- if it indeed exists in the transitive closure of imports
-- Return the ModDetails, empty if no hi-boot iface
tcHiBootIface hsc_src mod
- | isHsBoot hsc_src -- Already compiling a hs-boot file
+ | HsBootFile <- hsc_src -- Already compiling a hs-boot file
= return emptyModDetails
| otherwise
= do { traceIf (text "loadHiBootInterface" <+> ppr mod)
diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs
index fa8b2d060f..2433f6d6d9 100644
--- a/compiler/main/DriverPhases.hs
+++ b/compiler/main/DriverPhases.hs
@@ -10,7 +10,7 @@
-----------------------------------------------------------------------------
module DriverPhases (
- HscSource(..), isHsBoot, hscSourceString,
+ HscSource(..), isHsBootOrSig, hscSourceString,
Phase(..),
happensBefore, eqPhase, anyHsc, isStopLn,
startPhase,
@@ -22,10 +22,12 @@ module DriverPhases (
isCishSuffix,
isDynLibSuffix,
isHaskellUserSrcSuffix,
+ isHaskellSigSuffix,
isSourceSuffix,
isHaskellishFilename,
isHaskellSrcFilename,
+ isHaskellSigFilename,
isObjectFilename,
isCishFilename,
isDynLibFilename,
@@ -55,19 +57,54 @@ import System.FilePath
linker | other | - | a.out
-}
+-- Note [HscSource types]
+-- ~~~~~~~~~~~~~~~~~~~~~~
+-- There are three types of source file for Haskell code:
+--
+-- * HsSrcFile is an ordinary hs file which contains code,
+--
+-- * HsBootFile is an hs-boot file, which is used to break
+-- recursive module imports (there will always be an
+-- HsSrcFile associated with it), and
+--
+-- * HsigFile is an hsig file, which contains only type
+-- signatures and is used to specify signatures for
+-- modules.
+--
+-- Syntactically, hs-boot files and hsig files are quite similar: they
+-- only include type signatures and must be associated with an
+-- actual HsSrcFile. isHsBootOrSig allows us to abstract over code
+-- which is indifferent to which. However, there are some important
+-- differences, mostly owing to the fact that hsigs are proper
+-- modules (you `import Sig` directly) whereas HsBootFiles are
+-- temporary placeholders (you `import {-# SOURCE #-} Mod).
+-- When we finish compiling the true implementation of an hs-boot,
+-- we replace the HomeModInfo with the real HsSrcFile. An HsigFile, on the
+-- other hand, is never replaced (in particular, we *cannot* use the
+-- HomeModInfo of the original HsSrcFile backing the signature, since it
+-- will export too many symbols.)
+--
+-- Additionally, while HsSrcFile is the only Haskell file
+-- which has *code*, we do generate .o files for HsigFile, because
+-- this is how the recompilation checker figures out if a file
+-- needs to be recompiled. These are fake object files which
+-- should NOT be linked against.
+
data HscSource
- = HsSrcFile | HsBootFile
+ = HsSrcFile | HsBootFile | HsigFile
deriving( Eq, Ord, Show )
-- Ord needed for the finite maps we build in CompManager
-
hscSourceString :: HscSource -> String
hscSourceString HsSrcFile = ""
hscSourceString HsBootFile = "[boot]"
+hscSourceString HsigFile = "[sig]"
-isHsBoot :: HscSource -> Bool
-isHsBoot HsBootFile = True
-isHsBoot _ = False
+-- See Note [isHsBootOrSig]
+isHsBootOrSig :: HscSource -> Bool
+isHsBootOrSig HsBootFile = True
+isHsBootOrSig HsigFile = True
+isHsBootOrSig _ = False
data Phase
= Unlit HscSource
@@ -170,8 +207,10 @@ nextPhase dflags p
startPhase :: String -> Phase
startPhase "lhs" = Unlit HsSrcFile
startPhase "lhs-boot" = Unlit HsBootFile
+startPhase "lhsig" = Unlit HsigFile
startPhase "hs" = Cpp HsSrcFile
startPhase "hs-boot" = Cpp HsBootFile
+startPhase "hsig" = Cpp HsigFile
startPhase "hscpp" = HsPp HsSrcFile
startPhase "hspp" = Hsc HsSrcFile
startPhase "hc" = HCc
@@ -200,6 +239,7 @@ startPhase _ = StopLn -- all unknown file types
phaseInputExt :: Phase -> String
phaseInputExt (Unlit HsSrcFile) = "lhs"
phaseInputExt (Unlit HsBootFile) = "lhs-boot"
+phaseInputExt (Unlit HsigFile) = "lhsig"
phaseInputExt (Cpp _) = "lpp" -- intermediate only
phaseInputExt (HsPp _) = "hscpp" -- intermediate only
phaseInputExt (Hsc _) = "hspp" -- intermediate only
@@ -224,14 +264,16 @@ phaseInputExt MergeStub = "o"
phaseInputExt StopLn = "o"
haskellish_src_suffixes, haskellish_suffixes, cish_suffixes,
- haskellish_user_src_suffixes
+ haskellish_user_src_suffixes, haskellish_sig_suffixes
:: [String]
haskellish_src_suffixes = haskellish_user_src_suffixes ++
[ "hspp", "hscpp", "hcr", "cmm", "cmmcpp" ]
haskellish_suffixes = haskellish_src_suffixes ++ ["hc", "raw_s"]
cish_suffixes = [ "c", "cpp", "C", "cc", "cxx", "s", "S", "ll", "bc", "lm_s", "m", "M", "mm" ]
-- Will not be deleted as temp files:
-haskellish_user_src_suffixes = [ "hs", "lhs", "hs-boot", "lhs-boot" ]
+haskellish_user_src_suffixes =
+ haskellish_sig_suffixes ++ [ "hs", "lhs", "hs-boot", "lhs-boot" ]
+haskellish_sig_suffixes = [ "hsig", "lhsig" ]
objish_suffixes :: Platform -> [String]
-- Use the appropriate suffix for the system on which
@@ -247,9 +289,10 @@ dynlib_suffixes platform = case platformOS platform of
_ -> ["so"]
isHaskellishSuffix, isHaskellSrcSuffix, isCishSuffix,
- isHaskellUserSrcSuffix
+ isHaskellUserSrcSuffix, isHaskellSigSuffix
:: String -> Bool
isHaskellishSuffix s = s `elem` haskellish_suffixes
+isHaskellSigSuffix s = s `elem` haskellish_sig_suffixes
isHaskellSrcSuffix s = s `elem` haskellish_src_suffixes
isCishSuffix s = s `elem` cish_suffixes
isHaskellUserSrcSuffix s = s `elem` haskellish_user_src_suffixes
@@ -262,7 +305,7 @@ isSourceSuffix :: String -> Bool
isSourceSuffix suff = isHaskellishSuffix suff || isCishSuffix suff
isHaskellishFilename, isHaskellSrcFilename, isCishFilename,
- isHaskellUserSrcFilename, isSourceFilename
+ isHaskellUserSrcFilename, isSourceFilename, isHaskellSigFilename
:: FilePath -> Bool
-- takeExtension return .foo, so we drop 1 to get rid of the .
isHaskellishFilename f = isHaskellishSuffix (drop 1 $ takeExtension f)
@@ -270,6 +313,7 @@ isHaskellSrcFilename f = isHaskellSrcSuffix (drop 1 $ takeExtension f)
isCishFilename f = isCishSuffix (drop 1 $ takeExtension f)
isHaskellUserSrcFilename f = isHaskellUserSrcSuffix (drop 1 $ takeExtension f)
isSourceFilename f = isSourceSuffix (drop 1 $ takeExtension f)
+isHaskellSigFilename f = isHaskellSigSuffix (drop 1 $ takeExtension f)
isObjectFilename, isDynLibFilename :: Platform -> FilePath -> Bool
isObjectFilename platform f = isObjectSuffix platform (drop 1 $ takeExtension f)
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 43f31e6f2c..6bc67e7ac8 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -197,7 +197,7 @@ compileOne' m_tc_result mHscMessage
case hsc_lang of
HscInterpreted ->
case ms_hsc_src summary of
- HsBootFile ->
+ t | isHsBootOrSig t ->
do (iface, _changed, details) <- hscSimpleIface hsc_env tc_result mb_old_hash
return (HomeModInfo{ hm_details = details,
hm_iface = iface,
@@ -231,7 +231,7 @@ compileOne' m_tc_result mHscMessage
do (iface, changed, details) <- hscSimpleIface hsc_env tc_result mb_old_hash
when (gopt Opt_WriteInterface dflags) $
hscWriteIface dflags iface changed summary
- let linkable = if isHsBoot src_flavour
+ let linkable = if isHsBootOrSig src_flavour
then maybe_old_linkable
else Just (LM (ms_hs_date summary) this_mod [])
return (HomeModInfo{ hm_details = details,
@@ -240,7 +240,7 @@ compileOne' m_tc_result mHscMessage
_ ->
case ms_hsc_src summary of
- HsBootFile ->
+ t | isHsBootOrSig t ->
do (iface, changed, details) <- hscSimpleIface hsc_env tc_result mb_old_hash
hscWriteIface dflags iface changed summary
touchObjectFile dflags object_filename
@@ -341,7 +341,11 @@ link' dflags batch_attempt_linking hpt
LinkStaticLib -> True
_ -> platformBinariesAreStaticLibs (targetPlatform dflags)
- home_mod_infos = eltsUFM hpt
+ -- Don't attempt to link hsigs; they don't actually produce objects.
+ -- This is in contrast to hs-boot files, which will /eventually/
+ -- get objects.
+ home_mod_infos =
+ filter ((==Nothing).mi_sig_of.hm_iface) (eltsUFM hpt)
-- the packages we depend on
pkg_deps = concatMap (map fst . dep_pkgs . mi_deps . hm_iface) home_mod_infos
@@ -1511,8 +1515,8 @@ getLocation src_flavour mod_name = do
location1 <- liftIO $ mkHomeModLocation2 dflags mod_name basename suff
-- Boot-ify it if necessary
- let location2 | isHsBoot src_flavour = addBootSuffixLocn location1
- | otherwise = location1
+ let location2 | HsBootFile <- src_flavour = addBootSuffixLocn location1
+ | otherwise = location1
-- Take -ohi into account if present
@@ -2199,6 +2203,7 @@ joinObjectFiles dflags o_files output_fn = do
-- | What phase to run after one of the backend code generators has run
hscPostBackendPhase :: DynFlags -> HscSource -> HscTarget -> Phase
hscPostBackendPhase _ HsBootFile _ = StopLn
+hscPostBackendPhase _ HsigFile _ = StopLn
hscPostBackendPhase dflags _ hsc_lang =
case hsc_lang of
HscC -> HCc
@@ -2236,8 +2241,8 @@ getGhcVersionPathName dflags = do
-- 2. ${CC} -x assembler -c 'PIC_CFLAGS' source.S
--
-- Why do we need to pass 'PIC_CFLAGS' both to C compiler and assembler?
--- Because on some architectures (at least sparc32) assembler also choses
--- relocation type!
+-- Because on some architectures (at least sparc32) assembler also chooses
+-- the relocation type!
-- Consider the following C module:
--
-- /* pic-sample.c */
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 8f63cefa88..2831eecf72 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -50,6 +50,7 @@ module DynFlags (
fFlags, fWarningFlags, fLangFlags, xFlags,
dynFlagDependencies,
tablesNextToCode, mkTablesNextToCode,
+ SigOf(..), getSigOf,
Way(..), mkBuildTag, wayRTSOnly, addWay', updateWays,
wayGeneralFlags, wayUnsetGeneralFlags,
@@ -589,6 +590,17 @@ data ExtensionFlag
| Opt_PatternSynonyms
deriving (Eq, Enum, Show)
+data SigOf = NotSigOf
+ | SigOf Module
+ | SigOfMap (Map ModuleName Module)
+
+getSigOf :: DynFlags -> ModuleName -> Maybe Module
+getSigOf dflags n =
+ case sigOf dflags of
+ NotSigOf -> Nothing
+ SigOf m -> Just m
+ SigOfMap m -> Map.lookup n m
+
-- | Contains not only a collection of 'GeneralFlag's but also a plethora of
-- information relating to the compilation of a single file or GHC session
data DynFlags = DynFlags {
@@ -596,6 +608,8 @@ data DynFlags = DynFlags {
ghcLink :: GhcLink,
hscTarget :: HscTarget,
settings :: Settings,
+ -- See Note [Signature parameters in TcGblEnv and DynFlags]
+ sigOf :: SigOf, -- ^ Compiling an hs-boot against impl.
verbosity :: Int, -- ^ Verbosity level: see Note [Verbosity levels]
optLevel :: Int, -- ^ Optimisation level
simplPhases :: Int, -- ^ Number of simplifier phases
@@ -1332,6 +1346,7 @@ defaultDynFlags mySettings =
ghcMode = CompManager,
ghcLink = LinkBinary,
hscTarget = defaultHscTarget (sTargetPlatform mySettings),
+ sigOf = NotSigOf,
verbosity = 0,
optLevel = 0,
simplPhases = 2,
@@ -1819,6 +1834,29 @@ setOutputFile f d = d{ outputFile = f}
setDynOutputFile f d = d{ dynOutputFile = f}
setOutputHi f d = d{ outputHi = f}
+parseSigOf :: String -> SigOf
+parseSigOf str = case filter ((=="").snd) (readP_to_S parse str) of
+ [(r, "")] -> r
+ _ -> throwGhcException $ CmdLineError ("Can't parse -sig-of: " ++ str)
+ where parse = parseOne +++ parseMany
+ parseOne = SigOf `fmap` parseModule
+ parseMany = SigOfMap . Map.fromList <$> sepBy parseEntry (R.char ',')
+ parseEntry = do
+ n <- tok $ parseModuleName
+ -- ToDo: deprecate this 'is' syntax?
+ tok $ ((string "is" >> return ()) +++ (R.char '=' >> return ()))
+ m <- tok $ parseModule
+ return (mkModuleName n, m)
+ parseModule = do
+ pk <- munch1 (\c -> isAlphaNum c || c `elem` "-_")
+ _ <- R.char ':'
+ m <- parseModuleName
+ return (mkModule (stringToPackageKey pk) (mkModuleName m))
+ tok m = skipSpaces >> m
+
+setSigOf :: String -> DynFlags -> DynFlags
+setSigOf s d = d { sigOf = parseSigOf s }
+
addPluginModuleName :: String -> DynFlags -> DynFlags
addPluginModuleName name d = d { pluginModNames = (mkModuleName name) : (pluginModNames d) }
@@ -2140,6 +2178,7 @@ dynamic_flags = [
, Flag "v" (OptIntSuffix setVerbosity)
, Flag "j" (OptIntSuffix (\n -> upd (\d -> d {parMakeCount = n})))
+ , Flag "sig-of" (sepArg setSigOf)
-- RTS options -------------------------------------------------------------
, Flag "H" (HasArg (\s -> upd (\d ->
@@ -3061,7 +3100,8 @@ standardWarnings
Opt_WarnInlineRuleShadowing,
Opt_WarnAlternativeLayoutRuleTransitional,
Opt_WarnUnsupportedLlvmVersion,
- Opt_WarnContextQuantification
+ Opt_WarnContextQuantification,
+ Opt_WarnTabs
]
minusWOpts :: [WarningFlag]
@@ -3353,6 +3393,9 @@ removeGlobalPkgConf = upd $ \s -> s { extraPkgConfs = filter isNotGlobal . extra
clearPkgConf :: DynP ()
clearPkgConf = upd $ \s -> s { extraPkgConfs = const [] }
+parseModuleName :: ReadP String
+parseModuleName = munch1 (\c -> isAlphaNum c || c `elem` ".")
+
parsePackageFlag :: (String -> PackageArg) -- type of argument
-> String -- string to parse
-> PackageFlag
@@ -3367,11 +3410,10 @@ parsePackageFlag constr str = case filter ((=="").snd) (readP_to_S parse str) of
return (ExposePackage (constr pkg) (Just rns))
+++
return (ExposePackage (constr pkg) Nothing))
- parseMod = munch1 (\c -> isAlphaNum c || c `elem` ".")
parseItem = do
- orig <- tok $ parseMod
+ orig <- tok $ parseModuleName
(do _ <- tok $ string "as"
- new <- tok $ parseMod
+ new <- tok $ parseModuleName
return (orig, new)
+++
return (orig, orig))
diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs
index f56c173662..12838553cf 100644
--- a/compiler/main/Finder.lhs
+++ b/compiler/main/Finder.lhs
@@ -247,6 +247,8 @@ findHomeModule hsc_env mod_name =
source_exts =
[ ("hs", mkHomeModLocationSearched dflags mod_name "hs")
, ("lhs", mkHomeModLocationSearched dflags mod_name "lhs")
+ , ("hsig", mkHomeModLocationSearched dflags mod_name "hsig")
+ , ("lhsig", mkHomeModLocationSearched dflags mod_name "lhsig")
]
hi_exts = [ (hisuf, mkHiOnlyModLocation dflags hisuf)
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 0c63203d4c..1fb6f71af2 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -673,10 +673,22 @@ buildCompGraph (scc:sccs) = case scc of
CyclicSCC mss -> return ([], Just mss)
-- A Module and whether it is a boot module.
-type BuildModule = (Module, Bool)
+type BuildModule = (Module, IsBoot)
+
+-- | 'Bool' indicating if a module is a boot module or not. We need to treat
+-- boot modules specially when building compilation graphs, since they break
+-- cycles. Regular source files and signature files are treated equivalently.
+data IsBoot = IsBoot | NotBoot
+ deriving (Ord, Eq, Show, Read)
+
+-- | Tests if an 'HscSource' is a boot file, primarily for constructing
+-- elements of 'BuildModule'.
+hscSourceToIsBoot :: HscSource -> IsBoot
+hscSourceToIsBoot HsBootFile = IsBoot
+hscSourceToIsBoot _ = NotBoot
mkBuildModule :: ModSummary -> BuildModule
-mkBuildModule ms = (ms_mod ms, isBootSummary ms)
+mkBuildModule ms = (ms_mod ms, if isBootSummary ms then IsBoot else NotBoot)
-- | The entry point to the parallel upsweep.
--
@@ -904,8 +916,8 @@ parUpsweep_one mod home_mod_map comp_graph_loops lcl_dflags cleanup par_sem
-- All the textual imports of this module.
let textual_deps = Set.fromList $ mapFst (mkModule (thisPackage lcl_dflags)) $
- zip home_imps (repeat False) ++
- zip home_src_imps (repeat True)
+ zip home_imps (repeat NotBoot) ++
+ zip home_src_imps (repeat IsBoot)
-- Dealing with module loops
-- ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1420,13 +1432,14 @@ moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVertices nodes, l
numbered_summaries = zip summaries [1..]
lookup_node :: HscSource -> ModuleName -> Maybe SummaryNode
- lookup_node hs_src mod = Map.lookup (mod, hs_src) node_map
+ lookup_node hs_src mod = Map.lookup (mod, hscSourceToIsBoot hs_src) node_map
lookup_key :: HscSource -> ModuleName -> Maybe Int
lookup_key hs_src mod = fmap summaryNodeKey (lookup_node hs_src mod)
node_map :: NodeMap SummaryNode
- node_map = Map.fromList [ ((moduleName (ms_mod s), ms_hsc_src s), node)
+ node_map = Map.fromList [ ((moduleName (ms_mod s),
+ hscSourceToIsBoot (ms_hsc_src s)), node)
| node@(s, _, _) <- nodes ]
-- We use integers as the keys for the SCC algorithm
@@ -1459,14 +1472,17 @@ moduleGraphNodes drop_hs_boot_nodes summaries = (graphFromEdgedVertices nodes, l
out_edge_keys :: HscSource -> [ModuleName] -> [Int]
out_edge_keys hi_boot ms = mapMaybe (lookup_key hi_boot) ms
-- If we want keep_hi_boot_nodes, then we do lookup_key with
- -- the IsBootInterface parameter True; else False
+ -- IsBoot; else NotBoot
-
-type NodeKey = (ModuleName, HscSource) -- The nodes of the graph are
-type NodeMap a = Map.Map NodeKey a -- keyed by (mod, src_file_type) pairs
+-- The nodes of the graph are keyed by (mod, is boot?) pairs
+-- NB: hsig files show up as *normal* nodes (not boot!), since they don't
+-- participate in cycles (for now)
+type NodeKey = (ModuleName, IsBoot)
+type NodeMap a = Map.Map NodeKey a
msKey :: ModSummary -> NodeKey
-msKey (ModSummary { ms_mod = mod, ms_hsc_src = boot }) = (moduleName mod,boot)
+msKey (ModSummary { ms_mod = mod, ms_hsc_src = boot })
+ = (moduleName mod, hscSourceToIsBoot boot)
mkNodeMap :: [ModSummary] -> NodeMap ModSummary
mkNodeMap summaries = Map.fromList [ (msKey s, s) | s <- summaries]
@@ -1535,9 +1551,19 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
rootSummariesOk <- reportImportErrors rootSummaries
let root_map = mkRootMap rootSummariesOk
checkDuplicates root_map
- summs <- loop (concatMap msDeps rootSummariesOk) root_map
+ summs <- loop (concatMap calcDeps rootSummariesOk) root_map
return summs
where
+ -- When we're compiling a signature file, we have an implicit
+ -- dependency on what-ever the signature's implementation is.
+ -- (But not when we're type checking!)
+ calcDeps summ
+ | HsigFile <- ms_hsc_src summ
+ , Just m <- getSigOf (hsc_dflags hsc_env) (moduleName (ms_mod summ))
+ , modulePackageKey m == thisPackage (hsc_dflags hsc_env)
+ = (noLoc (moduleName m), NotBoot) : msDeps summ
+ | otherwise = msDeps summ
+
dflags = hsc_dflags hsc_env
roots = hsc_targets hsc_env
@@ -1553,7 +1579,7 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
else return $ Left $ mkPlainErrMsg dflags noSrcSpan $
text "can't find file:" <+> text file
getRootSummary (Target (TargetModule modl) obj_allowed maybe_buf)
- = do maybe_summary <- summariseModule hsc_env old_summary_map False
+ = do maybe_summary <- summariseModule hsc_env old_summary_map NotBoot
(L rootLoc modl) obj_allowed
maybe_buf excl_mods
case maybe_summary of
@@ -1575,7 +1601,7 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
dup_roots :: [[ModSummary]] -- Each at least of length 2
dup_roots = filterOut isSingleton $ map rights $ nodeMapElts root_map
- loop :: [(Located ModuleName,IsBootInterface)]
+ loop :: [(Located ModuleName,IsBoot)]
-- Work list: process these modules
-> NodeMap [Either ErrMsg ModSummary]
-- Visited set; the range is a list because
@@ -1598,9 +1624,10 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
case mb_s of
Nothing -> loop ss done
Just (Left e) -> loop ss (Map.insert key [Left e] done)
- Just (Right s)-> loop (msDeps s ++ ss) (Map.insert key [Right s] done)
+ Just (Right s)-> loop (calcDeps s ++ ss)
+ (Map.insert key [Right s] done)
where
- key = (unLoc wanted_mod, if is_boot then HsBootFile else HsSrcFile)
+ key = (unLoc wanted_mod, is_boot)
mkRootMap :: [ModSummary] -> NodeMap [Either ErrMsg ModSummary]
mkRootMap summaries = Map.insertListWith (flip (++))
@@ -1615,10 +1642,10 @@ mkRootMap summaries = Map.insertListWith (flip (++))
-- modules always contains B.hs if it contains B.hs-boot.
-- Remember, this pass isn't doing the topological sort. It's
-- just gathering the list of all relevant ModSummaries
-msDeps :: ModSummary -> [(Located ModuleName, IsBootInterface)]
+msDeps :: ModSummary -> [(Located ModuleName, IsBoot)]
msDeps s =
- concat [ [(m,True), (m,False)] | m <- ms_home_srcimps s ]
- ++ [ (m,False) | m <- ms_home_imps s ]
+ concat [ [(m,IsBoot), (m,NotBoot)] | m <- ms_home_srcimps s ]
+ ++ [ (m,NotBoot) | m <- ms_home_imps s ]
home_imps :: [Located (ImportDecl RdrName)] -> [Located ModuleName]
home_imps imps = [ ideclName i | L _ i <- imps, isLocal (ideclPkgQual i) ]
@@ -1678,7 +1705,7 @@ summariseFile hsc_env old_summaries file mb_phase obj_allowed maybe_buf
obj_timestamp <-
if isObjectTarget (hscTarget (hsc_dflags hsc_env))
|| obj_allowed -- bug #1205
- then liftIO $ getObjTimestamp location False
+ then liftIO $ getObjTimestamp location NotBoot
else return Nothing
return old_summary{ ms_obj_date = obj_timestamp }
else
@@ -1696,6 +1723,8 @@ summariseFile hsc_env old_summaries file mb_phase obj_allowed maybe_buf
new_summary src_timestamp = do
let dflags = hsc_dflags hsc_env
+ let hsc_src = if isHaskellSigFilename file then HsigFile else HsSrcFile
+
(dflags', hspp_fn, buf)
<- preprocessFile hsc_env file mb_phase maybe_buf
@@ -1716,7 +1745,7 @@ summariseFile hsc_env old_summaries file mb_phase obj_allowed maybe_buf
then liftIO $ modificationTimeIfExists (ml_obj_file location)
else return Nothing
- return (ModSummary { ms_mod = mod, ms_hsc_src = HsSrcFile,
+ return (ModSummary { ms_mod = mod, ms_hsc_src = hsc_src,
ms_location = location,
ms_hspp_file = hspp_fn,
ms_hspp_opts = dflags',
@@ -1736,7 +1765,7 @@ findSummaryBySourceFile summaries file
summariseModule
:: HscEnv
-> NodeMap ModSummary -- Map of old summaries
- -> IsBootInterface -- True <=> a {-# SOURCE #-} import
+ -> IsBoot -- IsBoot <=> a {-# SOURCE #-} import
-> Located ModuleName -- Imported module to be summarised
-> Bool -- object code allowed?
-> Maybe (StringBuffer, UTCTime)
@@ -1748,7 +1777,7 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
| wanted_mod `elem` excl_mods
= return Nothing
- | Just old_summary <- Map.lookup (wanted_mod, hsc_src) old_summary_map
+ | Just old_summary <- Map.lookup (wanted_mod, is_boot) old_summary_map
= do -- Find its new timestamp; all the
-- ModSummaries in the old map have valid ml_hs_files
let location = ms_location old_summary
@@ -1770,8 +1799,6 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
where
dflags = hsc_dflags hsc_env
- hsc_src = if is_boot then HsBootFile else HsSrcFile
-
check_timestamp old_summary location src_fn src_timestamp
| ms_hs_date old_summary == src_timestamp &&
not (gopt Opt_ForceRecomp dflags) = do
@@ -1809,8 +1836,8 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
just_found location mod = do
-- Adjust location to point to the hs-boot source file,
-- hi file, object file, when is_boot says so
- let location' | is_boot = addBootSuffixLocn location
- | otherwise = location
+ let location' | IsBoot <- is_boot = addBootSuffixLocn location
+ | otherwise = location
src_fn = expectJust "summarise2" (ml_hs_file location')
-- Check that it exists
@@ -1828,6 +1855,18 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
(dflags', hspp_fn, buf) <- preprocessFile hsc_env src_fn Nothing maybe_buf
(srcimps, the_imps, L mod_loc mod_name) <- getImports dflags' buf hspp_fn src_fn
+ -- NB: Despite the fact that is_boot is a top-level parameter, we
+ -- don't actually know coming into this function what the HscSource
+ -- of the module in question is. This is because we may be processing
+ -- this module because another module in the graph imported it: in this
+ -- case, we know if it's a boot or not because of the {-# SOURCE #-}
+ -- annotation, but we don't know if it's a signature or a regular
+ -- module until we actually look it up on the filesystem.
+ let hsc_src = case is_boot of
+ IsBoot -> HsBootFile
+ _ | isHaskellSigFilename src_fn -> HsigFile
+ | otherwise -> HsSrcFile
+
when (mod_name /= wanted_mod) $
throwOneError $ mkPlainErrMsg dflags' mod_loc $
text "File name does not match module name:"
@@ -1853,10 +1892,10 @@ summariseModule hsc_env old_summary_map is_boot (L loc wanted_mod)
ms_obj_date = obj_timestamp })))
-getObjTimestamp :: ModLocation -> Bool -> IO (Maybe UTCTime)
+getObjTimestamp :: ModLocation -> IsBoot -> IO (Maybe UTCTime)
getObjTimestamp location is_boot
- = if is_boot then return Nothing
- else modificationTimeIfExists (ml_obj_file location)
+ = if is_boot == IsBoot then return Nothing
+ else modificationTimeIfExists (ml_obj_file location)
preprocessFile :: HscEnv
@@ -1937,8 +1976,8 @@ cyclicModuleErr mss
graph = [(ms, msKey ms, get_deps ms) | ms <- mss]
get_deps :: ModSummary -> [NodeKey]
- get_deps ms = ([ (unLoc m, HsBootFile) | m <- ms_home_srcimps ms ] ++
- [ (unLoc m, HsSrcFile) | m <- ms_home_imps ms ])
+ get_deps ms = ([ (unLoc m, IsBoot) | m <- ms_home_srcimps ms ] ++
+ [ (unLoc m, NotBoot) | m <- ms_home_imps ms ])
show_path [] = panic "show_path"
show_path [m] = ptext (sLit "module") <+> ppr_ms m
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 15d67fc882..3f4af8d78d 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -631,7 +631,7 @@ hscCompileOneShot' hsc_env mod_summary src_changed
return HscNotGeneratingCode
_ ->
case ms_hsc_src mod_summary of
- HsBootFile ->
+ t | isHsBootOrSig t ->
do (iface, changed, _) <- hscSimpleIface' tc_result mb_old_hash
liftIO $ hscWriteIface dflags iface changed mod_summary
return HscUpdateBoot
diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs
index 123b0777fc..2460b83f6a 100644
--- a/compiler/main/HscTypes.lhs
+++ b/compiler/main/HscTypes.lhs
@@ -28,7 +28,9 @@ module HscTypes (
SourceModified(..),
-- * Information about the module being compiled
- HscSource(..), isHsBoot, hscSourceString, -- Re-exported from DriverPhases
+ -- (re-exported from DriverPhases)
+ HscSource(..), isHsBootOrSig, hscSourceString,
+
-- * State relating to modules in this package
HomePackageTable, HomeModInfo(..), emptyHomePackageTable,
@@ -38,7 +40,7 @@ module HscTypes (
-- * State relating to known packages
ExternalPackageState(..), EpsStats(..), addEpsInStats,
PackageTypeEnv, PackageIfaceTable, emptyPackageIfaceTable,
- lookupIfaceByModule, emptyModIface,
+ lookupIfaceByModule, emptyModIface, lookupHptByModule,
PackageInstEnv, PackageFamInstEnv, PackageRuleBase,
@@ -153,7 +155,7 @@ import PatSyn
import PrelNames ( gHC_PRIM, ioTyConName, printName, mkInteractiveModule )
import Packages hiding ( Version(..) )
import DynFlags
-import DriverPhases ( Phase, HscSource(..), isHsBoot, hscSourceString )
+import DriverPhases ( Phase, HscSource(..), isHsBootOrSig, hscSourceString )
import BasicTypes
import IfaceSyn
import CoreSyn ( CoreRule, CoreVect )
@@ -682,6 +684,7 @@ type ModLocationCache = ModuleEnv ModLocation
data ModIface
= ModIface {
mi_module :: !Module, -- ^ Name of the module we are for
+ mi_sig_of :: !(Maybe Module), -- ^ Are we a sig of another mod?
mi_iface_hash :: !Fingerprint, -- ^ Hash of the whole interface
mi_mod_hash :: !Fingerprint, -- ^ Hash of the ABI only
mi_flag_hash :: !Fingerprint, -- ^ Hash of the important flags
@@ -790,6 +793,7 @@ data ModIface
instance Binary ModIface where
put_ bh (ModIface {
mi_module = mod,
+ mi_sig_of = sig_of,
mi_boot = is_boot,
mi_iface_hash= iface_hash,
mi_mod_hash = mod_hash,
@@ -837,6 +841,7 @@ instance Binary ModIface where
put_ bh hpc_info
put_ bh trust
put_ bh trust_pkg
+ put_ bh sig_of
get bh = do
mod_name <- get bh
@@ -863,8 +868,10 @@ instance Binary ModIface where
hpc_info <- get bh
trust <- get bh
trust_pkg <- get bh
+ sig_of <- get bh
return (ModIface {
mi_module = mod_name,
+ mi_sig_of = sig_of,
mi_boot = is_boot,
mi_iface_hash = iface_hash,
mi_mod_hash = mod_hash,
@@ -901,6 +908,7 @@ type IfaceExport = AvailInfo
emptyModIface :: Module -> ModIface
emptyModIface mod
= ModIface { mi_module = mod,
+ mi_sig_of = Nothing,
mi_iface_hash = fingerprint0,
mi_mod_hash = fingerprint0,
mi_flag_hash = fingerprint0,
@@ -2321,7 +2329,7 @@ msObjFilePath ms = ml_obj_file (ms_location ms)
-- | Did this 'ModSummary' originate from a hs-boot file?
isBootSummary :: ModSummary -> Bool
-isBootSummary ms = isHsBoot (ms_hsc_src ms)
+isBootSummary ms = ms_hsc_src ms == HsBootFile
instance Outputable ModSummary where
ppr ms
@@ -2343,11 +2351,24 @@ showModMsg dflags target recomp mod_summary
HscInterpreted | recomp
-> text "interpreted"
HscNothing -> text "nothing"
- _ -> text (normalise $ msObjFilePath mod_summary),
+ _ | HsigFile == ms_hsc_src mod_summary -> text "nothing"
+ | otherwise -> text (normalise $ msObjFilePath mod_summary),
char ')']
where
mod = moduleName (ms_mod mod_summary)
- mod_str = showPpr dflags mod ++ hscSourceString (ms_hsc_src mod_summary)
+ mod_str = showPpr dflags mod
+ ++ hscSourceString' dflags mod (ms_hsc_src mod_summary)
+
+-- | Variant of hscSourceString which prints more information for signatures.
+-- This can't live in DriverPhases because this would cause a module loop.
+hscSourceString' :: DynFlags -> ModuleName -> HscSource -> String
+hscSourceString' _ _ HsSrcFile = ""
+hscSourceString' _ _ HsBootFile = "[boot]"
+hscSourceString' dflags mod HsigFile =
+ "[" ++ (maybe "abstract sig"
+ (("sig of "++).showPpr dflags)
+ (getSigOf dflags mod)) ++ "]"
+ -- NB: -sig-of could be missing if we're just typechecking
\end{code}
%************************************************************************
diff --git a/compiler/main/TidyPgm.lhs b/compiler/main/TidyPgm.lhs
index abe167d0a1..a975fdd5ac 100644
--- a/compiler/main/TidyPgm.lhs
+++ b/compiler/main/TidyPgm.lhs
@@ -121,6 +121,9 @@ Plan A: mkBootModDetails: omit pragmas, make interfaces small
code generator needs it. And to ensure that local names have
distinct OccNames in case of object-file splitting
+* If this an hsig file, drop the instances altogether too (they'll
+ get pulled in by the implicit module import.
+
\begin{code}
-- This is Plan A: make a small type env when typechecking only,
-- or when compiling a hs-boot file, or simply when not using -O
@@ -1112,7 +1115,8 @@ tidyTopBinds :: HscEnv
tidyTopBinds hsc_env this_mod unfold_env init_occ_env binds
= do mkIntegerId <- lookupMkIntegerName dflags hsc_env
- return $ tidy mkIntegerId init_env binds
+ integerSDataCon <- lookupIntegerSDataConName dflags hsc_env
+ return $ tidy mkIntegerId integerSDataCon init_env binds
where
dflags = hsc_dflags hsc_env
@@ -1120,32 +1124,37 @@ tidyTopBinds hsc_env this_mod unfold_env init_occ_env binds
this_pkg = thisPackage dflags
- tidy _ env [] = (env, [])
- tidy mkIntegerId env (b:bs) = let (env1, b') = tidyTopBind dflags this_pkg this_mod mkIntegerId unfold_env env b
- (env2, bs') = tidy mkIntegerId env1 bs
- in
- (env2, b':bs')
+ tidy _ _ env [] = (env, [])
+ tidy mkIntegerId integerSDataCon env (b:bs)
+ = let (env1, b') = tidyTopBind dflags this_pkg this_mod
+ mkIntegerId integerSDataCon unfold_env env b
+ (env2, bs') = tidy mkIntegerId integerSDataCon env1 bs
+ in (env2, b':bs')
------------------------
tidyTopBind :: DynFlags
-> PackageKey
-> Module
-> Id
+ -> Maybe DataCon
-> UnfoldEnv
-> TidyEnv
-> CoreBind
-> (TidyEnv, CoreBind)
-tidyTopBind dflags this_pkg this_mod mkIntegerId unfold_env (occ_env,subst1) (NonRec bndr rhs)
+tidyTopBind dflags this_pkg this_mod mkIntegerId integerSDataCon unfold_env
+ (occ_env,subst1) (NonRec bndr rhs)
= (tidy_env2, NonRec bndr' rhs')
where
Just (name',show_unfold) = lookupVarEnv unfold_env bndr
- caf_info = hasCafRefs dflags this_pkg this_mod (mkIntegerId, subst1) (idArity bndr) rhs
+ caf_info = hasCafRefs dflags this_pkg this_mod
+ (mkIntegerId, integerSDataCon, subst1) (idArity bndr) rhs
(bndr', rhs') = tidyTopPair dflags show_unfold tidy_env2 caf_info name' (bndr, rhs)
subst2 = extendVarEnv subst1 bndr bndr'
tidy_env2 = (occ_env, subst2)
-tidyTopBind dflags this_pkg this_mod mkIntegerId unfold_env (occ_env,subst1) (Rec prs)
+tidyTopBind dflags this_pkg this_mod mkIntegerId integerSDataCon unfold_env
+ (occ_env,subst1) (Rec prs)
= (tidy_env2, Rec prs')
where
prs' = [ tidyTopPair dflags show_unfold tidy_env2 caf_info name' (id,rhs)
@@ -1162,7 +1171,9 @@ tidyTopBind dflags this_pkg this_mod mkIntegerId unfold_env (occ_env,subst1) (Re
-- the CafInfo for a recursive group says whether *any* rhs in
-- the group may refer indirectly to a CAF (because then, they all do).
caf_info
- | or [ mayHaveCafRefs (hasCafRefs dflags this_pkg this_mod (mkIntegerId, subst1) (idArity bndr) rhs)
+ | or [ mayHaveCafRefs (hasCafRefs dflags this_pkg this_mod
+ (mkIntegerId, integerSDataCon, subst1)
+ (idArity bndr) rhs)
| (bndr,rhs) <- prs ] = MayHaveCafRefs
| otherwise = NoCafRefs
@@ -1299,7 +1310,7 @@ CAF list to keep track of non-collectable CAFs.
\begin{code}
hasCafRefs :: DynFlags -> PackageKey -> Module
- -> (Id, VarEnv Var) -> Arity -> CoreExpr
+ -> (Id, Maybe DataCon, VarEnv Var) -> Arity -> CoreExpr
-> CafInfo
hasCafRefs dflags this_pkg this_mod p arity expr
| is_caf || mentions_cafs = MayHaveCafRefs
@@ -1315,7 +1326,7 @@ hasCafRefs dflags this_pkg this_mod p arity expr
-- CorePrep later on, and we don't want to duplicate that
-- knowledge in rhsIsStatic below.
-cafRefsE :: DynFlags -> (Id, VarEnv Id) -> Expr a -> FastBool
+cafRefsE :: DynFlags -> (Id, Maybe DataCon, VarEnv Id) -> Expr a -> FastBool
cafRefsE _ p (Var id) = cafRefsV p id
cafRefsE dflags p (Lit lit) = cafRefsL dflags p lit
cafRefsE dflags p (App f a) = fastOr (cafRefsE dflags p f) (cafRefsE dflags p) a
@@ -1327,19 +1338,20 @@ cafRefsE dflags p (Cast e _co) = cafRefsE dflags p e
cafRefsE _ _ (Type _) = fastBool False
cafRefsE _ _ (Coercion _) = fastBool False
-cafRefsEs :: DynFlags -> (Id, VarEnv Id) -> [Expr a] -> FastBool
+cafRefsEs :: DynFlags -> (Id, Maybe DataCon, VarEnv Id) -> [Expr a] -> FastBool
cafRefsEs _ _ [] = fastBool False
cafRefsEs dflags p (e:es) = fastOr (cafRefsE dflags p e) (cafRefsEs dflags p) es
-cafRefsL :: DynFlags -> (Id, VarEnv Id) -> Literal -> FastBool
+cafRefsL :: DynFlags -> (Id, Maybe DataCon, VarEnv Id) -> Literal -> FastBool
-- Don't forget that mk_integer id might have Caf refs!
-- We first need to convert the Integer into its final form, to
-- see whether mkInteger is used.
-cafRefsL dflags p@(mk_integer, _) (LitInteger i _) = cafRefsE dflags p (cvtLitInteger dflags mk_integer i)
+cafRefsL dflags p@(mk_integer, sdatacon, _) (LitInteger i _)
+ = cafRefsE dflags p (cvtLitInteger dflags mk_integer sdatacon i)
cafRefsL _ _ _ = fastBool False
-cafRefsV :: (Id, VarEnv Id) -> Id -> FastBool
-cafRefsV (_, p) id
+cafRefsV :: (Id, Maybe DataCon, VarEnv Id) -> Id -> FastBool
+cafRefsV (_, _, p) id
| not (isLocalId id) = fastBool (mayHaveCafRefs (idCafInfo id))
| Just id' <- lookupVarEnv p id = fastBool (mayHaveCafRefs (idCafInfo id'))
| otherwise = fastBool False
diff --git a/compiler/prelude/PrelNames.lhs b/compiler/prelude/PrelNames.lhs
index e053b11c98..4e98739905 100644
--- a/compiler/prelude/PrelNames.lhs
+++ b/compiler/prelude/PrelNames.lhs
@@ -125,6 +125,8 @@ import BasicTypes
import Name
import SrcLoc
import FastString
+import Config ( cIntegerLibraryType, IntegerLibrary(..) )
+import Panic ( panic )
\end{code}
@@ -356,7 +358,9 @@ basicKnownKeyNames
-- GHCi Sandbox
, ghciIoClassName, ghciStepIoMName
- ]
+ ] ++ case cIntegerLibraryType of
+ IntegerGMP -> [integerSDataConName]
+ IntegerSimple -> []
genericTyConNames :: [Name]
genericTyConNames = [
@@ -916,7 +920,7 @@ fromIntegerName = varQual gHC_NUM (fsLit "fromInteger") fromIntegerClassOpKey
minusName = varQual gHC_NUM (fsLit "-") minusClassOpKey
negateName = varQual gHC_NUM (fsLit "negate") negateClassOpKey
-integerTyConName, mkIntegerName,
+integerTyConName, mkIntegerName, integerSDataConName,
integerToWord64Name, integerToInt64Name,
word64ToIntegerName, int64ToIntegerName,
plusIntegerName, timesIntegerName, smallIntegerName,
@@ -934,6 +938,10 @@ integerTyConName, mkIntegerName,
andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
shiftLIntegerName, shiftRIntegerName :: Name
integerTyConName = tcQual gHC_INTEGER_TYPE (fsLit "Integer") integerTyConKey
+integerSDataConName = conName gHC_INTEGER_TYPE (fsLit n) integerSDataConKey
+ where n = case cIntegerLibraryType of
+ IntegerGMP -> "S#"
+ IntegerSimple -> panic "integerSDataConName evaluated for integer-simple"
mkIntegerName = varQual gHC_INTEGER_TYPE (fsLit "mkInteger") mkIntegerIdKey
integerToWord64Name = varQual gHC_INTEGER_TYPE (fsLit "integerToWord64") integerToWord64IdKey
integerToInt64Name = varQual gHC_INTEGER_TYPE (fsLit "integerToInt64") integerToInt64IdKey
@@ -1515,8 +1523,8 @@ unitTyConKey = mkTupleTyConUnique BoxedTuple 0
\begin{code}
charDataConKey, consDataConKey, doubleDataConKey, falseDataConKey,
- floatDataConKey, intDataConKey, nilDataConKey, ratioDataConKey,
- stableNameDataConKey, trueDataConKey, wordDataConKey,
+ floatDataConKey, intDataConKey, integerSDataConKey, nilDataConKey,
+ ratioDataConKey, stableNameDataConKey, trueDataConKey, wordDataConKey,
ioDataConKey, integerDataConKey, eqBoxDataConKey, coercibleDataConKey :: Unique
charDataConKey = mkPreludeDataConUnique 1
consDataConKey = mkPreludeDataConUnique 2
@@ -1524,6 +1532,7 @@ doubleDataConKey = mkPreludeDataConUnique 3
falseDataConKey = mkPreludeDataConUnique 4
floatDataConKey = mkPreludeDataConUnique 5
intDataConKey = mkPreludeDataConUnique 6
+integerSDataConKey = mkPreludeDataConUnique 7
nilDataConKey = mkPreludeDataConUnique 11
ratioDataConKey = mkPreludeDataConUnique 12
stableNameDataConKey = mkPreludeDataConUnique 14
@@ -1553,11 +1562,6 @@ ltDataConKey = mkPreludeDataConUnique 27
eqDataConKey = mkPreludeDataConUnique 28
gtDataConKey = mkPreludeDataConUnique 29
--- For integer-gmp only
-integerGmpSDataConKey, integerGmpJDataConKey :: Unique
-integerGmpSDataConKey = mkPreludeDataConUnique 30
-integerGmpJDataConKey = mkPreludeDataConUnique 31
-
coercibleDataConKey = mkPreludeDataConUnique 32
\end{code}
diff --git a/compiler/prelude/TysWiredIn.lhs b/compiler/prelude/TysWiredIn.lhs
index b4ada73156..f4dca9a0de 100644
--- a/compiler/prelude/TysWiredIn.lhs
+++ b/compiler/prelude/TysWiredIn.lhs
@@ -29,9 +29,6 @@ module TysWiredIn (
charTyCon, charDataCon, charTyCon_RDR,
charTy, stringTy, charTyConName,
- -- integer-gmp only:
- integerGmpSDataCon,
-
-- * Double
doubleTyCon, doubleDataCon, doubleTy, doubleTyConName,
@@ -106,7 +103,6 @@ import Unique ( incrUnique, mkTupleTyConUnique,
import Data.Array
import FastString
import Outputable
-import Config
import Util
import BooleanFormula ( mkAnd )
@@ -160,9 +156,6 @@ wiredInTyCons = [ unitTyCon -- Not treated like other tuples, because
, typeNatKindCon
, typeSymbolKindCon
]
- ++ (case cIntegerLibraryType of
- IntegerGMP -> [integerTyCon]
- _ -> [])
\end{code}
\begin{code}
@@ -217,15 +210,6 @@ typeNatKindConName, typeSymbolKindConName :: Name
typeNatKindConName = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "Nat") typeNatKindConNameKey typeNatKindCon
typeSymbolKindConName = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "Symbol") typeSymbolKindConNameKey typeSymbolKindCon
--- For integer-gmp only:
-integerRealTyConName :: Name
-integerRealTyConName = case cIntegerLibraryType of
- IntegerGMP -> mkWiredInTyConName UserSyntax gHC_INTEGER_TYPE (fsLit "Integer") integerTyConKey integerTyCon
- _ -> panic "integerRealTyConName evaluated, but not integer-gmp"
-integerGmpSDataConName, integerGmpJDataConName :: Name
-integerGmpSDataConName = mkWiredInDataConName UserSyntax gHC_INTEGER_TYPE (fsLit "S#") integerGmpSDataConKey integerGmpSDataCon
-integerGmpJDataConName = mkWiredInDataConName UserSyntax gHC_INTEGER_TYPE (fsLit "J#") integerGmpJDataConKey integerGmpJDataCon
-
parrTyConName, parrDataConName :: Name
parrTyConName = mkWiredInTyConName BuiltInSyntax
gHC_PARR' (fsLit "[::]") parrTyConKey parrTyCon
@@ -571,28 +555,6 @@ stringTy = mkListTy charTy -- convenience only
\end{code}
\begin{code}
-integerTyCon :: TyCon
-integerTyCon = case cIntegerLibraryType of
- IntegerGMP ->
- pcNonRecDataTyCon integerRealTyConName Nothing []
- [integerGmpSDataCon, integerGmpJDataCon]
- _ ->
- panic "Evaluated integerTyCon, but not using IntegerGMP"
-
-integerGmpSDataCon :: DataCon
-integerGmpSDataCon = pcDataCon integerGmpSDataConName []
- [intPrimTy]
- integerTyCon
-
--- integerGmpJDataCon isn't exported, but we need to define it to fill
--- out integerTyCon
-integerGmpJDataCon :: DataCon
-integerGmpJDataCon = pcDataCon integerGmpJDataConName []
- [intPrimTy, byteArrayPrimTy]
- integerTyCon
-\end{code}
-
-\begin{code}
intTy :: Type
intTy = mkTyConTy intTyCon
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index c572e32ff7..96cb1aa4fd 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -173,7 +173,7 @@ rnTopBindsLHS fix_env binds
rnTopBindsRHS :: NameSet -> HsValBindsLR Name RdrName
-> RnM (HsValBinds Name, DefUses)
rnTopBindsRHS bound_names binds
- = do { is_boot <- tcIsHsBoot
+ = do { is_boot <- tcIsHsBootOrSig
; if is_boot
then rnTopBindsBoot binds
else rnValBindsRHS (TopSigCtxt bound_names False) binds }
diff --git a/compiler/rename/RnEnv.lhs b/compiler/rename/RnEnv.lhs
index 65da421e31..e33ed15808 100644
--- a/compiler/rename/RnEnv.lhs
+++ b/compiler/rename/RnEnv.lhs
@@ -84,6 +84,64 @@ import Constants ( mAX_TUPLE_SIZE )
%* *
%*********************************************************
+Note [Signature lazy interface loading]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+GHC's lazy interface loading can be a bit confusing, so this Note is an
+empirical description of what happens in one interesting case. When
+compiling a signature module against an its implementation, we do NOT
+load interface files associated with its names until after the type
+checking phase. For example:
+
+ module ASig where
+ data T
+ f :: T -> T
+
+Suppose we compile this with -sig-of "A is ASig":
+
+ module B where
+ data T = T
+ f T = T
+
+ module A(module B) where
+ import B
+
+During type checking, we'll load A.hi because we need to know what the
+RdrEnv for the module is, but we DO NOT load the interface for B.hi!
+It's wholly unnecessary: our local definition 'data T' in ASig is all
+the information we need to finish type checking. This is contrast to
+type checking of ordinary Haskell files, in which we would not have the
+local definition "data T" and would need to consult B.hi immediately.
+(Also, this situation never occurs for hs-boot files, since you're not
+allowed to reexport from another module.)
+
+After type checking, we then check that the types we provided are
+consistent with the backing implementation (in checkHiBootOrHsigIface).
+At this point, B.hi is loaded, because we need something to compare
+against.
+
+I discovered this behavior when trying to figure out why type class
+instances for Data.Map weren't in the EPS when I was type checking a
+test very much like ASig (sigof02dm): the associated interface hadn't
+been loaded yet! (The larger issue is a moot point, since an instance
+declared in a signature can never be a duplicate.)
+
+This behavior might change in the future. Consider this
+alternate module B:
+
+ module B where
+ {-# DEPRECATED T, f "Don't use" #-}
+ data T = T
+ f T = T
+
+One might conceivably want to report deprecation warnings when compiling
+ASig with -sig-of B, in which case we need to look at B.hi to find the
+deprecation warnings during renaming. At the moment, you don't get any
+warning until you use the identifier further downstream. This would
+require adjusting addUsedRdrName so that during signature compilation,
+we do not report deprecation warnings for LocalDef. See also
+Note [Handling of deprecations]
+
\begin{code}
newTopSrcBinder :: Located RdrName -> RnM Name
newTopSrcBinder (L loc rdr_name)
@@ -141,12 +199,36 @@ newTopSrcBinder (L loc rdr_name)
-- module name, we we get a confusing "M.T is not in scope" error later
; stage <- getStage
+ ; env <- getGblEnv
; if isBrackStage stage then
-- We are inside a TH bracket, so make an *Internal* name
-- See Note [Top-level Names in Template Haskell decl quotes] in RnNames
do { uniq <- newUnique
; return (mkInternalName uniq (rdrNameOcc rdr_name) loc) }
- else
+ else case tcg_impl_rdr_env env of
+ Just gr ->
+ -- We're compiling --sig-of, so resolve with respect to this
+ -- module.
+ -- See Note [Signature parameters in TcGblEnv and DynFlags]
+ do { case lookupGlobalRdrEnv gr (rdrNameOcc rdr_name) of
+ -- Be sure to override the loc so that we get accurate
+ -- information later
+ [GRE{ gre_name = n }] -> do
+ -- NB: Just adding this line will not work:
+ -- addUsedRdrName True gre rdr_name
+ -- see Note [Signature lazy interface loading] for
+ -- more details.
+ return (setNameLoc n loc)
+ _ -> do
+ { -- NB: cannot use reportUnboundName rdr_name
+ -- because it looks up in the wrong RdrEnv
+ -- ToDo: more helpful error messages
+ ; addErr (unknownNameErr (pprNonVarNameSpace
+ (occNameSpace (rdrNameOcc rdr_name))) rdr_name)
+ ; return (mkUnboundName rdr_name)
+ }
+ }
+ Nothing ->
-- Normal case
do { this_mod <- getModule
; newGlobalBinder this_mod (rdrNameOcc rdr_name) loc } }
@@ -1604,13 +1686,17 @@ mapFvRnCPS f (x:xs) cont = f x $ \ x' ->
warnUnusedTopBinds :: [GlobalRdrElt] -> RnM ()
warnUnusedTopBinds gres
= whenWOptM Opt_WarnUnusedBinds
- $ do isBoot <- tcIsHsBoot
+ $ do env <- getGblEnv
+ let isBoot = tcg_src env == HsBootFile
let noParent gre = case gre_par gre of
NoParent -> True
ParentIs _ -> False
-- Don't warn about unused bindings with parents in
-- .hs-boot files, as you are sometimes required to give
-- unused bindings (trac #3449).
+ -- HOWEVER, in a signature file, you are never obligated to put a
+ -- definition in the main text. Thus, if you define something
+ -- and forget to export it, we really DO want to warn.
gres' = if isBoot then filter noParent gres
else gres
warnUnusedGREs gres'
diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs
index cd43d8a866..51c71b083a 100644
--- a/compiler/rename/RnNames.lhs
+++ b/compiler/rename/RnNames.lhs
@@ -10,6 +10,7 @@ module RnNames (
rnImports, getLocalNonValBinders,
rnExports, extendGlobalRdrEnvRn,
gresFromAvails,
+ calculateAvails,
reportUnusedNames,
checkConName
) where
@@ -213,14 +214,7 @@ rnImportDecl this_mod
$+$ ptext (sLit $ "please enable Safe Haskell through either "
++ "Safe, Trustworthy or Unsafe"))
- let imp_mod = mi_module iface
- warns = mi_warns iface
- orph_iface = mi_orphan iface
- has_finsts = mi_finsts iface
- deps = mi_deps iface
- trust = getSafeMode $ mi_trust iface
- trust_pkg = mi_trust_pkg iface
-
+ let
qual_mod_name = as_mod `orElse` imp_mod_name
imp_spec = ImpDeclSpec { is_mod = imp_mod_name, is_qual = qual_only,
is_dloc = loc, is_as = qual_mod_name }
@@ -230,63 +224,6 @@ rnImportDecl this_mod
let gbl_env = mkGlobalRdrEnv (filterOut from_this_mod gres)
from_this_mod gre = nameModule (gre_name gre) == this_mod
- -- If the module exports anything defined in this module, just
- -- ignore it. Reason: otherwise it looks as if there are two
- -- local definition sites for the thing, and an error gets
- -- reported. Easiest thing is just to filter them out up
- -- front. This situation only arises if a module imports
- -- itself, or another module that imported it. (Necessarily,
- -- this invoves a loop.)
- --
- -- We do this *after* filterImports, so that if you say
- -- module A where
- -- import B( AType )
- -- type AType = ...
- --
- -- module B( AType ) where
- -- import {-# SOURCE #-} A( AType )
- --
- -- then you won't get a 'B does not export AType' message.
-
-
- -- Compute new transitive dependencies
-
- orphans | orph_iface = ASSERT( not (imp_mod `elem` dep_orphs deps) )
- imp_mod : dep_orphs deps
- | otherwise = dep_orphs deps
-
- finsts | has_finsts = ASSERT( not (imp_mod `elem` dep_finsts deps) )
- imp_mod : dep_finsts deps
- | otherwise = dep_finsts deps
-
- pkg = modulePackageKey (mi_module iface)
-
- -- Does this import mean we now require our own pkg
- -- to be trusted? See Note [Trust Own Package]
- ptrust = trust == Sf_Trustworthy || trust_pkg
-
- (dependent_mods, dependent_pkgs, pkg_trust_req)
- | pkg == thisPackage dflags =
- -- Imported module is from the home package
- -- Take its dependent modules and add imp_mod itself
- -- Take its dependent packages unchanged
- --
- -- NB: (dep_mods deps) might include a hi-boot file
- -- for the module being compiled, CM. Do *not* filter
- -- this out (as we used to), because when we've
- -- finished dealing with the direct imports we want to
- -- know if any of them depended on CM.hi-boot, in
- -- which case we should do the hi-boot consistency
- -- check. See LoadIface.loadHiBootInterface
- ((imp_mod_name, want_boot) : dep_mods deps, dep_pkgs deps, ptrust)
-
- | otherwise =
- -- Imported module is from another package
- -- Dump the dependent modules
- -- Add the package imp_mod comes from to the dependent packages
- ASSERT2( not (pkg `elem` (map fst $ dep_pkgs deps))
- , ppr pkg <+> ppr (dep_pkgs deps) )
- ([], (pkg, False) : dep_pkgs deps, False)
-- True <=> import M ()
import_all = case imp_details of
@@ -298,29 +235,14 @@ rnImportDecl this_mod
|| (not implicit && safeDirectImpsReq dflags)
|| (implicit && safeImplicitImpsReq dflags)
- imports = ImportAvails {
- imp_mods = unitModuleEnv imp_mod
- [(qual_mod_name, import_all, loc, mod_safe')],
- imp_orphs = orphans,
- imp_finsts = finsts,
- imp_dep_mods = mkModDeps dependent_mods,
- imp_dep_pkgs = map fst $ dependent_pkgs,
- -- Add in the imported modules trusted package
- -- requirements. ONLY do this though if we import the
- -- module as a safe import.
- -- See Note [Tracking Trust Transitively]
- -- and Note [Trust Transitive Property]
- imp_trust_pkgs = if mod_safe'
- then map fst $ filter snd dependent_pkgs
- else [],
- -- Do we require our own pkg to be trusted?
- -- See Note [Trust Own Package]
- imp_trust_own_pkg = pkg_trust_req
- }
+ let imports
+ = (calculateAvails dflags iface mod_safe' want_boot) {
+ imp_mods = unitModuleEnv (mi_module iface)
+ [(qual_mod_name, import_all, loc, mod_safe')] }
-- Complain if we import a deprecated module
whenWOptM Opt_WarnWarningsDeprecations (
- case warns of
+ case (mi_warns iface) of
WarnAll txt -> addWarn $ moduleWarn imp_mod_name txt
_ -> return ()
)
@@ -330,6 +252,99 @@ rnImportDecl this_mod
return (new_imp_decl, gbl_env, imports, mi_hpc iface)
+-- | Calculate the 'ImportAvails' induced by an import of a particular
+-- interface, but without 'imp_mods'.
+calculateAvails :: DynFlags
+ -> ModIface
+ -> IsSafeImport
+ -> IsBootInterface
+ -> ImportAvails
+calculateAvails dflags iface mod_safe' want_boot =
+ let imp_mod = mi_module iface
+ orph_iface = mi_orphan iface
+ has_finsts = mi_finsts iface
+ deps = mi_deps iface
+ trust = getSafeMode $ mi_trust iface
+ trust_pkg = mi_trust_pkg iface
+
+ -- If the module exports anything defined in this module, just
+ -- ignore it. Reason: otherwise it looks as if there are two
+ -- local definition sites for the thing, and an error gets
+ -- reported. Easiest thing is just to filter them out up
+ -- front. This situation only arises if a module imports
+ -- itself, or another module that imported it. (Necessarily,
+ -- this invoves a loop.)
+ --
+ -- We do this *after* filterImports, so that if you say
+ -- module A where
+ -- import B( AType )
+ -- type AType = ...
+ --
+ -- module B( AType ) where
+ -- import {-# SOURCE #-} A( AType )
+ --
+ -- then you won't get a 'B does not export AType' message.
+
+
+ -- Compute new transitive dependencies
+
+ orphans | orph_iface = ASSERT( not (imp_mod `elem` dep_orphs deps) )
+ imp_mod : dep_orphs deps
+ | otherwise = dep_orphs deps
+
+ finsts | has_finsts = ASSERT( not (imp_mod `elem` dep_finsts deps) )
+ imp_mod : dep_finsts deps
+ | otherwise = dep_finsts deps
+
+ pkg = modulePackageKey (mi_module iface)
+
+ -- Does this import mean we now require our own pkg
+ -- to be trusted? See Note [Trust Own Package]
+ ptrust = trust == Sf_Trustworthy || trust_pkg
+
+ (dependent_mods, dependent_pkgs, pkg_trust_req)
+ | pkg == thisPackage dflags =
+ -- Imported module is from the home package
+ -- Take its dependent modules and add imp_mod itself
+ -- Take its dependent packages unchanged
+ --
+ -- NB: (dep_mods deps) might include a hi-boot file
+ -- for the module being compiled, CM. Do *not* filter
+ -- this out (as we used to), because when we've
+ -- finished dealing with the direct imports we want to
+ -- know if any of them depended on CM.hi-boot, in
+ -- which case we should do the hi-boot consistency
+ -- check. See LoadIface.loadHiBootInterface
+ ((moduleName imp_mod,want_boot):dep_mods deps,dep_pkgs deps,ptrust)
+
+ | otherwise =
+ -- Imported module is from another package
+ -- Dump the dependent modules
+ -- Add the package imp_mod comes from to the dependent packages
+ ASSERT2( not (pkg `elem` (map fst $ dep_pkgs deps))
+ , ppr pkg <+> ppr (dep_pkgs deps) )
+ ([], (pkg, False) : dep_pkgs deps, False)
+
+ in ImportAvails {
+ imp_mods = emptyModuleEnv, -- this gets filled in later
+ imp_orphs = orphans,
+ imp_finsts = finsts,
+ imp_dep_mods = mkModDeps dependent_mods,
+ imp_dep_pkgs = map fst $ dependent_pkgs,
+ -- Add in the imported modules trusted package
+ -- requirements. ONLY do this though if we import the
+ -- module as a safe import.
+ -- See Note [Tracking Trust Transitively]
+ -- and Note [Trust Transitive Property]
+ imp_trust_pkgs = if mod_safe'
+ then map fst $ filter snd dependent_pkgs
+ else [],
+ -- Do we require our own pkg to be trusted?
+ -- See Note [Trust Own Package]
+ imp_trust_own_pkg = pkg_trust_req
+ }
+
+
warnRedundantSourceImport :: ModuleName -> SDoc
warnRedundantSourceImport mod_name
= ptext (sLit "Unnecessary {-# SOURCE #-} in the import of module")
@@ -489,7 +504,7 @@ getLocalNonValBinders fixity_env
-- Finish off with value binders:
-- foreign decls for an ordinary module
-- type sigs in case of a hs-boot file only
- ; is_boot <- tcIsHsBoot
+ ; is_boot <- tcIsHsBootOrSig
; let val_bndrs | is_boot = hs_boot_sig_bndrs
| otherwise = for_hs_bndrs
; val_avails <- mapM new_simple val_bndrs
diff --git a/compiler/stranal/DmdAnal.lhs b/compiler/stranal/DmdAnal.lhs
index 5cb2655afd..244aa5b0ee 100644
--- a/compiler/stranal/DmdAnal.lhs
+++ b/compiler/stranal/DmdAnal.lhs
@@ -1089,7 +1089,8 @@ extendSigsWithLam env id
findBndrDmd :: AnalEnv -> Bool -> DmdType -> Id -> (DmdType, Demand)
-- See Note [Trimming a demand to a type] in Demand.lhs
findBndrDmd env arg_of_dfun dmd_ty id
- = (dmd_ty', dmd')
+ = -- pprTrace "findBndrDmd" (vcat [ ppr id, ppr id_ty, ppr starting_dmd, ppr (findTypeShape fam_envs id_ty), ppr dmd' ])
+ (dmd_ty', dmd')
where
dmd' = zapDemand (ae_dflags env) $
strictify $
diff --git a/compiler/typecheck/Inst.lhs b/compiler/typecheck/Inst.lhs
index 154df92c28..17366a3aa2 100644
--- a/compiler/typecheck/Inst.lhs
+++ b/compiler/typecheck/Inst.lhs
@@ -60,6 +60,7 @@ import Util
import Outputable
import Control.Monad( unless )
import Data.List( mapAccumL )
+import Data.Maybe( isJust )
\end{code}
@@ -466,6 +467,7 @@ addLocalInst (home_ie, my_insts) ispec
-- 'dups' are those 'matches' that are equal to the new one
; isGHCi <- getIsGHCi
; eps <- getEps
+ ; tcg_env <- getGblEnv
; let (home_ie', my_insts')
| isGHCi = ( deleteFromInstEnv home_ie ispec
, filterOut (identicalInstHead ispec) my_insts)
@@ -474,7 +476,15 @@ addLocalInst (home_ie, my_insts) ispec
-- silently delete it
(_tvs, cls, tys) = instanceHead ispec
- inst_envs = (eps_inst_env eps, home_ie')
+ -- If we're compiling sig-of and there's an external duplicate
+ -- instance, silently ignore it (that's the instance we're
+ -- implementing!) NB: we still count local duplicate instances
+ -- as errors.
+ -- See Note [Signature files and type class instances]
+ global_ie
+ | isJust (tcg_sig_of tcg_env) = emptyInstEnv
+ | otherwise = eps_inst_env eps
+ inst_envs = (global_ie, home_ie')
(matches, _, _) = lookupInstEnv inst_envs cls tys
dups = filter (identicalInstHead ispec) (map fst matches)
@@ -483,14 +493,63 @@ addLocalInst (home_ie, my_insts) ispec
Just specs -> funDepErr ispec specs
Nothing -> return ()
- -- Check for duplicate instance decls
+ -- Check for duplicate instance decls.
; unless (null dups) $
dupInstErr ispec (head dups)
; return (extendInstEnv home_ie' ispec, ispec:my_insts') }
\end{code}
-Errors and tracing
+Note [Signature files and type class instances]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Instances in signature files do not have an effect when compiling:
+when you compile a signature against an implementation, you will
+see the instances WHETHER OR NOT the instance is declared in
+the file (this is because the signatures go in the EPS and we
+can't filter them out easily.) This is also why we cannot
+place the instance in the hi file: it would show up as a duplicate,
+and we don't have instance reexports anyway.
+
+However, you might find them useful when typechecking against
+a signature: the instance is a way of indicating to GHC that
+some instance exists, in case downstream code uses it.
+
+Implementing this is a little tricky. Consider the following
+situation (sigof03):
+
+ module A where
+ instance C T where ...
+
+ module ASig where
+ instance C T
+
+When compiling ASig, A.hi is loaded, which brings its instances
+into the EPS. When we process the instance declaration in ASig,
+we should ignore it for the purpose of doing a duplicate check,
+since it's not actually a duplicate. But don't skip the check
+entirely, we still want this to fail (tcfail221):
+
+ module ASig where
+ instance C T
+ instance C T
+
+Note that in some situations, the interface containing the type
+class instances may not have been loaded yet at all. The usual
+situation when A imports another module which provides the
+instances (sigof02m):
+
+ module A(module B) where
+ import B
+
+See also Note [Signature lazy interface loading]. We can't
+rely on this, however, since sometimes we'll have spurious
+type class instances in the EPS, see #9422 (sigof02dm)
+
+%************************************************************************
+%* *
+ Errors and tracing
+%* *
+%************************************************************************
\begin{code}
traceDFuns :: [ClsInst] -> TcRn ()
diff --git a/compiler/typecheck/TcBinds.lhs b/compiler/typecheck/TcBinds.lhs
index d0e875c17e..e919baca85 100644
--- a/compiler/typecheck/TcBinds.lhs
+++ b/compiler/typecheck/TcBinds.lhs
@@ -20,7 +20,7 @@ import {-# SOURCE #-} TcPatSyn ( tcPatSynDecl, tcPatSynWrapper )
import DynFlags
import HsSyn
-import HscTypes( isHsBoot )
+import HscTypes( isHsBootOrSig )
import TcRnMonad
import TcEnv
import TcUnify
@@ -184,7 +184,7 @@ tcRecSelBinds (ValBindsOut binds sigs)
= tcExtendGlobalValEnv [sel_id | L _ (IdSig sel_id) <- sigs] $
do { (rec_sel_binds, tcg_env) <- discardWarnings (tcValBinds TopLevel binds sigs getGblEnv)
; let tcg_env'
- | isHsBoot (tcg_src tcg_env) = tcg_env
+ | isHsBootOrSig (tcg_src tcg_env) = tcg_env
| otherwise = tcg_env { tcg_binds = foldr (unionBags . snd)
(tcg_binds tcg_env)
rec_sel_binds }
diff --git a/compiler/typecheck/TcDeriv.lhs b/compiler/typecheck/TcDeriv.lhs
index dd3c7b44b3..a429881233 100644
--- a/compiler/typecheck/TcDeriv.lhs
+++ b/compiler/typecheck/TcDeriv.lhs
@@ -356,7 +356,7 @@ tcDeriving tycl_decls inst_decls deriv_decls
; return (g, emptyBag, emptyValBindsOut)}) $
do { -- Fish the "deriving"-related information out of the TcEnv
-- And make the necessary "equations".
- is_boot <- tcIsHsBoot
+ is_boot <- tcIsHsBootOrSig
; traceTc "tcDeriving" (ppr is_boot)
; early_specs <- makeDerivSpecs is_boot tycl_decls inst_decls deriv_decls
diff --git a/compiler/typecheck/TcEnv.lhs b/compiler/typecheck/TcEnv.lhs
index 9eeaaa2d09..bcd6bfdf82 100644
--- a/compiler/typecheck/TcEnv.lhs
+++ b/compiler/typecheck/TcEnv.lhs
@@ -772,7 +772,7 @@ name, like otber top-level names, and hence must be made with newGlobalBinder.
\begin{code}
newDFunName :: Class -> [Type] -> SrcSpan -> TcM Name
newDFunName clas tys loc
- = do { is_boot <- tcIsHsBoot
+ = do { is_boot <- tcIsHsBootOrSig
; mod <- getModule
; let info_string = occNameString (getOccName clas) ++
concatMap (occNameString.getDFunTyKey) tys
diff --git a/compiler/typecheck/TcInstDcls.lhs b/compiler/typecheck/TcInstDcls.lhs
index 7e73c85f34..ec31471c82 100644
--- a/compiler/typecheck/TcInstDcls.lhs
+++ b/compiler/typecheck/TcInstDcls.lhs
@@ -52,7 +52,7 @@ import BasicTypes
import DynFlags
import ErrUtils
import FastString
-import HscTypes ( isHsBoot )
+import HscTypes ( isHsBootOrSig )
import Id
import MkId
import Name
@@ -432,8 +432,9 @@ tcInstDecls1 tycl_decls inst_decls deriv_decls
(typeableClassName == is_cls_nm (iSpec i))
-- but not those that come from Data.Typeable.Internal
&& tcg_mod env /= tYPEABLE_INTERNAL
- -- nor those from an .hs-boot file (deriving can't be used there)
- && not (isHsBoot (tcg_src env))
+ -- nor those from an .hs-boot or .hsig file
+ -- (deriving can't be used there)
+ && not (isHsBootOrSig (tcg_src env))
then (i:typeableInsts, otherInsts)
else (typeableInsts, i:otherInsts)
@@ -511,7 +512,7 @@ tcClsInstDecl (L loc (ClsInstDecl { cid_poly_ty = poly_ty, cid_binds = binds
, cid_datafam_insts = adts }))
= setSrcSpan loc $
addErrCtxt (instDeclCtxt1 poly_ty) $
- do { is_boot <- tcIsHsBoot
+ do { is_boot <- tcIsHsBootOrSig
; checkTc (not is_boot || (isEmptyLHsBinds binds && null uprags))
badBootDeclErr
@@ -622,7 +623,7 @@ tcFamInstDeclCombined mb_clsinfo fam_tc_lname
-- and can't (currently) be in an hs-boot file
; traceTc "tcFamInstDecl" (ppr fam_tc_lname)
; type_families <- xoptM Opt_TypeFamilies
- ; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file?
+ ; is_boot <- tcIsHsBootOrSig -- Are we compiling an hs-boot file?
; checkTc type_families $ badFamInstDecl fam_tc_lname
; checkTc (not is_boot) $ badBootFamInstDeclErr
diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs
index 91abcd3fa1..b48e307e6c 100644
--- a/compiler/typecheck/TcMType.lhs
+++ b/compiler/typecheck/TcMType.lhs
@@ -37,7 +37,7 @@ module TcMType (
-- Instantiation
tcInstTyVars, newSigTyVar,
tcInstType,
- tcInstSkolTyVars, tcInstSuperSkolTyVars,tcInstSuperSkolTyVarsX,
+ tcInstSkolTyVars, tcInstSuperSkolTyVarsX,
tcInstSigTyVarsLoc, tcInstSigTyVars,
tcInstSkolType,
tcSkolDFunType, tcSuperSkolTyVars,
@@ -197,7 +197,7 @@ tcInstType inst_tyvars ty
tcSkolDFunType :: Type -> TcM ([TcTyVar], TcThetaType, TcType)
-- Instantiate a type signature with skolem constants.
-- We could give them fresh names, but no need to do so
-tcSkolDFunType ty = tcInstType (\tvs -> return (tcSuperSkolTyVars tvs)) ty
+tcSkolDFunType ty = tcInstType tcInstSuperSkolTyVars ty
tcSuperSkolTyVars :: [TyVar] -> (TvSubst, [TcTyVar])
-- Make skolem constants, but do *not* give them new names, as above
@@ -216,8 +216,8 @@ tcSuperSkolTyVar subst tv
tcInstSkolTyVars :: [TyVar] -> TcM (TvSubst, [TcTyVar])
tcInstSkolTyVars = tcInstSkolTyVars' False emptyTvSubst
-tcInstSuperSkolTyVars :: [TyVar] -> TcM [TcTyVar]
-tcInstSuperSkolTyVars = fmap snd . tcInstSuperSkolTyVarsX emptyTvSubst
+tcInstSuperSkolTyVars :: [TyVar] -> TcM (TvSubst, [TcTyVar])
+tcInstSuperSkolTyVars = tcInstSuperSkolTyVarsX emptyTvSubst
tcInstSuperSkolTyVarsX :: TvSubst -> [TyVar] -> TcM (TvSubst, [TcTyVar])
tcInstSuperSkolTyVarsX subst = tcInstSkolTyVars' True subst
diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs
index 2bb8d2d1af..3440b4ff3a 100644
--- a/compiler/typecheck/TcRnDriver.lhs
+++ b/compiler/typecheck/TcRnDriver.lhs
@@ -94,6 +94,7 @@ import MkId
import TidyPgm ( globaliseAndTidyId )
import TysWiredIn ( unitTy, mkListTy )
#endif
+import TidyPgm ( mkBootModDetailsTc )
import FastString
import Maybes
@@ -136,6 +137,124 @@ tcRnModule hsc_env hsc_src save_rn_syntax
; initTc hsc_env hsc_src save_rn_syntax this_mod $
tcRnModuleTcRnM hsc_env hsc_src parsedModule pair }
+-- To be called at the beginning of renaming hsig files.
+-- If we're processing a signature, load up the RdrEnv
+-- specified by sig-of so that
+-- when we process top-level bindings, we pull in the right
+-- original names. We also need to add in dependencies from
+-- the implementation (orphans, family instances, packages),
+-- similar to how rnImportDecl handles things.
+-- ToDo: Handle SafeHaskell
+tcRnSignature :: DynFlags -> HscSource -> TcRn TcGblEnv
+tcRnSignature dflags hsc_src
+ = do { tcg_env <- getGblEnv ;
+ case tcg_sig_of tcg_env of {
+ Just sof
+ | hsc_src /= HsigFile -> do
+ { addErr (ptext (sLit "Illegal -sig-of specified for non hsig"))
+ ; return tcg_env
+ }
+ | otherwise -> do
+ { sig_iface <- initIfaceTcRn $ loadSysInterface (text "sig-of") sof
+ ; let { gr = mkGlobalRdrEnv
+ (gresFromAvails LocalDef (mi_exports sig_iface))
+ ; avails = calculateAvails dflags
+ sig_iface False{- safe -} False{- boot -} }
+ ; return (tcg_env
+ { tcg_impl_rdr_env = Just gr
+ , tcg_imports = tcg_imports tcg_env `plusImportAvails` avails
+ })
+ } ;
+ Nothing
+ | HsigFile <- hsc_src
+ , HscNothing <- hscTarget dflags -> do
+ { return tcg_env
+ }
+ | HsigFile <- hsc_src -> do
+ { addErr (ptext (sLit "Missing -sig-of for hsig"))
+ ; failM }
+ | otherwise -> return tcg_env
+ }
+ }
+
+checkHsigIface :: HscEnv -> TcGblEnv -> TcRn ()
+checkHsigIface hsc_env tcg_env
+ = case tcg_impl_rdr_env tcg_env of
+ Just gr -> do { sig_details <- liftIO $ mkBootModDetailsTc hsc_env tcg_env
+ ; checkHsigIface' gr sig_details
+ }
+ Nothing -> return ()
+
+checkHsigIface' :: GlobalRdrEnv -> ModDetails -> TcRn ()
+checkHsigIface' gr
+ ModDetails { md_insts = sig_insts, md_fam_insts = sig_fam_insts,
+ md_types = sig_type_env, md_exports = sig_exports}
+ = do { traceTc "checkHsigIface" $ vcat
+ [ ppr sig_type_env, ppr sig_insts, ppr sig_exports ]
+ ; mapM_ check_export sig_exports
+ ; unless (null sig_fam_insts) $
+ panic ("TcRnDriver.checkHsigIface: Cannot handle family " ++
+ "instances in hsig files yet...")
+ ; mapM_ check_inst sig_insts
+ ; failIfErrsM
+ }
+ where
+ check_export sig_avail
+ -- Skip instances, we'll check them later
+ | name `elem` dfun_names = return ()
+ | otherwise = do
+ { -- Lookup local environment only (don't want to accidentally pick
+ -- up the backing copy.) We consult tcg_type_env because we want
+ -- to pick up wired in names too (which get dropped by the iface
+ -- creation process); it's OK for a signature file to mention
+ -- a wired in name.
+ env <- getGblEnv
+ ; case lookupNameEnv (tcg_type_env env) name of
+ Nothing
+ -- All this means is no local definition is available: but we
+ -- could have created the export this way:
+ --
+ -- module ASig(f) where
+ -- import B(f)
+ --
+ -- In this case, we have to just lookup the identifier in
+ -- the backing implementation and make sure it matches.
+ | [GRE { gre_name = name' }]
+ <- lookupGlobalRdrEnv gr (nameOccName name)
+ , name == name' -> return ()
+ -- TODO: Possibly give a different error if the identifier
+ -- is exported, but it's a different original name
+ | otherwise -> addErrAt (nameSrcSpan name)
+ (missingBootThing False name "exported by")
+ Just sig_thing -> do {
+ -- We use tcLookupImported_maybe because we want to EXCLUDE
+ -- tcg_env.
+ ; r <- tcLookupImported_maybe name
+ ; case r of
+ Failed err -> addErr err
+ Succeeded real_thing ->
+ when (not (checkBootDecl sig_thing real_thing))
+ $ addErrAt (nameSrcSpan (getName sig_thing))
+ (bootMisMatch False real_thing sig_thing)
+ }}
+ where
+ name = availName sig_avail
+
+ dfun_names = map getName sig_insts
+
+ -- In general, for hsig files we can't assume that the implementing
+ -- file actually implemented the instances (they may be reexported
+ -- from elsewhere. Where should we look for the instances? We do
+ -- the same as we would otherwise: consult the EPS. This isn't
+ -- perfect (we might conclude the module exports an instance
+ -- when it doesn't, see #9422), but we will never refuse to compile
+ -- something
+ check_inst :: ClsInst -> TcM ()
+ check_inst sig_inst
+ = do eps <- getEps
+ when (not (memberInstEnv (eps_inst_env eps) sig_inst)) $
+ addErrTc (instMisMatch False sig_inst)
+
tcRnModuleTcRnM :: HscEnv
-> HscSource
-> HsParsedModule
@@ -153,7 +272,12 @@ tcRnModuleTcRnM hsc_env hsc_src
})
(this_mod, prel_imp_loc)
= setSrcSpan loc $
- do { -- Deal with imports; first add implicit prelude
+ do { let { dflags = hsc_dflags hsc_env } ;
+
+ tcg_env <- tcRnSignature dflags hsc_src ;
+ setGblEnv tcg_env $ do {
+
+ -- Deal with imports; first add implicit prelude
implicit_prelude <- xoptM Opt_ImplicitPrelude;
let { prel_imports = mkPrelImports (moduleName this_mod) prel_imp_loc
implicit_prelude import_decls } ;
@@ -186,8 +310,8 @@ tcRnModuleTcRnM hsc_env hsc_src
-- Rename and type check the declarations
traceRn (text "rn1a") ;
- tcg_env <- if isHsBoot hsc_src then
- tcRnHsBootDecls local_decls
+ tcg_env <- if isHsBootOrSig hsc_src then
+ tcRnHsBootDecls hsc_src local_decls
else
{-# SCC "tcRnSrcDecls" #-}
tcRnSrcDecls boot_iface local_decls ;
@@ -205,6 +329,21 @@ tcRnModuleTcRnM hsc_env hsc_src
-- Must be done after processing the exports
tcg_env <- checkHiBootIface tcg_env boot_iface ;
+ -- Compare the hsig tcg_env with the real thing
+ checkHsigIface hsc_env tcg_env ;
+
+ -- Nub out type class instances now that we've checked them,
+ -- if we're compiling an hsig with sig-of.
+ -- See Note [Signature files and type class instances]
+ tcg_env <- (case tcg_sig_of tcg_env of
+ Just _ -> return tcg_env {
+ tcg_inst_env = emptyInstEnv,
+ tcg_fam_inst_env = emptyFamInstEnv,
+ tcg_insts = [],
+ tcg_fam_insts = []
+ }
+ Nothing -> return tcg_env) ;
+
-- The new type env is already available to stuff slurped from
-- interface files, via TcEnv.updateGlobalTypeEnv
-- It's important that this includes the stuff in checkHiBootIface,
@@ -224,8 +363,7 @@ tcRnModuleTcRnM hsc_env hsc_src
-- Dump output and return
tcDump tcg_env ;
return tcg_env
- }}}
-
+ }}}}
implicitPreludeWarn :: SDoc
implicitPreludeWarn
@@ -465,8 +603,8 @@ tc_rn_src_decls boot_details ds
%************************************************************************
\begin{code}
-tcRnHsBootDecls :: [LHsDecl RdrName] -> TcM TcGblEnv
-tcRnHsBootDecls decls
+tcRnHsBootDecls :: HscSource -> [LHsDecl RdrName] -> TcM TcGblEnv
+tcRnHsBootDecls hsc_src decls
= do { (first_group, group_tail) <- findSplice decls
-- Rename the declarations
@@ -487,12 +625,12 @@ tcRnHsBootDecls decls
-- Check for illegal declarations
; case group_tail of
- Just (SpliceDecl d _, _) -> badBootDecl "splice" d
+ Just (SpliceDecl d _, _) -> badBootDecl hsc_src "splice" d
Nothing -> return ()
- ; mapM_ (badBootDecl "foreign") for_decls
- ; mapM_ (badBootDecl "default") def_decls
- ; mapM_ (badBootDecl "rule") rule_decls
- ; mapM_ (badBootDecl "vect") vect_decls
+ ; mapM_ (badBootDecl hsc_src "foreign") for_decls
+ ; mapM_ (badBootDecl hsc_src "default") def_decls
+ ; mapM_ (badBootDecl hsc_src "rule") rule_decls
+ ; mapM_ (badBootDecl hsc_src "vect") vect_decls
-- Typecheck type/class/isntance decls
; traceTc "Tc2 (boot)" empty
@@ -514,7 +652,10 @@ tcRnHsBootDecls decls
-- are written into the interface file.
; let { type_env0 = tcg_type_env gbl_env
; type_env1 = extendTypeEnvWithIds type_env0 val_ids
- ; type_env2 = extendTypeEnvWithIds type_env1 dfun_ids
+ -- Don't add the dictionaries for hsig, we don't actually want
+ -- to /define/ the instance
+ ; type_env2 | HsigFile <- hsc_src = type_env1
+ | otherwise = extendTypeEnvWithIds type_env1 dfun_ids
; dfun_ids = map iDFunId inst_infos
}
@@ -522,10 +663,15 @@ tcRnHsBootDecls decls
}}
; traceTc "boot" (ppr lie); return gbl_env }
-badBootDecl :: String -> Located decl -> TcM ()
-badBootDecl what (L loc _)
+badBootDecl :: HscSource -> String -> Located decl -> TcM ()
+badBootDecl hsc_src what (L loc _)
= addErrAt loc (char 'A' <+> text what
- <+> ptext (sLit "declaration is not (currently) allowed in a hs-boot file"))
+ <+> ptext (sLit "declaration is not (currently) allowed in a")
+ <+> (case hsc_src of
+ HsBootFile -> ptext (sLit "hs-boot")
+ HsigFile -> ptext (sLit "hsig")
+ _ -> panic "badBootDecl: should be an hsig or hs-boot file")
+ <+> ptext (sLit "file"))
\end{code}
Once we've typechecked the body of the module, we want to compare what
@@ -546,7 +692,7 @@ checkHiBootIface
tcg_insts = local_insts,
tcg_type_env = local_type_env, tcg_exports = local_exports })
boot_details
- | isHsBoot hs_src -- Current module is already a hs-boot file!
+ | HsBootFile <- hs_src -- Current module is already a hs-boot file!
= return tcg_env
| otherwise
@@ -605,7 +751,7 @@ checkHiBootIface'
-- Check that the actual module exports the same thing
| not (null missing_names)
= addErrAt (nameSrcSpan (head missing_names))
- (missingBootThing (head missing_names) "exported by")
+ (missingBootThing True (head missing_names) "exported by")
-- If the boot module does not *define* the thing, we are done
-- (it simply re-exports it, and names match, so nothing further to do)
@@ -617,10 +763,10 @@ checkHiBootIface'
Just boot_thing <- mb_boot_thing
= when (not (checkBootDecl boot_thing real_thing))
$ addErrAt (nameSrcSpan (getName boot_thing))
- (bootMisMatch real_thing boot_thing)
+ (bootMisMatch True real_thing boot_thing)
| otherwise
- = addErrTc (missingBootThing name "defined in")
+ = addErrTc (missingBootThing True name "defined in")
where
name = availName boot_avail
mb_boot_thing = lookupTypeEnv boot_type_env name
@@ -643,7 +789,7 @@ checkHiBootIface'
, text "boot_inst" <+> ppr boot_inst
, text "boot_inst_ty" <+> ppr boot_inst_ty
])
- ; addErrTc (instMisMatch boot_inst); return Nothing }
+ ; addErrTc (instMisMatch True boot_inst); return Nothing }
(dfun:_) -> return (Just (local_boot_dfun, dfun))
where
boot_dfun = instanceDFunId boot_inst
@@ -785,23 +931,32 @@ emptyRnEnv2 :: RnEnv2
emptyRnEnv2 = mkRnEnv2 emptyInScopeSet
----------------
-missingBootThing :: Name -> String -> SDoc
-missingBootThing name what
- = ppr name <+> ptext (sLit "is exported by the hs-boot file, but not")
+missingBootThing :: Bool -> Name -> String -> SDoc
+missingBootThing is_boot name what
+ = ppr name <+> ptext (sLit "is exported by the") <+>
+ (if is_boot then ptext (sLit "hs-boot") else ptext (sLit "hsig"))
+ <+> ptext (sLit "file, but not")
<+> text what <+> ptext (sLit "the module")
-bootMisMatch :: TyThing -> TyThing -> SDoc
-bootMisMatch real_thing boot_thing
+bootMisMatch :: Bool -> TyThing -> TyThing -> SDoc
+bootMisMatch is_boot real_thing boot_thing
= vcat [ppr real_thing <+>
ptext (sLit "has conflicting definitions in the module"),
- ptext (sLit "and its hs-boot file"),
+ ptext (sLit "and its") <+>
+ (if is_boot then ptext (sLit "hs-boot file")
+ else ptext (sLit "hsig file")),
ptext (sLit "Main module:") <+> PprTyThing.pprTyThing real_thing,
- ptext (sLit "Boot file: ") <+> PprTyThing.pprTyThing boot_thing]
+ (if is_boot
+ then ptext (sLit "Boot file: ")
+ else ptext (sLit "Hsig file: "))
+ <+> PprTyThing.pprTyThing boot_thing]
-instMisMatch :: ClsInst -> SDoc
-instMisMatch inst
+instMisMatch :: Bool -> ClsInst -> SDoc
+instMisMatch is_boot inst
= hang (ppr inst)
- 2 (ptext (sLit "is defined in the hs-boot file, but not in the module itself"))
+ 2 (ptext (sLit "is defined in the") <+>
+ (if is_boot then ptext (sLit "hs-boot") else ptext (sLit "hsig"))
+ <+> ptext (sLit "file, but not in the module itself"))
\end{code}
diff --git a/compiler/typecheck/TcRnMonad.lhs b/compiler/typecheck/TcRnMonad.lhs
index 3df8a2caa8..dce4b49fd6 100644
--- a/compiler/typecheck/TcRnMonad.lhs
+++ b/compiler/typecheck/TcRnMonad.lhs
@@ -104,6 +104,8 @@ initTc hsc_env hsc_src keep_rn_syntax mod do_this
th_state_var <- newIORef Map.empty ;
#endif /* GHCI */
let {
+ dflags = hsc_dflags hsc_env ;
+
maybe_rn_syntax :: forall a. a -> Maybe a ;
maybe_rn_syntax empty_val
| keep_rn_syntax = Just empty_val
@@ -119,6 +121,8 @@ initTc hsc_env hsc_src keep_rn_syntax mod do_this
tcg_mod = mod,
tcg_src = hsc_src,
+ tcg_sig_of = getSigOf dflags (moduleName mod),
+ tcg_impl_rdr_env = Nothing,
tcg_rdr_env = emptyGlobalRdrEnv,
tcg_fix_env = emptyNameEnv,
tcg_field_env = RecFields emptyNameEnv emptyNameSet,
@@ -193,8 +197,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod do_this
-- Collect any error messages
msgs <- readIORef errs_var ;
- let { dflags = hsc_dflags hsc_env
- ; final_res | errorsFound dflags msgs = Nothing
+ let { final_res | errorsFound dflags msgs = Nothing
| otherwise = maybe_res } ;
return (msgs, final_res)
@@ -542,8 +545,8 @@ getGHCiMonad = do { hsc <- getTopEnv; return (ic_monad $ hsc_IC hsc) }
getInteractivePrintName :: TcRn Name
getInteractivePrintName = do { hsc <- getTopEnv; return (ic_int_print $ hsc_IC hsc) }
-tcIsHsBoot :: TcRn Bool
-tcIsHsBoot = do { env <- getGblEnv; return (isHsBoot (tcg_src env)) }
+tcIsHsBootOrSig :: TcRn Bool
+tcIsHsBootOrSig = do { env <- getGblEnv; return (isHsBootOrSig (tcg_src env)) }
getGlobalRdrEnv :: TcRn GlobalRdrEnv
getGlobalRdrEnv = do { env <- getGblEnv; return (tcg_rdr_env env) }
diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs
index 4d0b2e1587..39adc791fc 100644
--- a/compiler/typecheck/TcRnTypes.lhs
+++ b/compiler/typecheck/TcRnTypes.lhs
@@ -213,6 +213,11 @@ data TcGblEnv
tcg_mod :: Module, -- ^ Module being compiled
tcg_src :: HscSource,
-- ^ What kind of module (regular Haskell, hs-boot, ext-core)
+ tcg_sig_of :: Maybe Module,
+ -- ^ Are we being compiled as a signature of an implementation?
+ tcg_impl_rdr_env :: Maybe GlobalRdrEnv,
+ -- ^ Environment used only during -sig-of for resolving top level
+ -- bindings. See Note [Signature parameters in TcGblEnv and DynFlags]
tcg_rdr_env :: GlobalRdrEnv, -- ^ Top level envt; used during renaming
tcg_default :: Maybe [Type],
@@ -353,6 +358,53 @@ data TcGblEnv
-- as -XSafe (Safe Haskell)
}
+-- Note [Signature parameters in TcGblEnv and DynFlags]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- When compiling signature files, we need to know which implementation
+-- we've actually linked against the signature. There are three seemingly
+-- redundant places where this information is stored: in DynFlags, there
+-- is sigOf, and in TcGblEnv, there is tcg_sig_of and tcg_impl_rdr_env.
+-- Here's the difference between each of them:
+--
+-- * DynFlags.sigOf is global per invocation of GHC. If we are compiling
+-- with --make, there may be multiple signature files being compiled; in
+-- which case this parameter is a map from local module name to implementing
+-- Module.
+--
+-- * HscEnv.tcg_sig_of is global per the compilation of a single file, so
+-- it is simply the result of looking up tcg_mod in the DynFlags.sigOf
+-- parameter. It's setup in TcRnMonad.initTc. This prevents us
+-- from having to repeatedly do a lookup in DynFlags.sigOf.
+--
+-- * HscEnv.tcg_impl_rdr_env is a RdrEnv that lets us look up names
+-- according to the sig-of module. It's setup in TcRnDriver.tcRnSignature.
+-- Here is an example showing why we need this map:
+--
+-- module A where
+-- a = True
+--
+-- module ASig where
+-- import B
+-- a :: Bool
+--
+-- module B where
+-- b = False
+--
+-- When we compile ASig --sig-of main:A, the default
+-- global RdrEnv (tcg_rdr_env) has an entry for b, but not for a
+-- (we never imported A). So we have to look in a different environment
+-- to actually get the original name.
+--
+-- By the way, why do we need to do the lookup; can't we just use A:a
+-- as the name directly? Well, if A is reexporting the entity from another
+-- module, then the original name needs to be the real original name:
+--
+-- module C where
+-- a = True
+--
+-- module A(a) where
+-- import C
+
instance ContainsModule TcGblEnv where
extractModule env = tcg_mod env
diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs
index 197ed975c7..6eae445b97 100644
--- a/compiler/typecheck/TcSimplify.lhs
+++ b/compiler/typecheck/TcSimplify.lhs
@@ -21,7 +21,8 @@ import TcSMonad as TcS
import TcInteract
import Kind ( isKind, isSubKind, defaultKind_maybe )
import Inst
-import Type ( classifyPredType, PredTree(..), getClassPredTys_maybe )
+import Type ( classifyPredType, isIPClass, PredTree(..), getClassPredTys_maybe )
+import TyCon ( isSynFamilyTyCon )
import Class ( Class )
import Id ( idType )
import Var
@@ -431,8 +432,22 @@ growThetaTyVars theta tvs
quantifyPred :: TyVarSet -- Quantifying over these
-> PredType -> Bool -- True <=> quantify over this wanted
quantifyPred qtvs pred
- | isIPPred pred = True -- See note [Inheriting implicit parameters]
- | otherwise = tyVarsOfType pred `intersectsVarSet` qtvs
+ = case classifyPredType pred of
+ ClassPred cls tys
+ | isIPClass cls -> True -- See note [Inheriting implicit parameters]
+ | otherwise -> tyVarsOfTypes tys `intersectsVarSet` qtvs
+ EqPred ty1 ty2 -> quant_fun ty1 || quant_fun ty2
+ IrredPred ty -> tyVarsOfType ty `intersectsVarSet` qtvs
+ TuplePred {} -> False
+ where
+ -- Only quantify over (F tys ~ ty) if tys mentions a quantiifed variable
+ -- In particular, quanitifying over (F Int ~ ty) is a bit like quantifying
+ -- over (Eq Int); the instance should kick in right here
+ quant_fun ty
+ = case tcSplitTyConApp_maybe ty of
+ Just (tc, tys) | isSynFamilyTyCon tc
+ -> tyVarsOfTypes tys `intersectsVarSet` qtvs
+ _ -> False
\end{code}
Note [Inheriting implicit parameters]
diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs
index 58da20785f..50113db52f 100644
--- a/compiler/typecheck/TcTyClsDecls.lhs
+++ b/compiler/typecheck/TcTyClsDecls.lhs
@@ -141,7 +141,7 @@ tcTyClGroup boot_details tyclds
; let role_annots = extractRoleAnnots tyclds
decls = group_tyclds tyclds
; tyclss <- fixM $ \ rec_tyclss -> do
- { is_boot <- tcIsHsBoot
+ { is_boot <- tcIsHsBootOrSig
; let rec_flags = calcRecFlags boot_details is_boot
role_annots rec_tyclss
@@ -782,7 +782,7 @@ tcDataDefn rec_info tc_name tvs kind
; stupid_tc_theta <- tcHsContext ctxt
; stupid_theta <- zonkTcTypeToTypes emptyZonkEnv stupid_tc_theta
; kind_signatures <- xoptM Opt_KindSignatures
- ; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file?
+ ; is_boot <- tcIsHsBootOrSig -- Are we compiling an hs-boot file?
-- Check that we don't use kind signatures without Glasgow extensions
; case mb_ksig of
@@ -1143,7 +1143,7 @@ dataDeclChecks tc_name new_or_data stupid_theta cons
-- Check that there's at least one condecl,
-- or else we're reading an hs-boot file, or -XEmptyDataDecls
; empty_data_decls <- xoptM Opt_EmptyDataDecls
- ; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file?
+ ; is_boot <- tcIsHsBootOrSig -- Are we compiling an hs-boot file?
; checkTc (not (null cons) || empty_data_decls || is_boot)
(emptyConDeclsErr tc_name)
; return gadt_syntax }
@@ -1425,7 +1425,7 @@ checkValidTyCon tc
= case syn_rhs of
{ ClosedSynFamilyTyCon ax -> checkValidClosedCoAxiom ax
; AbstractClosedSynFamilyTyCon ->
- do { hsBoot <- tcIsHsBoot
+ do { hsBoot <- tcIsHsBootOrSig
; checkTc hsBoot $
ptext (sLit "You may omit the equations in a closed type family") $$
ptext (sLit "only in a .hs-boot file") }
diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs
index 9a22fdf3b6..73ca75c3df 100644
--- a/compiler/typecheck/TcType.lhs
+++ b/compiler/typecheck/TcType.lhs
@@ -1480,7 +1480,7 @@ isFFIExportResultTy ty = checkRepTyCon legalFEResultTyCon ty empty
isFFIDynTy :: Type -> Type -> Validity
-- The type in a foreign import dynamic must be Ptr, FunPtr, or a newtype of
-- either, and the wrapped function type must be equal to the given type.
--- We assume that all types have been run through normalizeFfiType, so we don't
+-- We assume that all types have been run through normaliseFfiType, so we don't
-- need to worry about expanding newtypes here.
isFFIDynTy expected ty
-- Note [Foreign import dynamic]
diff --git a/compiler/types/Coercion.lhs b/compiler/types/Coercion.lhs
index 36eb711bdc..dc0a7d0d45 100644
--- a/compiler/types/Coercion.lhs
+++ b/compiler/types/Coercion.lhs
@@ -844,7 +844,7 @@ mkSubCo: Requires a nominal input coercion and always produces a
representational output. This is used when you (the programmer) are sure you
know exactly that role you have and what you want.
-setRole_maybe: This function takes both the input role and the output role
+downgradeRole_maybe: This function takes both the input role and the output role
as parameters. (The *output* role comes first!) It can only *downgrade* a
role -- that is, change it from N to R or P, or from R to P. This one-way
behavior is why there is the "_maybe". If an upgrade is requested, this
@@ -853,10 +853,10 @@ coercion, but you're not sure (as you're writing the code) of which roles are
involved.
This function could have been written using coercionRole to ascertain the role
-of the input. But, that function is recursive, and the caller of setRole_maybe
+of the input. But, that function is recursive, and the caller of downgradeRole_maybe
often knows the input role. So, this is more efficient.
-downgradeRole: This is just like setRole_maybe, but it panics if the conversion
+downgradeRole: This is just like downgradeRole_maybe, but it panics if the conversion
isn't a downgrade.
setNominalRole_maybe: This is the only function that can *upgrade* a coercion. The result
@@ -880,7 +880,7 @@ API, as he was decomposing Core casts. The Core casts use representational coerc
as they must, but his use case required nominal coercions (he was building a GADT).
So, that's why this function is exported from this module.
-One might ask: shouldn't setRole_maybe just use setNominalRole_maybe as appropriate?
+One might ask: shouldn't downgradeRole_maybe just use setNominalRole_maybe as appropriate?
I (Richard E.) have decided not to do this, because upgrading a role is bizarre and
a caller should have to ask for this behavior explicitly.
@@ -1081,15 +1081,15 @@ mkSubCo co = ASSERT2( coercionRole co == Nominal, ppr co <+> ppr (coercionRole c
SubCo co
-- only *downgrades* a role. See Note [Role twiddling functions]
-setRole_maybe :: Role -- desired role
- -> Role -- current role
- -> Coercion -> Maybe Coercion
-setRole_maybe Representational Nominal = Just . mkSubCo
-setRole_maybe Nominal Representational = const Nothing
-setRole_maybe Phantom Phantom = Just
-setRole_maybe Phantom _ = Just . mkPhantomCo
-setRole_maybe _ Phantom = const Nothing
-setRole_maybe _ _ = Just
+downgradeRole_maybe :: Role -- desired role
+ -> Role -- current role
+ -> Coercion -> Maybe Coercion
+downgradeRole_maybe Representational Nominal co = Just (mkSubCo co)
+downgradeRole_maybe Nominal Representational _ = Nothing
+downgradeRole_maybe Phantom Phantom co = Just co
+downgradeRole_maybe Phantom _ co = Just (mkPhantomCo co)
+downgradeRole_maybe _ Phantom _ = Nothing
+downgradeRole_maybe _ _ co = Just co
-- panics if the requested conversion is not a downgrade.
-- See also Note [Role twiddling functions]
@@ -1097,7 +1097,7 @@ downgradeRole :: Role -- desired role
-> Role -- current role
-> Coercion -> Coercion
downgradeRole r1 r2 co
- = case setRole_maybe r1 r2 co of
+ = case downgradeRole_maybe r1 r2 co of
Just co' -> co'
Nothing -> pprPanic "downgradeRole" (ppr co)
@@ -1158,8 +1158,9 @@ nthRole Phantom _ _ = Phantom
nthRole Representational tc n
= (tyConRolesX Representational tc) !! n
--- is one role "less" than another?
ltRole :: Role -> Role -> Bool
+-- Is one role "less" than another?
+-- Nominal < Representational < Phantom
ltRole Phantom _ = False
ltRole Representational Phantom = True
ltRole Representational _ = False
@@ -1619,17 +1620,16 @@ failing for reason 2) is fine. matchAxiom is trying to find a set of coercions
that match, but it may fail, and this is healthy behavior. Bottom line: if
you find that liftCoSubst is doing weird things (like leaving out-of-scope
variables lying around), disable coercion optimization (bypassing matchAxiom)
-and use downgradeRole instead of setRole_maybe. The panic will then happen,
+and use downgradeRole instead of downgradeRole_maybe. The panic will then happen,
and you may learn something useful.
\begin{code}
-
liftCoSubstTyVar :: LiftCoSubst -> Role -> TyVar -> Maybe Coercion
liftCoSubstTyVar (LCS _ cenv) r tv
= do { co <- lookupVarEnv cenv tv
; let co_role = coercionRole co -- could theoretically take this as
-- a parameter, but painful
- ; setRole_maybe r co_role co } -- see Note [liftCoSubstTyVar]
+ ; downgradeRole_maybe r co_role co } -- see Note [liftCoSubstTyVar]
liftCoSubstTyVarBndr :: LiftCoSubst -> TyVar -> (LiftCoSubst, TyVar)
liftCoSubstTyVarBndr subst@(LCS in_scope cenv) old_var
diff --git a/compiler/types/FamInstEnv.lhs b/compiler/types/FamInstEnv.lhs
index 894b94993d..bc21e2e1d7 100644
--- a/compiler/types/FamInstEnv.lhs
+++ b/compiler/types/FamInstEnv.lhs
@@ -790,19 +790,33 @@ The lookupFamInstEnv function does a nice job for *open* type families,
but we also need to handle closed ones when normalising a type:
\begin{code}
-reduceTyFamApp_maybe :: FamInstEnvs -> Role -> TyCon -> [Type] -> Maybe (Coercion, Type)
--- Attempt to do a *one-step* reduction of a type-synonym-family application
--- (i.e. is a no-op on data families)
+reduceTyFamApp_maybe :: FamInstEnvs
+ -> Role -- Desired role of result coercion
+ -> TyCon -> [Type]
+ -> Maybe (Coercion, Type)
+-- Attempt to do a *one-step* reduction of a type-family application
+-- but *not* newtypes
+-- Works on type-synonym families always; data-families only if
+-- the role we seek is representational
-- It first normalises the type arguments, wrt functions but *not* newtypes,
--- to be sure that nested calls like
--- F (G Int)
--- are correctly reduced
+-- to be sure that nested calls like
+-- F (G Int)
+-- are correctly reduced
--
-- The TyCon can be oversaturated.
-- Works on both open and closed families
reduceTyFamApp_maybe envs role tc tys
- | isOpenSynFamilyTyCon tc
+ | Phantom <- role
+ = Nothing
+
+ | case role of
+ Representational -> isOpenFamilyTyCon tc
+ _ -> isOpenSynFamilyTyCon tc
+ -- If we seek a representational coercion
+ -- (e.g. the call in topNormaliseType_maybe) then we can
+ -- unwrap data families as well as type-synonym families;
+ -- otherwise only type-synonym families
, [FamInstMatch { fim_instance = fam_inst
, fim_tys = inst_tys }] <- lookupFamInstEnv envs tc ntys
= let ax = famInstAxiom fam_inst
@@ -929,6 +943,7 @@ topNormaliseType_maybe env ty
---------------
normaliseTcApp :: FamInstEnvs -> Role -> TyCon -> [Type] -> (Coercion, Type)
+-- See comments on normaliseType for the arguments of this function
normaliseTcApp env role tc tys
| isTypeSynonymTyCon tc
, (co1, ntys) <- normaliseTcArgs env role tc tys
@@ -965,6 +980,7 @@ normaliseType :: FamInstEnvs -- environment with family instances
-> (Coercion, Type) -- (coercion,new type), where
-- co :: old-type ~ new_type
-- Normalise the input type, by eliminating *all* type-function redexes
+-- but *not* newtypes (which are visible to the programmer)
-- Returns with Refl if nothing happens
-- Try to not to disturb type syonyms if possible
diff --git a/compiler/types/InstEnv.lhs b/compiler/types/InstEnv.lhs
index 2e513583f5..6d03fbe094 100644
--- a/compiler/types/InstEnv.lhs
+++ b/compiler/types/InstEnv.lhs
@@ -18,6 +18,7 @@ module InstEnv (
InstEnv, emptyInstEnv, extendInstEnv, deleteFromInstEnv, identicalInstHead,
extendInstEnvList, lookupUniqueInstEnv, lookupInstEnv', lookupInstEnv, instEnvElts,
+ memberInstEnv,
classInstances, orphNamesOfClsInst, instanceBindFun,
instanceCantMatch, roughMatchTcs
) where
@@ -412,6 +413,13 @@ classInstances (pkg_ie, home_ie) cls
orphNamesOfClsInst :: ClsInst -> NameSet
orphNamesOfClsInst = orphNamesOfDFunHead . idType . instanceDFunId
+-- | Checks for an exact match of ClsInst in the instance environment.
+-- We use this when we do signature checking in TcRnDriver
+memberInstEnv :: InstEnv -> ClsInst -> Bool
+memberInstEnv inst_env ins_item@(ClsInst { is_cls_nm = cls_nm } ) =
+ maybe False (\(ClsIE items) -> any (identicalInstHead ins_item) items)
+ (lookupUFM inst_env cls_nm)
+
extendInstEnvList :: InstEnv -> [ClsInst] -> InstEnv
extendInstEnvList inst_env ispecs = foldl extendInstEnv inst_env ispecs
diff --git a/docs/backpack/backpack-impl.pdf b/docs/backpack/backpack-impl.pdf
new file mode 100644
index 0000000000..80dafbc5d0
--- /dev/null
+++ b/docs/backpack/backpack-impl.pdf
Binary files differ
diff --git a/docs/backpack/backpack-manual.pdf b/docs/backpack/backpack-manual.pdf
new file mode 100644
index 0000000000..0ec544aa01
--- /dev/null
+++ b/docs/backpack/backpack-manual.pdf
Binary files differ
diff --git a/docs/backpack/backpack-manual.tex b/docs/backpack/backpack-manual.tex
index 31a0ce5d84..51e9055a40 100644
--- a/docs/backpack/backpack-manual.tex
+++ b/docs/backpack/backpack-manual.tex
@@ -45,12 +45,33 @@ signature (without a client implementation.)} The syntax of an
example of a module signature representing an abstract map type:
\begin{verbatim}
+module Map where
type role Map nominal representational
data Map k v
instance Functor (Map k)
empty :: Map k a
\end{verbatim}
+For entities that can be explicitly exported and imported, the
+export list of a module signature behaves in the same way as
+the export list for a normal module (e.g., if no list is provided,
+only entities defined in the signature are made available.)
+
+\begin{color}{red}
+However, type class instances and type family instances operate
+differently: an instance is \emph{only} exported if it is directly
+defined in the signature. This is in contrast to the module behavior,
+where an instance is \emph{implicitly} brought into scope if it is
+imported in any way (even with an empty import list.)
+
+Even if an instance is ``hidden'' (i.e., not exported by a signature
+but in the implementation), we still take it into account when calculating
+conflicting instances (e.g., the soundness checks for type families). Thus,
+some compilation errors may only occur when linking an implementation
+and user, even if they compiled individually fine against the signature
+in question.
+\end{color}
+
An \texttt{hsig} file can either be type-checked or compiled against some
\emph{backing implementation}, an \texttt{hs} module which provides all
of the declarations that a signature advertises.
@@ -90,7 +111,7 @@ identifier for a symbol whose provenance is not known). Each instance
of \texttt{origname} in the signature is instead assigned the original
name \texttt{origname}, instead of the default original name.
-(TODO: This interface will work pretty poorly with \texttt{--make})
+(ToDo: This interface will work pretty poorly with \texttt{--make})
\end{color}
\paragraph{Compiling} We can specify a backing implementation for
@@ -120,30 +141,35 @@ interface file is similar to a module which reexports identifiers
from another module, except that we also record the backing implementation
for the purpose of handling imports, described in the next section.}
-\subsection{Extended format in the installed package database}
+\begin{color}{red}
+ToDo: In what cases is a type class instance/type family instance reexported?
+Currently, type classes from the backing implementation leak through.
+We also need to fix \#9422.
+\end{color}
+
+\subsection{Extended format in the installed package database}\label{sec:pkgdb}
After a set of Haskell modules has been compiled, they can be registered
-in the installed package database so that their exposed modules and
-signatures can be made available for import using the \texttt{-package}
-flag. An entry in the installed package database specifies what modules
-and signatures from the package itself are exposed. It can also
-re-export modules and signatures from other packages.\footnote{Signature
-reexports are essential for creating signature packages in a modular
-way; module reexports are very useful for backwards-compatibility
-packages and also taking an package that has been instantiated multiple
-ways and giving its modules unique names.}
+as a package in the \emph{installed package database} using
+\texttt{ghc-pkg}. An entry in the installed package database specifies
+what modules and signatures from the package itself are available for
+import. It can also re-export modules and signatures from other
+packages.\footnote{Signature reexports are essential for creating
+signature packages in a modular way; module reexports are very useful
+for backwards-compatibility packages and also taking an package that has
+been instantiated multiple ways and giving its modules unique names.}
There are three fields of an entry in the installed package database of note.
\begin{color}{red}
-First, the \texttt{exposed-modules} field is a comma-separated list of
-module names, possibly with two extra, optional pieces of information
+\paragraph{exposed-modules} A comma-separated list of
+module names which this package makes available for import, possibly with two extra, optional pieces of information
about the module in question: what the \emph{original module/signature}
-is (if it is a reexport)\footnote{Knowing the original module/signature
+is (\texttt{from MODULE})\footnote{Knowing the original module/signature
makes it possible for GHC to directly load the interface file, without
having to follow multiple hops in the package database.}, and what the
-\emph{backing implementation} is (if it is a signature)\footnote{Knowing
+\emph{backing implementation} is (\texttt{is MODULE})\footnote{Knowing
the backing implementation makes it possible to tell if an import is
unambiguous without having to load the interface file first.}.
@@ -159,13 +185,7 @@ exposed-modules:
If no reexports or signatures are used, the commas can be omitted
(making this syntax backwards compatible with the original syntax.)
-Entries to the installed package database are registered using \texttt{ghc-pkg}.
-\texttt{ghc-pkg} validates that all entries in \texttt{exposed-modules} are
-unambiguous; the criterion for which we will establish in the next section.\footnote{Note
-that this does mean duplicates can be allowed in some circumstances. This is most useful
-when combining multiple signatures together.}
-
-TODO: What is currently implemented is
+ToDo: What is currently implemented is
that \texttt{reexported-modules} has a seperate field, where the
original module is always set and backing implementation is always empty.
I came to this generalization when I found I needed to add support for
@@ -179,18 +199,20 @@ suggests we add the comma variant because it is unambiguous with the old
syntax.
\end{color}
-Second, the \texttt{instantiated-with} field records the \emph{original
-module} which instantiated any holes associated with a package (i.e.,
-what \texttt{-sig-of} parameter was used during compilation.)
+\paragraph{instantiated-with} A map from hole name to the \emph{original
+module} which instantiated the hole (i.e., what \texttt{-sig-of}
+parameters were used during compilation.)
-Finally, the \texttt{key} field records the \emph{package key} of a
-package. A package key is an opaque identifier identifying a package
+\paragraph{key} The \emph{package key} of a
+package, an opaque identifier identifying a package
which serves as the basis for type identity and linker
symbols.\footnote{Informally, you might think of a package as a package
name and its version, e.g., \texttt{containers-0.9}; however, sometimes,
it is necessary to distinguish between installed instances of a package
with the same name and version which were compiled with different
-dependencies.} \footnote{The package key is different from an
+dependencies.} When files are compiled as part of a package, the
+package key must be specified using the \texttt{-this-package-key}
+flag.\footnote{The package key is different from an
\emph{installed package ID}, which is a more fine-grained identifier for
a package. Identical installed package IDs imply identical package
keys, but not vice versa. However, within a single run of GHC, we
@@ -201,22 +223,25 @@ The package key is programatically generated by Cabal\footnote{In
practice, a package key looks something like
\texttt{conta\_GtvvBIboSRuDmyUQfSZoAx}. In this document, we'll use
\texttt{containers\_KEY} as a convenient shorthand to refer to some
-package key for the \texttt{containers} package.}; while GHC has no say
-in the generation process, Cabal's must choose distinct package keys if
+package key for the \texttt{containers} package.}. While GHC doesn't
+specify what the format of the package key is, Cabal's must choose distinct package keys if
any of the following fields in the installed package database are
distinct:
\begin{itemize}
\item \texttt{name} (e.g., \texttt{containers})
\item \texttt{version} (e.g., \texttt{0.8})
-\item \texttt{depends} modulo package keys
-\item \texttt{instantiated-with} modulo package keys
+\item \texttt{depends} (with respect to package keys)
+\item \texttt{instantiated-with} (with respect to package keys and module names)
\end{itemize}
\subsection{Module thinning and renaming}
+The command line flag \texttt{-package pkgname} causes all
+exposed modules of \texttt{pkgname} (from the installed package database) to become visible under their
+original names for imports.
The \texttt{-package} flag and its variants (\texttt{-package-id} and
-\texttt{-package-key}) now support ``thinning and renaming''
+\texttt{-package-key}) support ``thinning and renaming''
annotations, which allows a user to selectively expose only certain
modules from a package, possibly under different names.\footnote{This
feature has utility both with and without Backpack. The ability to
@@ -225,17 +250,14 @@ export conflicting module names; under Backpack, this situation becomes
especially common when an indefinite package is instantiated multiple
time with different dependencies.}
-The command line flag \texttt{-package pkgname} causes all
-exposed modules of \texttt{pkgname} to become visible under their
-original names for imports. Thinning and renaming can be applied
-using the extended syntax \texttt{-package "pkgname
-(rns)"}, where \texttt{rns} is a comma separated list of
+Thinning and renaming can be applied
+using the extended syntax \verb|-package "pkgname (rns)"|, where \texttt{rns} is a comma separated list of
module renamings \texttt{OldName as NewName}. Bare module names are
also accepted, where \texttt{Name} is shorthand for \texttt{Name as
Name}. A package exposed this way only causes modules (specified before
the \texttt{as}) explicitly listed in the renamings to become visible
under their new names (specified after the \texttt{as}). For example,
-\texttt{-package "containers (Data.Set, Data.Map as Map)"} makes
+\verb|-package "containers (Data.Set, Data.Map as Map)"| makes
\texttt{Data.Set} and \texttt{Map} (pointing to
\texttt{Data.Map}) available for import.\footnote{See also Cabal files
for a twist on this syntax.}
@@ -243,8 +265,7 @@ for a twist on this syntax.}
When the \texttt{-hide-all-packages} flag is applied, uses of the
\texttt{-package} flag are \emph{cumulative}; each argument is processed
and its bindings added to the global module map. For example,
-\texttt{-hide-all-packages -package containers -package "containers
-(Data.Map as Map)"} brings both the default exposed modules of
+\verb|-hide-all-packages -package containers -package "containers (Data.Map as Map)"| brings both the default exposed modules of
containers and a binding for \texttt{Map} into scope.\footnote{The
previous behavior, and the current behavior when
\texttt{-hide-all-packages} is not set, is for a second package flag for
@@ -279,38 +300,6 @@ This mapping says that this package reexports \texttt{pkg:AImpl} as
\texttt{pkg:AImpl}, and reexports a signature from \texttt{other-pkg}
which itself was compiled against \texttt{pkg:AImpl}.
-Here are some more examples:
-
-\begin{verbatim}
-$ cat > AImpl.hsig
-module AImpl where
- foo = 2
-$ cat > ASig.hsig
-module ASig where
- foo :: Int
-$ cat > BSig.hsig
-module BSig where
- foo :: Int
-$ cat > Main.hs
-module Main where
- import ASig
- import BSig
- main = print foo
-$ ghc -c AImpl.hs
-$ ghc -c ASig.hsig -sig-of "main:AImpl"
-$ ghc -c BSig.hsig -sig-of "main:AImpl"
-$ ghc -c Main.hs
-SUCCEEDS
-
-$ cat > BImpl.hs
-module BImpl where
- foo = 4
-$ ghc -c BImpl.hs
-$ ghc -c BSig.hsig -sig-of "main:BImpl" # recompile
-$ ghc -c Main.hs
-FAILS due to ambiguous original name
-\end{verbatim}
-
\paragraph{Typechecking} \Red{When typechecking only, there is not
necessarily a backing implementation associated with a signature. In
this case, even if the original names match up, we must perform an
@@ -319,54 +308,45 @@ This check is not necessary during compilation, because \texttt{-sig-of}
will ensure that the signatures are compatible with a common, unique
backing implementation.
-\begin{color}{red}
-\begin{verbatim}
-$ ghc -c ASig.hsig -fno-code -fwrite-interface
-$ ghc -c BSig.hsig -fno-code -fwrite-interface
-$ ghc -c Main.hs -fno-code -fwrite-interface
-FAILS due to ambiguous original name (default used)
-
-$ ghc -c ASig.hsig -shape-of "foo is main:AImpl" -fno-code -fwrite-interface
-$ ghc -c BSig.hsig -shape-of "foo is main:AImpl" -fno-code -fwrite-interface
-$ ghc -c Main.hs -fno-code -fwrite-interface
-SUCCEEDS
-
-$ ghc -c ASig.hsig -shape-of "foo is main:AImpl" -fno-code -fwrite-interface
-$ ghc -c BSig.hsig -shape-of "foo is main:BImpl" -fno-code -fwrite-interface
-$ ghc -c Main.hs -fno-code -fwrite-interface
-FAILS due to ambiguous original name
-
-$ cat > BSig.hsig
-module BSig where
- foo :: Bool
-
-$ ghc -c ASig.hsig -shape-of "foo is main:AImpl" -fno-code -fwrite-interface
-$ ghc -c BSig.hsig -shape-of "foo is main:AImpl" -fno-code -fwrite-interface
-$ ghc -c Main.hs -fno-code -fwrite-interface
-FAILS due to mismatchng types
-\end{verbatim}
-\end{color}
-
-\Red{EDITORS CUT HERE}
-
\subsection{Indefinite external packages}
\Red{Not implemented yet.}
\section{Cabal}
-\subsection{Reexports and signatures}
+\subsection{Fields in the Cabal file}
The Cabal file is a user-facing description of a package, which is
-processed into an \texttt{InstalledPackageInfo} by Cabal. Currently,
-package authors use \texttt{exposed-modules} in the \texttt{library}
-section to specify what \texttt{hs} modules are available for import
-when the package is exposed. Backpack extends the Cabal files with four
-new fields:
+converted into an \texttt{InstalledPackageInfo} during a Cabal build.
+Backpack extends the Cabal files with four new fields, all of which
+are only valid in the \texttt{library} section of a package:
+
+\paragraph{required-signatures} A space-separated list of module names
+specifying internal signatures (in \texttt{hsig} files) of the package.
+\Red{Signatures specified in this field are not put in the \texttt{exposed-modules} field in the installed package database and
+are not available for external import}; however, in order for a package to be
+compiled, implementations for all of its signatures must be provided (so
+they are not completely \emph{hidden} in the same way \texttt{other-modules} are).
+
+\paragraph{exposed-signatures} A space-separated list of module names
+specifying externally visible signatures (in \texttt{hsig} files) of the package. It is
+represented in the installed package database as an \texttt{exposed-module} with a
+non-empty backing implementation (\texttt{Sig is Impl}). Signatures exposed in this way are
+available for external import. In order for a package to be compiled,
+implementations for all exposed signatures must be provided.
+
+\paragraph{indefinite} A package is \emph{indefinite} if it has any
+uninstantiated
+\texttt{required-signatures} or \texttt{exposed-signatures}, or it
+depends on an indefinite package without instantiating all of the holes
+of that package. In principle, this parameter can be calculated
+by Cabal, but it serves a documentory purpose for packages which do not
+have any signatures themselves, but depend on packages which are indefinite.
+\Red{Actually, this field is in the top-level at the moment.}
\paragraph{reexported-modules} A comma-separated list of module or
signature reexports. It is represented in the installed package
-database as an module with a non-empty original module/signature: the
+database as a module with a non-empty original module/signature: the
original module is resolved by Cabal. There are three valid syntactic
forms:
@@ -391,35 +371,6 @@ In this way, packages which reexport multiple signatures to the
same name can be valid; a package may also reexport a signature
onto a home \texttt{hsig} signature.
-\paragraph{required-signatures} A space-separated list of module names
-specifying internal signatures (in \texttt{hsig} files) of the package.
-This field is analogous to \texttt{other-modules}, but with signatures.
-Signatures specified in this field can be imported by other home
-modules, but are not registered in the installed package database and
-available for external import. In order for this package to be
-compiled, implementations for all these signatures must be provided (see
-the section on \texttt{Setup}).
-
-\paragraph{exposed-signatures} A space-separated list of module names
-specifying externally visible signatures (in \texttt{hsig} files) of the package. It is
-represented in the installed package database as a module with a
-non-empty backing implementation. Signatures exposed in this way are
-available external import. In order for this package to be compiled,
-implementations for all these signatures must be provided (see the
-section on \texttt{Setup}).
-
-\paragraph{indefinite} A package is \emph{indefinite} if it has any
-\texttt{required-signatures} or \texttt{exposed-signatures}, or it
-transitively depends on an indefinite package whose signatures have
-not been instantiated. In principle, this parameter can be calculated
-by Cabal, but serves a documentory purpose for packages which do not
-have any signatures themselves, but depend on packages which do (without
-providing implementations for those signatures.)
-
-\subsection{Package key generation}
-
-The algorithm Cabal uses in order to calculate what
-
\subsection{build-depends}
This field has been extended with new syntax
@@ -429,30 +380,44 @@ and to have the ability to include an indefinite package \emph{multiple times}
\emph{primary} mechanism by which holes are instantiated in a mix-in module
system, however, this instantiation only occurs when running \texttt{cabal-install}.
-Here is an example entry in \texttt{build-depends}: \texttt{foo >= 0.8
-(ASig as A1, B as B1; ASig as A2, ...)}. This statement includes the
+Here is an example entry in \texttt{build-depends}:
+\verb|foo >= 0.8 (ASig as A1, B as B1; ASig as A2, ...)|. This statement includes the
package \texttt{foo} twice, once with \texttt{ASig} instantiated with
\texttt{A1} and \texttt{B} renamed as \texttt{B1}, and once with
\texttt{ASig} instantiated with \texttt{A2}, and all other modules
imported with their original names. Assuming that the key of the first
instance of \texttt{foo} is \texttt{foo\_KEY1} and the key of the second instance
is \texttt{foo\_KEY2}, and that \texttt{ASig} is an \texttt{exposed-signature}, then this \texttt{build-depends} would turn into
-these flags for GHC: \texttt{-package-key "foo\_KEY1 (ASig as A1, B as B1)" -package-key "foo\_KEY2" -package-key "foo\_KEY2 (ASig as A2)"}
+these flags for GHC\@: \verb|-package-key "foo\_KEY1 (ASig as A1, B as B1)" -package-key "foo\_KEY2" -package-key "foo\_KEY2 (ASig as A2)"|
Syntactically, the thinnings and renamings are placed inside a
parenthetical after the package name and version constraints.
Semicolons distinguish separate inclusions of the package, and the inner
comma-separated lists indicate the thinning/renamings of the module.
-You can also write \texttt{...}, which simply
+You can also write \verb|...|, which simply
includes all of the default bindings from the package.
\Red{This is not implemented. Should this only refer to modules which were not referred to already? Should it refer only to holes?}
-There are two marks that should be made about separate instantiations of
+There are two remarks that should be made about separate instantiations of
the package. First, Cabal will automatically ``de-duplicate'' instances of
-the package which are equivalent: thus, \texttt{foo (A; B)} is equivalent to
-\texttt{foo (A, B)} when \texttt{foo} is a definite package, or
+the package which are equivalent: thus, \verb|foo (A; B)| is equivalent to
+\texttt{foo (A, B)} when \texttt{foo} is a definite package, or when the
+holes instantiation for each instance is equivalent. Second, when merging
+two \texttt{build-depends} statements together (for example, due to
+a conditional section in a Cabal file), they are considered \emph{separate
+inclusions of a package.}
+
+\subsection{Setup flags}
+
+There is one new flag for the \texttt{Setup} script, which can be
+used to manually provide instantiations for holes in a package:
+\verb|--instantiate-with NAME=PKG:MOD|, which binds a module \verb|NAME|
+to the implementation \verb|MOD| provided by installed package ID \verb|PKG|.
+The flag can be specified multiply times to provide bindings for all
+signatures. The module in question must be the \emph{original} module,
+not a re-export.
+
-\subsection{Setup new flags}
\subsection{Metadata in the installed package database}
diff --git a/docs/users_guide/7.10.1-notes.xml b/docs/users_guide/7.10.1-notes.xml
index a02c4b06ce..3ca5112a9f 100644
--- a/docs/users_guide/7.10.1-notes.xml
+++ b/docs/users_guide/7.10.1-notes.xml
@@ -66,6 +66,12 @@
<itemizedlist>
<listitem>
<para>
+ GHC has had its internal Unicode database for
+ parsing updated to the Unicode 7.0 standard.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
GHC now checks that all the language extensions required for
the inferred type signatures are explicitly enabled. This
means that if any of the type signatures inferred in your
@@ -81,6 +87,12 @@
<option>-XTypeFamilies</option>, <option>-XGADTs</option> or
<option>-XFlexibleContexts</option>).
</para>
+ <para>
+ <option>-fwarn-tabs</option> warning flag is turned on by
+ default with this release of GHC. It can be suppressed
+ either by using <literal>GHC_OPTIONS</literal> pragma or by
+ specifying <option>-fno-warn-tabs</option> flag.
+ </para>
</listitem>
</itemizedlist>
</sect3>
diff --git a/docs/users_guide/ghci.xml b/docs/users_guide/ghci.xml
index cbf5b764a1..4ea1f92f61 100644
--- a/docs/users_guide/ghci.xml
+++ b/docs/users_guide/ghci.xml
@@ -17,7 +17,7 @@
</footnote> the language extensions that GHC provides.
<indexterm><primary>FFI</primary><secondary>GHCi support</secondary></indexterm>
<indexterm><primary>Foreign Function
- Interface</primary><secondary>GHCi support</secondary></indexterm>.
+ Interface</primary><secondary>GHCi support</secondary></indexterm>
GHCi also includes an interactive debugger (see <xref linkend="ghci-debugger"/>).</para>
<sect1 id="ghci-introduction">
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index dd98f5ab66..7aff1a7fb0 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -7121,7 +7121,7 @@ class (F a ~ b) => C a b where
type <literal>(Show a, Ord a)</literal> is of kind <literal>Constraint</literal>.
</listitem>
<listitem>
- Anything whose form is not yet know, but the user has declared to have kind <literal>Constraint</literal>
+ Anything whose form is not yet known, but the user has declared to have kind <literal>Constraint</literal>
(for which they need to import it from <literal>GHC.Exts</literal>). So for example
<literal>type Foo (f :: * -> Constraint) = forall b. f b => b -> b</literal> is allowed, as well as
examples involving type families:
diff --git a/docs/users_guide/separate_compilation.xml b/docs/users_guide/separate_compilation.xml
index 5ef78804b5..43ab182729 100644
--- a/docs/users_guide/separate_compilation.xml
+++ b/docs/users_guide/separate_compilation.xml
@@ -883,6 +883,102 @@ methods entirely; but you must either omit them all or put them all in.
</para>
</sect2>
+ <sect2 id="module-signatures">
+ <title>Module signatures</title>
+ <para>GHC supports the specification of module signatures, which
+ both implementations and users can typecheck against separately.
+ This functionality should be considered experimental for now; some
+ details, especially for type classes and type families, may change.
+ This system was originally described in <ulink
+ url="http://plv.mpi-sws.org/backpack/">Backpack: Retrofitting Haskell with
+ Interfaces</ulink>. Signature files are somewhat similar to
+ <literal>hs-boot</literal> files, but have the <literal>hsig</literal>
+ extension and behave slightly differently.
+ </para>
+
+ <para>Suppose that I have modules <filename>String.hs</filename> and
+ <filename>A.hs</filename>, thus:</para>
+
+<programlisting>
+module Text where
+ data Text = Text String
+
+ empty :: Text
+ empty = Text ""
+
+ toString :: Text -> String
+ toString (Text s) = s
+
+module A where
+ import Text
+ z = toString empty
+</programlisting>
+
+ <para>Presently, module <literal>A</literal> depends explicitly on
+ a concrete implementation of <literal>Text</literal>. What if we wanted
+ to a signature <literal>Text</literal>, so we could vary the
+ implementation with other possibilities (e.g. packed UTF-8 encoded
+ bytestrings)? To do this, we can write a signature
+ <filename>TextSig.hsig</filename>, and modify <literal>A</literal>
+ to include the signature instead:
+ </para>
+
+<programlisting>
+module TextSig where
+ data Text
+ empty :: Text
+ toString :: Text -> String
+
+module A where
+ import TextSig
+ z = toString empty
+</programlisting>
+
+ <para>To compile these two files, we need to specify what module we
+ would like to use to implement the signature. This can be done by
+ compiling the implementation, and then using the <literal>-sig-of</literal>
+ flag to specify the implementation backing a signature:</para>
+
+<programlisting>
+ghc -c Text.hs
+ghc -c TextSig.hsig -sig-of main:Text
+ghc -c A.hs
+</programlisting>
+
+ <para>Signature files can also be compiled as part of
+ <literal>--make</literal>, in which case the syntax is extended
+ to support specifying implementations of multiple signatures
+ as <literal>FooSig is main:Foo, BarSig is main:Bar</literal>.
+ At the moment, you must specify the full module name (package key,
+ colon, and then module name), although in the future we may support
+ more user-friendly syntax.</para>
+
+ <para>To just type-check an interface file, no <literal>-sig-of</literal>
+ is necessary; instead, just pass the options
+ <literal>-fno-code -fwrite-interface</literal>. <literal>hsig</literal>
+ files will generate normal interface files which other files can
+ also use to type-check against. However, at the moment, we always
+ assume that an entity defined in a signature is a unique identifier
+ (even though we may happen to know it is type equal with another
+ identifier). In the future, we will support passing shaping information
+ to the compiler in order to let it know about these type
+ equalities.</para>
+
+ <para>Just like <literal>hs-boot</literal> files, when an
+ <literal>hsig</literal> file is compiled it is checked for type
+ consistency against the backing implementation; furthermore, it also
+ produces a pseudo-object file <literal>A.o</literal> which you should
+ not link with. Signature files are also written in a subset
+ of Haskell similar to essentially identical to that of
+ <literal>hs-boot</literal> files.</para>
+
+ <para>There is one important gotcha with the current implementation:
+ currently, instances from backing implementations will "leak" code that
+ uses signatures, and explicit instance declarations in signatures are
+ forbidden. This behavior will be subject to change.</para>
+
+ </sect2>
+
<sect2 id="using-make">
<title>Using <command>make</command></title>
diff --git a/libffi/ghc.mk b/libffi/ghc.mk
index 4e177d24a4..ec37f0c533 100644
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -90,6 +90,7 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP)
$(LIBFFI_PATH_MANGLE) \
cd build && \
CC=$(CC_STAGE1) \
+ CXX=$(CC_STAGE1) \
LD=$(LD) \
AR=$(AR_STAGE1) \
NM=$(NM) \
diff --git a/libraries/base/Data/Bifunctor.hs b/libraries/base/Data/Bifunctor.hs
new file mode 100644
index 0000000000..4c84f1cee1
--- /dev/null
+++ b/libraries/base/Data/Bifunctor.hs
@@ -0,0 +1,103 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module : Data.Bifunctor
+-- Copyright : (C) 2008-2014 Edward Kmett,
+-- License : BSD-style (see the file LICENSE)
+--
+-- Maintainer : libraries@haskell.org
+-- Stability : provisional
+-- Portability : portable
+--
+-- /Since: 4.8.0.0/
+----------------------------------------------------------------------------
+module Data.Bifunctor
+ ( Bifunctor(..)
+ ) where
+
+import Control.Applicative ( Const(..) )
+import Data.Either ( Either(..) )
+import GHC.Base ( (.), id )
+
+-- | Formally, the class 'Bifunctor' represents a bifunctor
+-- from @Hask@ -> @Hask@.
+--
+-- Intuitively it is a bifunctor where both the first and second
+-- arguments are covariant.
+--
+-- You can define a 'Bifunctor' by either defining 'bimap' or by
+-- defining both 'first' and 'second'.
+--
+-- If you supply 'bimap', you should ensure that:
+--
+-- @'bimap' 'id' 'id' ≡ 'id'@
+--
+-- If you supply 'first' and 'second', ensure:
+--
+-- @
+-- 'first' 'id' ≡ 'id'
+-- 'second' 'id' ≡ 'id'
+-- @
+--
+-- If you supply both, you should also ensure:
+--
+-- @'bimap' f g ≡ 'first' f '.' 'second' g@
+--
+-- These ensure by parametricity:
+--
+-- @
+-- 'bimap' (f '.' g) (h '.' i) ≡ 'bimap' f h '.' 'bimap' g i
+-- 'first' (f '.' g) ≡ 'first' f '.' 'first' g
+-- 'second' (f '.' g) ≡ 'second' f '.' 'second' g
+-- @
+--
+-- /Since: 4.8.0.0/
+class Bifunctor p where
+ {-# MINIMAL bimap | first, second #-}
+
+ -- | Map over both arguments at the same time.
+ --
+ -- @'bimap' f g ≡ 'first' f '.' 'second' g@
+ bimap :: (a -> b) -> (c -> d) -> p a c -> p b d
+ bimap f g = first f . second g
+
+ -- | Map covariantly over the first argument.
+ --
+ -- @'first' f ≡ 'bimap' f 'id'@
+ first :: (a -> b) -> p a c -> p b c
+ first f = bimap f id
+
+ -- | Map covariantly over the second argument.
+ --
+ -- @'second' ≡ 'bimap' 'id'@
+ second :: (b -> c) -> p a b -> p a c
+ second = bimap id
+
+
+instance Bifunctor (,) where
+ bimap f g ~(a, b) = (f a, g b)
+
+instance Bifunctor ((,,) x1) where
+ bimap f g ~(x1, a, b) = (x1, f a, g b)
+
+instance Bifunctor ((,,,) x1 x2) where
+ bimap f g ~(x1, x2, a, b) = (x1, x2, f a, g b)
+
+instance Bifunctor ((,,,,) x1 x2 x3) where
+ bimap f g ~(x1, x2, x3, a, b) = (x1, x2, x3, f a, g b)
+
+instance Bifunctor ((,,,,,) x1 x2 x3 x4) where
+ bimap f g ~(x1, x2, x3, x4, a, b) = (x1, x2, x3, x4, f a, g b)
+
+instance Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) where
+ bimap f g ~(x1, x2, x3, x4, x5, a, b) = (x1, x2, x3, x4, x5, f a, g b)
+
+
+instance Bifunctor Either where
+ bimap f _ (Left a) = Left (f a)
+ bimap _ g (Right b) = Right (g b)
+
+instance Bifunctor Const where
+ bimap f _ (Const a) = Const (f a)
diff --git a/libraries/base/Data/Bool.hs b/libraries/base/Data/Bool.hs
index deeac800f9..15371982ea 100644
--- a/libraries/base/Data/Bool.hs
+++ b/libraries/base/Data/Bool.hs
@@ -6,7 +6,7 @@
-- Module : Data.Bool
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
-- Portability : portable
@@ -18,7 +18,7 @@
module Data.Bool (
-- * Booleans
Bool(..),
- -- ** Operations
+ -- ** Operations
(&&),
(||),
not,
@@ -28,11 +28,34 @@ module Data.Bool (
import GHC.Base
--- | Case analysis for the 'Bool' type.
--- @bool a b p@ evaluates to @a@ when @p@ is @False@, and evaluates to @b@
--- when @p@ is @True@.
+-- | Case analysis for the 'Bool' type. @bool x y p@ evaluates to @x@
+-- when @p@ is @False@, and evaluates to @y@ when @p@ is @True@.
+--
+-- This is equivalent to @if p then y else x@; that is, one can
+-- think of it as an if-then-else construct with its arguments
+-- reordered.
+--
+-- /Since: 4.7.0.0/
+--
+-- ==== __Examples__
+--
+-- Basic usage:
+--
+-- >>> bool "foo" "bar" True
+-- "bar"
+-- >>> bool "foo" "bar" False
+-- "foo"
+--
+-- Confirm that @bool x y p@ and @if p then y else x@ are
+-- equivalent:
+--
+-- >>> let p = True; x = "bar"; y = "foo"
+-- >>> bool x y p == if p then y else x
+-- True
+-- >>> let p = False
+-- >>> bool x y p == if p then y else x
+-- True
--
--- /Since: 4.7.0.0/
bool :: a -> a -> Bool -> a
bool f _ False = f
bool _ t True = t
diff --git a/libraries/base/Data/Char.hs b/libraries/base/Data/Char.hs
index aa4a59485c..ac708ac0ef 100644
--- a/libraries/base/Data/Char.hs
+++ b/libraries/base/Data/Char.hs
@@ -68,10 +68,14 @@ import GHC.Enum
-- (i.e. @\'0\'@..@\'9\'@, @\'a\'@..@\'f\'@, @\'A\'@..@\'F\'@).
digitToInt :: Char -> Int
digitToInt c
- | isDigit c = ord c - ord '0'
- | c >= 'a' && c <= 'f' = ord c - ord 'a' + 10
- | c >= 'A' && c <= 'F' = ord c - ord 'A' + 10
- | otherwise = error ("Char.digitToInt: not a digit " ++ show c) -- sigh
+ | (fromIntegral dec::Word) <= 9 = dec
+ | (fromIntegral hexl::Word) <= 5 = hexl + 10
+ | (fromIntegral hexu::Word) <= 5 = hexu + 10
+ | otherwise = error ("Char.digitToInt: not a digit " ++ show c) -- sigh
+ where
+ dec = ord c - ord '0'
+ hexl = ord c - ord 'a'
+ hexu = ord c - ord 'A'
-- | Unicode General Categories (column 2 of the UnicodeData table)
-- in the order they are listed in the Unicode standard.
diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs
index d8310ca49e..75460bb2f6 100644
--- a/libraries/base/Data/Foldable.hs
+++ b/libraries/base/Data/Foldable.hs
@@ -49,7 +49,7 @@ module Data.Foldable (
import Data.Bool
import Data.Either
import Data.Eq
-import qualified Data.OldList as List
+import qualified GHC.List as List
import Data.Maybe
import Data.Monoid
import Data.Ord
diff --git a/libraries/base/Data/Functor.hs b/libraries/base/Data/Functor.hs
index 878445f6fa..0896947417 100644
--- a/libraries/base/Data/Functor.hs
+++ b/libraries/base/Data/Functor.hs
@@ -25,9 +25,42 @@ module Data.Functor
import GHC.Base ( Functor(..), const, flip )
+-- $setup
+-- Allow the use of Prelude in doctests.
+-- >>> import Prelude
+
infixl 4 <$>
-- | An infix synonym for 'fmap'.
+--
+-- ==== __Examples__
+--
+-- Convert from a 'Maybe' 'Int' to a 'Maybe' 'String' using 'show':
+--
+-- >>> show <$> Nothing
+-- Nothing
+-- >>> show <$> Just 3
+-- Just "3"
+--
+-- Convert from an 'Either' 'Int' 'Int' to an 'Either' 'Int'
+-- 'String' using 'show':
+--
+-- >>> show <$> Left 17
+-- Left 17
+-- >>> show <$> Right 17
+-- Right "17"
+--
+-- Double each element of a list:
+--
+-- >>> (*2) <$> [1,2,3]
+-- [2,4,6]
+--
+-- Apply 'even' to the second element of a pair:
+--
+-- >>> even <$> (2,2)
+-- (2,True)
+--
+--
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<$>) = fmap
@@ -35,11 +68,77 @@ infixl 4 $>
-- | Flipped version of '<$'.
--
--- /Since: 4.7.0.0/
+-- /Since: 4.7.0.0/
+--
+-- ==== __Examples__
+--
+-- Replace the contents of a 'Maybe' 'Int' with a constant 'String':
+--
+-- >>> Nothing $> "foo"
+-- Nothing
+-- >>> Just 90210 $> "foo"
+-- Just "foo"
+--
+-- Replace the contents of an 'Either' 'Int' 'Int' with a constant
+-- 'String', resulting in an 'Either' 'Int' 'String':
+--
+-- >>> Left 8675309 $> "foo"
+-- Left 8675309
+-- >>> Right 8675309 $> "foo"
+-- Right "foo"
+--
+-- Replace each element of a list with a constant 'String':
+--
+-- >>> [1,2,3] $> "foo"
+-- ["foo","foo","foo"]
+--
+-- Replace the second element of a pair with a constant 'String':
+--
+-- >>> (1,2) $> "foo"
+-- (1,"foo")
+--
($>) :: Functor f => f a -> b -> f b
($>) = flip (<$)
--- | @'void' value@ discards or ignores the result of evaluation, such as the
--- return value of an 'IO' action.
+-- | @'void' value@ discards or ignores the result of evaluation, such
+-- as the return value of an 'IO' action.
+--
+-- ==== __Examples__
+--
+-- Replace the contents of a 'Maybe' 'Int' with unit:
+--
+-- >>> void Nothing
+-- Nothing
+-- >>> void (Just 3)
+-- Just ()
+--
+-- Replace the contents of an 'Either' 'Int' 'Int' with unit,
+-- resulting in an 'Either' 'Int' '()':
+--
+-- >>> void (Left 8675309)
+-- Left 8675309
+-- >>> void (Right 8675309)
+-- Right ()
+--
+-- Replace every element of a list with unit:
+--
+-- >>> void [1,2,3]
+-- [(),(),()]
+--
+-- Replace the second element of a pair with unit:
+--
+-- >>> void (1,2)
+-- (1,())
+--
+-- Discard the result of an 'IO' action:
+--
+-- >>> mapM print [1,2]
+-- 1
+-- 2
+-- [(),()]
+-- >>> void $ mapM print [1,2]
+-- 1
+-- 2
+--
void :: Functor f => f a -> f ()
void = fmap (const ())
diff --git a/libraries/base/Data/IORef.hs b/libraries/base/Data/IORef.hs
index 0e5717cb7c..2981805cb6 100644
--- a/libraries/base/Data/IORef.hs
+++ b/libraries/base/Data/IORef.hs
@@ -106,9 +106,9 @@ atomicModifyIORef = GHC.IORef.atomicModifyIORef
-- /Since: 4.6.0.0/
atomicModifyIORef' :: IORef a -> (a -> (a,b)) -> IO b
atomicModifyIORef' ref f = do
- b <- atomicModifyIORef ref
- (\x -> let (a, b) = f x
- in (a, a `seq` b))
+ b <- atomicModifyIORef ref $ \a ->
+ case f a of
+ v@(a',_) -> a' `seq` v
b `seq` return b
-- | Variant of 'writeIORef' with the \"barrier to reordering\" property that
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs
index ff8515419a..00bc660985 100644
--- a/libraries/base/Data/OldList.hs
+++ b/libraries/base/Data/OldList.hs
@@ -277,12 +277,12 @@ findIndices :: (a -> Bool) -> [a] -> [Int]
#ifdef USE_REPORT_PRELUDE
findIndices p xs = [ i | (x,i) <- zip xs [0..], p x]
#else
--- Efficient definition
-findIndices p ls = loop 0# ls
- where
- loop _ [] = []
- loop n (x:xs) | p x = I# n : loop (n +# 1#) xs
- | otherwise = loop (n +# 1#) xs
+-- Efficient definition, adapted from Data.Sequence
+{-# INLINE findIndices #-}
+findIndices p ls = build $ \c n ->
+ let go x r k | p x = I# k `c` r (k +# 1#)
+ | otherwise = r (k +# 1#)
+ in foldr go (\_ -> n) ls 0#
#endif /* USE_REPORT_PRELUDE */
-- | The 'isPrefixOf' function takes two lists and returns 'True'
@@ -292,11 +292,34 @@ isPrefixOf [] _ = True
isPrefixOf _ [] = False
isPrefixOf (x:xs) (y:ys)= x == y && isPrefixOf xs ys
--- | The 'isSuffixOf' function takes two lists and returns 'True'
--- iff the first list is a suffix of the second.
--- Both lists must be finite.
+-- | The 'isSuffixOf' function takes two lists and returns 'True' iff
+-- the first list is a suffix of the second. The second list must be
+-- finite.
isSuffixOf :: (Eq a) => [a] -> [a] -> Bool
-isSuffixOf x y = reverse x `isPrefixOf` reverse y
+ns `isSuffixOf` hs = maybe False id $ do
+ delta <- dropLengthMaybe ns hs
+ return $ ns == dropLength delta hs
+ -- Since dropLengthMaybe ns hs succeeded, we know that (if hs is finite)
+ -- length ns + length delta = length hs
+ -- so dropping the length of delta from hs will yield a suffix exactly
+ -- the length of ns.
+
+-- A version of drop that drops the length of the first argument from the
+-- second argument. If xs is longer than ys, xs will not be traversed in its
+-- entirety. dropLength is also generally faster than (drop . length)
+-- Both this and dropLengthMaybe could be written as folds over their first
+-- arguments, but this reduces clarity with no benefit to isSuffixOf.
+dropLength :: [a] -> [b] -> [b]
+dropLength [] y = y
+dropLength _ [] = []
+dropLength (_:x') (_:y') = dropLength x' y'
+
+-- A version of dropLength that returns Nothing if the second list runs out of
+-- elements before the first.
+dropLengthMaybe :: [a] -> [b] -> Maybe [b]
+dropLengthMaybe [] y = Just y
+dropLengthMaybe _ [] = Nothing
+dropLengthMaybe (_:x') (_:y') = dropLengthMaybe x' y'
-- | The 'isInfixOf' function takes two lists and returns 'True'
-- iff the first list is contained, wholly and intact,
@@ -536,45 +559,6 @@ insertBy cmp x ys@(y:ys')
GT -> y : insertBy cmp x ys'
_ -> x : ys
--- | 'maximum' returns the maximum value from a list,
--- which must be non-empty, finite, and of an ordered type.
--- It is a special case of 'Data.List.maximumBy', which allows the
--- programmer to supply their own comparison function.
-maximum :: (Ord a) => [a] -> a
-{-# INLINE [1] maximum #-}
-maximum [] = errorEmptyList "maximum"
-maximum xs = foldl1 max xs
-
-{-# RULES
- "maximumInt" maximum = (strictMaximum :: [Int] -> Int);
- "maximumInteger" maximum = (strictMaximum :: [Integer] -> Integer)
- #-}
-
--- We can't make the overloaded version of maximum strict without
--- changing its semantics (max might not be strict), but we can for
--- the version specialised to 'Int'.
-strictMaximum :: (Ord a) => [a] -> a
-strictMaximum [] = errorEmptyList "maximum"
-strictMaximum xs = foldl1' max xs
-
--- | 'minimum' returns the minimum value from a list,
--- which must be non-empty, finite, and of an ordered type.
--- It is a special case of 'Data.List.minimumBy', which allows the
--- programmer to supply their own comparison function.
-minimum :: (Ord a) => [a] -> a
-{-# INLINE [1] minimum #-}
-minimum [] = errorEmptyList "minimum"
-minimum xs = foldl1 min xs
-
-{-# RULES
- "minimumInt" minimum = (strictMinimum :: [Int] -> Int);
- "minimumInteger" minimum = (strictMinimum :: [Integer] -> Integer)
- #-}
-
-strictMinimum :: (Ord a) => [a] -> a
-strictMinimum [] = errorEmptyList "minimum"
-strictMinimum xs = foldl1' min xs
-
-- | The 'maximumBy' function takes a comparison function and a list
-- and returns the greatest element of the list by the comparison function.
-- The list must be finite and non-empty.
@@ -1055,39 +1039,6 @@ unfoldr f b0 = build (\c n ->
in go b0)
-- -----------------------------------------------------------------------------
-
--- | A strict version of 'foldl'.
-foldl' :: forall a b . (b -> a -> b) -> b -> [a] -> b
-foldl' k z0 xs = foldr (\(v::a) (fn::b->b) (z::b) -> z `seq` fn (k z v)) (id :: b -> b) xs z0
--- Implementing foldl' via foldr is only a good idea if the compiler can optimize
--- the resulting code (eta-expand the recursive "go"), so this needs -fcall-arity!
--- Also see #7994
-
--- | 'foldl1' is a variant of 'foldl' that has no starting value argument,
--- and thus must be applied to non-empty lists.
-foldl1 :: (a -> a -> a) -> [a] -> a
-foldl1 f (x:xs) = foldl f x xs
-foldl1 _ [] = errorEmptyList "foldl1"
-
--- | A strict version of 'foldl1'
-foldl1' :: (a -> a -> a) -> [a] -> a
-foldl1' f (x:xs) = foldl' f x xs
-foldl1' _ [] = errorEmptyList "foldl1'"
-
--- -----------------------------------------------------------------------------
--- List sum and product
-
--- | The 'sum' function computes the sum of a finite list of numbers.
-sum :: (Num a) => [a] -> a
--- | The 'product' function computes the product of a finite list of numbers.
-product :: (Num a) => [a] -> a
-
-{-# INLINE sum #-}
-sum = foldl (+) 0
-{-# INLINE product #-}
-product = foldl (*) 1
-
--- -----------------------------------------------------------------------------
-- Functions on strings
-- | 'lines' breaks a string up into a list of strings at newline
diff --git a/libraries/base/GHC/Arr.lhs b/libraries/base/GHC/Arr.lhs
index 14bc917cca..2b30091b52 100644
--- a/libraries/base/GHC/Arr.lhs
+++ b/libraries/base/GHC/Arr.lhs
@@ -100,9 +100,9 @@ class (Ord a) => Ix a where
-- Must specify one of index, unsafeIndex
- -- 'index' is typically over-ridden in instances, with essentially
- -- the same code, but using indexError instead of hopelessIndexError
- -- Reason: we have 'Show' at the instances
+ -- 'index' is typically over-ridden in instances, with essentially
+ -- the same code, but using indexError instead of hopelessIndexError
+ -- Reason: we have 'Show' at the instances
{-# INLINE index #-} -- See Note [Inlining index]
index b i | inRange b i = unsafeIndex b i
| otherwise = hopelessIndexError
@@ -529,7 +529,7 @@ safeRangeSize (l,u) = let r = rangeSize (l, u)
else r
-- Don't inline this error message everywhere!!
-negRange :: Int -- Uninformative, but Ix does not provide Show
+negRange :: Int -- Uninformative, but Ix does not provide Show
negRange = error "Negative range size"
{-# INLINE[1] safeIndex #-}
@@ -537,7 +537,7 @@ negRange = error "Negative range size"
-- Inline *after* (!) so the rules can fire
-- Make sure it is strict in n
safeIndex :: Ix i => (i, i) -> Int -> i -> Int
-safeIndex (l,u) n@(I# _) i
+safeIndex (l,u) n@(I# _) i
| (0 <= i') && (i' < n) = i'
| otherwise = badSafeIndex i' n
where
@@ -633,9 +633,9 @@ adjust :: (e -> a -> e) -> MutableArray# s e -> (Int, a) -> STRep s b -> STRep s
-- See NB on 'fill'
adjust f marr# (I# i#, new) next
= \s1# -> case readArray# marr# i# s1# of
- (# s2#, old #) ->
- case writeArray# marr# i# (f old new) s2# of
- s3# -> next s3#
+ (# s2#, old #) ->
+ case writeArray# marr# i# (f old new) s2# of
+ s3# -> next s3#
-- | Constructs an array identical to the first argument except that it has
-- been updated by the associations in the right argument.
diff --git a/libraries/base/GHC/Exception.lhs b/libraries/base/GHC/Exception.lhs
index 540df31da1..e5bb0f9aaa 100644
--- a/libraries/base/GHC/Exception.lhs
+++ b/libraries/base/GHC/Exception.lhs
@@ -12,13 +12,13 @@
-- Module : GHC.Exception
-- Copyright : (c) The University of Glasgow, 1998-2002
-- License : see libraries/base/LICENSE
---
+--
-- Maintainer : cvs-ghc@haskell.org
-- Stability : internal
-- Portability : non-portable (GHC extensions)
--
-- Exceptions and exception-handling functions.
---
+--
-----------------------------------------------------------------------------
module GHC.Exception
@@ -194,8 +194,8 @@ data ArithException
deriving (Eq, Ord, Typeable)
divZeroException, overflowException, ratioZeroDenomException :: SomeException
-divZeroException = toException DivideByZero
-overflowException = toException Overflow
+divZeroException = toException DivideByZero
+overflowException = toException Overflow
ratioZeroDenomException = toException RatioZeroDenominator
instance Exception ArithException
diff --git a/libraries/base/GHC/Float.lhs b/libraries/base/GHC/Float.lhs
index fcb9c169f3..dc2c1de087 100644
--- a/libraries/base/GHC/Float.lhs
+++ b/libraries/base/GHC/Float.lhs
@@ -742,7 +742,7 @@ floatToDigits base x =
k1 = (lx * 8651) `quot` 28738
in if lx >= 0 then k1 + 1 else k1
else
- -- f :: Integer, log :: Float -> Float,
+ -- f :: Integer, log :: Float -> Float,
-- ceiling :: Float -> Int
ceiling ((log (fromInteger (f+1) :: Float) +
fromIntegral e * log (fromInteger b)) /
@@ -1133,8 +1133,8 @@ word2Float (W# w) = F# (word2Float# w)
"realToFrac/Float->Double" realToFrac = float2Double
"realToFrac/Double->Float" realToFrac = double2Float
"realToFrac/Double->Double" realToFrac = id :: Double -> Double
-"realToFrac/Int->Double" realToFrac = int2Double -- See Note [realToFrac int-to-float]
-"realToFrac/Int->Float" realToFrac = int2Float -- ..ditto
+"realToFrac/Int->Double" realToFrac = int2Double -- See Note [realToFrac int-to-float]
+"realToFrac/Int->Float" realToFrac = int2Float -- ..ditto
#-}
\end{code}
diff --git a/libraries/base/GHC/IO/Buffer.hs b/libraries/base/GHC/IO/Buffer.hs
index e0695552c8..77f1d99f46 100644
--- a/libraries/base/GHC/IO/Buffer.hs
+++ b/libraries/base/GHC/IO/Buffer.hs
@@ -7,7 +7,7 @@
-- Module : GHC.IO.Buffer
-- Copyright : (c) The University of Glasgow 2008
-- License : see libraries/base/LICENSE
---
+--
-- Maintainer : cvs-ghc@haskell.org
-- Stability : internal
-- Portability : non-portable (GHC Extensions)
@@ -179,11 +179,11 @@ charSize = 4
-- of the file.
data Buffer e
= Buffer {
- bufRaw :: !(RawBuffer e),
+ bufRaw :: !(RawBuffer e),
bufState :: BufferState,
- bufSize :: !Int, -- in elements, not bytes
- bufL :: !Int, -- offset of first item in the buffer
- bufR :: !Int -- offset of last item + 1
+ bufSize :: !Int, -- in elements, not bytes
+ bufL :: !Int, -- offset of first item in the buffer
+ bufR :: !Int -- offset of last item + 1
}
#ifdef CHARBUF_UTF16
@@ -237,7 +237,7 @@ bufferAdd :: Int -> Buffer e -> Buffer e
bufferAdd i buf@Buffer{ bufR=w } = buf{ bufR=w+i }
emptyBuffer :: RawBuffer e -> Int -> BufferState -> Buffer e
-emptyBuffer raw sz state =
+emptyBuffer raw sz state =
Buffer{ bufRaw=raw, bufState=state, bufR=0, bufL=0, bufSize=sz }
newByteBuffer :: Int -> BufferState -> IO (Buffer Word8)
@@ -270,7 +270,7 @@ summaryBuffer buf = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-"
-- * r <= w
-- * if r == w, and the buffer is for reading, then r == 0 && w == 0
-- * a write buffer is never full. If an operation
--- fills up the buffer, it will always flush it before
+-- fills up the buffer, it will always flush it before
-- returning.
-- * a read buffer may be full as a result of hLookAhead. In normal
-- operation, a read buffer always has at least one character of space.
@@ -278,10 +278,10 @@ summaryBuffer buf = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-"
checkBuffer :: Buffer a -> IO ()
checkBuffer buf@Buffer{ bufState = state, bufL=r, bufR=w, bufSize=size } = do
check buf (
- size > 0
- && r <= w
- && w <= size
- && ( r /= w || state == WriteBuffer || (r == 0 && w == 0) )
+ size > 0
+ && r <= w
+ && w <= size
+ && ( r /= w || state == WriteBuffer || (r == 0 && w == 0) )
&& ( state /= WriteBuffer || w < size ) -- write buffer is never full
)
diff --git a/libraries/base/GHC/IO/Encoding/Iconv.hs b/libraries/base/GHC/IO/Encoding/Iconv.hs
index 2ae6146317..892f84498e 100644
--- a/libraries/base/GHC/IO/Encoding/Iconv.hs
+++ b/libraries/base/GHC/IO/Encoding/Iconv.hs
@@ -10,7 +10,7 @@
-- Module : GHC.IO.Encoding.Iconv
-- Copyright : (c) The University of Glasgow, 2008-2009
-- License : see libraries/base/LICENSE
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : internal
-- Portability : non-portable
@@ -78,7 +78,7 @@ foreign import ccall unsafe "hs_iconv_close"
foreign import ccall unsafe "hs_iconv"
hs_iconv :: IConv -> Ptr CString -> Ptr CSize -> Ptr CString -> Ptr CSize
- -> IO CSize
+ -> IO CSize
foreign import ccall unsafe "localeEncoding"
c_localeEncoding :: IO CString
@@ -101,10 +101,10 @@ iconvEncoding = mkIconvEncoding ErrorOnCodingFailure
mkIconvEncoding :: CodingFailureMode -> String -> IO TextEncoding
mkIconvEncoding cfm charset = do
- return (TextEncoding {
+ return (TextEncoding {
textEncodingName = charset,
- mkTextDecoder = newIConv raw_charset (haskellChar ++ suffix) (recoverDecode cfm) iconvDecode,
- mkTextEncoder = newIConv haskellChar charset (recoverEncode cfm) iconvEncode})
+ mkTextDecoder = newIConv raw_charset (haskellChar ++ suffix) (recoverDecode cfm) iconvDecode,
+ mkTextEncoder = newIConv haskellChar charset (recoverEncode cfm) iconvEncode})
where
-- An annoying feature of GNU iconv is that the //PREFIXES only take
-- effect when they appear on the tocode parameter to iconv_open:
@@ -135,7 +135,7 @@ iconvDecode iconv_t ibuf obuf = iconvRecode iconv_t ibuf 0 obuf char_shift
iconvEncode :: IConv -> EncodeBuffer
iconvEncode iconv_t ibuf obuf = iconvRecode iconv_t ibuf char_shift obuf 0
-iconvRecode :: IConv -> Buffer a -> Int -> Buffer b -> Int
+iconvRecode :: IConv -> Buffer a -> Int -> Buffer b -> Int
-> IO (CodingProgress, Buffer a, Buffer b)
iconvRecode iconv_t
input@Buffer{ bufRaw=iraw, bufL=ir, bufR=iw, bufSize=_ } iscale
@@ -153,20 +153,20 @@ iconvRecode iconv_t
res <- hs_iconv iconv_t p_inbuf p_inleft p_outbuf p_outleft
new_inleft <- peek p_inleft
new_outleft <- peek p_outleft
- let
- new_inleft' = fromIntegral new_inleft `shiftR` iscale
- new_outleft' = fromIntegral new_outleft `shiftR` oscale
- new_input
+ let
+ new_inleft' = fromIntegral new_inleft `shiftR` iscale
+ new_outleft' = fromIntegral new_outleft `shiftR` oscale
+ new_input
| new_inleft == 0 = input { bufL = 0, bufR = 0 }
- | otherwise = input { bufL = iw - new_inleft' }
- new_output = output{ bufR = os - new_outleft' }
+ | otherwise = input { bufL = iw - new_inleft' }
+ new_output = output{ bufR = os - new_outleft' }
iconv_trace ("iconv res=" ++ show res)
iconv_trace ("iconvRecode after, input=" ++ show (summaryBuffer new_input))
iconv_trace ("iconvRecode after, output=" ++ show (summaryBuffer new_output))
if (res /= -1)
- then do -- all input translated
- return (InputUnderflow, new_input, new_output)
- else do
+ then do -- all input translated
+ return (InputUnderflow, new_input, new_output)
+ else do
errno <- getErrno
case errno of
e | e == e2BIG -> return (OutputUnderflow, new_input, new_output)
diff --git a/libraries/base/GHC/List.lhs b/libraries/base/GHC/List.lhs
index 7792eed524..6a930333e0 100644
--- a/libraries/base/GHC/List.lhs
+++ b/libraries/base/GHC/List.lhs
@@ -1,6 +1,7 @@
\begin{code}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, ScopedTypeVariables, MagicHash #-}
+{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
@@ -22,25 +23,21 @@ module GHC.List (
map, (++), filter, concat,
head, last, tail, init, uncons, null, length, (!!),
- foldl, scanl, scanl1, scanl', foldr, foldr1, scanr, scanr1,
- iterate, repeat, replicate, cycle,
- take, drop, splitAt, takeWhile, dropWhile, span, break,
- reverse, and, or,
+ foldl, foldl', foldl1, foldl1', scanl, scanl1, scanl', foldr, foldr1,
+ scanr, scanr1, iterate, repeat, replicate, cycle,
+ take, drop, sum, product, maximum, minimum, splitAt, takeWhile, dropWhile,
+ span, break, reverse, and, or,
any, all, elem, notElem, lookup,
concatMap,
zip, zip3, zipWith, zipWith3, unzip, unzip3,
errorEmptyList,
-#ifndef USE_REPORT_PRELUDE
- -- non-standard, but hidden when creating the Prelude
- -- export list.
- takeUInt_append
-#endif
-
) where
import Data.Maybe
import GHC.Base
+import GHC.Num (Num(..))
+import GHC.Integer (Integer)
infixl 9 !!
infix 4 `elem`, `notElem`
@@ -121,24 +118,27 @@ null (_:_) = False
-- the result type of which may be any kind of number.
{-# NOINLINE [1] length #-}
length :: [a] -> Int
-length l = lenAcc l 0#
-
-lenAcc :: [a] -> Int# -> Int
-lenAcc [] a# = I# a#
-lenAcc (_:xs) a# = lenAcc xs (a# +# 1#)
+length xs = lenAcc xs 0
-incLen :: a -> (Int# -> Int) -> Int# -> Int
-incLen _ g x = g (x +# 1#)
+lenAcc :: [a] -> Int -> Int
+lenAcc [] n = n
+lenAcc (_:ys) n = lenAcc ys (n+1)
--- These rules make length into a good consumer
--- Note that we use a higher-order-style use of foldr, so that
--- the accumulating parameter can be evaluated strictly
--- See Trac #876 for what goes wrong otherwise
{-# RULES
-"length" [~1] forall xs. length xs = foldr incLen I# xs 0#
-"lengthList" [1] foldr incLen I# = lenAcc
+"length" [~1] forall xs . length xs = foldr lengthFB idLength xs 0
+"lengthList" [1] foldr lengthFB idLength = lenAcc
#-}
+-- The lambda form turns out to be necessary to make this inline
+-- when we need it to and give good performance.
+{-# INLINE [0] lengthFB #-}
+lengthFB :: x -> (Int -> Int) -> Int -> Int
+lengthFB _ r = \ !a -> r (a + 1)
+
+{-# INLINE [0] idLength #-}
+idLength :: Int -> Int
+idLength = id
+
-- | 'filter', applied to a predicate and a list, returns the list of
-- those elements that satisfy the predicate; i.e.,
--
@@ -186,10 +186,47 @@ filterFB c p x r | p x = x `c` r
foldl :: forall a b. (b -> a -> b) -> b -> [a] -> b
{-# INLINE foldl #-}
-foldl k z0 xs = foldr (\(v::a) (fn::b->b) (z::b) -> fn (k z v)) (id :: b -> b) xs z0
+foldl k z0 xs =
+ foldr (\(v::a) (fn::b->b) (z::b) -> fn (k z v)) (id :: b -> b) xs z0
-- Implementing foldl via foldr is only a good idea if the compiler can optimize
--- the resulting code (eta-expand the recursive "go"), so this needs -fcall-arity!
--- Also see #7994
+-- the resulting code (eta-expand the recursive "go"), so this needs
+-- -fcall-arity! Also see #7994.
+
+-- ----------------------------------------------------------------------------
+
+-- | A strict version of 'foldl'.
+foldl' :: forall a b . (b -> a -> b) -> b -> [a] -> b
+{-# INLINE foldl' #-}
+foldl' k z0 xs =
+ foldr (\(v::a) (fn::b->b) (z::b) -> z `seq` fn (k z v)) (id :: b -> b) xs z0
+
+-- Implementing foldl' via foldr is only a good idea if the compiler can
+-- optimize the resulting code (eta-expand the recursive "go"), so this needs
+-- -fcall-arity! Also see #7994
+
+-- | 'foldl1' is a variant of 'foldl' that has no starting value argument,
+-- and thus must be applied to non-empty lists.
+foldl1 :: (a -> a -> a) -> [a] -> a
+foldl1 f (x:xs) = foldl f x xs
+foldl1 _ [] = errorEmptyList "foldl1"
+
+-- | A strict version of 'foldl1'
+foldl1' :: (a -> a -> a) -> [a] -> a
+foldl1' f (x:xs) = foldl' f x xs
+foldl1' _ [] = errorEmptyList "foldl1'"
+
+-- -----------------------------------------------------------------------------
+-- List sum and product
+
+-- | The 'sum' function computes the sum of a finite list of numbers.
+sum :: (Num a) => [a] -> a
+{-# INLINE sum #-}
+sum = foldl (+) 0
+
+-- | The 'product' function computes the product of a finite list of numbers.
+product :: (Num a) => [a] -> a
+{-# INLINE product #-}
+product = foldl (*) 1
-- | 'scanl' is similar to 'foldl', but returns a list of successive
-- reduced values from the left:
@@ -244,9 +281,9 @@ scanl' :: (b -> a -> b) -> b -> [a] -> [b]
scanl' = scanlGo'
where
scanlGo' :: (b -> a -> b) -> b -> [a] -> [b]
- scanlGo' f q ls = q `seq` q : (case ls of
- [] -> []
- x:xs -> scanlGo' f (f q x) xs)
+ scanlGo' f !q ls = q : (case ls of
+ [] -> []
+ x:xs -> scanlGo' f (f q x) xs)
-- Note [scanl rewrite rules]
{-# RULES
@@ -258,11 +295,11 @@ scanl' = scanlGo'
{-# INLINE [0] scanlFB' #-}
scanlFB' :: (b -> a -> b) -> (b -> c -> c) -> a -> (b -> c) -> b -> c
-scanlFB' f c = \b g x -> let b' = f x b in b' `seq` b' `c` g b'
+scanlFB' f c = \b g x -> let !b' = f x b in b' `c` g b'
{-# INLINE [0] flipSeqScanl' #-}
flipSeqScanl' :: a -> b -> a
-flipSeqScanl' = flip seq
+flipSeqScanl' a !_b = a
{-
Note [scanl rewrite rules]
@@ -309,7 +346,6 @@ foldr1 _ [] = errorEmptyList "foldr1"
-- Note that
--
-- > head (scanr f z xs) == foldr f z xs.
-
{-# NOINLINE [1] scanr #-}
scanr :: (a -> b -> b) -> b -> [a] -> [b]
scanr _ q0 [] = [q0]
@@ -334,13 +370,52 @@ scanrFB f c = \x (r, est) -> (f x r, r `c` est)
#-}
-- | 'scanr1' is a variant of 'scanr' that has no starting value argument.
-
scanr1 :: (a -> a -> a) -> [a] -> [a]
scanr1 _ [] = []
scanr1 _ [x] = [x]
scanr1 f (x:xs) = f x q : qs
where qs@(q:_) = scanr1 f xs
+-- | 'maximum' returns the maximum value from a list,
+-- which must be non-empty, finite, and of an ordered type.
+-- It is a special case of 'Data.List.maximumBy', which allows the
+-- programmer to supply their own comparison function.
+maximum :: (Ord a) => [a] -> a
+{-# INLINE [1] maximum #-}
+maximum [] = errorEmptyList "maximum"
+maximum xs = foldl1 max xs
+
+{-# RULES
+ "maximumInt" maximum = (strictMaximum :: [Int] -> Int);
+ "maximumInteger" maximum = (strictMaximum :: [Integer] -> Integer)
+ #-}
+
+-- We can't make the overloaded version of maximum strict without
+-- changing its semantics (max might not be strict), but we can for
+-- the version specialised to 'Int'.
+strictMaximum :: (Ord a) => [a] -> a
+strictMaximum [] = errorEmptyList "maximum"
+strictMaximum xs = foldl1' max xs
+
+-- | 'minimum' returns the minimum value from a list,
+-- which must be non-empty, finite, and of an ordered type.
+-- It is a special case of 'Data.List.minimumBy', which allows the
+-- programmer to supply their own comparison function.
+minimum :: (Ord a) => [a] -> a
+{-# INLINE [1] minimum #-}
+minimum [] = errorEmptyList "minimum"
+minimum xs = foldl1 min xs
+
+{-# RULES
+ "minimumInt" minimum = (strictMinimum :: [Int] -> Int);
+ "minimumInteger" minimum = (strictMinimum :: [Integer] -> Integer)
+ #-}
+
+strictMinimum :: (Ord a) => [a] -> a
+strictMinimum [] = errorEmptyList "minimum"
+strictMinimum xs = foldl1' min xs
+
+
-- | 'iterate' @f x@ returns an infinite list of repeated applications
-- of @f@ to @x@:
--
@@ -352,7 +427,8 @@ iterate f x = x : iterate f (f x)
{-# NOINLINE [0] iterateFB #-}
iterateFB :: (a -> b -> b) -> (a -> a) -> a -> b
-iterateFB c f x = x `c` iterateFB c f (f x)
+iterateFB c f x0 = go x0
+ where go x = x `c` go (f x)
{-# RULES
"iterate" [~1] forall f x. iterate f x = build (\c _n -> iterateFB c f x)
@@ -389,7 +465,7 @@ replicate n x = take n (repeat x)
-- on infinite lists.
cycle :: [a] -> [a]
-cycle [] = error "Prelude.cycle: empty list"
+cycle [] = errorEmptyList "cycle"
cycle xs = xs' where xs' = xs ++ xs'
-- | 'takeWhile', applied to a predicate @p@ and a list @xs@, returns the
@@ -452,6 +528,59 @@ dropWhile p xs@(x:xs')
-- It is an instance of the more general 'Data.List.genericTake',
-- in which @n@ may be of any integral type.
take :: Int -> [a] -> [a]
+#ifdef USE_REPORT_PRELUDE
+take n _ | n <= 0 = []
+take _ [] = []
+take n (x:xs) = x : take (n-1) xs
+#else
+
+{- We always want to inline this to take advantage of a known length argument
+sign. Note, however, that it's important for the RULES to grab take, rather
+than trying to INLINE take immediately and then letting the RULES grab
+unsafeTake. Presumably the latter approach doesn't grab it early enough; it led
+to an allocation regression in nofib/fft2. -}
+{-# INLINE [1] take #-}
+take n xs | 0 < n = unsafeTake n xs
+ | otherwise = []
+
+-- A version of take that takes the whole list if it's given an argument less
+-- than 1.
+{-# NOINLINE [1] unsafeTake #-}
+unsafeTake :: Int -> [a] -> [a]
+unsafeTake !_ [] = []
+unsafeTake 1 (x: _) = [x]
+unsafeTake m (x:xs) = x : unsafeTake (m - 1) xs
+
+{-# RULES
+"take" [~1] forall n xs . take n xs =
+ build (\c nil -> if 0 < n
+ then foldr (takeFB c nil) (flipSeqTake nil) xs n
+ else nil)
+"unsafeTakeList" [1] forall n xs . foldr (takeFB (:) []) (flipSeqTake []) xs n
+ = unsafeTake n xs
+ #-}
+
+{-# INLINE [0] flipSeqTake #-}
+-- Just flip seq, specialized to Int, but not inlined too early.
+-- It's important to force the numeric argument here, even though
+-- it's not used. Otherwise, take n [] doesn't force n. This is
+-- bad for strictness analysis and unboxing, and leads to increased
+-- allocation in T7257.
+flipSeqTake :: a -> Int -> a
+flipSeqTake x !_n = x
+
+{-# INLINE [0] takeFB #-}
+takeFB :: (a -> b -> b) -> b -> a -> (Int -> b) -> Int -> b
+-- The \m accounts for the fact that takeFB is used in a higher-order
+-- way by takeFoldr, so it's better to inline. A good example is
+-- take n (repeat x)
+-- for which we get excellent code... but only if we inline takeFB
+-- when given four arguments
+takeFB c n x xs
+ = \ m -> case m of
+ 1 -> x `c` n
+ _ -> x `c` xs (m - 1)
+#endif
-- | 'drop' @n xs@ returns the suffix of @xs@
-- after the first @n@ elements, or @[]@ if @n > 'length' xs@:
@@ -466,6 +595,23 @@ take :: Int -> [a] -> [a]
-- It is an instance of the more general 'Data.List.genericDrop',
-- in which @n@ may be of any integral type.
drop :: Int -> [a] -> [a]
+#ifdef USE_REPORT_PRELUDE
+drop n xs | n <= 0 = xs
+drop _ [] = []
+drop n (_:xs) = drop (n-1) xs
+#else /* hack away */
+{-# INLINE drop #-}
+drop n ls
+ | n <= 0 = ls
+ | otherwise = unsafeDrop n ls
+ where
+ -- A version of drop that drops the whole list if given an argument
+ -- less than 1
+ unsafeDrop :: Int -> [a] -> [a]
+ unsafeDrop !_ [] = []
+ unsafeDrop 1 (_:xs) = xs
+ unsafeDrop m (_:xs) = unsafeDrop (m - 1) xs
+#endif
-- | 'splitAt' @n xs@ returns a tuple where first element is @xs@ prefix of
-- length @n@ and second element is the remainder of the list:
@@ -485,97 +631,18 @@ drop :: Int -> [a] -> [a]
splitAt :: Int -> [a] -> ([a],[a])
#ifdef USE_REPORT_PRELUDE
-take n _ | n <= 0 = []
-take _ [] = []
-take n (x:xs) = x : take (n-1) xs
-
-drop n xs | n <= 0 = xs
-drop _ [] = []
-drop n (_:xs) = drop (n-1) xs
-
splitAt n xs = (take n xs, drop n xs)
-
-#else /* hack away */
-{-# RULES
-"take" [~1] forall n xs . take n xs = takeFoldr n xs
-"takeList" [1] forall n xs . foldr (takeFB (:) []) (takeConst []) xs n = takeUInt n xs
- #-}
-
-{-# INLINE takeFoldr #-}
-takeFoldr :: Int -> [a] -> [a]
-takeFoldr (I# n#) xs
- = build (\c nil -> if isTrue# (n# <=# 0#) then nil else
- foldr (takeFB c nil) (takeConst nil) xs n#)
-
-{-# NOINLINE [0] takeConst #-}
--- just a version of const that doesn't get inlined too early, so we
--- can spot it in rules. Also we need a type sig due to the unboxed Int#.
-takeConst :: a -> Int# -> a
-takeConst x _ = x
-
-{-# INLINE [0] takeFB #-}
-takeFB :: (a -> b -> b) -> b -> a -> (Int# -> b) -> Int# -> b
--- The \m accounts for the fact that takeFB is used in a higher-order
--- way by takeFoldr, so it's better to inline. A good example is
--- take n (repeat x)
--- for which we get excellent code... but only if we inline takeFB
--- when given four arguments
-takeFB c n x xs
- = \ m -> if isTrue# (m <=# 1#)
- then x `c` n
- else x `c` xs (m -# 1#)
-
-{-# INLINE [0] take #-}
-take (I# n#) xs = takeUInt n# xs
-
--- The general code for take, below, checks n <= maxInt
--- No need to check for maxInt overflow when specialised
--- at type Int or Int# since the Int must be <= maxInt
-
-takeUInt :: Int# -> [b] -> [b]
-takeUInt n xs
- | isTrue# (n >=# 0#) = take_unsafe_UInt n xs
- | otherwise = []
-
-take_unsafe_UInt :: Int# -> [b] -> [b]
-take_unsafe_UInt 0# _ = []
-take_unsafe_UInt m ls =
- case ls of
- [] -> []
- (x:xs) -> x : take_unsafe_UInt (m -# 1#) xs
-
-takeUInt_append :: Int# -> [b] -> [b] -> [b]
-takeUInt_append n xs rs
- | isTrue# (n >=# 0#) = take_unsafe_UInt_append n xs rs
- | otherwise = []
-
-take_unsafe_UInt_append :: Int# -> [b] -> [b] -> [b]
-take_unsafe_UInt_append 0# _ rs = rs
-take_unsafe_UInt_append m ls rs =
- case ls of
- [] -> rs
- (x:xs) -> x : take_unsafe_UInt_append (m -# 1#) xs rs
-
-drop (I# n#) ls
- | isTrue# (n# <# 0#) = ls
- | otherwise = drop# n# ls
- where
- drop# :: Int# -> [a] -> [a]
- drop# 0# xs = xs
- drop# _ xs@[] = xs
- drop# m# (_:xs) = drop# (m# -# 1#) xs
-
-splitAt (I# n#) ls
- | isTrue# (n# <# 0#) = ([], ls)
- | otherwise = splitAt# n# ls
+#else
+splitAt n ls
+ | n <= 0 = ([], ls)
+ | otherwise = splitAt' n ls
where
- splitAt# :: Int# -> [a] -> ([a], [a])
- splitAt# 0# xs = ([], xs)
- splitAt# _ xs@[] = (xs, xs)
- splitAt# m# (x:xs) = (x:xs', xs'')
+ splitAt' :: Int -> [a] -> ([a], [a])
+ splitAt' _ [] = ([], [])
+ splitAt' 1 (x:xs) = ([x], xs)
+ splitAt' m (x:xs) = (x:xs', xs'')
where
- (xs', xs'') = splitAt# (m# -# 1#) xs
-
+ (xs', xs'') = splitAt' (m - 1) xs
#endif /* USE_REPORT_PRELUDE */
-- | 'span', applied to a predicate @p@ and a list @xs@, returns a tuple where
@@ -631,26 +698,31 @@ reverse l = rev l []
-- 'True', the list must be finite; 'False', however, results from a 'False'
-- value at a finite index of a finite or infinite list.
and :: [Bool] -> Bool
+#ifdef USE_REPORT_PRELUDE
+and = foldr (&&) True
+#else
+and [] = True
+and (x:xs) = x && and xs
+{-# NOINLINE [1] and #-}
+
+{-# RULES
+"and/build" forall (g::forall b.(Bool->b->b)->b->b) .
+ and (build g) = g (&&) True
+ #-}
+#endif
-- | 'or' returns the disjunction of a Boolean list. For the result to be
-- 'False', the list must be finite; 'True', however, results from a 'True'
-- value at a finite index of a finite or infinite list.
or :: [Bool] -> Bool
#ifdef USE_REPORT_PRELUDE
-and = foldr (&&) True
or = foldr (||) False
#else
-and [] = True
-and (x:xs) = x && and xs
or [] = False
or (x:xs) = x || or xs
-
-{-# NOINLINE [1] and #-}
{-# NOINLINE [1] or #-}
{-# RULES
-"and/build" forall (g::forall b.(Bool->b->b)->b->b) .
- and (build g) = g (&&) True
"or/build" forall (g::forall b.(Bool->b->b)->b->b) .
or (build g) = g (||) False
#-}
@@ -662,27 +734,34 @@ or (x:xs) = x || or xs
-- value for the predicate applied to an element at a finite index of a finite or infinite list.
any :: (a -> Bool) -> [a] -> Bool
+#ifdef USE_REPORT_PRELUDE
+any p = or . map p
+#else
+any _ [] = False
+any p (x:xs) = p x || any p xs
+
+{-# NOINLINE [1] any #-}
+
+{-# RULES
+"any/build" forall p (g::forall b.(a->b->b)->b->b) .
+ any p (build g) = g ((||) . p) False
+ #-}
+#endif
+
-- | Applied to a predicate and a list, 'all' determines if all elements
-- of the list satisfy the predicate. For the result to be
-- 'True', the list must be finite; 'False', however, results from a 'False'
-- value for the predicate applied to an element at a finite index of a finite or infinite list.
all :: (a -> Bool) -> [a] -> Bool
#ifdef USE_REPORT_PRELUDE
-any p = or . map p
all p = and . map p
#else
-any _ [] = False
-any p (x:xs) = p x || any p xs
-
all _ [] = True
all p (x:xs) = p x && all p xs
-{-# NOINLINE [1] any #-}
{-# NOINLINE [1] all #-}
{-# RULES
-"any/build" forall p (g::forall b.(a->b->b)->b->b) .
- any p (build g) = g ((||) . p) False
"all/build" forall p (g::forall b.(a->b->b)->b->b) .
all p (build g) = g ((&&) . p) True
#-}
@@ -690,20 +769,33 @@ all p (x:xs) = p x && all p xs
-- | 'elem' is the list membership predicate, usually written in infix form,
-- e.g., @x \`elem\` xs@. For the result to be
--- 'False', the list must be finite; 'True', however, results from an element equal to @x@ found at a finite index of a finite or infinite list.
+-- 'False', the list must be finite; 'True', however, results from an element
+-- equal to @x@ found at a finite index of a finite or infinite list.
elem :: (Eq a) => a -> [a] -> Bool
-
--- | 'notElem' is the negation of 'elem'.
-notElem :: (Eq a) => a -> [a] -> Bool
#ifdef USE_REPORT_PRELUDE
elem x = any (== x)
-notElem x = all (/= x)
#else
elem _ [] = False
elem x (y:ys) = x==y || elem x ys
+{-# NOINLINE [1] elem #-}
+{-# RULES
+"elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b)
+ . elem x (build g) = g (\ y r -> (x == y) || r) False
+ #-}
+#endif
+-- | 'notElem' is the negation of 'elem'.
+notElem :: (Eq a) => a -> [a] -> Bool
+#ifdef USE_REPORT_PRELUDE
+notElem x = all (/= x)
+#else
notElem _ [] = True
notElem x (y:ys)= x /= y && notElem x ys
+{-# NOINLINE [1] notElem #-}
+{-# RULES
+"notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b)
+ . notElem x (build g) = g (\ y r -> (x /= y) && r) True
+ #-}
#endif
-- | 'lookup' @key assocs@ looks up a key in an association list.
@@ -717,6 +809,14 @@ lookup key ((x,y):xys)
concatMap :: (a -> [b]) -> [a] -> [b]
concatMap f = foldr ((++) . f) []
+{-# NOINLINE [1] concatMap #-}
+
+{-# RULES
+"concatMap" forall f xs . concatMap f xs =
+ build (\c n -> foldr (\x b -> foldr c b (f x)) n xs)
+ #-}
+
+
-- | Concatenate a list of lists.
concat :: [[a]] -> [a]
concat = foldr (++) []
@@ -724,7 +824,8 @@ concat = foldr (++) []
{-# NOINLINE [1] concat #-}
{-# RULES
- "concat" forall xs. concat xs = build (\c n -> foldr (\x y -> foldr c y x) n xs)
+ "concat" forall xs. concat xs =
+ build (\c n -> foldr (\x y -> foldr c y x) n xs)
-- We don't bother to turn non-fusible applications of concat back into concat
#-}
@@ -742,15 +843,23 @@ xs !! n | n < 0 = error "Prelude.!!: negative index"
(x:_) !! 0 = x
(_:xs) !! n = xs !! (n-1)
#else
--- HBC version (stolen), then unboxified
-xs !! (I# n0) | isTrue# (n0 <# 0#) = error "Prelude.(!!): negative index\n"
- | otherwise = sub xs n0
- where
- sub :: [a] -> Int# -> a
- sub [] _ = error "Prelude.(!!): index too large\n"
- sub (y:ys) n = if isTrue# (n ==# 0#)
- then y
- else sub ys (n -# 1#)
+
+-- We don't really want the errors to inline with (!!).
+-- We may want to fuss around a bit with NOINLINE, and
+-- if so we should be careful not to trip up known-bottom
+-- optimizations.
+tooLarge :: Int -> a
+tooLarge _ = error (prel_list_str ++ "!!: index too large")
+
+negIndex :: a
+negIndex = error $ prel_list_str ++ "!!: negative index"
+
+{-# INLINABLE (!!) #-}
+xs !! n
+ | n < 0 = negIndex
+ | otherwise = foldr (\x r k -> case k of
+ 0 -> x
+ _ -> r (k-1)) tooLarge xs n
#endif
\end{code}
@@ -765,7 +874,7 @@ xs !! (I# n0) | isTrue# (n0 <# 0#) = error "Prelude.(!!): negative index\n"
foldr2 :: (a -> b -> c -> c) -> c -> [a] -> [b] -> c
foldr2 k z = go
where
- go [] ys = ys `seq` z -- see #9495 for the seq
+ go [] !_ys = z -- see #9495 for the !
go _xs [] = z
go (x:xs) (y:ys) = k x y (go xs ys)
{-# INLINE [0] foldr2 #-}
@@ -809,7 +918,7 @@ Zips for larger tuples are in the List module.
-- list preserve semantics.
{-# NOINLINE [1] zip #-}
zip :: [a] -> [b] -> [(a,b)]
-zip [] bs = bs `seq` [] -- see #9495 for the seq
+zip [] !_bs = [] -- see #9495 for the !
zip _as [] = []
zip (a:as) (b:bs) = (a,b) : zip as bs
@@ -858,7 +967,7 @@ zip3 _ _ _ = []
{-# NOINLINE [1] zipWith #-}
zipWith :: (a->b->c) -> [a]->[b]->[c]
-zipWith _f [] bs = bs `seq` [] -- see #9495 for the seq
+zipWith _f [] !_bs = [] -- see #9495 for the !
zipWith _f _as [] = []
zipWith f (a:as) (b:bs) = f a b : zipWith f as bs
diff --git a/libraries/base/GHC/Num.lhs b/libraries/base/GHC/Num.lhs
index 5cdf782a41..4e0bef2972 100644
--- a/libraries/base/GHC/Num.lhs
+++ b/libraries/base/GHC/Num.lhs
@@ -93,7 +93,7 @@ instance Num Int where
| n `eqInt` 0 = 0
| otherwise = 1
- {-# INLINE fromInteger #-} -- Just to be sure!
+ {-# INLINE fromInteger #-} -- Just to be sure!
fromInteger i = I# (integerToInt i)
\end{code}
diff --git a/libraries/base/GHC/Real.lhs b/libraries/base/GHC/Real.lhs
index 481125aa93..9b5c5d8463 100644
--- a/libraries/base/GHC/Real.lhs
+++ b/libraries/base/GHC/Real.lhs
@@ -241,10 +241,10 @@ These 'numeric' enumerations come straight from the Report
\begin{code}
numericEnumFrom :: (Fractional a) => a -> [a]
-numericEnumFrom n = n `seq` (n : numericEnumFrom (n + 1))
+numericEnumFrom n = n `seq` (n : numericEnumFrom (n + 1))
numericEnumFromThen :: (Fractional a) => a -> a -> [a]
-numericEnumFromThen n m = n `seq` m `seq` (n : numericEnumFromThen m (m+m-n))
+numericEnumFromThen n m = n `seq` m `seq` (n : numericEnumFromThen m (m+m-n))
numericEnumFromTo :: (Ord a, Fractional a) => a -> a -> [a]
numericEnumFromTo n m = takeWhile (<= m + 1/2) (numericEnumFrom n)
diff --git a/libraries/base/GHC/TopHandler.lhs b/libraries/base/GHC/TopHandler.lhs
index cdca26205c..52ac6c8eb8 100644
--- a/libraries/base/GHC/TopHandler.lhs
+++ b/libraries/base/GHC/TopHandler.lhs
@@ -12,7 +12,7 @@
-- Module : GHC.TopHandler
-- Copyright : (c) The University of Glasgow, 2001-2002
-- License : see libraries/base/LICENSE
---
+--
-- Maintainer : cvs-ghc@haskell.org
-- Stability : internal
-- Portability : non-portable (GHC Extensions)
@@ -55,12 +55,12 @@ import Data.Dynamic (toDyn)
-- called in the program). It catches otherwise uncaught exceptions,
-- and also flushes stdout\/stderr before exiting.
runMainIO :: IO a -> IO a
-runMainIO main =
- do
+runMainIO main =
+ do
main_thread_id <- myThreadId
weak_tid <- mkWeakThreadId main_thread_id
install_interrupt_handler $ do
- m <- deRefWeak weak_tid
+ m <- deRefWeak weak_tid
case m of
Nothing -> return ()
Just tid -> throwTo tid (toException UserInterrupt)
@@ -72,7 +72,7 @@ install_interrupt_handler :: IO () -> IO ()
#ifdef mingw32_HOST_OS
install_interrupt_handler handler = do
_ <- GHC.ConsoleHandler.installHandler $
- Catch $ \event ->
+ Catch $ \event ->
case event of
ControlC -> handler
Break -> handler
@@ -93,10 +93,10 @@ install_interrupt_handler handler = do
foreign import ccall unsafe
stg_sig_install
- :: CInt -- sig no.
- -> CInt -- action code (STG_SIG_HAN etc.)
- -> Ptr () -- (in, out) blocked
- -> IO CInt -- (ret) old action code
+ :: CInt -- sig no.
+ -> CInt -- action code (STG_SIG_HAN etc.)
+ -> Ptr () -- (in, out) blocked
+ -> IO CInt -- (ret) old action code
#endif
-- | 'runIO' is wrapped around every @foreign export@ and @foreign
@@ -112,7 +112,7 @@ runIO main = catch main topHandler
-- we don't shut down the system cleanly, we just exit. This is
-- useful in some cases, because the safe exit version will give other
-- threads a chance to clean up first, which might shut down the
--- system in a different way. For example, try
+-- system in a different way. For example, try
--
-- main = forkIO (runIO (exitWith (ExitFailure 1))) >> threadDelay 10000
--
@@ -135,7 +135,7 @@ topHandler :: SomeException -> IO a
topHandler err = catch (real_handler safeExit err) topHandler
topHandlerFastExit :: SomeException -> IO a
-topHandlerFastExit err =
+topHandlerFastExit err =
catchException (real_handler fastExit err) topHandlerFastExit
-- Make sure we handle errors while reporting the error!
@@ -165,7 +165,7 @@ real_handler exit se = do
| Errno ioe == ePIPE, hdl == stdout -> exit 0
_ -> do reportError se
exit 1
-
+
-- try to flush stdout/stderr, but don't worry if we fail
-- (these handles might have errors, and we don't want to go into
@@ -204,7 +204,7 @@ foreign import ccall "shutdownHaskellAndSignal"
#endif
exitInterrupted :: IO a
-exitInterrupted =
+exitInterrupted =
#ifdef mingw32_HOST_OS
safeExit 252
#else
diff --git a/libraries/base/GHC/Unicode.hs b/libraries/base/GHC/Unicode.hs
index dea2fb97b9..627780586f 100644
--- a/libraries/base/GHC/Unicode.hs
+++ b/libraries/base/GHC/Unicode.hs
@@ -30,6 +30,8 @@ module GHC.Unicode (
import GHC.Base
import GHC.Char (chr)
+import GHC.Real
+import GHC.Num
#include "HsBaseConfig.h"
@@ -65,16 +67,16 @@ isPrint :: Char -> Bool
-- characters @\\t@, @\\n@, @\\r@, @\\f@, @\\v@.
isSpace :: Char -> Bool
-- isSpace includes non-breaking space
--- Done with explicit equalities both for efficiency, and to avoid a tiresome
--- recursion with GHC.List elem
-isSpace c = c == ' ' ||
- c == '\t' ||
- c == '\n' ||
- c == '\r' ||
- c == '\f' ||
- c == '\v' ||
- c == '\xa0' ||
- iswspace (ord c) /= 0
+-- The magic 0x377 isn't really that magical. As of 2014, all the codepoints
+-- at or below 0x377 have been assigned, so we shouldn't have to worry about
+-- any new spaces appearing below there. It would probably be best to
+-- use branchless ||, but currently the eqLit transformation will undo that,
+-- so we'll do it like this until there's a way around that.
+isSpace c
+ | uc <= 0x377 = uc == 32 || uc - 0x9 <= 4 || uc == 0xa0
+ | otherwise = iswspace (ord c) /= 0
+ where
+ uc = fromIntegral (ord c) :: Word
-- | Selects upper-case or title-case alphabetic Unicode characters (letters).
-- Title case is used by a small number of letter ligatures like the
@@ -98,17 +100,23 @@ isAlphaNum :: Char -> Bool
-- | Selects ASCII digits, i.e. @\'0\'@..@\'9\'@.
isDigit :: Char -> Bool
-isDigit c = c >= '0' && c <= '9'
+isDigit c = (fromIntegral (ord c - ord '0') :: Word) <= 9
+
+-- We use an addition and an unsigned comparison instead of two signed
+-- comparisons because it's usually faster and puts less strain on branch
+-- prediction. It likely also enables some CSE when combined with functions
+-- that follow up with an actual conversion.
-- | Selects ASCII octal digits, i.e. @\'0\'@..@\'7\'@.
isOctDigit :: Char -> Bool
-isOctDigit c = c >= '0' && c <= '7'
+isOctDigit c = (fromIntegral (ord c - ord '0') :: Word) <= 7
-- | Selects ASCII hexadecimal digits,
-- i.e. @\'0\'@..@\'9\'@, @\'a\'@..@\'f\'@, @\'A\'@..@\'F\'@.
isHexDigit :: Char -> Bool
-isHexDigit c = isDigit c || c >= 'A' && c <= 'F' ||
- c >= 'a' && c <= 'f'
+isHexDigit c = isDigit c ||
+ (fromIntegral (ord c - ord 'A')::Word) <= 5 ||
+ (fromIntegral (ord c - ord 'a')::Word) <= 5
-- | Convert a letter to the corresponding upper-case letter, if any.
-- Any other character is returned unchanged.
@@ -132,7 +140,6 @@ toTitle :: Char -> Char
isAlpha c = iswalpha (ord c) /= 0
isAlphaNum c = iswalnum (ord c) /= 0
---isSpace c = iswspace (ord c) /= 0
isControl c = iswcntrl (ord c) /= 0
isPrint c = iswprint (ord c) /= 0
isUpper c = iswupper (ord c) /= 0
diff --git a/libraries/base/System/Mem/StableName.hs b/libraries/base/System/Mem/StableName.hs
index f2baaf3e83..9da42e516e 100644
--- a/libraries/base/System/Mem/StableName.hs
+++ b/libraries/base/System/Mem/StableName.hs
@@ -11,14 +11,14 @@
-- Module : System.Mem.StableName
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
-- Portability : non-portable
--
-- Stable names are a way of performing fast (O(1)), not-quite-exact
-- comparison between objects.
---
+--
-- Stable names solve the following problem: suppose you want to build
-- a hash table with Haskell objects as keys, but you want to use
-- pointer equality for comparison; maybe because the keys are large
@@ -41,8 +41,8 @@ module System.Mem.StableName (
import Data.Typeable
import GHC.IO ( IO(..) )
-import GHC.Base ( Int(..), StableName#, makeStableName#
- , eqStableName#, stableNameToInt# )
+import GHC.Base ( Int(..), StableName#, makeStableName#
+ , eqStableName#, stableNameToInt# )
-----------------------------------------------------------------------------
-- Stable Names
@@ -53,7 +53,7 @@ import GHC.Base ( Int(..), StableName#, makeStableName#
Stable names have the following property:
* If @sn1 :: StableName@ and @sn2 :: StableName@ and @sn1 == sn2@
- then @sn1@ and @sn2@ were created by calls to @makeStableName@ on
+ then @sn1@ and @sn2@ were created by calls to @makeStableName@ on
the same object.
The reverse is not necessarily true: if two stable names are not
@@ -82,7 +82,7 @@ data StableName a = StableName (StableName# a)
-- the first argument is not evaluated by 'makeStableName'.
makeStableName :: a -> IO (StableName a)
#if defined(__PARALLEL_HASKELL__)
-makeStableName a =
+makeStableName a =
error "makeStableName not implemented in parallel Haskell"
#else
makeStableName a = IO $ \ s ->
@@ -95,21 +95,21 @@ makeStableName a = IO $ \ s ->
-- of 'hashStableName' makes a good hash key).
hashStableName :: StableName a -> Int
#if defined(__PARALLEL_HASKELL__)
-hashStableName (StableName sn) =
+hashStableName (StableName sn) =
error "hashStableName not implemented in parallel Haskell"
#else
hashStableName (StableName sn) = I# (stableNameToInt# sn)
#endif
-instance Eq (StableName a) where
+instance Eq (StableName a) where
#if defined(__PARALLEL_HASKELL__)
- (StableName sn1) == (StableName sn2) =
+ (StableName sn1) == (StableName sn2) =
error "eqStableName not implemented in parallel Haskell"
#else
- (StableName sn1) == (StableName sn2) =
+ (StableName sn1) == (StableName sn2) =
case eqStableName# sn1 sn2 of
- 0# -> False
- _ -> True
+ 0# -> False
+ _ -> True
#endif
-- | Equality on 'StableName' that does not require that the types of
@@ -119,8 +119,8 @@ instance Eq (StableName a) where
eqStableName :: StableName a -> StableName b -> Bool
eqStableName (StableName sn1) (StableName sn2) =
case eqStableName# sn1 sn2 of
- 0# -> False
- _ -> True
+ 0# -> False
+ _ -> True
-- Requested by Emil Axelsson on glasgow-haskell-users, who wants to
-- use it for implementing observable sharing.
diff --git a/libraries/base/System/Mem/Weak.hs b/libraries/base/System/Mem/Weak.hs
index fc69019e65..b9580b5588 100644
--- a/libraries/base/System/Mem/Weak.hs
+++ b/libraries/base/System/Mem/Weak.hs
@@ -5,7 +5,7 @@
-- Module : System.Mem.Weak
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
-- Portability : non-portable
@@ -16,9 +16,9 @@
-- object. A weak pointer can be de-referenced to find out
-- whether the object it refers to is still alive or not, and if so
-- to return the object itself.
---
+--
-- Weak pointers are particularly useful for caches and memo tables.
--- To build a memo table, you build a data structure
+-- To build a memo table, you build a data structure
-- mapping from the function argument (the key) to its result (the
-- value). When you apply the function to a new argument you first
-- check whether the key\/value pair is already in the memo table.
@@ -26,47 +26,47 @@
-- key and value alive. So the table should contain a weak pointer
-- to the key, not an ordinary pointer. The pointer to the value must
-- not be weak, because the only reference to the value might indeed be
--- from the memo table.
---
+-- from the memo table.
+--
-- So it looks as if the memo table will keep all its values
-- alive for ever. One way to solve this is to purge the table
-- occasionally, by deleting entries whose keys have died.
---
+--
-- The weak pointers in this library
-- support another approach, called /finalization/.
-- When the key referred to by a weak pointer dies, the storage manager
-- arranges to run a programmer-specified finalizer. In the case of memo
-- tables, for example, the finalizer could remove the key\/value pair
--- from the memo table.
---
+-- from the memo table.
+--
-- Another difficulty with the memo table is that the value of a
-- key\/value pair might itself contain a pointer to the key.
-- So the memo table keeps the value alive, which keeps the key alive,
-- even though there may be no other references to the key so both should
--- die. The weak pointers in this library provide a slight
+-- die. The weak pointers in this library provide a slight
-- generalisation of the basic weak-pointer idea, in which each
-- weak pointer actually contains both a key and a value.
--
-----------------------------------------------------------------------------
module System.Mem.Weak (
- -- * The @Weak@ type
- Weak, -- abstract
-
- -- * The general interface
- mkWeak,
- deRefWeak,
- finalize,
-
- -- * Specialised versions
- mkWeakPtr,
- addFinalizer,
- mkWeakPair,
- -- replaceFinaliser
-
- -- * A precise semantics
-
- -- $precise
+ -- * The @Weak@ type
+ Weak, -- abstract
+
+ -- * The general interface
+ mkWeak,
+ deRefWeak,
+ finalize,
+
+ -- * Specialised versions
+ mkWeakPtr,
+ addFinalizer,
+ mkWeakPair,
+ -- replaceFinaliser
+
+ -- * A precise semantics
+
+ -- $precise
) where
import GHC.Weak
diff --git a/libraries/base/Text/Printf.hs b/libraries/base/Text/Printf.hs
index d20e077b95..7cf4204e50 100644
--- a/libraries/base/Text/Printf.hs
+++ b/libraries/base/Text/Printf.hs
@@ -246,7 +246,7 @@ import System.IO
-- * Haskell 'printf' will place a zero after a decimal point when
-- possible.
--
--- Examples:
+-- ==== __Examples__
--
-- > > printf "%d\n" (23::Int)
-- > 23
diff --git a/libraries/base/Text/Show/Functions.hs b/libraries/base/Text/Show/Functions.hs
index 7d3f110a32..690b203ea3 100644
--- a/libraries/base/Text/Show/Functions.hs
+++ b/libraries/base/Text/Show/Functions.hs
@@ -7,7 +7,7 @@
-- Module : Text.Show.Functions
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
---
+--
-- Maintainer : libraries@haskell.org
-- Stability : provisional
-- Portability : portable
@@ -15,12 +15,12 @@
-- Optional instance of 'Text.Show.Show' for functions:
--
-- > instance Show (a -> b) where
--- > showsPrec _ _ = showString \"\<function\>\"
+-- > showsPrec _ _ = showString \"\<function\>\"
--
-----------------------------------------------------------------------------
module Text.Show.Functions () where
instance Show (a -> b) where
- showsPrec _ _ = showString "<function>"
+ showsPrec _ _ = showString "<function>"
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index 45e674fa33..957053dd15 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -117,6 +117,7 @@ Library
Control.Monad.ST.Strict
Control.Monad.ST.Unsafe
Control.Monad.Zip
+ Data.Bifunctor
Data.Bits
Data.Bool
Data.Char
diff --git a/libraries/base/cbits/WCsubst.c b/libraries/base/cbits/WCsubst.c
index e3e09eb39b..c4b0645aa2 100644
--- a/libraries/base/cbits/WCsubst.c
+++ b/libraries/base/cbits/WCsubst.c
@@ -1,6 +1,7 @@
/*-------------------------------------------------------------------------
This is an automatically generated file: do not edit
-Generated by ubconfc at Mon Feb 7 20:26:56 CET 2011
+Generated by ubconfc at Wed Oct 15 14:24:39 EDT 2014
+@generated
-------------------------------------------------------------------------*/
#include "WCsubst.h"
@@ -59,208 +60,222 @@ struct _charblock_
const struct _convrule_ *rule;
};
-#define GENCAT_LO 262144
-#define GENCAT_PC 2048
-#define GENCAT_PD 128
-#define GENCAT_MN 2097152
-#define GENCAT_PE 32
-#define GENCAT_NL 16777216
-#define GENCAT_PF 131072
-#define GENCAT_LT 524288
-#define GENCAT_NO 65536
-#define GENCAT_LU 512
-#define GENCAT_PI 16384
-#define GENCAT_SC 8
-#define GENCAT_PO 4
-#define GENCAT_PS 16
-#define GENCAT_SK 1024
-#define GENCAT_SM 64
-#define GENCAT_SO 8192
-#define GENCAT_CC 1
-#define GENCAT_CF 32768
-#define GENCAT_CO 268435456
-#define GENCAT_ZL 33554432
-#define GENCAT_CS 134217728
#define GENCAT_ZP 67108864
-#define GENCAT_ZS 2
#define GENCAT_MC 8388608
+#define GENCAT_NO 131072
+#define GENCAT_SK 1024
+#define GENCAT_CO 268435456
#define GENCAT_ME 4194304
#define GENCAT_ND 256
+#define GENCAT_PO 4
+#define GENCAT_LT 524288
+#define GENCAT_PC 2048
+#define GENCAT_SM 64
+#define GENCAT_ZS 2
+#define GENCAT_CC 1
+#define GENCAT_LU 512
+#define GENCAT_PD 128
+#define GENCAT_SO 8192
+#define GENCAT_PE 32
+#define GENCAT_CS 134217728
+#define GENCAT_PF 262144
+#define GENCAT_CF 65536
+#define GENCAT_PS 16
+#define GENCAT_SC 8
#define GENCAT_LL 4096
+#define GENCAT_ZL 33554432
#define GENCAT_LM 1048576
+#define GENCAT_PI 32768
+#define GENCAT_NL 16777216
+#define GENCAT_MN 2097152
+#define GENCAT_LO 16384
#define MAX_UNI_CHAR 1114109
-#define NUM_BLOCKS 2783
-#define NUM_CONVBLOCKS 1230
-#define NUM_SPACEBLOCKS 8
+#define NUM_BLOCKS 3073
+#define NUM_CONVBLOCKS 1276
+#define NUM_SPACEBLOCKS 7
#define NUM_LAT1BLOCKS 63
-#define NUM_RULES 167
-static const struct _convrule_ rule160={GENCAT_LL, NUMCAT_LL, 1, -7264, 0, -7264};
-static const struct _convrule_ rule36={GENCAT_LU, NUMCAT_LU, 1, 0, 211, 0};
-static const struct _convrule_ rule25={GENCAT_LU, NUMCAT_LU, 1, 0, -121, 0};
-static const struct _convrule_ rule18={GENCAT_LL, NUMCAT_LL, 1, 743, 0, 743};
-static const struct _convrule_ rule108={GENCAT_LU, NUMCAT_LU, 1, 0, 80, 0};
-static const struct _convrule_ rule50={GENCAT_LL, NUMCAT_LL, 1, -79, 0, -79};
-static const struct _convrule_ rule106={GENCAT_LL, NUMCAT_LL, 1, -96, 0, -96};
-static const struct _convrule_ rule79={GENCAT_LL, NUMCAT_LL, 1, -69, 0, -69};
-static const struct _convrule_ rule126={GENCAT_LL, NUMCAT_LL, 1, 128, 0, 128};
-static const struct _convrule_ rule119={GENCAT_LL, NUMCAT_LL, 1, -59, 0, -59};
-static const struct _convrule_ rule102={GENCAT_LL, NUMCAT_LL, 1, -86, 0, -86};
-static const struct _convrule_ rule38={GENCAT_LL, NUMCAT_LL, 1, 163, 0, 163};
-static const struct _convrule_ rule113={GENCAT_LL, NUMCAT_LL, 1, -48, 0, -48};
-static const struct _convrule_ rule133={GENCAT_LL, NUMCAT_LL, 1, -7205, 0, -7205};
-static const struct _convrule_ rule128={GENCAT_LL, NUMCAT_LL, 1, 126, 0, 126};
-static const struct _convrule_ rule97={GENCAT_LL, NUMCAT_LL, 1, -57, 0, -57};
-static const struct _convrule_ rule161={GENCAT_LU, NUMCAT_LU, 1, 0, -35332, 0};
-static const struct _convrule_ rule136={GENCAT_LU, NUMCAT_LU, 1, 0, -112, 0};
-static const struct _convrule_ rule99={GENCAT_LL, NUMCAT_LL, 1, -47, 0, -47};
-static const struct _convrule_ rule90={GENCAT_LL, NUMCAT_LL, 1, -38, 0, -38};
-static const struct _convrule_ rule32={GENCAT_LU, NUMCAT_LU, 1, 0, 202, 0};
-static const struct _convrule_ rule145={GENCAT_LL, NUMCAT_LL, 1, -28, 0, -28};
-static const struct _convrule_ rule93={GENCAT_LL, NUMCAT_LL, 1, -64, 0, -64};
-static const struct _convrule_ rule91={GENCAT_LL, NUMCAT_LL, 1, -37, 0, -37};
-static const struct _convrule_ rule60={GENCAT_LU, NUMCAT_LU, 1, 0, 71, 0};
-static const struct _convrule_ rule100={GENCAT_LL, NUMCAT_LL, 1, -54, 0, -54};
-static const struct _convrule_ rule94={GENCAT_LL, NUMCAT_LL, 1, -63, 0, -63};
-static const struct _convrule_ rule35={GENCAT_LL, NUMCAT_LL, 1, 97, 0, 97};
-static const struct _convrule_ rule149={GENCAT_SO, NUMCAT_SO, 1, -26, 0, -26};
-static const struct _convrule_ rule103={GENCAT_LL, NUMCAT_LL, 1, -80, 0, -80};
-static const struct _convrule_ rule96={GENCAT_LL, NUMCAT_LL, 1, -62, 0, -62};
-static const struct _convrule_ rule81={GENCAT_LL, NUMCAT_LL, 1, -71, 0, -71};
-static const struct _convrule_ rule9={GENCAT_LU, NUMCAT_LU, 1, 0, 32, 0};
-static const struct _convrule_ rule147={GENCAT_NL, NUMCAT_NL, 1, -16, 0, -16};
-static const struct _convrule_ rule143={GENCAT_LU, NUMCAT_LU, 1, 0, -8262, 0};
-static const struct _convrule_ rule127={GENCAT_LL, NUMCAT_LL, 1, 112, 0, 112};
-static const struct _convrule_ rule124={GENCAT_LL, NUMCAT_LL, 1, 86, 0, 86};
-static const struct _convrule_ rule40={GENCAT_LL, NUMCAT_LL, 1, 130, 0, 130};
-static const struct _convrule_ rule20={GENCAT_LL, NUMCAT_LL, 1, 121, 0, 121};
-static const struct _convrule_ rule158={GENCAT_LU, NUMCAT_LU, 1, 0, -10782, 0};
-static const struct _convrule_ rule111={GENCAT_LL, NUMCAT_LL, 1, -15, 0, -15};
-static const struct _convrule_ rule12={GENCAT_LL, NUMCAT_LL, 1, -32, 0, -32};
-static const struct _convrule_ rule85={GENCAT_MN, NUMCAT_MN, 1, 84, 0, 84};
-static const struct _convrule_ rule166={GENCAT_LL, NUMCAT_LL, 1, -40, 0, -40};
-static const struct _convrule_ rule125={GENCAT_LL, NUMCAT_LL, 1, 100, 0, 100};
-static const struct _convrule_ rule123={GENCAT_LL, NUMCAT_LL, 1, 74, 0, 74};
-static const struct _convrule_ rule92={GENCAT_LL, NUMCAT_LL, 1, -31, 0, -31};
-static const struct _convrule_ rule56={GENCAT_LU, NUMCAT_LU, 1, 0, 10792, 0};
-static const struct _convrule_ rule46={GENCAT_LL, NUMCAT_LL, 1, 56, 0, 56};
-static const struct _convrule_ rule33={GENCAT_LU, NUMCAT_LU, 1, 0, 203, 0};
-static const struct _convrule_ rule150={GENCAT_LU, NUMCAT_LU, 1, 0, -10743, 0};
-static const struct _convrule_ rule39={GENCAT_LU, NUMCAT_LU, 1, 0, 213, 0};
-static const struct _convrule_ rule57={GENCAT_LL, NUMCAT_LL, 1, 10815, 0, 10815};
-static const struct _convrule_ rule157={GENCAT_LU, NUMCAT_LU, 1, 0, -10783, 0};
-static const struct _convrule_ rule55={GENCAT_LU, NUMCAT_LU, 1, 0, -163, 0};
-static const struct _convrule_ rule151={GENCAT_LU, NUMCAT_LU, 1, 0, -3814, 0};
-static const struct _convrule_ rule142={GENCAT_LU, NUMCAT_LU, 1, 0, -8383, 0};
-static const struct _convrule_ rule101={GENCAT_LL, NUMCAT_LL, 1, -8, 0, -8};
-static const struct _convrule_ rule89={GENCAT_LU, NUMCAT_LU, 1, 0, 63, 0};
-static const struct _convrule_ rule41={GENCAT_LU, NUMCAT_LU, 1, 0, 214, 0};
-static const struct _convrule_ rule118={GENCAT_LL, NUMCAT_LL, 1, 3814, 0, 3814};
-static const struct _convrule_ rule26={GENCAT_LL, NUMCAT_LL, 1, -300, 0, -300};
-static const struct _convrule_ rule159={GENCAT_LU, NUMCAT_LU, 1, 0, -10815, 0};
-static const struct _convrule_ rule115={GENCAT_LU, NUMCAT_LU, 1, 0, 7264, 0};
-static const struct _convrule_ rule22={GENCAT_LL, NUMCAT_LL, 1, -1, 0, -1};
-static const struct _convrule_ rule120={GENCAT_LU, NUMCAT_LU, 1, 0, -7615, 0};
-static const struct _convrule_ rule49={GENCAT_LL, NUMCAT_LL, 1, -2, 0, -1};
-static const struct _convrule_ rule131={GENCAT_LU, NUMCAT_LU, 1, 0, -74, 0};
-static const struct _convrule_ rule88={GENCAT_LU, NUMCAT_LU, 1, 0, 64, 0};
-static const struct _convrule_ rule30={GENCAT_LU, NUMCAT_LU, 1, 0, 205, 0};
-static const struct _convrule_ rule117={GENCAT_LL, NUMCAT_LL, 1, 35332, 0, 35332};
-static const struct _convrule_ rule110={GENCAT_LU, NUMCAT_LU, 1, 0, 15, 0};
-static const struct _convrule_ rule130={GENCAT_LL, NUMCAT_LL, 1, 9, 0, 9};
-static const struct _convrule_ rule121={GENCAT_LL, NUMCAT_LL, 1, 8, 0, 8};
-static const struct _convrule_ rule95={GENCAT_LU, NUMCAT_LU, 1, 0, 8, 0};
-static const struct _convrule_ rule54={GENCAT_LU, NUMCAT_LU, 1, 0, 10795, 0};
-static const struct _convrule_ rule29={GENCAT_LU, NUMCAT_LU, 1, 0, 206, 0};
-static const struct _convrule_ rule138={GENCAT_LU, NUMCAT_LU, 1, 0, -126, 0};
-static const struct _convrule_ rule104={GENCAT_LL, NUMCAT_LL, 1, 7, 0, 7};
-static const struct _convrule_ rule58={GENCAT_LU, NUMCAT_LU, 1, 0, -195, 0};
-static const struct _convrule_ rule146={GENCAT_NL, NUMCAT_NL, 1, 0, 16, 0};
-static const struct _convrule_ rule148={GENCAT_SO, NUMCAT_SO, 1, 0, 26, 0};
-static const struct _convrule_ rule70={GENCAT_LL, NUMCAT_LL, 1, 42280, 0, 42280};
-static const struct _convrule_ rule107={GENCAT_LU, NUMCAT_LU, 1, 0, -7, 0};
+#define NUM_RULES 181
+static const struct _convrule_ rule169={GENCAT_LU, NUMCAT_LU, 1, 0, -35332, 0};
+static const struct _convrule_ rule157={GENCAT_SO, NUMCAT_SO, 1, -26, 0, -26};
+static const struct _convrule_ rule168={GENCAT_LL, NUMCAT_LL, 1, -7264, 0, -7264};
+static const struct _convrule_ rule173={GENCAT_LU, NUMCAT_LU, 1, 0, -42315, 0};
+static const struct _convrule_ rule129={GENCAT_LL, NUMCAT_LL, 1, 8, 0, 8};
+static const struct _convrule_ rule88={GENCAT_LL, NUMCAT_LL, 1, 42258, 0, 42258};
+static const struct _convrule_ rule20={GENCAT_LL, NUMCAT_LL, 0, 0, 0, 0};
+static const struct _convrule_ rule76={GENCAT_LL, NUMCAT_LL, 1, 10743, 0, 10743};
+static const struct _convrule_ rule61={GENCAT_LL, NUMCAT_LL, 1, 10783, 0, 10783};
+static const struct _convrule_ rule37={GENCAT_LU, NUMCAT_LU, 1, 0, 211, 0};
+static const struct _convrule_ rule80={GENCAT_LL, NUMCAT_LL, 1, -214, 0, -214};
+static const struct _convrule_ rule75={GENCAT_LL, NUMCAT_LL, 1, -211, 0, -211};
+static const struct _convrule_ rule121={GENCAT_LL, NUMCAT_LL, 1, -48, 0, -48};
static const struct _convrule_ rule52={GENCAT_LU, NUMCAT_LU, 1, 0, -56, 0};
-static const struct _convrule_ rule153={GENCAT_LL, NUMCAT_LL, 1, -10795, 0, -10795};
-static const struct _convrule_ rule152={GENCAT_LU, NUMCAT_LU, 1, 0, -10727, 0};
-static const struct _convrule_ rule141={GENCAT_LU, NUMCAT_LU, 1, 0, -7517, 0};
-static const struct _convrule_ rule34={GENCAT_LU, NUMCAT_LU, 1, 0, 207, 0};
-static const struct _convrule_ rule164={GENCAT_CO, NUMCAT_CO, 0, 0, 0, 0};
-static const struct _convrule_ rule84={GENCAT_MN, NUMCAT_MN, 0, 0, 0, 0};
-static const struct _convrule_ rule16={GENCAT_CF, NUMCAT_CF, 0, 0, 0, 0};
-static const struct _convrule_ rule45={GENCAT_LO, NUMCAT_LO, 0, 0, 0, 0};
+static const struct _convrule_ rule135={GENCAT_LL, NUMCAT_LL, 1, 112, 0, 112};
+static const struct _convrule_ rule71={GENCAT_LL, NUMCAT_LL, 1, -207, 0, -207};
+static const struct _convrule_ rule123={GENCAT_LU, NUMCAT_LU, 1, 0, 7264, 0};
+static const struct _convrule_ rule152={GENCAT_LU, NUMCAT_LU, 1, 0, 28, 0};
+static const struct _convrule_ rule159={GENCAT_LU, NUMCAT_LU, 1, 0, -3814, 0};
+static const struct _convrule_ rule45={GENCAT_LU, NUMCAT_LU, 1, 0, 219, 0};
+static const struct _convrule_ rule7={GENCAT_PD, NUMCAT_PD, 0, 0, 0, 0};
+static const struct _convrule_ rule180={GENCAT_LL, NUMCAT_LL, 1, -40, 0, -40};
+static const struct _convrule_ rule97={GENCAT_LL, NUMCAT_LL, 1, -38, 0, -38};
+static const struct _convrule_ rule95={GENCAT_LU, NUMCAT_LU, 1, 0, 64, 0};
+static const struct _convrule_ rule1={GENCAT_ZS, NUMCAT_ZS, 0, 0, 0, 0};
+static const struct _convrule_ rule29={GENCAT_LU, NUMCAT_LU, 1, 0, 210, 0};
+static const struct _convrule_ rule35={GENCAT_LU, NUMCAT_LU, 1, 0, 207, 0};
+static const struct _convrule_ rule154={GENCAT_NL, NUMCAT_NL, 1, 0, 16, 0};
static const struct _convrule_ rule13={GENCAT_SO, NUMCAT_SO, 0, 0, 0, 0};
-static const struct _convrule_ rule17={GENCAT_NO, NUMCAT_NO, 0, 0, 0, 0};
-static const struct _convrule_ rule8={GENCAT_ND, NUMCAT_ND, 0, 0, 0, 0};
-static const struct _convrule_ rule14={GENCAT_LL, NUMCAT_LL, 0, 0, 0, 0};
-static const struct _convrule_ rule98={GENCAT_LU, NUMCAT_LU, 0, 0, 0, 0};
-static const struct _convrule_ rule6={GENCAT_SM, NUMCAT_SM, 0, 0, 0, 0};
-static const struct _convrule_ rule114={GENCAT_MC, NUMCAT_MC, 0, 0, 0, 0};
+static const struct _convrule_ rule149={GENCAT_LU, NUMCAT_LU, 1, 0, -7517, 0};
+static const struct _convrule_ rule128={GENCAT_LU, NUMCAT_LU, 1, 0, -7615, 0};
+static const struct _convrule_ rule98={GENCAT_LL, NUMCAT_LL, 1, -37, 0, -37};
static const struct _convrule_ rule2={GENCAT_PO, NUMCAT_PO, 0, 0, 0, 0};
-static const struct _convrule_ rule116={GENCAT_NL, NUMCAT_NL, 0, 0, 0, 0};
-static const struct _convrule_ rule3={GENCAT_SC, NUMCAT_SC, 0, 0, 0, 0};
-static const struct _convrule_ rule10={GENCAT_SK, NUMCAT_SK, 0, 0, 0, 0};
-static const struct _convrule_ rule83={GENCAT_LM, NUMCAT_LM, 0, 0, 0, 0};
-static const struct _convrule_ rule5={GENCAT_PE, NUMCAT_PE, 0, 0, 0, 0};
-static const struct _convrule_ rule4={GENCAT_PS, NUMCAT_PS, 0, 0, 0, 0};
+static const struct _convrule_ rule69={GENCAT_LL, NUMCAT_LL, 1, 42319, 0, 42319};
+static const struct _convrule_ rule56={GENCAT_LU, NUMCAT_LU, 1, 0, 10792, 0};
+static const struct _convrule_ rule25={GENCAT_LL, NUMCAT_LL, 1, -232, 0, -232};
+static const struct _convrule_ rule43={GENCAT_LU, NUMCAT_LU, 1, 0, 218, 0};
+static const struct _convrule_ rule165={GENCAT_LU, NUMCAT_LU, 1, 0, -10783, 0};
+static const struct _convrule_ rule133={GENCAT_LL, NUMCAT_LL, 1, 100, 0, 100};
+static const struct _convrule_ rule96={GENCAT_LU, NUMCAT_LU, 1, 0, 63, 0};
+static const struct _convrule_ rule90={GENCAT_MN, NUMCAT_MN, 0, 0, 0, 0};
+static const struct _convrule_ rule12={GENCAT_LL, NUMCAT_LL, 1, -32, 0, -32};
+static const struct _convrule_ rule93={GENCAT_LU, NUMCAT_LU, 1, 0, 38, 0};
+static const struct _convrule_ rule99={GENCAT_LL, NUMCAT_LL, 1, -31, 0, -31};
+static const struct _convrule_ rule105={GENCAT_LU, NUMCAT_LU, 0, 0, 0, 0};
static const struct _convrule_ rule11={GENCAT_PC, NUMCAT_PC, 0, 0, 0, 0};
-static const struct _convrule_ rule7={GENCAT_PD, NUMCAT_PD, 0, 0, 0, 0};
-static const struct _convrule_ rule163={GENCAT_CS, NUMCAT_CS, 0, 0, 0, 0};
-static const struct _convrule_ rule109={GENCAT_ME, NUMCAT_ME, 0, 0, 0, 0};
-static const struct _convrule_ rule1={GENCAT_ZS, NUMCAT_ZS, 0, 0, 0, 0};
-static const struct _convrule_ rule19={GENCAT_PF, NUMCAT_PF, 0, 0, 0, 0};
+static const struct _convrule_ rule175={GENCAT_LU, NUMCAT_LU, 1, 0, -42258, 0};
+static const struct _convrule_ rule144={GENCAT_LU, NUMCAT_LU, 1, 0, -112, 0};
static const struct _convrule_ rule15={GENCAT_PI, NUMCAT_PI, 0, 0, 0, 0};
-static const struct _convrule_ rule140={GENCAT_ZP, NUMCAT_ZP, 0, 0, 0, 0};
-static const struct _convrule_ rule139={GENCAT_ZL, NUMCAT_ZL, 0, 0, 0, 0};
-static const struct _convrule_ rule134={GENCAT_LU, NUMCAT_LU, 1, 0, -86, 0};
-static const struct _convrule_ rule43={GENCAT_LU, NUMCAT_LU, 1, 0, 217, 0};
-static const struct _convrule_ rule0={GENCAT_CC, NUMCAT_CC, 0, 0, 0, 0};
-static const struct _convrule_ rule154={GENCAT_LL, NUMCAT_LL, 1, -10792, 0, -10792};
-static const struct _convrule_ rule74={GENCAT_LL, NUMCAT_LL, 1, 10749, 0, 10749};
-static const struct _convrule_ rule87={GENCAT_LU, NUMCAT_LU, 1, 0, 37, 0};
-static const struct _convrule_ rule61={GENCAT_LL, NUMCAT_LL, 1, 10783, 0, 10783};
-static const struct _convrule_ rule122={GENCAT_LU, NUMCAT_LU, 1, 0, -8, 0};
-static const struct _convrule_ rule129={GENCAT_LT, NUMCAT_LT, 1, 0, -8, 0};
-static const struct _convrule_ rule63={GENCAT_LL, NUMCAT_LL, 1, 10782, 0, 10782};
-static const struct _convrule_ rule82={GENCAT_LL, NUMCAT_LL, 1, -219, 0, -219};
-static const struct _convrule_ rule77={GENCAT_LL, NUMCAT_LL, 1, 10727, 0, 10727};
-static const struct _convrule_ rule78={GENCAT_LL, NUMCAT_LL, 1, -218, 0, -218};
-static const struct _convrule_ rule71={GENCAT_LL, NUMCAT_LL, 1, -209, 0, -209};
-static const struct _convrule_ rule62={GENCAT_LL, NUMCAT_LL, 1, 10780, 0, 10780};
-static const struct _convrule_ rule48={GENCAT_LT, NUMCAT_LT, 1, -1, 1, 0};
-static const struct _convrule_ rule21={GENCAT_LU, NUMCAT_LU, 1, 0, 1, 0};
-static const struct _convrule_ rule137={GENCAT_LU, NUMCAT_LU, 1, 0, -128, 0};
-static const struct _convrule_ rule80={GENCAT_LL, NUMCAT_LL, 1, -217, 0, -217};
-static const struct _convrule_ rule73={GENCAT_LL, NUMCAT_LL, 1, 10743, 0, 10743};
-static const struct _convrule_ rule42={GENCAT_LU, NUMCAT_LU, 1, 0, 218, 0};
-static const struct _convrule_ rule69={GENCAT_LL, NUMCAT_LL, 1, -207, 0, -207};
+static const struct _convrule_ rule132={GENCAT_LL, NUMCAT_LL, 1, 86, 0, 86};
+static const struct _convrule_ rule122={GENCAT_MC, NUMCAT_MC, 0, 0, 0, 0};
+static const struct _convrule_ rule126={GENCAT_LL, NUMCAT_LL, 1, 3814, 0, 3814};
+static const struct _convrule_ rule44={GENCAT_LU, NUMCAT_LU, 1, 0, 217, 0};
+static const struct _convrule_ rule153={GENCAT_LL, NUMCAT_LL, 1, -28, 0, -28};
+static const struct _convrule_ rule178={GENCAT_CO, NUMCAT_CO, 0, 0, 0, 0};
+static const struct _convrule_ rule114={GENCAT_LL, NUMCAT_LL, 1, -96, 0, -96};
static const struct _convrule_ rule51={GENCAT_LU, NUMCAT_LU, 1, 0, -97, 0};
-static const struct _convrule_ rule144={GENCAT_LU, NUMCAT_LU, 1, 0, 28, 0};
-static const struct _convrule_ rule65={GENCAT_LL, NUMCAT_LL, 1, -206, 0, -206};
-static const struct _convrule_ rule86={GENCAT_LU, NUMCAT_LU, 1, 0, 38, 0};
-static const struct _convrule_ rule76={GENCAT_LL, NUMCAT_LL, 1, -214, 0, -214};
-static const struct _convrule_ rule66={GENCAT_LL, NUMCAT_LL, 1, -205, 0, -205};
-static const struct _convrule_ rule24={GENCAT_LL, NUMCAT_LL, 1, -232, 0, -232};
-static const struct _convrule_ rule112={GENCAT_LU, NUMCAT_LU, 1, 0, 48, 0};
-static const struct _convrule_ rule132={GENCAT_LT, NUMCAT_LT, 1, 0, -9, 0};
-static const struct _convrule_ rule75={GENCAT_LL, NUMCAT_LL, 1, -213, 0, -213};
-static const struct _convrule_ rule68={GENCAT_LL, NUMCAT_LL, 1, -203, 0, -203};
-static const struct _convrule_ rule135={GENCAT_LU, NUMCAT_LU, 1, 0, -100, 0};
-static const struct _convrule_ rule72={GENCAT_LL, NUMCAT_LL, 1, -211, 0, -211};
+static const struct _convrule_ rule39={GENCAT_LL, NUMCAT_LL, 1, 163, 0, 163};
+static const struct _convrule_ rule179={GENCAT_LU, NUMCAT_LU, 1, 0, 40, 0};
+static const struct _convrule_ rule124={GENCAT_NL, NUMCAT_NL, 0, 0, 0, 0};
+static const struct _convrule_ rule94={GENCAT_LU, NUMCAT_LU, 1, 0, 37, 0};
+static const struct _convrule_ rule82={GENCAT_LL, NUMCAT_LL, 1, -218, 0, -218};
+static const struct _convrule_ rule118={GENCAT_LU, NUMCAT_LU, 1, 0, 15, 0};
static const struct _convrule_ rule67={GENCAT_LL, NUMCAT_LL, 1, -202, 0, -202};
+static const struct _convrule_ rule66={GENCAT_LL, NUMCAT_LL, 1, -205, 0, -205};
static const struct _convrule_ rule47={GENCAT_LU, NUMCAT_LU, 1, 0, 2, 1};
-static const struct _convrule_ rule37={GENCAT_LU, NUMCAT_LU, 1, 0, 209, 0};
-static const struct _convrule_ rule156={GENCAT_LU, NUMCAT_LU, 1, 0, -10749, 0};
+static const struct _convrule_ rule30={GENCAT_LU, NUMCAT_LU, 1, 0, 206, 0};
+static const struct _convrule_ rule109={GENCAT_LL, NUMCAT_LL, 1, -86, 0, -86};
+static const struct _convrule_ rule4={GENCAT_PS, NUMCAT_PS, 0, 0, 0, 0};
+static const struct _convrule_ rule3={GENCAT_SC, NUMCAT_SC, 0, 0, 0, 0};
+static const struct _convrule_ rule150={GENCAT_LU, NUMCAT_LU, 1, 0, -8383, 0};
+static const struct _convrule_ rule120={GENCAT_LU, NUMCAT_LU, 1, 0, 48, 0};
+static const struct _convrule_ rule14={GENCAT_LO, NUMCAT_LO, 0, 0, 0, 0};
+static const struct _convrule_ rule18={GENCAT_LL, NUMCAT_LL, 1, 743, 0, 743};
+static const struct _convrule_ rule147={GENCAT_ZL, NUMCAT_ZL, 0, 0, 0, 0};
+static const struct _convrule_ rule142={GENCAT_LU, NUMCAT_LU, 1, 0, -86, 0};
+static const struct _convrule_ rule171={GENCAT_LU, NUMCAT_LU, 1, 0, -42308, 0};
+static const struct _convrule_ rule162={GENCAT_LL, NUMCAT_LL, 1, -10792, 0, -10792};
+static const struct _convrule_ rule166={GENCAT_LU, NUMCAT_LU, 1, 0, -10782, 0};
+static const struct _convrule_ rule139={GENCAT_LU, NUMCAT_LU, 1, 0, -74, 0};
+static const struct _convrule_ rule24={GENCAT_LU, NUMCAT_LU, 1, 0, -199, 0};
+static const struct _convrule_ rule143={GENCAT_LU, NUMCAT_LU, 1, 0, -100, 0};
+static const struct _convrule_ rule125={GENCAT_LL, NUMCAT_LL, 1, 35332, 0, 35332};
+static const struct _convrule_ rule141={GENCAT_LL, NUMCAT_LL, 1, -7205, 0, -7205};
+static const struct _convrule_ rule138={GENCAT_LL, NUMCAT_LL, 1, 9, 0, 9};
+static const struct _convrule_ rule27={GENCAT_LL, NUMCAT_LL, 1, -300, 0, -300};
+static const struct _convrule_ rule172={GENCAT_LU, NUMCAT_LU, 1, 0, -42319, 0};
+static const struct _convrule_ rule31={GENCAT_LU, NUMCAT_LU, 1, 0, 205, 0};
+static const struct _convrule_ rule59={GENCAT_LU, NUMCAT_LU, 1, 0, 69, 0};
+static const struct _convrule_ rule6={GENCAT_SM, NUMCAT_SM, 0, 0, 0, 0};
+static const struct _convrule_ rule119={GENCAT_LL, NUMCAT_LL, 1, -15, 0, -15};
+static const struct _convrule_ rule110={GENCAT_LL, NUMCAT_LL, 1, -80, 0, -80};
+static const struct _convrule_ rule176={GENCAT_LU, NUMCAT_LU, 1, 0, -42282, 0};
+static const struct _convrule_ rule151={GENCAT_LU, NUMCAT_LU, 1, 0, -8262, 0};
+static const struct _convrule_ rule130={GENCAT_LU, NUMCAT_LU, 1, 0, -8, 0};
+static const struct _convrule_ rule26={GENCAT_LU, NUMCAT_LU, 1, 0, -121, 0};
+static const struct _convrule_ rule0={GENCAT_CC, NUMCAT_CC, 0, 0, 0, 0};
+static const struct _convrule_ rule111={GENCAT_LL, NUMCAT_LL, 1, 7, 0, 7};
+static const struct _convrule_ rule91={GENCAT_MN, NUMCAT_MN, 1, 84, 0, 84};
+static const struct _convrule_ rule78={GENCAT_LL, NUMCAT_LL, 1, 10749, 0, 10749};
+static const struct _convrule_ rule77={GENCAT_LL, NUMCAT_LL, 1, 42305, 0, 42305};
+static const struct _convrule_ rule70={GENCAT_LL, NUMCAT_LL, 1, 42315, 0, 42315};
+static const struct _convrule_ rule50={GENCAT_LL, NUMCAT_LL, 1, -79, 0, -79};
+static const struct _convrule_ rule60={GENCAT_LU, NUMCAT_LU, 1, 0, 71, 0};
+static const struct _convrule_ rule22={GENCAT_LU, NUMCAT_LU, 1, 0, 1, 0};
+static const struct _convrule_ rule49={GENCAT_LL, NUMCAT_LL, 1, -2, 0, -1};
+static const struct _convrule_ rule92={GENCAT_LU, NUMCAT_LU, 1, 0, 116, 0};
+static const struct _convrule_ rule83={GENCAT_LL, NUMCAT_LL, 1, 42282, 0, 42282};
+static const struct _convrule_ rule155={GENCAT_NL, NUMCAT_NL, 1, -16, 0, -16};
+static const struct _convrule_ rule102={GENCAT_LU, NUMCAT_LU, 1, 0, 8, 0};
+static const struct _convrule_ rule23={GENCAT_LL, NUMCAT_LL, 1, -1, 0, -1};
+static const struct _convrule_ rule87={GENCAT_LL, NUMCAT_LL, 1, -219, 0, -219};
+static const struct _convrule_ rule79={GENCAT_LL, NUMCAT_LL, 1, -213, 0, -213};
static const struct _convrule_ rule64={GENCAT_LL, NUMCAT_LL, 1, -210, 0, -210};
-static const struct _convrule_ rule44={GENCAT_LU, NUMCAT_LU, 1, 0, 219, 0};
-static const struct _convrule_ rule28={GENCAT_LU, NUMCAT_LU, 1, 0, 210, 0};
+static const struct _convrule_ rule163={GENCAT_LU, NUMCAT_LU, 1, 0, -10780, 0};
+static const struct _convrule_ rule86={GENCAT_LL, NUMCAT_LL, 1, -71, 0, -71};
+static const struct _convrule_ rule84={GENCAT_LL, NUMCAT_LL, 1, -69, 0, -69};
+static const struct _convrule_ rule32={GENCAT_LU, NUMCAT_LU, 1, 0, 79, 0};
+static const struct _convrule_ rule115={GENCAT_LU, NUMCAT_LU, 1, 0, -7, 0};
+static const struct _convrule_ rule74={GENCAT_LL, NUMCAT_LL, 1, -209, 0, -209};
+static const struct _convrule_ rule177={GENCAT_CS, NUMCAT_CS, 0, 0, 0, 0};
+static const struct _convrule_ rule140={GENCAT_LT, NUMCAT_LT, 1, 0, -9, 0};
+static const struct _convrule_ rule57={GENCAT_LL, NUMCAT_LL, 1, 10815, 0, 10815};
+static const struct _convrule_ rule72={GENCAT_LL, NUMCAT_LL, 1, 42280, 0, 42280};
+static const struct _convrule_ rule34={GENCAT_LU, NUMCAT_LU, 1, 0, 203, 0};
+static const struct _convrule_ rule63={GENCAT_LL, NUMCAT_LL, 1, 10782, 0, 10782};
+static const struct _convrule_ rule170={GENCAT_LU, NUMCAT_LU, 1, 0, -42280, 0};
+static const struct _convrule_ rule145={GENCAT_LU, NUMCAT_LU, 1, 0, -128, 0};
+static const struct _convrule_ rule100={GENCAT_LL, NUMCAT_LL, 1, -64, 0, -64};
+static const struct _convrule_ rule17={GENCAT_NO, NUMCAT_NO, 0, 0, 0, 0};
+static const struct _convrule_ rule89={GENCAT_LM, NUMCAT_LM, 0, 0, 0, 0};
+static const struct _convrule_ rule46={GENCAT_LL, NUMCAT_LL, 1, 56, 0, 56};
+static const struct _convrule_ rule131={GENCAT_LL, NUMCAT_LL, 1, 74, 0, 74};
+static const struct _convrule_ rule42={GENCAT_LU, NUMCAT_LU, 1, 0, 214, 0};
+static const struct _convrule_ rule148={GENCAT_ZP, NUMCAT_ZP, 0, 0, 0, 0};
+static const struct _convrule_ rule101={GENCAT_LL, NUMCAT_LL, 1, -63, 0, -63};
+static const struct _convrule_ rule36={GENCAT_LL, NUMCAT_LL, 1, 97, 0, 97};
+static const struct _convrule_ rule137={GENCAT_LT, NUMCAT_LT, 1, 0, -8, 0};
+static const struct _convrule_ rule134={GENCAT_LL, NUMCAT_LL, 1, 128, 0, 128};
+static const struct _convrule_ rule81={GENCAT_LL, NUMCAT_LL, 1, 10727, 0, 10727};
+static const struct _convrule_ rule62={GENCAT_LL, NUMCAT_LL, 1, 10780, 0, 10780};
+static const struct _convrule_ rule41={GENCAT_LL, NUMCAT_LL, 1, 130, 0, 130};
+static const struct _convrule_ rule68={GENCAT_LL, NUMCAT_LL, 1, -203, 0, -203};
+static const struct _convrule_ rule65={GENCAT_LL, NUMCAT_LL, 1, -206, 0, -206};
+static const struct _convrule_ rule48={GENCAT_LT, NUMCAT_LT, 1, -1, 1, 0};
+static const struct _convrule_ rule19={GENCAT_PF, NUMCAT_PF, 0, 0, 0, 0};
+static const struct _convrule_ rule33={GENCAT_LU, NUMCAT_LU, 1, 0, 202, 0};
+static const struct _convrule_ rule103={GENCAT_LL, NUMCAT_LL, 1, -62, 0, -62};
+static const struct _convrule_ rule8={GENCAT_ND, NUMCAT_ND, 0, 0, 0, 0};
static const struct _convrule_ rule53={GENCAT_LU, NUMCAT_LU, 1, 0, -130, 0};
-static const struct _convrule_ rule165={GENCAT_LU, NUMCAT_LU, 1, 0, 40, 0};
-static const struct _convrule_ rule162={GENCAT_LU, NUMCAT_LU, 1, 0, -42280, 0};
-static const struct _convrule_ rule155={GENCAT_LU, NUMCAT_LU, 1, 0, -10780, 0};
-static const struct _convrule_ rule105={GENCAT_LU, NUMCAT_LU, 1, 0, -60, 0};
-static const struct _convrule_ rule59={GENCAT_LU, NUMCAT_LU, 1, 0, 69, 0};
-static const struct _convrule_ rule31={GENCAT_LU, NUMCAT_LU, 1, 0, 79, 0};
-static const struct _convrule_ rule27={GENCAT_LL, NUMCAT_LL, 1, 195, 0, 195};
-static const struct _convrule_ rule23={GENCAT_LU, NUMCAT_LU, 1, 0, -199, 0};
+static const struct _convrule_ rule28={GENCAT_LL, NUMCAT_LL, 1, 195, 0, 195};
+static const struct _convrule_ rule158={GENCAT_LU, NUMCAT_LU, 1, 0, -10743, 0};
+static const struct _convrule_ rule127={GENCAT_LL, NUMCAT_LL, 1, -59, 0, -59};
+static const struct _convrule_ rule113={GENCAT_LU, NUMCAT_LU, 1, 0, -60, 0};
+static const struct _convrule_ rule108={GENCAT_LL, NUMCAT_LL, 1, -8, 0, -8};
+static const struct _convrule_ rule73={GENCAT_LL, NUMCAT_LL, 1, 42308, 0, 42308};
+static const struct _convrule_ rule40={GENCAT_LU, NUMCAT_LU, 1, 0, 213, 0};
+static const struct _convrule_ rule136={GENCAT_LL, NUMCAT_LL, 1, 126, 0, 126};
+static const struct _convrule_ rule116={GENCAT_LU, NUMCAT_LU, 1, 0, 80, 0};
+static const struct _convrule_ rule55={GENCAT_LU, NUMCAT_LU, 1, 0, -163, 0};
+static const struct _convrule_ rule174={GENCAT_LU, NUMCAT_LU, 1, 0, -42305, 0};
+static const struct _convrule_ rule161={GENCAT_LL, NUMCAT_LL, 1, -10795, 0, -10795};
+static const struct _convrule_ rule58={GENCAT_LU, NUMCAT_LU, 1, 0, -195, 0};
+static const struct _convrule_ rule54={GENCAT_LU, NUMCAT_LU, 1, 0, 10795, 0};
+static const struct _convrule_ rule107={GENCAT_LL, NUMCAT_LL, 1, -54, 0, -54};
+static const struct _convrule_ rule146={GENCAT_LU, NUMCAT_LU, 1, 0, -126, 0};
+static const struct _convrule_ rule104={GENCAT_LL, NUMCAT_LL, 1, -57, 0, -57};
+static const struct _convrule_ rule21={GENCAT_LL, NUMCAT_LL, 1, 121, 0, 121};
+static const struct _convrule_ rule156={GENCAT_SO, NUMCAT_SO, 1, 0, 26, 0};
+static const struct _convrule_ rule85={GENCAT_LL, NUMCAT_LL, 1, -217, 0, -217};
+static const struct _convrule_ rule16={GENCAT_CF, NUMCAT_CF, 0, 0, 0, 0};
+static const struct _convrule_ rule112={GENCAT_LL, NUMCAT_LL, 1, -116, 0, -116};
+static const struct _convrule_ rule38={GENCAT_LU, NUMCAT_LU, 1, 0, 209, 0};
+static const struct _convrule_ rule10={GENCAT_SK, NUMCAT_SK, 0, 0, 0, 0};
+static const struct _convrule_ rule167={GENCAT_LU, NUMCAT_LU, 1, 0, -10815, 0};
+static const struct _convrule_ rule5={GENCAT_PE, NUMCAT_PE, 0, 0, 0, 0};
+static const struct _convrule_ rule164={GENCAT_LU, NUMCAT_LU, 1, 0, -10749, 0};
+static const struct _convrule_ rule117={GENCAT_ME, NUMCAT_ME, 0, 0, 0, 0};
+static const struct _convrule_ rule106={GENCAT_LL, NUMCAT_LL, 1, -47, 0, -47};
+static const struct _convrule_ rule160={GENCAT_LU, NUMCAT_LU, 1, 0, -10727, 0};
+static const struct _convrule_ rule9={GENCAT_LU, NUMCAT_LU, 1, 0, 32, 0};
static const struct _charblock_ allchars[]={
{0, 32, &rule0},
{32, 1, &rule1},
@@ -294,7 +309,8 @@ static const struct _charblock_ allchars[]={
{160, 1, &rule1},
{161, 1, &rule2},
{162, 4, &rule3},
- {166, 2, &rule13},
+ {166, 1, &rule13},
+ {167, 1, &rule2},
{168, 1, &rule10},
{169, 1, &rule13},
{170, 1, &rule14},
@@ -308,8 +324,7 @@ static const struct _charblock_ allchars[]={
{178, 2, &rule17},
{180, 1, &rule10},
{181, 1, &rule18},
- {182, 1, &rule13},
- {183, 1, &rule2},
+ {182, 2, &rule2},
{184, 1, &rule10},
{185, 1, &rule17},
{186, 1, &rule14},
@@ -319,201 +334,201 @@ static const struct _charblock_ allchars[]={
{192, 23, &rule9},
{215, 1, &rule6},
{216, 7, &rule9},
- {223, 1, &rule14},
+ {223, 1, &rule20},
{224, 23, &rule12},
{247, 1, &rule6},
{248, 7, &rule12},
- {255, 1, &rule20},
- {256, 1, &rule21},
- {257, 1, &rule22},
- {258, 1, &rule21},
- {259, 1, &rule22},
- {260, 1, &rule21},
- {261, 1, &rule22},
- {262, 1, &rule21},
- {263, 1, &rule22},
- {264, 1, &rule21},
- {265, 1, &rule22},
- {266, 1, &rule21},
- {267, 1, &rule22},
- {268, 1, &rule21},
- {269, 1, &rule22},
- {270, 1, &rule21},
- {271, 1, &rule22},
- {272, 1, &rule21},
- {273, 1, &rule22},
- {274, 1, &rule21},
- {275, 1, &rule22},
- {276, 1, &rule21},
- {277, 1, &rule22},
- {278, 1, &rule21},
- {279, 1, &rule22},
- {280, 1, &rule21},
- {281, 1, &rule22},
- {282, 1, &rule21},
- {283, 1, &rule22},
- {284, 1, &rule21},
- {285, 1, &rule22},
- {286, 1, &rule21},
- {287, 1, &rule22},
- {288, 1, &rule21},
- {289, 1, &rule22},
- {290, 1, &rule21},
- {291, 1, &rule22},
- {292, 1, &rule21},
- {293, 1, &rule22},
- {294, 1, &rule21},
- {295, 1, &rule22},
- {296, 1, &rule21},
- {297, 1, &rule22},
- {298, 1, &rule21},
- {299, 1, &rule22},
- {300, 1, &rule21},
- {301, 1, &rule22},
- {302, 1, &rule21},
- {303, 1, &rule22},
- {304, 1, &rule23},
- {305, 1, &rule24},
- {306, 1, &rule21},
- {307, 1, &rule22},
- {308, 1, &rule21},
- {309, 1, &rule22},
- {310, 1, &rule21},
- {311, 1, &rule22},
- {312, 1, &rule14},
- {313, 1, &rule21},
- {314, 1, &rule22},
- {315, 1, &rule21},
- {316, 1, &rule22},
- {317, 1, &rule21},
- {318, 1, &rule22},
- {319, 1, &rule21},
- {320, 1, &rule22},
- {321, 1, &rule21},
- {322, 1, &rule22},
- {323, 1, &rule21},
- {324, 1, &rule22},
- {325, 1, &rule21},
- {326, 1, &rule22},
- {327, 1, &rule21},
- {328, 1, &rule22},
- {329, 1, &rule14},
- {330, 1, &rule21},
- {331, 1, &rule22},
- {332, 1, &rule21},
- {333, 1, &rule22},
- {334, 1, &rule21},
- {335, 1, &rule22},
- {336, 1, &rule21},
- {337, 1, &rule22},
- {338, 1, &rule21},
- {339, 1, &rule22},
- {340, 1, &rule21},
- {341, 1, &rule22},
- {342, 1, &rule21},
- {343, 1, &rule22},
- {344, 1, &rule21},
- {345, 1, &rule22},
- {346, 1, &rule21},
- {347, 1, &rule22},
- {348, 1, &rule21},
- {349, 1, &rule22},
- {350, 1, &rule21},
- {351, 1, &rule22},
- {352, 1, &rule21},
- {353, 1, &rule22},
- {354, 1, &rule21},
- {355, 1, &rule22},
- {356, 1, &rule21},
- {357, 1, &rule22},
- {358, 1, &rule21},
- {359, 1, &rule22},
- {360, 1, &rule21},
- {361, 1, &rule22},
- {362, 1, &rule21},
- {363, 1, &rule22},
- {364, 1, &rule21},
- {365, 1, &rule22},
- {366, 1, &rule21},
- {367, 1, &rule22},
- {368, 1, &rule21},
- {369, 1, &rule22},
- {370, 1, &rule21},
- {371, 1, &rule22},
- {372, 1, &rule21},
- {373, 1, &rule22},
- {374, 1, &rule21},
- {375, 1, &rule22},
- {376, 1, &rule25},
- {377, 1, &rule21},
- {378, 1, &rule22},
- {379, 1, &rule21},
- {380, 1, &rule22},
- {381, 1, &rule21},
- {382, 1, &rule22},
- {383, 1, &rule26},
- {384, 1, &rule27},
- {385, 1, &rule28},
- {386, 1, &rule21},
- {387, 1, &rule22},
- {388, 1, &rule21},
- {389, 1, &rule22},
- {390, 1, &rule29},
- {391, 1, &rule21},
- {392, 1, &rule22},
- {393, 2, &rule30},
- {395, 1, &rule21},
- {396, 1, &rule22},
- {397, 1, &rule14},
- {398, 1, &rule31},
- {399, 1, &rule32},
- {400, 1, &rule33},
- {401, 1, &rule21},
- {402, 1, &rule22},
- {403, 1, &rule30},
- {404, 1, &rule34},
- {405, 1, &rule35},
- {406, 1, &rule36},
- {407, 1, &rule37},
- {408, 1, &rule21},
- {409, 1, &rule22},
- {410, 1, &rule38},
- {411, 1, &rule14},
- {412, 1, &rule36},
- {413, 1, &rule39},
- {414, 1, &rule40},
- {415, 1, &rule41},
- {416, 1, &rule21},
- {417, 1, &rule22},
- {418, 1, &rule21},
- {419, 1, &rule22},
- {420, 1, &rule21},
- {421, 1, &rule22},
- {422, 1, &rule42},
- {423, 1, &rule21},
- {424, 1, &rule22},
- {425, 1, &rule42},
- {426, 2, &rule14},
- {428, 1, &rule21},
- {429, 1, &rule22},
- {430, 1, &rule42},
- {431, 1, &rule21},
- {432, 1, &rule22},
- {433, 2, &rule43},
- {435, 1, &rule21},
- {436, 1, &rule22},
- {437, 1, &rule21},
- {438, 1, &rule22},
- {439, 1, &rule44},
- {440, 1, &rule21},
- {441, 1, &rule22},
- {442, 1, &rule14},
- {443, 1, &rule45},
- {444, 1, &rule21},
- {445, 1, &rule22},
- {446, 1, &rule14},
+ {255, 1, &rule21},
+ {256, 1, &rule22},
+ {257, 1, &rule23},
+ {258, 1, &rule22},
+ {259, 1, &rule23},
+ {260, 1, &rule22},
+ {261, 1, &rule23},
+ {262, 1, &rule22},
+ {263, 1, &rule23},
+ {264, 1, &rule22},
+ {265, 1, &rule23},
+ {266, 1, &rule22},
+ {267, 1, &rule23},
+ {268, 1, &rule22},
+ {269, 1, &rule23},
+ {270, 1, &rule22},
+ {271, 1, &rule23},
+ {272, 1, &rule22},
+ {273, 1, &rule23},
+ {274, 1, &rule22},
+ {275, 1, &rule23},
+ {276, 1, &rule22},
+ {277, 1, &rule23},
+ {278, 1, &rule22},
+ {279, 1, &rule23},
+ {280, 1, &rule22},
+ {281, 1, &rule23},
+ {282, 1, &rule22},
+ {283, 1, &rule23},
+ {284, 1, &rule22},
+ {285, 1, &rule23},
+ {286, 1, &rule22},
+ {287, 1, &rule23},
+ {288, 1, &rule22},
+ {289, 1, &rule23},
+ {290, 1, &rule22},
+ {291, 1, &rule23},
+ {292, 1, &rule22},
+ {293, 1, &rule23},
+ {294, 1, &rule22},
+ {295, 1, &rule23},
+ {296, 1, &rule22},
+ {297, 1, &rule23},
+ {298, 1, &rule22},
+ {299, 1, &rule23},
+ {300, 1, &rule22},
+ {301, 1, &rule23},
+ {302, 1, &rule22},
+ {303, 1, &rule23},
+ {304, 1, &rule24},
+ {305, 1, &rule25},
+ {306, 1, &rule22},
+ {307, 1, &rule23},
+ {308, 1, &rule22},
+ {309, 1, &rule23},
+ {310, 1, &rule22},
+ {311, 1, &rule23},
+ {312, 1, &rule20},
+ {313, 1, &rule22},
+ {314, 1, &rule23},
+ {315, 1, &rule22},
+ {316, 1, &rule23},
+ {317, 1, &rule22},
+ {318, 1, &rule23},
+ {319, 1, &rule22},
+ {320, 1, &rule23},
+ {321, 1, &rule22},
+ {322, 1, &rule23},
+ {323, 1, &rule22},
+ {324, 1, &rule23},
+ {325, 1, &rule22},
+ {326, 1, &rule23},
+ {327, 1, &rule22},
+ {328, 1, &rule23},
+ {329, 1, &rule20},
+ {330, 1, &rule22},
+ {331, 1, &rule23},
+ {332, 1, &rule22},
+ {333, 1, &rule23},
+ {334, 1, &rule22},
+ {335, 1, &rule23},
+ {336, 1, &rule22},
+ {337, 1, &rule23},
+ {338, 1, &rule22},
+ {339, 1, &rule23},
+ {340, 1, &rule22},
+ {341, 1, &rule23},
+ {342, 1, &rule22},
+ {343, 1, &rule23},
+ {344, 1, &rule22},
+ {345, 1, &rule23},
+ {346, 1, &rule22},
+ {347, 1, &rule23},
+ {348, 1, &rule22},
+ {349, 1, &rule23},
+ {350, 1, &rule22},
+ {351, 1, &rule23},
+ {352, 1, &rule22},
+ {353, 1, &rule23},
+ {354, 1, &rule22},
+ {355, 1, &rule23},
+ {356, 1, &rule22},
+ {357, 1, &rule23},
+ {358, 1, &rule22},
+ {359, 1, &rule23},
+ {360, 1, &rule22},
+ {361, 1, &rule23},
+ {362, 1, &rule22},
+ {363, 1, &rule23},
+ {364, 1, &rule22},
+ {365, 1, &rule23},
+ {366, 1, &rule22},
+ {367, 1, &rule23},
+ {368, 1, &rule22},
+ {369, 1, &rule23},
+ {370, 1, &rule22},
+ {371, 1, &rule23},
+ {372, 1, &rule22},
+ {373, 1, &rule23},
+ {374, 1, &rule22},
+ {375, 1, &rule23},
+ {376, 1, &rule26},
+ {377, 1, &rule22},
+ {378, 1, &rule23},
+ {379, 1, &rule22},
+ {380, 1, &rule23},
+ {381, 1, &rule22},
+ {382, 1, &rule23},
+ {383, 1, &rule27},
+ {384, 1, &rule28},
+ {385, 1, &rule29},
+ {386, 1, &rule22},
+ {387, 1, &rule23},
+ {388, 1, &rule22},
+ {389, 1, &rule23},
+ {390, 1, &rule30},
+ {391, 1, &rule22},
+ {392, 1, &rule23},
+ {393, 2, &rule31},
+ {395, 1, &rule22},
+ {396, 1, &rule23},
+ {397, 1, &rule20},
+ {398, 1, &rule32},
+ {399, 1, &rule33},
+ {400, 1, &rule34},
+ {401, 1, &rule22},
+ {402, 1, &rule23},
+ {403, 1, &rule31},
+ {404, 1, &rule35},
+ {405, 1, &rule36},
+ {406, 1, &rule37},
+ {407, 1, &rule38},
+ {408, 1, &rule22},
+ {409, 1, &rule23},
+ {410, 1, &rule39},
+ {411, 1, &rule20},
+ {412, 1, &rule37},
+ {413, 1, &rule40},
+ {414, 1, &rule41},
+ {415, 1, &rule42},
+ {416, 1, &rule22},
+ {417, 1, &rule23},
+ {418, 1, &rule22},
+ {419, 1, &rule23},
+ {420, 1, &rule22},
+ {421, 1, &rule23},
+ {422, 1, &rule43},
+ {423, 1, &rule22},
+ {424, 1, &rule23},
+ {425, 1, &rule43},
+ {426, 2, &rule20},
+ {428, 1, &rule22},
+ {429, 1, &rule23},
+ {430, 1, &rule43},
+ {431, 1, &rule22},
+ {432, 1, &rule23},
+ {433, 2, &rule44},
+ {435, 1, &rule22},
+ {436, 1, &rule23},
+ {437, 1, &rule22},
+ {438, 1, &rule23},
+ {439, 1, &rule45},
+ {440, 1, &rule22},
+ {441, 1, &rule23},
+ {442, 1, &rule20},
+ {443, 1, &rule14},
+ {444, 1, &rule22},
+ {445, 1, &rule23},
+ {446, 1, &rule20},
{447, 1, &rule46},
- {448, 4, &rule45},
+ {448, 4, &rule14},
{452, 1, &rule47},
{453, 1, &rule48},
{454, 1, &rule49},
@@ -523,1371 +538,1406 @@ static const struct _charblock_ allchars[]={
{458, 1, &rule47},
{459, 1, &rule48},
{460, 1, &rule49},
- {461, 1, &rule21},
- {462, 1, &rule22},
- {463, 1, &rule21},
- {464, 1, &rule22},
- {465, 1, &rule21},
- {466, 1, &rule22},
- {467, 1, &rule21},
- {468, 1, &rule22},
- {469, 1, &rule21},
- {470, 1, &rule22},
- {471, 1, &rule21},
- {472, 1, &rule22},
- {473, 1, &rule21},
- {474, 1, &rule22},
- {475, 1, &rule21},
- {476, 1, &rule22},
+ {461, 1, &rule22},
+ {462, 1, &rule23},
+ {463, 1, &rule22},
+ {464, 1, &rule23},
+ {465, 1, &rule22},
+ {466, 1, &rule23},
+ {467, 1, &rule22},
+ {468, 1, &rule23},
+ {469, 1, &rule22},
+ {470, 1, &rule23},
+ {471, 1, &rule22},
+ {472, 1, &rule23},
+ {473, 1, &rule22},
+ {474, 1, &rule23},
+ {475, 1, &rule22},
+ {476, 1, &rule23},
{477, 1, &rule50},
- {478, 1, &rule21},
- {479, 1, &rule22},
- {480, 1, &rule21},
- {481, 1, &rule22},
- {482, 1, &rule21},
- {483, 1, &rule22},
- {484, 1, &rule21},
- {485, 1, &rule22},
- {486, 1, &rule21},
- {487, 1, &rule22},
- {488, 1, &rule21},
- {489, 1, &rule22},
- {490, 1, &rule21},
- {491, 1, &rule22},
- {492, 1, &rule21},
- {493, 1, &rule22},
- {494, 1, &rule21},
- {495, 1, &rule22},
- {496, 1, &rule14},
+ {478, 1, &rule22},
+ {479, 1, &rule23},
+ {480, 1, &rule22},
+ {481, 1, &rule23},
+ {482, 1, &rule22},
+ {483, 1, &rule23},
+ {484, 1, &rule22},
+ {485, 1, &rule23},
+ {486, 1, &rule22},
+ {487, 1, &rule23},
+ {488, 1, &rule22},
+ {489, 1, &rule23},
+ {490, 1, &rule22},
+ {491, 1, &rule23},
+ {492, 1, &rule22},
+ {493, 1, &rule23},
+ {494, 1, &rule22},
+ {495, 1, &rule23},
+ {496, 1, &rule20},
{497, 1, &rule47},
{498, 1, &rule48},
{499, 1, &rule49},
- {500, 1, &rule21},
- {501, 1, &rule22},
+ {500, 1, &rule22},
+ {501, 1, &rule23},
{502, 1, &rule51},
{503, 1, &rule52},
- {504, 1, &rule21},
- {505, 1, &rule22},
- {506, 1, &rule21},
- {507, 1, &rule22},
- {508, 1, &rule21},
- {509, 1, &rule22},
- {510, 1, &rule21},
- {511, 1, &rule22},
- {512, 1, &rule21},
- {513, 1, &rule22},
- {514, 1, &rule21},
- {515, 1, &rule22},
- {516, 1, &rule21},
- {517, 1, &rule22},
- {518, 1, &rule21},
- {519, 1, &rule22},
- {520, 1, &rule21},
- {521, 1, &rule22},
- {522, 1, &rule21},
- {523, 1, &rule22},
- {524, 1, &rule21},
- {525, 1, &rule22},
- {526, 1, &rule21},
- {527, 1, &rule22},
- {528, 1, &rule21},
- {529, 1, &rule22},
- {530, 1, &rule21},
- {531, 1, &rule22},
- {532, 1, &rule21},
- {533, 1, &rule22},
- {534, 1, &rule21},
- {535, 1, &rule22},
- {536, 1, &rule21},
- {537, 1, &rule22},
- {538, 1, &rule21},
- {539, 1, &rule22},
- {540, 1, &rule21},
- {541, 1, &rule22},
- {542, 1, &rule21},
- {543, 1, &rule22},
+ {504, 1, &rule22},
+ {505, 1, &rule23},
+ {506, 1, &rule22},
+ {507, 1, &rule23},
+ {508, 1, &rule22},
+ {509, 1, &rule23},
+ {510, 1, &rule22},
+ {511, 1, &rule23},
+ {512, 1, &rule22},
+ {513, 1, &rule23},
+ {514, 1, &rule22},
+ {515, 1, &rule23},
+ {516, 1, &rule22},
+ {517, 1, &rule23},
+ {518, 1, &rule22},
+ {519, 1, &rule23},
+ {520, 1, &rule22},
+ {521, 1, &rule23},
+ {522, 1, &rule22},
+ {523, 1, &rule23},
+ {524, 1, &rule22},
+ {525, 1, &rule23},
+ {526, 1, &rule22},
+ {527, 1, &rule23},
+ {528, 1, &rule22},
+ {529, 1, &rule23},
+ {530, 1, &rule22},
+ {531, 1, &rule23},
+ {532, 1, &rule22},
+ {533, 1, &rule23},
+ {534, 1, &rule22},
+ {535, 1, &rule23},
+ {536, 1, &rule22},
+ {537, 1, &rule23},
+ {538, 1, &rule22},
+ {539, 1, &rule23},
+ {540, 1, &rule22},
+ {541, 1, &rule23},
+ {542, 1, &rule22},
+ {543, 1, &rule23},
{544, 1, &rule53},
- {545, 1, &rule14},
- {546, 1, &rule21},
- {547, 1, &rule22},
- {548, 1, &rule21},
- {549, 1, &rule22},
- {550, 1, &rule21},
- {551, 1, &rule22},
- {552, 1, &rule21},
- {553, 1, &rule22},
- {554, 1, &rule21},
- {555, 1, &rule22},
- {556, 1, &rule21},
- {557, 1, &rule22},
- {558, 1, &rule21},
- {559, 1, &rule22},
- {560, 1, &rule21},
- {561, 1, &rule22},
- {562, 1, &rule21},
- {563, 1, &rule22},
- {564, 6, &rule14},
+ {545, 1, &rule20},
+ {546, 1, &rule22},
+ {547, 1, &rule23},
+ {548, 1, &rule22},
+ {549, 1, &rule23},
+ {550, 1, &rule22},
+ {551, 1, &rule23},
+ {552, 1, &rule22},
+ {553, 1, &rule23},
+ {554, 1, &rule22},
+ {555, 1, &rule23},
+ {556, 1, &rule22},
+ {557, 1, &rule23},
+ {558, 1, &rule22},
+ {559, 1, &rule23},
+ {560, 1, &rule22},
+ {561, 1, &rule23},
+ {562, 1, &rule22},
+ {563, 1, &rule23},
+ {564, 6, &rule20},
{570, 1, &rule54},
- {571, 1, &rule21},
- {572, 1, &rule22},
+ {571, 1, &rule22},
+ {572, 1, &rule23},
{573, 1, &rule55},
{574, 1, &rule56},
{575, 2, &rule57},
- {577, 1, &rule21},
- {578, 1, &rule22},
+ {577, 1, &rule22},
+ {578, 1, &rule23},
{579, 1, &rule58},
{580, 1, &rule59},
{581, 1, &rule60},
- {582, 1, &rule21},
- {583, 1, &rule22},
- {584, 1, &rule21},
- {585, 1, &rule22},
- {586, 1, &rule21},
- {587, 1, &rule22},
- {588, 1, &rule21},
- {589, 1, &rule22},
- {590, 1, &rule21},
- {591, 1, &rule22},
+ {582, 1, &rule22},
+ {583, 1, &rule23},
+ {584, 1, &rule22},
+ {585, 1, &rule23},
+ {586, 1, &rule22},
+ {587, 1, &rule23},
+ {588, 1, &rule22},
+ {589, 1, &rule23},
+ {590, 1, &rule22},
+ {591, 1, &rule23},
{592, 1, &rule61},
{593, 1, &rule62},
{594, 1, &rule63},
{595, 1, &rule64},
{596, 1, &rule65},
- {597, 1, &rule14},
+ {597, 1, &rule20},
{598, 2, &rule66},
- {600, 1, &rule14},
+ {600, 1, &rule20},
{601, 1, &rule67},
- {602, 1, &rule14},
+ {602, 1, &rule20},
{603, 1, &rule68},
- {604, 4, &rule14},
+ {604, 1, &rule69},
+ {605, 3, &rule20},
{608, 1, &rule66},
- {609, 2, &rule14},
- {611, 1, &rule69},
- {612, 1, &rule14},
- {613, 1, &rule70},
- {614, 2, &rule14},
- {616, 1, &rule71},
- {617, 1, &rule72},
- {618, 1, &rule14},
- {619, 1, &rule73},
- {620, 3, &rule14},
- {623, 1, &rule72},
- {624, 1, &rule14},
- {625, 1, &rule74},
- {626, 1, &rule75},
- {627, 2, &rule14},
- {629, 1, &rule76},
- {630, 7, &rule14},
- {637, 1, &rule77},
- {638, 2, &rule14},
- {640, 1, &rule78},
- {641, 2, &rule14},
- {643, 1, &rule78},
- {644, 4, &rule14},
- {648, 1, &rule78},
- {649, 1, &rule79},
- {650, 2, &rule80},
- {652, 1, &rule81},
- {653, 5, &rule14},
- {658, 1, &rule82},
- {659, 1, &rule14},
- {660, 1, &rule45},
- {661, 27, &rule14},
- {688, 18, &rule83},
+ {609, 1, &rule70},
+ {610, 1, &rule20},
+ {611, 1, &rule71},
+ {612, 1, &rule20},
+ {613, 1, &rule72},
+ {614, 1, &rule73},
+ {615, 1, &rule20},
+ {616, 1, &rule74},
+ {617, 1, &rule75},
+ {618, 1, &rule20},
+ {619, 1, &rule76},
+ {620, 1, &rule77},
+ {621, 2, &rule20},
+ {623, 1, &rule75},
+ {624, 1, &rule20},
+ {625, 1, &rule78},
+ {626, 1, &rule79},
+ {627, 2, &rule20},
+ {629, 1, &rule80},
+ {630, 7, &rule20},
+ {637, 1, &rule81},
+ {638, 2, &rule20},
+ {640, 1, &rule82},
+ {641, 2, &rule20},
+ {643, 1, &rule82},
+ {644, 3, &rule20},
+ {647, 1, &rule83},
+ {648, 1, &rule82},
+ {649, 1, &rule84},
+ {650, 2, &rule85},
+ {652, 1, &rule86},
+ {653, 5, &rule20},
+ {658, 1, &rule87},
+ {659, 1, &rule20},
+ {660, 1, &rule14},
+ {661, 9, &rule20},
+ {670, 1, &rule88},
+ {671, 17, &rule20},
+ {688, 18, &rule89},
{706, 4, &rule10},
- {710, 12, &rule83},
+ {710, 12, &rule89},
{722, 14, &rule10},
- {736, 5, &rule83},
+ {736, 5, &rule89},
{741, 7, &rule10},
- {748, 1, &rule83},
+ {748, 1, &rule89},
{749, 1, &rule10},
- {750, 1, &rule83},
+ {750, 1, &rule89},
{751, 17, &rule10},
- {768, 69, &rule84},
- {837, 1, &rule85},
- {838, 42, &rule84},
- {880, 1, &rule21},
- {881, 1, &rule22},
- {882, 1, &rule21},
- {883, 1, &rule22},
- {884, 1, &rule83},
+ {768, 69, &rule90},
+ {837, 1, &rule91},
+ {838, 42, &rule90},
+ {880, 1, &rule22},
+ {881, 1, &rule23},
+ {882, 1, &rule22},
+ {883, 1, &rule23},
+ {884, 1, &rule89},
{885, 1, &rule10},
- {886, 1, &rule21},
- {887, 1, &rule22},
- {890, 1, &rule83},
- {891, 3, &rule40},
+ {886, 1, &rule22},
+ {887, 1, &rule23},
+ {890, 1, &rule89},
+ {891, 3, &rule41},
{894, 1, &rule2},
+ {895, 1, &rule92},
{900, 2, &rule10},
- {902, 1, &rule86},
+ {902, 1, &rule93},
{903, 1, &rule2},
- {904, 3, &rule87},
- {908, 1, &rule88},
- {910, 2, &rule89},
- {912, 1, &rule14},
+ {904, 3, &rule94},
+ {908, 1, &rule95},
+ {910, 2, &rule96},
+ {912, 1, &rule20},
{913, 17, &rule9},
{931, 9, &rule9},
- {940, 1, &rule90},
- {941, 3, &rule91},
- {944, 1, &rule14},
+ {940, 1, &rule97},
+ {941, 3, &rule98},
+ {944, 1, &rule20},
{945, 17, &rule12},
- {962, 1, &rule92},
+ {962, 1, &rule99},
{963, 9, &rule12},
- {972, 1, &rule93},
- {973, 2, &rule94},
- {975, 1, &rule95},
- {976, 1, &rule96},
- {977, 1, &rule97},
- {978, 3, &rule98},
- {981, 1, &rule99},
- {982, 1, &rule100},
- {983, 1, &rule101},
- {984, 1, &rule21},
- {985, 1, &rule22},
- {986, 1, &rule21},
- {987, 1, &rule22},
- {988, 1, &rule21},
- {989, 1, &rule22},
- {990, 1, &rule21},
- {991, 1, &rule22},
- {992, 1, &rule21},
- {993, 1, &rule22},
- {994, 1, &rule21},
- {995, 1, &rule22},
- {996, 1, &rule21},
- {997, 1, &rule22},
- {998, 1, &rule21},
- {999, 1, &rule22},
- {1000, 1, &rule21},
- {1001, 1, &rule22},
- {1002, 1, &rule21},
- {1003, 1, &rule22},
- {1004, 1, &rule21},
- {1005, 1, &rule22},
- {1006, 1, &rule21},
- {1007, 1, &rule22},
- {1008, 1, &rule102},
- {1009, 1, &rule103},
- {1010, 1, &rule104},
- {1011, 1, &rule14},
- {1012, 1, &rule105},
- {1013, 1, &rule106},
+ {972, 1, &rule100},
+ {973, 2, &rule101},
+ {975, 1, &rule102},
+ {976, 1, &rule103},
+ {977, 1, &rule104},
+ {978, 3, &rule105},
+ {981, 1, &rule106},
+ {982, 1, &rule107},
+ {983, 1, &rule108},
+ {984, 1, &rule22},
+ {985, 1, &rule23},
+ {986, 1, &rule22},
+ {987, 1, &rule23},
+ {988, 1, &rule22},
+ {989, 1, &rule23},
+ {990, 1, &rule22},
+ {991, 1, &rule23},
+ {992, 1, &rule22},
+ {993, 1, &rule23},
+ {994, 1, &rule22},
+ {995, 1, &rule23},
+ {996, 1, &rule22},
+ {997, 1, &rule23},
+ {998, 1, &rule22},
+ {999, 1, &rule23},
+ {1000, 1, &rule22},
+ {1001, 1, &rule23},
+ {1002, 1, &rule22},
+ {1003, 1, &rule23},
+ {1004, 1, &rule22},
+ {1005, 1, &rule23},
+ {1006, 1, &rule22},
+ {1007, 1, &rule23},
+ {1008, 1, &rule109},
+ {1009, 1, &rule110},
+ {1010, 1, &rule111},
+ {1011, 1, &rule112},
+ {1012, 1, &rule113},
+ {1013, 1, &rule114},
{1014, 1, &rule6},
- {1015, 1, &rule21},
- {1016, 1, &rule22},
- {1017, 1, &rule107},
- {1018, 1, &rule21},
- {1019, 1, &rule22},
- {1020, 1, &rule14},
+ {1015, 1, &rule22},
+ {1016, 1, &rule23},
+ {1017, 1, &rule115},
+ {1018, 1, &rule22},
+ {1019, 1, &rule23},
+ {1020, 1, &rule20},
{1021, 3, &rule53},
- {1024, 16, &rule108},
+ {1024, 16, &rule116},
{1040, 32, &rule9},
{1072, 32, &rule12},
- {1104, 16, &rule103},
- {1120, 1, &rule21},
- {1121, 1, &rule22},
- {1122, 1, &rule21},
- {1123, 1, &rule22},
- {1124, 1, &rule21},
- {1125, 1, &rule22},
- {1126, 1, &rule21},
- {1127, 1, &rule22},
- {1128, 1, &rule21},
- {1129, 1, &rule22},
- {1130, 1, &rule21},
- {1131, 1, &rule22},
- {1132, 1, &rule21},
- {1133, 1, &rule22},
- {1134, 1, &rule21},
- {1135, 1, &rule22},
- {1136, 1, &rule21},
- {1137, 1, &rule22},
- {1138, 1, &rule21},
- {1139, 1, &rule22},
- {1140, 1, &rule21},
- {1141, 1, &rule22},
- {1142, 1, &rule21},
- {1143, 1, &rule22},
- {1144, 1, &rule21},
- {1145, 1, &rule22},
- {1146, 1, &rule21},
- {1147, 1, &rule22},
- {1148, 1, &rule21},
- {1149, 1, &rule22},
- {1150, 1, &rule21},
- {1151, 1, &rule22},
- {1152, 1, &rule21},
- {1153, 1, &rule22},
+ {1104, 16, &rule110},
+ {1120, 1, &rule22},
+ {1121, 1, &rule23},
+ {1122, 1, &rule22},
+ {1123, 1, &rule23},
+ {1124, 1, &rule22},
+ {1125, 1, &rule23},
+ {1126, 1, &rule22},
+ {1127, 1, &rule23},
+ {1128, 1, &rule22},
+ {1129, 1, &rule23},
+ {1130, 1, &rule22},
+ {1131, 1, &rule23},
+ {1132, 1, &rule22},
+ {1133, 1, &rule23},
+ {1134, 1, &rule22},
+ {1135, 1, &rule23},
+ {1136, 1, &rule22},
+ {1137, 1, &rule23},
+ {1138, 1, &rule22},
+ {1139, 1, &rule23},
+ {1140, 1, &rule22},
+ {1141, 1, &rule23},
+ {1142, 1, &rule22},
+ {1143, 1, &rule23},
+ {1144, 1, &rule22},
+ {1145, 1, &rule23},
+ {1146, 1, &rule22},
+ {1147, 1, &rule23},
+ {1148, 1, &rule22},
+ {1149, 1, &rule23},
+ {1150, 1, &rule22},
+ {1151, 1, &rule23},
+ {1152, 1, &rule22},
+ {1153, 1, &rule23},
{1154, 1, &rule13},
- {1155, 5, &rule84},
- {1160, 2, &rule109},
- {1162, 1, &rule21},
- {1163, 1, &rule22},
- {1164, 1, &rule21},
- {1165, 1, &rule22},
- {1166, 1, &rule21},
- {1167, 1, &rule22},
- {1168, 1, &rule21},
- {1169, 1, &rule22},
- {1170, 1, &rule21},
- {1171, 1, &rule22},
- {1172, 1, &rule21},
- {1173, 1, &rule22},
- {1174, 1, &rule21},
- {1175, 1, &rule22},
- {1176, 1, &rule21},
- {1177, 1, &rule22},
- {1178, 1, &rule21},
- {1179, 1, &rule22},
- {1180, 1, &rule21},
- {1181, 1, &rule22},
- {1182, 1, &rule21},
- {1183, 1, &rule22},
- {1184, 1, &rule21},
- {1185, 1, &rule22},
- {1186, 1, &rule21},
- {1187, 1, &rule22},
- {1188, 1, &rule21},
- {1189, 1, &rule22},
- {1190, 1, &rule21},
- {1191, 1, &rule22},
- {1192, 1, &rule21},
- {1193, 1, &rule22},
- {1194, 1, &rule21},
- {1195, 1, &rule22},
- {1196, 1, &rule21},
- {1197, 1, &rule22},
- {1198, 1, &rule21},
- {1199, 1, &rule22},
- {1200, 1, &rule21},
- {1201, 1, &rule22},
- {1202, 1, &rule21},
- {1203, 1, &rule22},
- {1204, 1, &rule21},
- {1205, 1, &rule22},
- {1206, 1, &rule21},
- {1207, 1, &rule22},
- {1208, 1, &rule21},
- {1209, 1, &rule22},
- {1210, 1, &rule21},
- {1211, 1, &rule22},
- {1212, 1, &rule21},
- {1213, 1, &rule22},
- {1214, 1, &rule21},
- {1215, 1, &rule22},
- {1216, 1, &rule110},
- {1217, 1, &rule21},
- {1218, 1, &rule22},
- {1219, 1, &rule21},
- {1220, 1, &rule22},
- {1221, 1, &rule21},
- {1222, 1, &rule22},
- {1223, 1, &rule21},
- {1224, 1, &rule22},
- {1225, 1, &rule21},
- {1226, 1, &rule22},
- {1227, 1, &rule21},
- {1228, 1, &rule22},
- {1229, 1, &rule21},
- {1230, 1, &rule22},
- {1231, 1, &rule111},
- {1232, 1, &rule21},
- {1233, 1, &rule22},
- {1234, 1, &rule21},
- {1235, 1, &rule22},
- {1236, 1, &rule21},
- {1237, 1, &rule22},
- {1238, 1, &rule21},
- {1239, 1, &rule22},
- {1240, 1, &rule21},
- {1241, 1, &rule22},
- {1242, 1, &rule21},
- {1243, 1, &rule22},
- {1244, 1, &rule21},
- {1245, 1, &rule22},
- {1246, 1, &rule21},
- {1247, 1, &rule22},
- {1248, 1, &rule21},
- {1249, 1, &rule22},
- {1250, 1, &rule21},
- {1251, 1, &rule22},
- {1252, 1, &rule21},
- {1253, 1, &rule22},
- {1254, 1, &rule21},
- {1255, 1, &rule22},
- {1256, 1, &rule21},
- {1257, 1, &rule22},
- {1258, 1, &rule21},
- {1259, 1, &rule22},
- {1260, 1, &rule21},
- {1261, 1, &rule22},
- {1262, 1, &rule21},
- {1263, 1, &rule22},
- {1264, 1, &rule21},
- {1265, 1, &rule22},
- {1266, 1, &rule21},
- {1267, 1, &rule22},
- {1268, 1, &rule21},
- {1269, 1, &rule22},
- {1270, 1, &rule21},
- {1271, 1, &rule22},
- {1272, 1, &rule21},
- {1273, 1, &rule22},
- {1274, 1, &rule21},
- {1275, 1, &rule22},
- {1276, 1, &rule21},
- {1277, 1, &rule22},
- {1278, 1, &rule21},
- {1279, 1, &rule22},
- {1280, 1, &rule21},
- {1281, 1, &rule22},
- {1282, 1, &rule21},
- {1283, 1, &rule22},
- {1284, 1, &rule21},
- {1285, 1, &rule22},
- {1286, 1, &rule21},
- {1287, 1, &rule22},
- {1288, 1, &rule21},
- {1289, 1, &rule22},
- {1290, 1, &rule21},
- {1291, 1, &rule22},
- {1292, 1, &rule21},
- {1293, 1, &rule22},
- {1294, 1, &rule21},
- {1295, 1, &rule22},
- {1296, 1, &rule21},
- {1297, 1, &rule22},
- {1298, 1, &rule21},
- {1299, 1, &rule22},
- {1300, 1, &rule21},
- {1301, 1, &rule22},
- {1302, 1, &rule21},
- {1303, 1, &rule22},
- {1304, 1, &rule21},
- {1305, 1, &rule22},
- {1306, 1, &rule21},
- {1307, 1, &rule22},
- {1308, 1, &rule21},
- {1309, 1, &rule22},
- {1310, 1, &rule21},
- {1311, 1, &rule22},
- {1312, 1, &rule21},
- {1313, 1, &rule22},
- {1314, 1, &rule21},
- {1315, 1, &rule22},
- {1316, 1, &rule21},
- {1317, 1, &rule22},
- {1318, 1, &rule21},
- {1319, 1, &rule22},
- {1329, 38, &rule112},
- {1369, 1, &rule83},
+ {1155, 5, &rule90},
+ {1160, 2, &rule117},
+ {1162, 1, &rule22},
+ {1163, 1, &rule23},
+ {1164, 1, &rule22},
+ {1165, 1, &rule23},
+ {1166, 1, &rule22},
+ {1167, 1, &rule23},
+ {1168, 1, &rule22},
+ {1169, 1, &rule23},
+ {1170, 1, &rule22},
+ {1171, 1, &rule23},
+ {1172, 1, &rule22},
+ {1173, 1, &rule23},
+ {1174, 1, &rule22},
+ {1175, 1, &rule23},
+ {1176, 1, &rule22},
+ {1177, 1, &rule23},
+ {1178, 1, &rule22},
+ {1179, 1, &rule23},
+ {1180, 1, &rule22},
+ {1181, 1, &rule23},
+ {1182, 1, &rule22},
+ {1183, 1, &rule23},
+ {1184, 1, &rule22},
+ {1185, 1, &rule23},
+ {1186, 1, &rule22},
+ {1187, 1, &rule23},
+ {1188, 1, &rule22},
+ {1189, 1, &rule23},
+ {1190, 1, &rule22},
+ {1191, 1, &rule23},
+ {1192, 1, &rule22},
+ {1193, 1, &rule23},
+ {1194, 1, &rule22},
+ {1195, 1, &rule23},
+ {1196, 1, &rule22},
+ {1197, 1, &rule23},
+ {1198, 1, &rule22},
+ {1199, 1, &rule23},
+ {1200, 1, &rule22},
+ {1201, 1, &rule23},
+ {1202, 1, &rule22},
+ {1203, 1, &rule23},
+ {1204, 1, &rule22},
+ {1205, 1, &rule23},
+ {1206, 1, &rule22},
+ {1207, 1, &rule23},
+ {1208, 1, &rule22},
+ {1209, 1, &rule23},
+ {1210, 1, &rule22},
+ {1211, 1, &rule23},
+ {1212, 1, &rule22},
+ {1213, 1, &rule23},
+ {1214, 1, &rule22},
+ {1215, 1, &rule23},
+ {1216, 1, &rule118},
+ {1217, 1, &rule22},
+ {1218, 1, &rule23},
+ {1219, 1, &rule22},
+ {1220, 1, &rule23},
+ {1221, 1, &rule22},
+ {1222, 1, &rule23},
+ {1223, 1, &rule22},
+ {1224, 1, &rule23},
+ {1225, 1, &rule22},
+ {1226, 1, &rule23},
+ {1227, 1, &rule22},
+ {1228, 1, &rule23},
+ {1229, 1, &rule22},
+ {1230, 1, &rule23},
+ {1231, 1, &rule119},
+ {1232, 1, &rule22},
+ {1233, 1, &rule23},
+ {1234, 1, &rule22},
+ {1235, 1, &rule23},
+ {1236, 1, &rule22},
+ {1237, 1, &rule23},
+ {1238, 1, &rule22},
+ {1239, 1, &rule23},
+ {1240, 1, &rule22},
+ {1241, 1, &rule23},
+ {1242, 1, &rule22},
+ {1243, 1, &rule23},
+ {1244, 1, &rule22},
+ {1245, 1, &rule23},
+ {1246, 1, &rule22},
+ {1247, 1, &rule23},
+ {1248, 1, &rule22},
+ {1249, 1, &rule23},
+ {1250, 1, &rule22},
+ {1251, 1, &rule23},
+ {1252, 1, &rule22},
+ {1253, 1, &rule23},
+ {1254, 1, &rule22},
+ {1255, 1, &rule23},
+ {1256, 1, &rule22},
+ {1257, 1, &rule23},
+ {1258, 1, &rule22},
+ {1259, 1, &rule23},
+ {1260, 1, &rule22},
+ {1261, 1, &rule23},
+ {1262, 1, &rule22},
+ {1263, 1, &rule23},
+ {1264, 1, &rule22},
+ {1265, 1, &rule23},
+ {1266, 1, &rule22},
+ {1267, 1, &rule23},
+ {1268, 1, &rule22},
+ {1269, 1, &rule23},
+ {1270, 1, &rule22},
+ {1271, 1, &rule23},
+ {1272, 1, &rule22},
+ {1273, 1, &rule23},
+ {1274, 1, &rule22},
+ {1275, 1, &rule23},
+ {1276, 1, &rule22},
+ {1277, 1, &rule23},
+ {1278, 1, &rule22},
+ {1279, 1, &rule23},
+ {1280, 1, &rule22},
+ {1281, 1, &rule23},
+ {1282, 1, &rule22},
+ {1283, 1, &rule23},
+ {1284, 1, &rule22},
+ {1285, 1, &rule23},
+ {1286, 1, &rule22},
+ {1287, 1, &rule23},
+ {1288, 1, &rule22},
+ {1289, 1, &rule23},
+ {1290, 1, &rule22},
+ {1291, 1, &rule23},
+ {1292, 1, &rule22},
+ {1293, 1, &rule23},
+ {1294, 1, &rule22},
+ {1295, 1, &rule23},
+ {1296, 1, &rule22},
+ {1297, 1, &rule23},
+ {1298, 1, &rule22},
+ {1299, 1, &rule23},
+ {1300, 1, &rule22},
+ {1301, 1, &rule23},
+ {1302, 1, &rule22},
+ {1303, 1, &rule23},
+ {1304, 1, &rule22},
+ {1305, 1, &rule23},
+ {1306, 1, &rule22},
+ {1307, 1, &rule23},
+ {1308, 1, &rule22},
+ {1309, 1, &rule23},
+ {1310, 1, &rule22},
+ {1311, 1, &rule23},
+ {1312, 1, &rule22},
+ {1313, 1, &rule23},
+ {1314, 1, &rule22},
+ {1315, 1, &rule23},
+ {1316, 1, &rule22},
+ {1317, 1, &rule23},
+ {1318, 1, &rule22},
+ {1319, 1, &rule23},
+ {1320, 1, &rule22},
+ {1321, 1, &rule23},
+ {1322, 1, &rule22},
+ {1323, 1, &rule23},
+ {1324, 1, &rule22},
+ {1325, 1, &rule23},
+ {1326, 1, &rule22},
+ {1327, 1, &rule23},
+ {1329, 38, &rule120},
+ {1369, 1, &rule89},
{1370, 6, &rule2},
- {1377, 38, &rule113},
- {1415, 1, &rule14},
+ {1377, 38, &rule121},
+ {1415, 1, &rule20},
{1417, 1, &rule2},
{1418, 1, &rule7},
- {1425, 45, &rule84},
+ {1421, 2, &rule13},
+ {1423, 1, &rule3},
+ {1425, 45, &rule90},
{1470, 1, &rule7},
- {1471, 1, &rule84},
+ {1471, 1, &rule90},
{1472, 1, &rule2},
- {1473, 2, &rule84},
+ {1473, 2, &rule90},
{1475, 1, &rule2},
- {1476, 2, &rule84},
+ {1476, 2, &rule90},
{1478, 1, &rule2},
- {1479, 1, &rule84},
- {1488, 27, &rule45},
- {1520, 3, &rule45},
+ {1479, 1, &rule90},
+ {1488, 27, &rule14},
+ {1520, 3, &rule14},
{1523, 2, &rule2},
- {1536, 4, &rule16},
+ {1536, 6, &rule16},
{1542, 3, &rule6},
{1545, 2, &rule2},
{1547, 1, &rule3},
{1548, 2, &rule2},
{1550, 2, &rule13},
- {1552, 11, &rule84},
+ {1552, 11, &rule90},
{1563, 1, &rule2},
+ {1564, 1, &rule16},
{1566, 2, &rule2},
- {1568, 32, &rule45},
- {1600, 1, &rule83},
- {1601, 10, &rule45},
- {1611, 21, &rule84},
+ {1568, 32, &rule14},
+ {1600, 1, &rule89},
+ {1601, 10, &rule14},
+ {1611, 21, &rule90},
{1632, 10, &rule8},
{1642, 4, &rule2},
- {1646, 2, &rule45},
- {1648, 1, &rule84},
- {1649, 99, &rule45},
+ {1646, 2, &rule14},
+ {1648, 1, &rule90},
+ {1649, 99, &rule14},
{1748, 1, &rule2},
- {1749, 1, &rule45},
- {1750, 7, &rule84},
+ {1749, 1, &rule14},
+ {1750, 7, &rule90},
{1757, 1, &rule16},
{1758, 1, &rule13},
- {1759, 6, &rule84},
- {1765, 2, &rule83},
- {1767, 2, &rule84},
+ {1759, 6, &rule90},
+ {1765, 2, &rule89},
+ {1767, 2, &rule90},
{1769, 1, &rule13},
- {1770, 4, &rule84},
- {1774, 2, &rule45},
+ {1770, 4, &rule90},
+ {1774, 2, &rule14},
{1776, 10, &rule8},
- {1786, 3, &rule45},
+ {1786, 3, &rule14},
{1789, 2, &rule13},
- {1791, 1, &rule45},
+ {1791, 1, &rule14},
{1792, 14, &rule2},
{1807, 1, &rule16},
- {1808, 1, &rule45},
- {1809, 1, &rule84},
- {1810, 30, &rule45},
- {1840, 27, &rule84},
- {1869, 89, &rule45},
- {1958, 11, &rule84},
- {1969, 1, &rule45},
+ {1808, 1, &rule14},
+ {1809, 1, &rule90},
+ {1810, 30, &rule14},
+ {1840, 27, &rule90},
+ {1869, 89, &rule14},
+ {1958, 11, &rule90},
+ {1969, 1, &rule14},
{1984, 10, &rule8},
- {1994, 33, &rule45},
- {2027, 9, &rule84},
- {2036, 2, &rule83},
+ {1994, 33, &rule14},
+ {2027, 9, &rule90},
+ {2036, 2, &rule89},
{2038, 1, &rule13},
{2039, 3, &rule2},
- {2042, 1, &rule83},
- {2048, 22, &rule45},
- {2070, 4, &rule84},
- {2074, 1, &rule83},
- {2075, 9, &rule84},
- {2084, 1, &rule83},
- {2085, 3, &rule84},
- {2088, 1, &rule83},
- {2089, 5, &rule84},
+ {2042, 1, &rule89},
+ {2048, 22, &rule14},
+ {2070, 4, &rule90},
+ {2074, 1, &rule89},
+ {2075, 9, &rule90},
+ {2084, 1, &rule89},
+ {2085, 3, &rule90},
+ {2088, 1, &rule89},
+ {2089, 5, &rule90},
{2096, 15, &rule2},
- {2112, 25, &rule45},
- {2137, 3, &rule84},
+ {2112, 25, &rule14},
+ {2137, 3, &rule90},
{2142, 1, &rule2},
- {2304, 3, &rule84},
- {2307, 1, &rule114},
- {2308, 54, &rule45},
- {2362, 1, &rule84},
- {2363, 1, &rule114},
- {2364, 1, &rule84},
- {2365, 1, &rule45},
- {2366, 3, &rule114},
- {2369, 8, &rule84},
- {2377, 4, &rule114},
- {2381, 1, &rule84},
- {2382, 2, &rule114},
- {2384, 1, &rule45},
- {2385, 7, &rule84},
- {2392, 10, &rule45},
- {2402, 2, &rule84},
+ {2208, 19, &rule14},
+ {2276, 31, &rule90},
+ {2307, 1, &rule122},
+ {2308, 54, &rule14},
+ {2362, 1, &rule90},
+ {2363, 1, &rule122},
+ {2364, 1, &rule90},
+ {2365, 1, &rule14},
+ {2366, 3, &rule122},
+ {2369, 8, &rule90},
+ {2377, 4, &rule122},
+ {2381, 1, &rule90},
+ {2382, 2, &rule122},
+ {2384, 1, &rule14},
+ {2385, 7, &rule90},
+ {2392, 10, &rule14},
+ {2402, 2, &rule90},
{2404, 2, &rule2},
{2406, 10, &rule8},
{2416, 1, &rule2},
- {2417, 1, &rule83},
- {2418, 6, &rule45},
- {2425, 7, &rule45},
- {2433, 1, &rule84},
- {2434, 2, &rule114},
- {2437, 8, &rule45},
- {2447, 2, &rule45},
- {2451, 22, &rule45},
- {2474, 7, &rule45},
- {2482, 1, &rule45},
- {2486, 4, &rule45},
- {2492, 1, &rule84},
- {2493, 1, &rule45},
- {2494, 3, &rule114},
- {2497, 4, &rule84},
- {2503, 2, &rule114},
- {2507, 2, &rule114},
- {2509, 1, &rule84},
- {2510, 1, &rule45},
- {2519, 1, &rule114},
- {2524, 2, &rule45},
- {2527, 3, &rule45},
- {2530, 2, &rule84},
+ {2417, 1, &rule89},
+ {2418, 15, &rule14},
+ {2433, 1, &rule90},
+ {2434, 2, &rule122},
+ {2437, 8, &rule14},
+ {2447, 2, &rule14},
+ {2451, 22, &rule14},
+ {2474, 7, &rule14},
+ {2482, 1, &rule14},
+ {2486, 4, &rule14},
+ {2492, 1, &rule90},
+ {2493, 1, &rule14},
+ {2494, 3, &rule122},
+ {2497, 4, &rule90},
+ {2503, 2, &rule122},
+ {2507, 2, &rule122},
+ {2509, 1, &rule90},
+ {2510, 1, &rule14},
+ {2519, 1, &rule122},
+ {2524, 2, &rule14},
+ {2527, 3, &rule14},
+ {2530, 2, &rule90},
{2534, 10, &rule8},
- {2544, 2, &rule45},
+ {2544, 2, &rule14},
{2546, 2, &rule3},
{2548, 6, &rule17},
{2554, 1, &rule13},
{2555, 1, &rule3},
- {2561, 2, &rule84},
- {2563, 1, &rule114},
- {2565, 6, &rule45},
- {2575, 2, &rule45},
- {2579, 22, &rule45},
- {2602, 7, &rule45},
- {2610, 2, &rule45},
- {2613, 2, &rule45},
- {2616, 2, &rule45},
- {2620, 1, &rule84},
- {2622, 3, &rule114},
- {2625, 2, &rule84},
- {2631, 2, &rule84},
- {2635, 3, &rule84},
- {2641, 1, &rule84},
- {2649, 4, &rule45},
- {2654, 1, &rule45},
+ {2561, 2, &rule90},
+ {2563, 1, &rule122},
+ {2565, 6, &rule14},
+ {2575, 2, &rule14},
+ {2579, 22, &rule14},
+ {2602, 7, &rule14},
+ {2610, 2, &rule14},
+ {2613, 2, &rule14},
+ {2616, 2, &rule14},
+ {2620, 1, &rule90},
+ {2622, 3, &rule122},
+ {2625, 2, &rule90},
+ {2631, 2, &rule90},
+ {2635, 3, &rule90},
+ {2641, 1, &rule90},
+ {2649, 4, &rule14},
+ {2654, 1, &rule14},
{2662, 10, &rule8},
- {2672, 2, &rule84},
- {2674, 3, &rule45},
- {2677, 1, &rule84},
- {2689, 2, &rule84},
- {2691, 1, &rule114},
- {2693, 9, &rule45},
- {2703, 3, &rule45},
- {2707, 22, &rule45},
- {2730, 7, &rule45},
- {2738, 2, &rule45},
- {2741, 5, &rule45},
- {2748, 1, &rule84},
- {2749, 1, &rule45},
- {2750, 3, &rule114},
- {2753, 5, &rule84},
- {2759, 2, &rule84},
- {2761, 1, &rule114},
- {2763, 2, &rule114},
- {2765, 1, &rule84},
- {2768, 1, &rule45},
- {2784, 2, &rule45},
- {2786, 2, &rule84},
+ {2672, 2, &rule90},
+ {2674, 3, &rule14},
+ {2677, 1, &rule90},
+ {2689, 2, &rule90},
+ {2691, 1, &rule122},
+ {2693, 9, &rule14},
+ {2703, 3, &rule14},
+ {2707, 22, &rule14},
+ {2730, 7, &rule14},
+ {2738, 2, &rule14},
+ {2741, 5, &rule14},
+ {2748, 1, &rule90},
+ {2749, 1, &rule14},
+ {2750, 3, &rule122},
+ {2753, 5, &rule90},
+ {2759, 2, &rule90},
+ {2761, 1, &rule122},
+ {2763, 2, &rule122},
+ {2765, 1, &rule90},
+ {2768, 1, &rule14},
+ {2784, 2, &rule14},
+ {2786, 2, &rule90},
{2790, 10, &rule8},
+ {2800, 1, &rule2},
{2801, 1, &rule3},
- {2817, 1, &rule84},
- {2818, 2, &rule114},
- {2821, 8, &rule45},
- {2831, 2, &rule45},
- {2835, 22, &rule45},
- {2858, 7, &rule45},
- {2866, 2, &rule45},
- {2869, 5, &rule45},
- {2876, 1, &rule84},
- {2877, 1, &rule45},
- {2878, 1, &rule114},
- {2879, 1, &rule84},
- {2880, 1, &rule114},
- {2881, 4, &rule84},
- {2887, 2, &rule114},
- {2891, 2, &rule114},
- {2893, 1, &rule84},
- {2902, 1, &rule84},
- {2903, 1, &rule114},
- {2908, 2, &rule45},
- {2911, 3, &rule45},
- {2914, 2, &rule84},
+ {2817, 1, &rule90},
+ {2818, 2, &rule122},
+ {2821, 8, &rule14},
+ {2831, 2, &rule14},
+ {2835, 22, &rule14},
+ {2858, 7, &rule14},
+ {2866, 2, &rule14},
+ {2869, 5, &rule14},
+ {2876, 1, &rule90},
+ {2877, 1, &rule14},
+ {2878, 1, &rule122},
+ {2879, 1, &rule90},
+ {2880, 1, &rule122},
+ {2881, 4, &rule90},
+ {2887, 2, &rule122},
+ {2891, 2, &rule122},
+ {2893, 1, &rule90},
+ {2902, 1, &rule90},
+ {2903, 1, &rule122},
+ {2908, 2, &rule14},
+ {2911, 3, &rule14},
+ {2914, 2, &rule90},
{2918, 10, &rule8},
{2928, 1, &rule13},
- {2929, 1, &rule45},
+ {2929, 1, &rule14},
{2930, 6, &rule17},
- {2946, 1, &rule84},
- {2947, 1, &rule45},
- {2949, 6, &rule45},
- {2958, 3, &rule45},
- {2962, 4, &rule45},
- {2969, 2, &rule45},
- {2972, 1, &rule45},
- {2974, 2, &rule45},
- {2979, 2, &rule45},
- {2984, 3, &rule45},
- {2990, 12, &rule45},
- {3006, 2, &rule114},
- {3008, 1, &rule84},
- {3009, 2, &rule114},
- {3014, 3, &rule114},
- {3018, 3, &rule114},
- {3021, 1, &rule84},
- {3024, 1, &rule45},
- {3031, 1, &rule114},
+ {2946, 1, &rule90},
+ {2947, 1, &rule14},
+ {2949, 6, &rule14},
+ {2958, 3, &rule14},
+ {2962, 4, &rule14},
+ {2969, 2, &rule14},
+ {2972, 1, &rule14},
+ {2974, 2, &rule14},
+ {2979, 2, &rule14},
+ {2984, 3, &rule14},
+ {2990, 12, &rule14},
+ {3006, 2, &rule122},
+ {3008, 1, &rule90},
+ {3009, 2, &rule122},
+ {3014, 3, &rule122},
+ {3018, 3, &rule122},
+ {3021, 1, &rule90},
+ {3024, 1, &rule14},
+ {3031, 1, &rule122},
{3046, 10, &rule8},
{3056, 3, &rule17},
{3059, 6, &rule13},
{3065, 1, &rule3},
{3066, 1, &rule13},
- {3073, 3, &rule114},
- {3077, 8, &rule45},
- {3086, 3, &rule45},
- {3090, 23, &rule45},
- {3114, 10, &rule45},
- {3125, 5, &rule45},
- {3133, 1, &rule45},
- {3134, 3, &rule84},
- {3137, 4, &rule114},
- {3142, 3, &rule84},
- {3146, 4, &rule84},
- {3157, 2, &rule84},
- {3160, 2, &rule45},
- {3168, 2, &rule45},
- {3170, 2, &rule84},
+ {3072, 1, &rule90},
+ {3073, 3, &rule122},
+ {3077, 8, &rule14},
+ {3086, 3, &rule14},
+ {3090, 23, &rule14},
+ {3114, 16, &rule14},
+ {3133, 1, &rule14},
+ {3134, 3, &rule90},
+ {3137, 4, &rule122},
+ {3142, 3, &rule90},
+ {3146, 4, &rule90},
+ {3157, 2, &rule90},
+ {3160, 2, &rule14},
+ {3168, 2, &rule14},
+ {3170, 2, &rule90},
{3174, 10, &rule8},
{3192, 7, &rule17},
{3199, 1, &rule13},
- {3202, 2, &rule114},
- {3205, 8, &rule45},
- {3214, 3, &rule45},
- {3218, 23, &rule45},
- {3242, 10, &rule45},
- {3253, 5, &rule45},
- {3260, 1, &rule84},
- {3261, 1, &rule45},
- {3262, 1, &rule114},
- {3263, 1, &rule84},
- {3264, 5, &rule114},
- {3270, 1, &rule84},
- {3271, 2, &rule114},
- {3274, 2, &rule114},
- {3276, 2, &rule84},
- {3285, 2, &rule114},
- {3294, 1, &rule45},
- {3296, 2, &rule45},
- {3298, 2, &rule84},
+ {3201, 1, &rule90},
+ {3202, 2, &rule122},
+ {3205, 8, &rule14},
+ {3214, 3, &rule14},
+ {3218, 23, &rule14},
+ {3242, 10, &rule14},
+ {3253, 5, &rule14},
+ {3260, 1, &rule90},
+ {3261, 1, &rule14},
+ {3262, 1, &rule122},
+ {3263, 1, &rule90},
+ {3264, 5, &rule122},
+ {3270, 1, &rule90},
+ {3271, 2, &rule122},
+ {3274, 2, &rule122},
+ {3276, 2, &rule90},
+ {3285, 2, &rule122},
+ {3294, 1, &rule14},
+ {3296, 2, &rule14},
+ {3298, 2, &rule90},
{3302, 10, &rule8},
- {3313, 2, &rule45},
- {3330, 2, &rule114},
- {3333, 8, &rule45},
- {3342, 3, &rule45},
- {3346, 41, &rule45},
- {3389, 1, &rule45},
- {3390, 3, &rule114},
- {3393, 4, &rule84},
- {3398, 3, &rule114},
- {3402, 3, &rule114},
- {3405, 1, &rule84},
- {3406, 1, &rule45},
- {3415, 1, &rule114},
- {3424, 2, &rule45},
- {3426, 2, &rule84},
+ {3313, 2, &rule14},
+ {3329, 1, &rule90},
+ {3330, 2, &rule122},
+ {3333, 8, &rule14},
+ {3342, 3, &rule14},
+ {3346, 41, &rule14},
+ {3389, 1, &rule14},
+ {3390, 3, &rule122},
+ {3393, 4, &rule90},
+ {3398, 3, &rule122},
+ {3402, 3, &rule122},
+ {3405, 1, &rule90},
+ {3406, 1, &rule14},
+ {3415, 1, &rule122},
+ {3424, 2, &rule14},
+ {3426, 2, &rule90},
{3430, 10, &rule8},
{3440, 6, &rule17},
{3449, 1, &rule13},
- {3450, 6, &rule45},
- {3458, 2, &rule114},
- {3461, 18, &rule45},
- {3482, 24, &rule45},
- {3507, 9, &rule45},
- {3517, 1, &rule45},
- {3520, 7, &rule45},
- {3530, 1, &rule84},
- {3535, 3, &rule114},
- {3538, 3, &rule84},
- {3542, 1, &rule84},
- {3544, 8, &rule114},
- {3570, 2, &rule114},
+ {3450, 6, &rule14},
+ {3458, 2, &rule122},
+ {3461, 18, &rule14},
+ {3482, 24, &rule14},
+ {3507, 9, &rule14},
+ {3517, 1, &rule14},
+ {3520, 7, &rule14},
+ {3530, 1, &rule90},
+ {3535, 3, &rule122},
+ {3538, 3, &rule90},
+ {3542, 1, &rule90},
+ {3544, 8, &rule122},
+ {3558, 10, &rule8},
+ {3570, 2, &rule122},
{3572, 1, &rule2},
- {3585, 48, &rule45},
- {3633, 1, &rule84},
- {3634, 2, &rule45},
- {3636, 7, &rule84},
+ {3585, 48, &rule14},
+ {3633, 1, &rule90},
+ {3634, 2, &rule14},
+ {3636, 7, &rule90},
{3647, 1, &rule3},
- {3648, 6, &rule45},
- {3654, 1, &rule83},
- {3655, 8, &rule84},
+ {3648, 6, &rule14},
+ {3654, 1, &rule89},
+ {3655, 8, &rule90},
{3663, 1, &rule2},
{3664, 10, &rule8},
{3674, 2, &rule2},
- {3713, 2, &rule45},
- {3716, 1, &rule45},
- {3719, 2, &rule45},
- {3722, 1, &rule45},
- {3725, 1, &rule45},
- {3732, 4, &rule45},
- {3737, 7, &rule45},
- {3745, 3, &rule45},
- {3749, 1, &rule45},
- {3751, 1, &rule45},
- {3754, 2, &rule45},
- {3757, 4, &rule45},
- {3761, 1, &rule84},
- {3762, 2, &rule45},
- {3764, 6, &rule84},
- {3771, 2, &rule84},
- {3773, 1, &rule45},
- {3776, 5, &rule45},
- {3782, 1, &rule83},
- {3784, 6, &rule84},
+ {3713, 2, &rule14},
+ {3716, 1, &rule14},
+ {3719, 2, &rule14},
+ {3722, 1, &rule14},
+ {3725, 1, &rule14},
+ {3732, 4, &rule14},
+ {3737, 7, &rule14},
+ {3745, 3, &rule14},
+ {3749, 1, &rule14},
+ {3751, 1, &rule14},
+ {3754, 2, &rule14},
+ {3757, 4, &rule14},
+ {3761, 1, &rule90},
+ {3762, 2, &rule14},
+ {3764, 6, &rule90},
+ {3771, 2, &rule90},
+ {3773, 1, &rule14},
+ {3776, 5, &rule14},
+ {3782, 1, &rule89},
+ {3784, 6, &rule90},
{3792, 10, &rule8},
- {3804, 2, &rule45},
- {3840, 1, &rule45},
+ {3804, 4, &rule14},
+ {3840, 1, &rule14},
{3841, 3, &rule13},
{3844, 15, &rule2},
- {3859, 5, &rule13},
- {3864, 2, &rule84},
+ {3859, 1, &rule13},
+ {3860, 1, &rule2},
+ {3861, 3, &rule13},
+ {3864, 2, &rule90},
{3866, 6, &rule13},
{3872, 10, &rule8},
{3882, 10, &rule17},
{3892, 1, &rule13},
- {3893, 1, &rule84},
+ {3893, 1, &rule90},
{3894, 1, &rule13},
- {3895, 1, &rule84},
+ {3895, 1, &rule90},
{3896, 1, &rule13},
- {3897, 1, &rule84},
+ {3897, 1, &rule90},
{3898, 1, &rule4},
{3899, 1, &rule5},
{3900, 1, &rule4},
{3901, 1, &rule5},
- {3902, 2, &rule114},
- {3904, 8, &rule45},
- {3913, 36, &rule45},
- {3953, 14, &rule84},
- {3967, 1, &rule114},
- {3968, 5, &rule84},
+ {3902, 2, &rule122},
+ {3904, 8, &rule14},
+ {3913, 36, &rule14},
+ {3953, 14, &rule90},
+ {3967, 1, &rule122},
+ {3968, 5, &rule90},
{3973, 1, &rule2},
- {3974, 2, &rule84},
- {3976, 5, &rule45},
- {3981, 11, &rule84},
- {3993, 36, &rule84},
+ {3974, 2, &rule90},
+ {3976, 5, &rule14},
+ {3981, 11, &rule90},
+ {3993, 36, &rule90},
{4030, 8, &rule13},
- {4038, 1, &rule84},
+ {4038, 1, &rule90},
{4039, 6, &rule13},
{4046, 2, &rule13},
{4048, 5, &rule2},
{4053, 4, &rule13},
{4057, 2, &rule2},
- {4096, 43, &rule45},
- {4139, 2, &rule114},
- {4141, 4, &rule84},
- {4145, 1, &rule114},
- {4146, 6, &rule84},
- {4152, 1, &rule114},
- {4153, 2, &rule84},
- {4155, 2, &rule114},
- {4157, 2, &rule84},
- {4159, 1, &rule45},
+ {4096, 43, &rule14},
+ {4139, 2, &rule122},
+ {4141, 4, &rule90},
+ {4145, 1, &rule122},
+ {4146, 6, &rule90},
+ {4152, 1, &rule122},
+ {4153, 2, &rule90},
+ {4155, 2, &rule122},
+ {4157, 2, &rule90},
+ {4159, 1, &rule14},
{4160, 10, &rule8},
{4170, 6, &rule2},
- {4176, 6, &rule45},
- {4182, 2, &rule114},
- {4184, 2, &rule84},
- {4186, 4, &rule45},
- {4190, 3, &rule84},
- {4193, 1, &rule45},
- {4194, 3, &rule114},
- {4197, 2, &rule45},
- {4199, 7, &rule114},
- {4206, 3, &rule45},
- {4209, 4, &rule84},
- {4213, 13, &rule45},
- {4226, 1, &rule84},
- {4227, 2, &rule114},
- {4229, 2, &rule84},
- {4231, 6, &rule114},
- {4237, 1, &rule84},
- {4238, 1, &rule45},
- {4239, 1, &rule114},
+ {4176, 6, &rule14},
+ {4182, 2, &rule122},
+ {4184, 2, &rule90},
+ {4186, 4, &rule14},
+ {4190, 3, &rule90},
+ {4193, 1, &rule14},
+ {4194, 3, &rule122},
+ {4197, 2, &rule14},
+ {4199, 7, &rule122},
+ {4206, 3, &rule14},
+ {4209, 4, &rule90},
+ {4213, 13, &rule14},
+ {4226, 1, &rule90},
+ {4227, 2, &rule122},
+ {4229, 2, &rule90},
+ {4231, 6, &rule122},
+ {4237, 1, &rule90},
+ {4238, 1, &rule14},
+ {4239, 1, &rule122},
{4240, 10, &rule8},
- {4250, 3, &rule114},
- {4253, 1, &rule84},
+ {4250, 3, &rule122},
+ {4253, 1, &rule90},
{4254, 2, &rule13},
- {4256, 38, &rule115},
- {4304, 43, &rule45},
+ {4256, 38, &rule123},
+ {4295, 1, &rule123},
+ {4301, 1, &rule123},
+ {4304, 43, &rule14},
{4347, 1, &rule2},
- {4348, 1, &rule83},
- {4352, 329, &rule45},
- {4682, 4, &rule45},
- {4688, 7, &rule45},
- {4696, 1, &rule45},
- {4698, 4, &rule45},
- {4704, 41, &rule45},
- {4746, 4, &rule45},
- {4752, 33, &rule45},
- {4786, 4, &rule45},
- {4792, 7, &rule45},
- {4800, 1, &rule45},
- {4802, 4, &rule45},
- {4808, 15, &rule45},
- {4824, 57, &rule45},
- {4882, 4, &rule45},
- {4888, 67, &rule45},
- {4957, 3, &rule84},
- {4960, 1, &rule13},
- {4961, 8, &rule2},
+ {4348, 1, &rule89},
+ {4349, 332, &rule14},
+ {4682, 4, &rule14},
+ {4688, 7, &rule14},
+ {4696, 1, &rule14},
+ {4698, 4, &rule14},
+ {4704, 41, &rule14},
+ {4746, 4, &rule14},
+ {4752, 33, &rule14},
+ {4786, 4, &rule14},
+ {4792, 7, &rule14},
+ {4800, 1, &rule14},
+ {4802, 4, &rule14},
+ {4808, 15, &rule14},
+ {4824, 57, &rule14},
+ {4882, 4, &rule14},
+ {4888, 67, &rule14},
+ {4957, 3, &rule90},
+ {4960, 9, &rule2},
{4969, 20, &rule17},
- {4992, 16, &rule45},
+ {4992, 16, &rule14},
{5008, 10, &rule13},
- {5024, 85, &rule45},
+ {5024, 85, &rule14},
{5120, 1, &rule7},
- {5121, 620, &rule45},
+ {5121, 620, &rule14},
{5741, 2, &rule2},
- {5743, 17, &rule45},
+ {5743, 17, &rule14},
{5760, 1, &rule1},
- {5761, 26, &rule45},
+ {5761, 26, &rule14},
{5787, 1, &rule4},
{5788, 1, &rule5},
- {5792, 75, &rule45},
+ {5792, 75, &rule14},
{5867, 3, &rule2},
- {5870, 3, &rule116},
- {5888, 13, &rule45},
- {5902, 4, &rule45},
- {5906, 3, &rule84},
- {5920, 18, &rule45},
- {5938, 3, &rule84},
+ {5870, 3, &rule124},
+ {5873, 8, &rule14},
+ {5888, 13, &rule14},
+ {5902, 4, &rule14},
+ {5906, 3, &rule90},
+ {5920, 18, &rule14},
+ {5938, 3, &rule90},
{5941, 2, &rule2},
- {5952, 18, &rule45},
- {5970, 2, &rule84},
- {5984, 13, &rule45},
- {5998, 3, &rule45},
- {6002, 2, &rule84},
- {6016, 52, &rule45},
- {6068, 2, &rule16},
- {6070, 1, &rule114},
- {6071, 7, &rule84},
- {6078, 8, &rule114},
- {6086, 1, &rule84},
- {6087, 2, &rule114},
- {6089, 11, &rule84},
+ {5952, 18, &rule14},
+ {5970, 2, &rule90},
+ {5984, 13, &rule14},
+ {5998, 3, &rule14},
+ {6002, 2, &rule90},
+ {6016, 52, &rule14},
+ {6068, 2, &rule90},
+ {6070, 1, &rule122},
+ {6071, 7, &rule90},
+ {6078, 8, &rule122},
+ {6086, 1, &rule90},
+ {6087, 2, &rule122},
+ {6089, 11, &rule90},
{6100, 3, &rule2},
- {6103, 1, &rule83},
+ {6103, 1, &rule89},
{6104, 3, &rule2},
{6107, 1, &rule3},
- {6108, 1, &rule45},
- {6109, 1, &rule84},
+ {6108, 1, &rule14},
+ {6109, 1, &rule90},
{6112, 10, &rule8},
{6128, 10, &rule17},
{6144, 6, &rule2},
{6150, 1, &rule7},
{6151, 4, &rule2},
- {6155, 3, &rule84},
- {6158, 1, &rule1},
+ {6155, 3, &rule90},
+ {6158, 1, &rule16},
{6160, 10, &rule8},
- {6176, 35, &rule45},
- {6211, 1, &rule83},
- {6212, 52, &rule45},
- {6272, 41, &rule45},
- {6313, 1, &rule84},
- {6314, 1, &rule45},
- {6320, 70, &rule45},
- {6400, 29, &rule45},
- {6432, 3, &rule84},
- {6435, 4, &rule114},
- {6439, 2, &rule84},
- {6441, 3, &rule114},
- {6448, 2, &rule114},
- {6450, 1, &rule84},
- {6451, 6, &rule114},
- {6457, 3, &rule84},
+ {6176, 35, &rule14},
+ {6211, 1, &rule89},
+ {6212, 52, &rule14},
+ {6272, 41, &rule14},
+ {6313, 1, &rule90},
+ {6314, 1, &rule14},
+ {6320, 70, &rule14},
+ {6400, 31, &rule14},
+ {6432, 3, &rule90},
+ {6435, 4, &rule122},
+ {6439, 2, &rule90},
+ {6441, 3, &rule122},
+ {6448, 2, &rule122},
+ {6450, 1, &rule90},
+ {6451, 6, &rule122},
+ {6457, 3, &rule90},
{6464, 1, &rule13},
{6468, 2, &rule2},
{6470, 10, &rule8},
- {6480, 30, &rule45},
- {6512, 5, &rule45},
- {6528, 44, &rule45},
- {6576, 17, &rule114},
- {6593, 7, &rule45},
- {6600, 2, &rule114},
+ {6480, 30, &rule14},
+ {6512, 5, &rule14},
+ {6528, 44, &rule14},
+ {6576, 17, &rule122},
+ {6593, 7, &rule14},
+ {6600, 2, &rule122},
{6608, 10, &rule8},
{6618, 1, &rule17},
{6622, 34, &rule13},
- {6656, 23, &rule45},
- {6679, 2, &rule84},
- {6681, 3, &rule114},
+ {6656, 23, &rule14},
+ {6679, 2, &rule90},
+ {6681, 2, &rule122},
+ {6683, 1, &rule90},
{6686, 2, &rule2},
- {6688, 53, &rule45},
- {6741, 1, &rule114},
- {6742, 1, &rule84},
- {6743, 1, &rule114},
- {6744, 7, &rule84},
- {6752, 1, &rule84},
- {6753, 1, &rule114},
- {6754, 1, &rule84},
- {6755, 2, &rule114},
- {6757, 8, &rule84},
- {6765, 6, &rule114},
- {6771, 10, &rule84},
- {6783, 1, &rule84},
+ {6688, 53, &rule14},
+ {6741, 1, &rule122},
+ {6742, 1, &rule90},
+ {6743, 1, &rule122},
+ {6744, 7, &rule90},
+ {6752, 1, &rule90},
+ {6753, 1, &rule122},
+ {6754, 1, &rule90},
+ {6755, 2, &rule122},
+ {6757, 8, &rule90},
+ {6765, 6, &rule122},
+ {6771, 10, &rule90},
+ {6783, 1, &rule90},
{6784, 10, &rule8},
{6800, 10, &rule8},
{6816, 7, &rule2},
- {6823, 1, &rule83},
+ {6823, 1, &rule89},
{6824, 6, &rule2},
- {6912, 4, &rule84},
- {6916, 1, &rule114},
- {6917, 47, &rule45},
- {6964, 1, &rule84},
- {6965, 1, &rule114},
- {6966, 5, &rule84},
- {6971, 1, &rule114},
- {6972, 1, &rule84},
- {6973, 5, &rule114},
- {6978, 1, &rule84},
- {6979, 2, &rule114},
- {6981, 7, &rule45},
+ {6832, 14, &rule90},
+ {6846, 1, &rule117},
+ {6912, 4, &rule90},
+ {6916, 1, &rule122},
+ {6917, 47, &rule14},
+ {6964, 1, &rule90},
+ {6965, 1, &rule122},
+ {6966, 5, &rule90},
+ {6971, 1, &rule122},
+ {6972, 1, &rule90},
+ {6973, 5, &rule122},
+ {6978, 1, &rule90},
+ {6979, 2, &rule122},
+ {6981, 7, &rule14},
{6992, 10, &rule8},
{7002, 7, &rule2},
{7009, 10, &rule13},
- {7019, 9, &rule84},
+ {7019, 9, &rule90},
{7028, 9, &rule13},
- {7040, 2, &rule84},
- {7042, 1, &rule114},
- {7043, 30, &rule45},
- {7073, 1, &rule114},
- {7074, 4, &rule84},
- {7078, 2, &rule114},
- {7080, 2, &rule84},
- {7082, 1, &rule114},
- {7086, 2, &rule45},
+ {7040, 2, &rule90},
+ {7042, 1, &rule122},
+ {7043, 30, &rule14},
+ {7073, 1, &rule122},
+ {7074, 4, &rule90},
+ {7078, 2, &rule122},
+ {7080, 2, &rule90},
+ {7082, 1, &rule122},
+ {7083, 3, &rule90},
+ {7086, 2, &rule14},
{7088, 10, &rule8},
- {7104, 38, &rule45},
- {7142, 1, &rule84},
- {7143, 1, &rule114},
- {7144, 2, &rule84},
- {7146, 3, &rule114},
- {7149, 1, &rule84},
- {7150, 1, &rule114},
- {7151, 3, &rule84},
- {7154, 2, &rule114},
+ {7098, 44, &rule14},
+ {7142, 1, &rule90},
+ {7143, 1, &rule122},
+ {7144, 2, &rule90},
+ {7146, 3, &rule122},
+ {7149, 1, &rule90},
+ {7150, 1, &rule122},
+ {7151, 3, &rule90},
+ {7154, 2, &rule122},
{7164, 4, &rule2},
- {7168, 36, &rule45},
- {7204, 8, &rule114},
- {7212, 8, &rule84},
- {7220, 2, &rule114},
- {7222, 2, &rule84},
+ {7168, 36, &rule14},
+ {7204, 8, &rule122},
+ {7212, 8, &rule90},
+ {7220, 2, &rule122},
+ {7222, 2, &rule90},
{7227, 5, &rule2},
{7232, 10, &rule8},
- {7245, 3, &rule45},
+ {7245, 3, &rule14},
{7248, 10, &rule8},
- {7258, 30, &rule45},
- {7288, 6, &rule83},
+ {7258, 30, &rule14},
+ {7288, 6, &rule89},
{7294, 2, &rule2},
- {7376, 3, &rule84},
+ {7360, 8, &rule2},
+ {7376, 3, &rule90},
{7379, 1, &rule2},
- {7380, 13, &rule84},
- {7393, 1, &rule114},
- {7394, 7, &rule84},
- {7401, 4, &rule45},
- {7405, 1, &rule84},
- {7406, 4, &rule45},
- {7410, 1, &rule114},
- {7424, 44, &rule14},
- {7468, 54, &rule83},
- {7522, 22, &rule14},
- {7544, 1, &rule83},
- {7545, 1, &rule117},
- {7546, 3, &rule14},
- {7549, 1, &rule118},
- {7550, 29, &rule14},
- {7579, 37, &rule83},
- {7616, 39, &rule84},
- {7676, 4, &rule84},
- {7680, 1, &rule21},
- {7681, 1, &rule22},
- {7682, 1, &rule21},
- {7683, 1, &rule22},
- {7684, 1, &rule21},
- {7685, 1, &rule22},
- {7686, 1, &rule21},
- {7687, 1, &rule22},
- {7688, 1, &rule21},
- {7689, 1, &rule22},
- {7690, 1, &rule21},
- {7691, 1, &rule22},
- {7692, 1, &rule21},
- {7693, 1, &rule22},
- {7694, 1, &rule21},
- {7695, 1, &rule22},
- {7696, 1, &rule21},
- {7697, 1, &rule22},
- {7698, 1, &rule21},
- {7699, 1, &rule22},
- {7700, 1, &rule21},
- {7701, 1, &rule22},
- {7702, 1, &rule21},
- {7703, 1, &rule22},
- {7704, 1, &rule21},
- {7705, 1, &rule22},
- {7706, 1, &rule21},
- {7707, 1, &rule22},
- {7708, 1, &rule21},
- {7709, 1, &rule22},
- {7710, 1, &rule21},
- {7711, 1, &rule22},
- {7712, 1, &rule21},
- {7713, 1, &rule22},
- {7714, 1, &rule21},
- {7715, 1, &rule22},
- {7716, 1, &rule21},
- {7717, 1, &rule22},
- {7718, 1, &rule21},
- {7719, 1, &rule22},
- {7720, 1, &rule21},
- {7721, 1, &rule22},
- {7722, 1, &rule21},
- {7723, 1, &rule22},
- {7724, 1, &rule21},
- {7725, 1, &rule22},
- {7726, 1, &rule21},
- {7727, 1, &rule22},
- {7728, 1, &rule21},
- {7729, 1, &rule22},
- {7730, 1, &rule21},
- {7731, 1, &rule22},
- {7732, 1, &rule21},
- {7733, 1, &rule22},
- {7734, 1, &rule21},
- {7735, 1, &rule22},
- {7736, 1, &rule21},
- {7737, 1, &rule22},
- {7738, 1, &rule21},
- {7739, 1, &rule22},
- {7740, 1, &rule21},
- {7741, 1, &rule22},
- {7742, 1, &rule21},
- {7743, 1, &rule22},
- {7744, 1, &rule21},
- {7745, 1, &rule22},
- {7746, 1, &rule21},
- {7747, 1, &rule22},
- {7748, 1, &rule21},
- {7749, 1, &rule22},
- {7750, 1, &rule21},
- {7751, 1, &rule22},
- {7752, 1, &rule21},
- {7753, 1, &rule22},
- {7754, 1, &rule21},
- {7755, 1, &rule22},
- {7756, 1, &rule21},
- {7757, 1, &rule22},
- {7758, 1, &rule21},
- {7759, 1, &rule22},
- {7760, 1, &rule21},
- {7761, 1, &rule22},
- {7762, 1, &rule21},
- {7763, 1, &rule22},
- {7764, 1, &rule21},
- {7765, 1, &rule22},
- {7766, 1, &rule21},
- {7767, 1, &rule22},
- {7768, 1, &rule21},
- {7769, 1, &rule22},
- {7770, 1, &rule21},
- {7771, 1, &rule22},
- {7772, 1, &rule21},
- {7773, 1, &rule22},
- {7774, 1, &rule21},
- {7775, 1, &rule22},
- {7776, 1, &rule21},
- {7777, 1, &rule22},
- {7778, 1, &rule21},
- {7779, 1, &rule22},
- {7780, 1, &rule21},
- {7781, 1, &rule22},
- {7782, 1, &rule21},
- {7783, 1, &rule22},
- {7784, 1, &rule21},
- {7785, 1, &rule22},
- {7786, 1, &rule21},
- {7787, 1, &rule22},
- {7788, 1, &rule21},
- {7789, 1, &rule22},
- {7790, 1, &rule21},
- {7791, 1, &rule22},
- {7792, 1, &rule21},
- {7793, 1, &rule22},
- {7794, 1, &rule21},
- {7795, 1, &rule22},
- {7796, 1, &rule21},
- {7797, 1, &rule22},
- {7798, 1, &rule21},
- {7799, 1, &rule22},
- {7800, 1, &rule21},
- {7801, 1, &rule22},
- {7802, 1, &rule21},
- {7803, 1, &rule22},
- {7804, 1, &rule21},
- {7805, 1, &rule22},
- {7806, 1, &rule21},
- {7807, 1, &rule22},
- {7808, 1, &rule21},
- {7809, 1, &rule22},
- {7810, 1, &rule21},
- {7811, 1, &rule22},
- {7812, 1, &rule21},
- {7813, 1, &rule22},
- {7814, 1, &rule21},
- {7815, 1, &rule22},
- {7816, 1, &rule21},
- {7817, 1, &rule22},
- {7818, 1, &rule21},
- {7819, 1, &rule22},
- {7820, 1, &rule21},
- {7821, 1, &rule22},
- {7822, 1, &rule21},
- {7823, 1, &rule22},
- {7824, 1, &rule21},
- {7825, 1, &rule22},
- {7826, 1, &rule21},
- {7827, 1, &rule22},
- {7828, 1, &rule21},
- {7829, 1, &rule22},
- {7830, 5, &rule14},
- {7835, 1, &rule119},
- {7836, 2, &rule14},
- {7838, 1, &rule120},
- {7839, 1, &rule14},
- {7840, 1, &rule21},
- {7841, 1, &rule22},
- {7842, 1, &rule21},
- {7843, 1, &rule22},
- {7844, 1, &rule21},
- {7845, 1, &rule22},
- {7846, 1, &rule21},
- {7847, 1, &rule22},
- {7848, 1, &rule21},
- {7849, 1, &rule22},
- {7850, 1, &rule21},
- {7851, 1, &rule22},
- {7852, 1, &rule21},
- {7853, 1, &rule22},
- {7854, 1, &rule21},
- {7855, 1, &rule22},
- {7856, 1, &rule21},
- {7857, 1, &rule22},
- {7858, 1, &rule21},
- {7859, 1, &rule22},
- {7860, 1, &rule21},
- {7861, 1, &rule22},
- {7862, 1, &rule21},
- {7863, 1, &rule22},
- {7864, 1, &rule21},
- {7865, 1, &rule22},
- {7866, 1, &rule21},
- {7867, 1, &rule22},
- {7868, 1, &rule21},
- {7869, 1, &rule22},
- {7870, 1, &rule21},
- {7871, 1, &rule22},
- {7872, 1, &rule21},
- {7873, 1, &rule22},
- {7874, 1, &rule21},
- {7875, 1, &rule22},
- {7876, 1, &rule21},
- {7877, 1, &rule22},
- {7878, 1, &rule21},
- {7879, 1, &rule22},
- {7880, 1, &rule21},
- {7881, 1, &rule22},
- {7882, 1, &rule21},
- {7883, 1, &rule22},
- {7884, 1, &rule21},
- {7885, 1, &rule22},
- {7886, 1, &rule21},
- {7887, 1, &rule22},
- {7888, 1, &rule21},
- {7889, 1, &rule22},
- {7890, 1, &rule21},
- {7891, 1, &rule22},
- {7892, 1, &rule21},
- {7893, 1, &rule22},
- {7894, 1, &rule21},
- {7895, 1, &rule22},
- {7896, 1, &rule21},
- {7897, 1, &rule22},
- {7898, 1, &rule21},
- {7899, 1, &rule22},
- {7900, 1, &rule21},
- {7901, 1, &rule22},
- {7902, 1, &rule21},
- {7903, 1, &rule22},
- {7904, 1, &rule21},
- {7905, 1, &rule22},
- {7906, 1, &rule21},
- {7907, 1, &rule22},
- {7908, 1, &rule21},
- {7909, 1, &rule22},
- {7910, 1, &rule21},
- {7911, 1, &rule22},
- {7912, 1, &rule21},
- {7913, 1, &rule22},
- {7914, 1, &rule21},
- {7915, 1, &rule22},
- {7916, 1, &rule21},
- {7917, 1, &rule22},
- {7918, 1, &rule21},
- {7919, 1, &rule22},
- {7920, 1, &rule21},
- {7921, 1, &rule22},
- {7922, 1, &rule21},
- {7923, 1, &rule22},
- {7924, 1, &rule21},
- {7925, 1, &rule22},
- {7926, 1, &rule21},
- {7927, 1, &rule22},
- {7928, 1, &rule21},
- {7929, 1, &rule22},
- {7930, 1, &rule21},
- {7931, 1, &rule22},
- {7932, 1, &rule21},
- {7933, 1, &rule22},
- {7934, 1, &rule21},
- {7935, 1, &rule22},
- {7936, 8, &rule121},
- {7944, 8, &rule122},
- {7952, 6, &rule121},
- {7960, 6, &rule122},
- {7968, 8, &rule121},
- {7976, 8, &rule122},
- {7984, 8, &rule121},
- {7992, 8, &rule122},
- {8000, 6, &rule121},
- {8008, 6, &rule122},
- {8016, 1, &rule14},
- {8017, 1, &rule121},
- {8018, 1, &rule14},
- {8019, 1, &rule121},
- {8020, 1, &rule14},
- {8021, 1, &rule121},
- {8022, 1, &rule14},
- {8023, 1, &rule121},
- {8025, 1, &rule122},
- {8027, 1, &rule122},
- {8029, 1, &rule122},
- {8031, 1, &rule122},
- {8032, 8, &rule121},
- {8040, 8, &rule122},
- {8048, 2, &rule123},
- {8050, 4, &rule124},
- {8054, 2, &rule125},
- {8056, 2, &rule126},
- {8058, 2, &rule127},
- {8060, 2, &rule128},
- {8064, 8, &rule121},
- {8072, 8, &rule129},
- {8080, 8, &rule121},
- {8088, 8, &rule129},
- {8096, 8, &rule121},
- {8104, 8, &rule129},
- {8112, 2, &rule121},
- {8114, 1, &rule14},
- {8115, 1, &rule130},
- {8116, 1, &rule14},
- {8118, 2, &rule14},
- {8120, 2, &rule122},
- {8122, 2, &rule131},
- {8124, 1, &rule132},
+ {7380, 13, &rule90},
+ {7393, 1, &rule122},
+ {7394, 7, &rule90},
+ {7401, 4, &rule14},
+ {7405, 1, &rule90},
+ {7406, 4, &rule14},
+ {7410, 2, &rule122},
+ {7412, 1, &rule90},
+ {7413, 2, &rule14},
+ {7416, 2, &rule90},
+ {7424, 44, &rule20},
+ {7468, 63, &rule89},
+ {7531, 13, &rule20},
+ {7544, 1, &rule89},
+ {7545, 1, &rule125},
+ {7546, 3, &rule20},
+ {7549, 1, &rule126},
+ {7550, 29, &rule20},
+ {7579, 37, &rule89},
+ {7616, 54, &rule90},
+ {7676, 4, &rule90},
+ {7680, 1, &rule22},
+ {7681, 1, &rule23},
+ {7682, 1, &rule22},
+ {7683, 1, &rule23},
+ {7684, 1, &rule22},
+ {7685, 1, &rule23},
+ {7686, 1, &rule22},
+ {7687, 1, &rule23},
+ {7688, 1, &rule22},
+ {7689, 1, &rule23},
+ {7690, 1, &rule22},
+ {7691, 1, &rule23},
+ {7692, 1, &rule22},
+ {7693, 1, &rule23},
+ {7694, 1, &rule22},
+ {7695, 1, &rule23},
+ {7696, 1, &rule22},
+ {7697, 1, &rule23},
+ {7698, 1, &rule22},
+ {7699, 1, &rule23},
+ {7700, 1, &rule22},
+ {7701, 1, &rule23},
+ {7702, 1, &rule22},
+ {7703, 1, &rule23},
+ {7704, 1, &rule22},
+ {7705, 1, &rule23},
+ {7706, 1, &rule22},
+ {7707, 1, &rule23},
+ {7708, 1, &rule22},
+ {7709, 1, &rule23},
+ {7710, 1, &rule22},
+ {7711, 1, &rule23},
+ {7712, 1, &rule22},
+ {7713, 1, &rule23},
+ {7714, 1, &rule22},
+ {7715, 1, &rule23},
+ {7716, 1, &rule22},
+ {7717, 1, &rule23},
+ {7718, 1, &rule22},
+ {7719, 1, &rule23},
+ {7720, 1, &rule22},
+ {7721, 1, &rule23},
+ {7722, 1, &rule22},
+ {7723, 1, &rule23},
+ {7724, 1, &rule22},
+ {7725, 1, &rule23},
+ {7726, 1, &rule22},
+ {7727, 1, &rule23},
+ {7728, 1, &rule22},
+ {7729, 1, &rule23},
+ {7730, 1, &rule22},
+ {7731, 1, &rule23},
+ {7732, 1, &rule22},
+ {7733, 1, &rule23},
+ {7734, 1, &rule22},
+ {7735, 1, &rule23},
+ {7736, 1, &rule22},
+ {7737, 1, &rule23},
+ {7738, 1, &rule22},
+ {7739, 1, &rule23},
+ {7740, 1, &rule22},
+ {7741, 1, &rule23},
+ {7742, 1, &rule22},
+ {7743, 1, &rule23},
+ {7744, 1, &rule22},
+ {7745, 1, &rule23},
+ {7746, 1, &rule22},
+ {7747, 1, &rule23},
+ {7748, 1, &rule22},
+ {7749, 1, &rule23},
+ {7750, 1, &rule22},
+ {7751, 1, &rule23},
+ {7752, 1, &rule22},
+ {7753, 1, &rule23},
+ {7754, 1, &rule22},
+ {7755, 1, &rule23},
+ {7756, 1, &rule22},
+ {7757, 1, &rule23},
+ {7758, 1, &rule22},
+ {7759, 1, &rule23},
+ {7760, 1, &rule22},
+ {7761, 1, &rule23},
+ {7762, 1, &rule22},
+ {7763, 1, &rule23},
+ {7764, 1, &rule22},
+ {7765, 1, &rule23},
+ {7766, 1, &rule22},
+ {7767, 1, &rule23},
+ {7768, 1, &rule22},
+ {7769, 1, &rule23},
+ {7770, 1, &rule22},
+ {7771, 1, &rule23},
+ {7772, 1, &rule22},
+ {7773, 1, &rule23},
+ {7774, 1, &rule22},
+ {7775, 1, &rule23},
+ {7776, 1, &rule22},
+ {7777, 1, &rule23},
+ {7778, 1, &rule22},
+ {7779, 1, &rule23},
+ {7780, 1, &rule22},
+ {7781, 1, &rule23},
+ {7782, 1, &rule22},
+ {7783, 1, &rule23},
+ {7784, 1, &rule22},
+ {7785, 1, &rule23},
+ {7786, 1, &rule22},
+ {7787, 1, &rule23},
+ {7788, 1, &rule22},
+ {7789, 1, &rule23},
+ {7790, 1, &rule22},
+ {7791, 1, &rule23},
+ {7792, 1, &rule22},
+ {7793, 1, &rule23},
+ {7794, 1, &rule22},
+ {7795, 1, &rule23},
+ {7796, 1, &rule22},
+ {7797, 1, &rule23},
+ {7798, 1, &rule22},
+ {7799, 1, &rule23},
+ {7800, 1, &rule22},
+ {7801, 1, &rule23},
+ {7802, 1, &rule22},
+ {7803, 1, &rule23},
+ {7804, 1, &rule22},
+ {7805, 1, &rule23},
+ {7806, 1, &rule22},
+ {7807, 1, &rule23},
+ {7808, 1, &rule22},
+ {7809, 1, &rule23},
+ {7810, 1, &rule22},
+ {7811, 1, &rule23},
+ {7812, 1, &rule22},
+ {7813, 1, &rule23},
+ {7814, 1, &rule22},
+ {7815, 1, &rule23},
+ {7816, 1, &rule22},
+ {7817, 1, &rule23},
+ {7818, 1, &rule22},
+ {7819, 1, &rule23},
+ {7820, 1, &rule22},
+ {7821, 1, &rule23},
+ {7822, 1, &rule22},
+ {7823, 1, &rule23},
+ {7824, 1, &rule22},
+ {7825, 1, &rule23},
+ {7826, 1, &rule22},
+ {7827, 1, &rule23},
+ {7828, 1, &rule22},
+ {7829, 1, &rule23},
+ {7830, 5, &rule20},
+ {7835, 1, &rule127},
+ {7836, 2, &rule20},
+ {7838, 1, &rule128},
+ {7839, 1, &rule20},
+ {7840, 1, &rule22},
+ {7841, 1, &rule23},
+ {7842, 1, &rule22},
+ {7843, 1, &rule23},
+ {7844, 1, &rule22},
+ {7845, 1, &rule23},
+ {7846, 1, &rule22},
+ {7847, 1, &rule23},
+ {7848, 1, &rule22},
+ {7849, 1, &rule23},
+ {7850, 1, &rule22},
+ {7851, 1, &rule23},
+ {7852, 1, &rule22},
+ {7853, 1, &rule23},
+ {7854, 1, &rule22},
+ {7855, 1, &rule23},
+ {7856, 1, &rule22},
+ {7857, 1, &rule23},
+ {7858, 1, &rule22},
+ {7859, 1, &rule23},
+ {7860, 1, &rule22},
+ {7861, 1, &rule23},
+ {7862, 1, &rule22},
+ {7863, 1, &rule23},
+ {7864, 1, &rule22},
+ {7865, 1, &rule23},
+ {7866, 1, &rule22},
+ {7867, 1, &rule23},
+ {7868, 1, &rule22},
+ {7869, 1, &rule23},
+ {7870, 1, &rule22},
+ {7871, 1, &rule23},
+ {7872, 1, &rule22},
+ {7873, 1, &rule23},
+ {7874, 1, &rule22},
+ {7875, 1, &rule23},
+ {7876, 1, &rule22},
+ {7877, 1, &rule23},
+ {7878, 1, &rule22},
+ {7879, 1, &rule23},
+ {7880, 1, &rule22},
+ {7881, 1, &rule23},
+ {7882, 1, &rule22},
+ {7883, 1, &rule23},
+ {7884, 1, &rule22},
+ {7885, 1, &rule23},
+ {7886, 1, &rule22},
+ {7887, 1, &rule23},
+ {7888, 1, &rule22},
+ {7889, 1, &rule23},
+ {7890, 1, &rule22},
+ {7891, 1, &rule23},
+ {7892, 1, &rule22},
+ {7893, 1, &rule23},
+ {7894, 1, &rule22},
+ {7895, 1, &rule23},
+ {7896, 1, &rule22},
+ {7897, 1, &rule23},
+ {7898, 1, &rule22},
+ {7899, 1, &rule23},
+ {7900, 1, &rule22},
+ {7901, 1, &rule23},
+ {7902, 1, &rule22},
+ {7903, 1, &rule23},
+ {7904, 1, &rule22},
+ {7905, 1, &rule23},
+ {7906, 1, &rule22},
+ {7907, 1, &rule23},
+ {7908, 1, &rule22},
+ {7909, 1, &rule23},
+ {7910, 1, &rule22},
+ {7911, 1, &rule23},
+ {7912, 1, &rule22},
+ {7913, 1, &rule23},
+ {7914, 1, &rule22},
+ {7915, 1, &rule23},
+ {7916, 1, &rule22},
+ {7917, 1, &rule23},
+ {7918, 1, &rule22},
+ {7919, 1, &rule23},
+ {7920, 1, &rule22},
+ {7921, 1, &rule23},
+ {7922, 1, &rule22},
+ {7923, 1, &rule23},
+ {7924, 1, &rule22},
+ {7925, 1, &rule23},
+ {7926, 1, &rule22},
+ {7927, 1, &rule23},
+ {7928, 1, &rule22},
+ {7929, 1, &rule23},
+ {7930, 1, &rule22},
+ {7931, 1, &rule23},
+ {7932, 1, &rule22},
+ {7933, 1, &rule23},
+ {7934, 1, &rule22},
+ {7935, 1, &rule23},
+ {7936, 8, &rule129},
+ {7944, 8, &rule130},
+ {7952, 6, &rule129},
+ {7960, 6, &rule130},
+ {7968, 8, &rule129},
+ {7976, 8, &rule130},
+ {7984, 8, &rule129},
+ {7992, 8, &rule130},
+ {8000, 6, &rule129},
+ {8008, 6, &rule130},
+ {8016, 1, &rule20},
+ {8017, 1, &rule129},
+ {8018, 1, &rule20},
+ {8019, 1, &rule129},
+ {8020, 1, &rule20},
+ {8021, 1, &rule129},
+ {8022, 1, &rule20},
+ {8023, 1, &rule129},
+ {8025, 1, &rule130},
+ {8027, 1, &rule130},
+ {8029, 1, &rule130},
+ {8031, 1, &rule130},
+ {8032, 8, &rule129},
+ {8040, 8, &rule130},
+ {8048, 2, &rule131},
+ {8050, 4, &rule132},
+ {8054, 2, &rule133},
+ {8056, 2, &rule134},
+ {8058, 2, &rule135},
+ {8060, 2, &rule136},
+ {8064, 8, &rule129},
+ {8072, 8, &rule137},
+ {8080, 8, &rule129},
+ {8088, 8, &rule137},
+ {8096, 8, &rule129},
+ {8104, 8, &rule137},
+ {8112, 2, &rule129},
+ {8114, 1, &rule20},
+ {8115, 1, &rule138},
+ {8116, 1, &rule20},
+ {8118, 2, &rule20},
+ {8120, 2, &rule130},
+ {8122, 2, &rule139},
+ {8124, 1, &rule140},
{8125, 1, &rule10},
- {8126, 1, &rule133},
+ {8126, 1, &rule141},
{8127, 3, &rule10},
- {8130, 1, &rule14},
- {8131, 1, &rule130},
- {8132, 1, &rule14},
- {8134, 2, &rule14},
- {8136, 4, &rule134},
- {8140, 1, &rule132},
+ {8130, 1, &rule20},
+ {8131, 1, &rule138},
+ {8132, 1, &rule20},
+ {8134, 2, &rule20},
+ {8136, 4, &rule142},
+ {8140, 1, &rule140},
{8141, 3, &rule10},
- {8144, 2, &rule121},
- {8146, 2, &rule14},
- {8150, 2, &rule14},
- {8152, 2, &rule122},
- {8154, 2, &rule135},
+ {8144, 2, &rule129},
+ {8146, 2, &rule20},
+ {8150, 2, &rule20},
+ {8152, 2, &rule130},
+ {8154, 2, &rule143},
{8157, 3, &rule10},
- {8160, 2, &rule121},
- {8162, 3, &rule14},
- {8165, 1, &rule104},
- {8166, 2, &rule14},
- {8168, 2, &rule122},
- {8170, 2, &rule136},
- {8172, 1, &rule107},
+ {8160, 2, &rule129},
+ {8162, 3, &rule20},
+ {8165, 1, &rule111},
+ {8166, 2, &rule20},
+ {8168, 2, &rule130},
+ {8170, 2, &rule144},
+ {8172, 1, &rule115},
{8173, 3, &rule10},
- {8178, 1, &rule14},
- {8179, 1, &rule130},
- {8180, 1, &rule14},
- {8182, 2, &rule14},
- {8184, 2, &rule137},
- {8186, 2, &rule138},
- {8188, 1, &rule132},
+ {8178, 1, &rule20},
+ {8179, 1, &rule138},
+ {8180, 1, &rule20},
+ {8182, 2, &rule20},
+ {8184, 2, &rule145},
+ {8186, 2, &rule146},
+ {8188, 1, &rule140},
{8189, 2, &rule10},
{8192, 11, &rule1},
{8203, 5, &rule16},
@@ -1901,8 +1951,8 @@ static const struct _charblock_ allchars[]={
{8222, 1, &rule4},
{8223, 1, &rule15},
{8224, 8, &rule2},
- {8232, 1, &rule139},
- {8233, 1, &rule140},
+ {8232, 1, &rule147},
+ {8233, 1, &rule148},
{8234, 5, &rule16},
{8239, 1, &rule1},
{8240, 9, &rule2},
@@ -1921,76 +1971,76 @@ static const struct _charblock_ allchars[]={
{8277, 10, &rule2},
{8287, 1, &rule1},
{8288, 5, &rule16},
- {8298, 6, &rule16},
+ {8294, 10, &rule16},
{8304, 1, &rule17},
- {8305, 1, &rule83},
+ {8305, 1, &rule89},
{8308, 6, &rule17},
{8314, 3, &rule6},
{8317, 1, &rule4},
{8318, 1, &rule5},
- {8319, 1, &rule83},
+ {8319, 1, &rule89},
{8320, 10, &rule17},
{8330, 3, &rule6},
{8333, 1, &rule4},
{8334, 1, &rule5},
- {8336, 13, &rule83},
- {8352, 26, &rule3},
- {8400, 13, &rule84},
- {8413, 4, &rule109},
- {8417, 1, &rule84},
- {8418, 3, &rule109},
- {8421, 12, &rule84},
+ {8336, 13, &rule89},
+ {8352, 30, &rule3},
+ {8400, 13, &rule90},
+ {8413, 4, &rule117},
+ {8417, 1, &rule90},
+ {8418, 3, &rule117},
+ {8421, 12, &rule90},
{8448, 2, &rule13},
- {8450, 1, &rule98},
+ {8450, 1, &rule105},
{8451, 4, &rule13},
- {8455, 1, &rule98},
+ {8455, 1, &rule105},
{8456, 2, &rule13},
- {8458, 1, &rule14},
- {8459, 3, &rule98},
- {8462, 2, &rule14},
- {8464, 3, &rule98},
- {8467, 1, &rule14},
+ {8458, 1, &rule20},
+ {8459, 3, &rule105},
+ {8462, 2, &rule20},
+ {8464, 3, &rule105},
+ {8467, 1, &rule20},
{8468, 1, &rule13},
- {8469, 1, &rule98},
+ {8469, 1, &rule105},
{8470, 2, &rule13},
{8472, 1, &rule6},
- {8473, 5, &rule98},
+ {8473, 5, &rule105},
{8478, 6, &rule13},
- {8484, 1, &rule98},
+ {8484, 1, &rule105},
{8485, 1, &rule13},
- {8486, 1, &rule141},
+ {8486, 1, &rule149},
{8487, 1, &rule13},
- {8488, 1, &rule98},
+ {8488, 1, &rule105},
{8489, 1, &rule13},
- {8490, 1, &rule142},
- {8491, 1, &rule143},
- {8492, 2, &rule98},
+ {8490, 1, &rule150},
+ {8491, 1, &rule151},
+ {8492, 2, &rule105},
{8494, 1, &rule13},
- {8495, 1, &rule14},
- {8496, 2, &rule98},
- {8498, 1, &rule144},
- {8499, 1, &rule98},
- {8500, 1, &rule14},
- {8501, 4, &rule45},
- {8505, 1, &rule14},
+ {8495, 1, &rule20},
+ {8496, 2, &rule105},
+ {8498, 1, &rule152},
+ {8499, 1, &rule105},
+ {8500, 1, &rule20},
+ {8501, 4, &rule14},
+ {8505, 1, &rule20},
{8506, 2, &rule13},
- {8508, 2, &rule14},
- {8510, 2, &rule98},
+ {8508, 2, &rule20},
+ {8510, 2, &rule105},
{8512, 5, &rule6},
- {8517, 1, &rule98},
- {8518, 4, &rule14},
+ {8517, 1, &rule105},
+ {8518, 4, &rule20},
{8522, 1, &rule13},
{8523, 1, &rule6},
{8524, 2, &rule13},
- {8526, 1, &rule145},
+ {8526, 1, &rule153},
{8527, 1, &rule13},
{8528, 16, &rule17},
- {8544, 16, &rule146},
- {8560, 16, &rule147},
- {8576, 3, &rule116},
- {8579, 1, &rule21},
- {8580, 1, &rule22},
- {8581, 4, &rule116},
+ {8544, 16, &rule154},
+ {8560, 16, &rule155},
+ {8576, 3, &rule124},
+ {8579, 1, &rule22},
+ {8580, 1, &rule23},
+ {8581, 4, &rule124},
{8585, 1, &rule17},
{8592, 5, &rule6},
{8597, 5, &rule13},
@@ -2012,7 +2062,10 @@ static const struct _charblock_ allchars[]={
{8661, 31, &rule13},
{8692, 268, &rule6},
{8960, 8, &rule13},
- {8968, 4, &rule6},
+ {8968, 1, &rule4},
+ {8969, 1, &rule5},
+ {8970, 1, &rule4},
+ {8971, 1, &rule5},
{8972, 20, &rule13},
{8992, 2, &rule6},
{8994, 7, &rule13},
@@ -2024,13 +2077,13 @@ static const struct _charblock_ allchars[]={
{9115, 25, &rule6},
{9140, 40, &rule13},
{9180, 6, &rule6},
- {9186, 18, &rule13},
+ {9186, 25, &rule13},
{9216, 39, &rule13},
{9280, 11, &rule13},
{9312, 60, &rule17},
{9372, 26, &rule13},
- {9398, 26, &rule148},
- {9424, 26, &rule149},
+ {9398, 26, &rule156},
+ {9424, 26, &rule157},
{9450, 22, &rule17},
{9472, 183, &rule13},
{9655, 1, &rule6},
@@ -2040,8 +2093,7 @@ static const struct _charblock_ allchars[]={
{9720, 8, &rule6},
{9728, 111, &rule13},
{9839, 1, &rule6},
- {9840, 144, &rule13},
- {9985, 103, &rule13},
+ {9840, 248, &rule13},
{10088, 1, &rule4},
{10089, 1, &rule5},
{10090, 1, &rule4},
@@ -2061,9 +2113,7 @@ static const struct _charblock_ allchars[]={
{10176, 5, &rule6},
{10181, 1, &rule4},
{10182, 1, &rule5},
- {10183, 4, &rule6},
- {10188, 1, &rule6},
- {10190, 24, &rule6},
+ {10183, 31, &rule6},
{10214, 1, &rule4},
{10215, 1, &rule5},
{10216, 1, &rule4},
@@ -2112,160 +2162,168 @@ static const struct _charblock_ allchars[]={
{11056, 21, &rule6},
{11077, 2, &rule13},
{11079, 6, &rule6},
- {11088, 10, &rule13},
- {11264, 47, &rule112},
- {11312, 47, &rule113},
- {11360, 1, &rule21},
- {11361, 1, &rule22},
- {11362, 1, &rule150},
- {11363, 1, &rule151},
- {11364, 1, &rule152},
- {11365, 1, &rule153},
- {11366, 1, &rule154},
- {11367, 1, &rule21},
- {11368, 1, &rule22},
- {11369, 1, &rule21},
- {11370, 1, &rule22},
- {11371, 1, &rule21},
- {11372, 1, &rule22},
- {11373, 1, &rule155},
- {11374, 1, &rule156},
- {11375, 1, &rule157},
- {11376, 1, &rule158},
- {11377, 1, &rule14},
- {11378, 1, &rule21},
- {11379, 1, &rule22},
- {11380, 1, &rule14},
- {11381, 1, &rule21},
- {11382, 1, &rule22},
- {11383, 6, &rule14},
- {11389, 1, &rule83},
- {11390, 2, &rule159},
- {11392, 1, &rule21},
- {11393, 1, &rule22},
- {11394, 1, &rule21},
- {11395, 1, &rule22},
- {11396, 1, &rule21},
- {11397, 1, &rule22},
- {11398, 1, &rule21},
- {11399, 1, &rule22},
- {11400, 1, &rule21},
- {11401, 1, &rule22},
- {11402, 1, &rule21},
- {11403, 1, &rule22},
- {11404, 1, &rule21},
- {11405, 1, &rule22},
- {11406, 1, &rule21},
- {11407, 1, &rule22},
- {11408, 1, &rule21},
- {11409, 1, &rule22},
- {11410, 1, &rule21},
- {11411, 1, &rule22},
- {11412, 1, &rule21},
- {11413, 1, &rule22},
- {11414, 1, &rule21},
- {11415, 1, &rule22},
- {11416, 1, &rule21},
- {11417, 1, &rule22},
- {11418, 1, &rule21},
- {11419, 1, &rule22},
- {11420, 1, &rule21},
- {11421, 1, &rule22},
- {11422, 1, &rule21},
- {11423, 1, &rule22},
- {11424, 1, &rule21},
- {11425, 1, &rule22},
- {11426, 1, &rule21},
- {11427, 1, &rule22},
- {11428, 1, &rule21},
- {11429, 1, &rule22},
- {11430, 1, &rule21},
- {11431, 1, &rule22},
- {11432, 1, &rule21},
- {11433, 1, &rule22},
- {11434, 1, &rule21},
- {11435, 1, &rule22},
- {11436, 1, &rule21},
- {11437, 1, &rule22},
- {11438, 1, &rule21},
- {11439, 1, &rule22},
- {11440, 1, &rule21},
- {11441, 1, &rule22},
- {11442, 1, &rule21},
- {11443, 1, &rule22},
- {11444, 1, &rule21},
- {11445, 1, &rule22},
- {11446, 1, &rule21},
- {11447, 1, &rule22},
- {11448, 1, &rule21},
- {11449, 1, &rule22},
- {11450, 1, &rule21},
- {11451, 1, &rule22},
- {11452, 1, &rule21},
- {11453, 1, &rule22},
- {11454, 1, &rule21},
- {11455, 1, &rule22},
- {11456, 1, &rule21},
- {11457, 1, &rule22},
- {11458, 1, &rule21},
- {11459, 1, &rule22},
- {11460, 1, &rule21},
- {11461, 1, &rule22},
- {11462, 1, &rule21},
- {11463, 1, &rule22},
- {11464, 1, &rule21},
- {11465, 1, &rule22},
- {11466, 1, &rule21},
- {11467, 1, &rule22},
- {11468, 1, &rule21},
- {11469, 1, &rule22},
- {11470, 1, &rule21},
- {11471, 1, &rule22},
- {11472, 1, &rule21},
- {11473, 1, &rule22},
- {11474, 1, &rule21},
- {11475, 1, &rule22},
- {11476, 1, &rule21},
- {11477, 1, &rule22},
- {11478, 1, &rule21},
- {11479, 1, &rule22},
- {11480, 1, &rule21},
- {11481, 1, &rule22},
- {11482, 1, &rule21},
- {11483, 1, &rule22},
- {11484, 1, &rule21},
- {11485, 1, &rule22},
- {11486, 1, &rule21},
- {11487, 1, &rule22},
- {11488, 1, &rule21},
- {11489, 1, &rule22},
- {11490, 1, &rule21},
- {11491, 1, &rule22},
- {11492, 1, &rule14},
+ {11085, 39, &rule13},
+ {11126, 32, &rule13},
+ {11160, 34, &rule13},
+ {11197, 12, &rule13},
+ {11210, 8, &rule13},
+ {11264, 47, &rule120},
+ {11312, 47, &rule121},
+ {11360, 1, &rule22},
+ {11361, 1, &rule23},
+ {11362, 1, &rule158},
+ {11363, 1, &rule159},
+ {11364, 1, &rule160},
+ {11365, 1, &rule161},
+ {11366, 1, &rule162},
+ {11367, 1, &rule22},
+ {11368, 1, &rule23},
+ {11369, 1, &rule22},
+ {11370, 1, &rule23},
+ {11371, 1, &rule22},
+ {11372, 1, &rule23},
+ {11373, 1, &rule163},
+ {11374, 1, &rule164},
+ {11375, 1, &rule165},
+ {11376, 1, &rule166},
+ {11377, 1, &rule20},
+ {11378, 1, &rule22},
+ {11379, 1, &rule23},
+ {11380, 1, &rule20},
+ {11381, 1, &rule22},
+ {11382, 1, &rule23},
+ {11383, 5, &rule20},
+ {11388, 2, &rule89},
+ {11390, 2, &rule167},
+ {11392, 1, &rule22},
+ {11393, 1, &rule23},
+ {11394, 1, &rule22},
+ {11395, 1, &rule23},
+ {11396, 1, &rule22},
+ {11397, 1, &rule23},
+ {11398, 1, &rule22},
+ {11399, 1, &rule23},
+ {11400, 1, &rule22},
+ {11401, 1, &rule23},
+ {11402, 1, &rule22},
+ {11403, 1, &rule23},
+ {11404, 1, &rule22},
+ {11405, 1, &rule23},
+ {11406, 1, &rule22},
+ {11407, 1, &rule23},
+ {11408, 1, &rule22},
+ {11409, 1, &rule23},
+ {11410, 1, &rule22},
+ {11411, 1, &rule23},
+ {11412, 1, &rule22},
+ {11413, 1, &rule23},
+ {11414, 1, &rule22},
+ {11415, 1, &rule23},
+ {11416, 1, &rule22},
+ {11417, 1, &rule23},
+ {11418, 1, &rule22},
+ {11419, 1, &rule23},
+ {11420, 1, &rule22},
+ {11421, 1, &rule23},
+ {11422, 1, &rule22},
+ {11423, 1, &rule23},
+ {11424, 1, &rule22},
+ {11425, 1, &rule23},
+ {11426, 1, &rule22},
+ {11427, 1, &rule23},
+ {11428, 1, &rule22},
+ {11429, 1, &rule23},
+ {11430, 1, &rule22},
+ {11431, 1, &rule23},
+ {11432, 1, &rule22},
+ {11433, 1, &rule23},
+ {11434, 1, &rule22},
+ {11435, 1, &rule23},
+ {11436, 1, &rule22},
+ {11437, 1, &rule23},
+ {11438, 1, &rule22},
+ {11439, 1, &rule23},
+ {11440, 1, &rule22},
+ {11441, 1, &rule23},
+ {11442, 1, &rule22},
+ {11443, 1, &rule23},
+ {11444, 1, &rule22},
+ {11445, 1, &rule23},
+ {11446, 1, &rule22},
+ {11447, 1, &rule23},
+ {11448, 1, &rule22},
+ {11449, 1, &rule23},
+ {11450, 1, &rule22},
+ {11451, 1, &rule23},
+ {11452, 1, &rule22},
+ {11453, 1, &rule23},
+ {11454, 1, &rule22},
+ {11455, 1, &rule23},
+ {11456, 1, &rule22},
+ {11457, 1, &rule23},
+ {11458, 1, &rule22},
+ {11459, 1, &rule23},
+ {11460, 1, &rule22},
+ {11461, 1, &rule23},
+ {11462, 1, &rule22},
+ {11463, 1, &rule23},
+ {11464, 1, &rule22},
+ {11465, 1, &rule23},
+ {11466, 1, &rule22},
+ {11467, 1, &rule23},
+ {11468, 1, &rule22},
+ {11469, 1, &rule23},
+ {11470, 1, &rule22},
+ {11471, 1, &rule23},
+ {11472, 1, &rule22},
+ {11473, 1, &rule23},
+ {11474, 1, &rule22},
+ {11475, 1, &rule23},
+ {11476, 1, &rule22},
+ {11477, 1, &rule23},
+ {11478, 1, &rule22},
+ {11479, 1, &rule23},
+ {11480, 1, &rule22},
+ {11481, 1, &rule23},
+ {11482, 1, &rule22},
+ {11483, 1, &rule23},
+ {11484, 1, &rule22},
+ {11485, 1, &rule23},
+ {11486, 1, &rule22},
+ {11487, 1, &rule23},
+ {11488, 1, &rule22},
+ {11489, 1, &rule23},
+ {11490, 1, &rule22},
+ {11491, 1, &rule23},
+ {11492, 1, &rule20},
{11493, 6, &rule13},
- {11499, 1, &rule21},
- {11500, 1, &rule22},
- {11501, 1, &rule21},
- {11502, 1, &rule22},
- {11503, 3, &rule84},
+ {11499, 1, &rule22},
+ {11500, 1, &rule23},
+ {11501, 1, &rule22},
+ {11502, 1, &rule23},
+ {11503, 3, &rule90},
+ {11506, 1, &rule22},
+ {11507, 1, &rule23},
{11513, 4, &rule2},
{11517, 1, &rule17},
{11518, 2, &rule2},
- {11520, 38, &rule160},
- {11568, 54, &rule45},
- {11631, 1, &rule83},
+ {11520, 38, &rule168},
+ {11559, 1, &rule168},
+ {11565, 1, &rule168},
+ {11568, 56, &rule14},
+ {11631, 1, &rule89},
{11632, 1, &rule2},
- {11647, 1, &rule84},
- {11648, 23, &rule45},
- {11680, 7, &rule45},
- {11688, 7, &rule45},
- {11696, 7, &rule45},
- {11704, 7, &rule45},
- {11712, 7, &rule45},
- {11720, 7, &rule45},
- {11728, 7, &rule45},
- {11736, 7, &rule45},
- {11744, 32, &rule84},
+ {11647, 1, &rule90},
+ {11648, 23, &rule14},
+ {11680, 7, &rule14},
+ {11688, 7, &rule14},
+ {11696, 7, &rule14},
+ {11704, 7, &rule14},
+ {11712, 7, &rule14},
+ {11720, 7, &rule14},
+ {11728, 7, &rule14},
+ {11736, 7, &rule14},
+ {11744, 32, &rule90},
{11776, 2, &rule2},
{11778, 1, &rule15},
{11779, 1, &rule19},
@@ -2296,8 +2354,13 @@ static const struct _charblock_ allchars[]={
{11816, 1, &rule4},
{11817, 1, &rule5},
{11818, 5, &rule2},
- {11823, 1, &rule83},
- {11824, 2, &rule2},
+ {11823, 1, &rule89},
+ {11824, 10, &rule2},
+ {11834, 2, &rule7},
+ {11836, 4, &rule2},
+ {11840, 1, &rule7},
+ {11841, 1, &rule2},
+ {11842, 1, &rule4},
{11904, 26, &rule13},
{11931, 89, &rule13},
{12032, 214, &rule13},
@@ -2305,9 +2368,9 @@ static const struct _charblock_ allchars[]={
{12288, 1, &rule1},
{12289, 3, &rule2},
{12292, 1, &rule13},
- {12293, 1, &rule83},
- {12294, 1, &rule45},
- {12295, 1, &rule116},
+ {12293, 1, &rule89},
+ {12294, 1, &rule14},
+ {12295, 1, &rule124},
{12296, 1, &rule4},
{12297, 1, &rule5},
{12298, 1, &rule4},
@@ -2331,37 +2394,40 @@ static const struct _charblock_ allchars[]={
{12317, 1, &rule4},
{12318, 2, &rule5},
{12320, 1, &rule13},
- {12321, 9, &rule116},
- {12330, 6, &rule84},
+ {12321, 9, &rule124},
+ {12330, 4, &rule90},
+ {12334, 2, &rule122},
{12336, 1, &rule7},
- {12337, 5, &rule83},
+ {12337, 5, &rule89},
{12342, 2, &rule13},
- {12344, 3, &rule116},
- {12347, 1, &rule83},
- {12348, 1, &rule45},
+ {12344, 3, &rule124},
+ {12347, 1, &rule89},
+ {12348, 1, &rule14},
{12349, 1, &rule2},
{12350, 2, &rule13},
- {12353, 86, &rule45},
- {12441, 2, &rule84},
+ {12353, 86, &rule14},
+ {12441, 2, &rule90},
{12443, 2, &rule10},
- {12445, 2, &rule83},
- {12447, 1, &rule45},
+ {12445, 2, &rule89},
+ {12447, 1, &rule14},
{12448, 1, &rule7},
- {12449, 90, &rule45},
+ {12449, 90, &rule14},
{12539, 1, &rule2},
- {12540, 3, &rule83},
- {12543, 1, &rule45},
- {12549, 41, &rule45},
- {12593, 94, &rule45},
+ {12540, 3, &rule89},
+ {12543, 1, &rule14},
+ {12549, 41, &rule14},
+ {12593, 94, &rule14},
{12688, 2, &rule13},
{12690, 4, &rule17},
{12694, 10, &rule13},
- {12704, 27, &rule45},
+ {12704, 27, &rule14},
{12736, 36, &rule13},
- {12784, 16, &rule45},
+ {12784, 16, &rule14},
{12800, 31, &rule13},
{12832, 10, &rule17},
- {12842, 39, &rule13},
+ {12842, 30, &rule13},
+ {12872, 8, &rule17},
+ {12880, 1, &rule13},
{12881, 15, &rule17},
{12896, 32, &rule13},
{12928, 10, &rule17},
@@ -2369,353 +2435,400 @@ static const struct _charblock_ allchars[]={
{12977, 15, &rule17},
{12992, 63, &rule13},
{13056, 256, &rule13},
- {13312, 6582, &rule45},
+ {13312, 6582, &rule14},
{19904, 64, &rule13},
- {19968, 20940, &rule45},
- {40960, 21, &rule45},
- {40981, 1, &rule83},
- {40982, 1143, &rule45},
+ {19968, 20941, &rule14},
+ {40960, 21, &rule14},
+ {40981, 1, &rule89},
+ {40982, 1143, &rule14},
{42128, 55, &rule13},
- {42192, 40, &rule45},
- {42232, 6, &rule83},
+ {42192, 40, &rule14},
+ {42232, 6, &rule89},
{42238, 2, &rule2},
- {42240, 268, &rule45},
- {42508, 1, &rule83},
+ {42240, 268, &rule14},
+ {42508, 1, &rule89},
{42509, 3, &rule2},
- {42512, 16, &rule45},
+ {42512, 16, &rule14},
{42528, 10, &rule8},
- {42538, 2, &rule45},
- {42560, 1, &rule21},
- {42561, 1, &rule22},
- {42562, 1, &rule21},
- {42563, 1, &rule22},
- {42564, 1, &rule21},
- {42565, 1, &rule22},
- {42566, 1, &rule21},
- {42567, 1, &rule22},
- {42568, 1, &rule21},
- {42569, 1, &rule22},
- {42570, 1, &rule21},
- {42571, 1, &rule22},
- {42572, 1, &rule21},
- {42573, 1, &rule22},
- {42574, 1, &rule21},
- {42575, 1, &rule22},
- {42576, 1, &rule21},
- {42577, 1, &rule22},
- {42578, 1, &rule21},
- {42579, 1, &rule22},
- {42580, 1, &rule21},
- {42581, 1, &rule22},
- {42582, 1, &rule21},
- {42583, 1, &rule22},
- {42584, 1, &rule21},
- {42585, 1, &rule22},
- {42586, 1, &rule21},
- {42587, 1, &rule22},
- {42588, 1, &rule21},
- {42589, 1, &rule22},
- {42590, 1, &rule21},
- {42591, 1, &rule22},
- {42592, 1, &rule21},
- {42593, 1, &rule22},
- {42594, 1, &rule21},
- {42595, 1, &rule22},
- {42596, 1, &rule21},
- {42597, 1, &rule22},
- {42598, 1, &rule21},
- {42599, 1, &rule22},
- {42600, 1, &rule21},
- {42601, 1, &rule22},
- {42602, 1, &rule21},
- {42603, 1, &rule22},
- {42604, 1, &rule21},
- {42605, 1, &rule22},
- {42606, 1, &rule45},
- {42607, 1, &rule84},
- {42608, 3, &rule109},
+ {42538, 2, &rule14},
+ {42560, 1, &rule22},
+ {42561, 1, &rule23},
+ {42562, 1, &rule22},
+ {42563, 1, &rule23},
+ {42564, 1, &rule22},
+ {42565, 1, &rule23},
+ {42566, 1, &rule22},
+ {42567, 1, &rule23},
+ {42568, 1, &rule22},
+ {42569, 1, &rule23},
+ {42570, 1, &rule22},
+ {42571, 1, &rule23},
+ {42572, 1, &rule22},
+ {42573, 1, &rule23},
+ {42574, 1, &rule22},
+ {42575, 1, &rule23},
+ {42576, 1, &rule22},
+ {42577, 1, &rule23},
+ {42578, 1, &rule22},
+ {42579, 1, &rule23},
+ {42580, 1, &rule22},
+ {42581, 1, &rule23},
+ {42582, 1, &rule22},
+ {42583, 1, &rule23},
+ {42584, 1, &rule22},
+ {42585, 1, &rule23},
+ {42586, 1, &rule22},
+ {42587, 1, &rule23},
+ {42588, 1, &rule22},
+ {42589, 1, &rule23},
+ {42590, 1, &rule22},
+ {42591, 1, &rule23},
+ {42592, 1, &rule22},
+ {42593, 1, &rule23},
+ {42594, 1, &rule22},
+ {42595, 1, &rule23},
+ {42596, 1, &rule22},
+ {42597, 1, &rule23},
+ {42598, 1, &rule22},
+ {42599, 1, &rule23},
+ {42600, 1, &rule22},
+ {42601, 1, &rule23},
+ {42602, 1, &rule22},
+ {42603, 1, &rule23},
+ {42604, 1, &rule22},
+ {42605, 1, &rule23},
+ {42606, 1, &rule14},
+ {42607, 1, &rule90},
+ {42608, 3, &rule117},
{42611, 1, &rule2},
- {42620, 2, &rule84},
+ {42612, 10, &rule90},
{42622, 1, &rule2},
- {42623, 1, &rule83},
- {42624, 1, &rule21},
- {42625, 1, &rule22},
- {42626, 1, &rule21},
- {42627, 1, &rule22},
- {42628, 1, &rule21},
- {42629, 1, &rule22},
- {42630, 1, &rule21},
- {42631, 1, &rule22},
- {42632, 1, &rule21},
- {42633, 1, &rule22},
- {42634, 1, &rule21},
- {42635, 1, &rule22},
- {42636, 1, &rule21},
- {42637, 1, &rule22},
- {42638, 1, &rule21},
- {42639, 1, &rule22},
- {42640, 1, &rule21},
- {42641, 1, &rule22},
- {42642, 1, &rule21},
- {42643, 1, &rule22},
- {42644, 1, &rule21},
- {42645, 1, &rule22},
- {42646, 1, &rule21},
- {42647, 1, &rule22},
- {42656, 70, &rule45},
- {42726, 10, &rule116},
- {42736, 2, &rule84},
+ {42623, 1, &rule89},
+ {42624, 1, &rule22},
+ {42625, 1, &rule23},
+ {42626, 1, &rule22},
+ {42627, 1, &rule23},
+ {42628, 1, &rule22},
+ {42629, 1, &rule23},
+ {42630, 1, &rule22},
+ {42631, 1, &rule23},
+ {42632, 1, &rule22},
+ {42633, 1, &rule23},
+ {42634, 1, &rule22},
+ {42635, 1, &rule23},
+ {42636, 1, &rule22},
+ {42637, 1, &rule23},
+ {42638, 1, &rule22},
+ {42639, 1, &rule23},
+ {42640, 1, &rule22},
+ {42641, 1, &rule23},
+ {42642, 1, &rule22},
+ {42643, 1, &rule23},
+ {42644, 1, &rule22},
+ {42645, 1, &rule23},
+ {42646, 1, &rule22},
+ {42647, 1, &rule23},
+ {42648, 1, &rule22},
+ {42649, 1, &rule23},
+ {42650, 1, &rule22},
+ {42651, 1, &rule23},
+ {42652, 2, &rule89},
+ {42655, 1, &rule90},
+ {42656, 70, &rule14},
+ {42726, 10, &rule124},
+ {42736, 2, &rule90},
{42738, 6, &rule2},
{42752, 23, &rule10},
- {42775, 9, &rule83},
+ {42775, 9, &rule89},
{42784, 2, &rule10},
- {42786, 1, &rule21},
- {42787, 1, &rule22},
- {42788, 1, &rule21},
- {42789, 1, &rule22},
- {42790, 1, &rule21},
- {42791, 1, &rule22},
- {42792, 1, &rule21},
- {42793, 1, &rule22},
- {42794, 1, &rule21},
- {42795, 1, &rule22},
- {42796, 1, &rule21},
- {42797, 1, &rule22},
- {42798, 1, &rule21},
- {42799, 1, &rule22},
- {42800, 2, &rule14},
- {42802, 1, &rule21},
- {42803, 1, &rule22},
- {42804, 1, &rule21},
- {42805, 1, &rule22},
- {42806, 1, &rule21},
- {42807, 1, &rule22},
- {42808, 1, &rule21},
- {42809, 1, &rule22},
- {42810, 1, &rule21},
- {42811, 1, &rule22},
- {42812, 1, &rule21},
- {42813, 1, &rule22},
- {42814, 1, &rule21},
- {42815, 1, &rule22},
- {42816, 1, &rule21},
- {42817, 1, &rule22},
- {42818, 1, &rule21},
- {42819, 1, &rule22},
- {42820, 1, &rule21},
- {42821, 1, &rule22},
- {42822, 1, &rule21},
- {42823, 1, &rule22},
- {42824, 1, &rule21},
- {42825, 1, &rule22},
- {42826, 1, &rule21},
- {42827, 1, &rule22},
- {42828, 1, &rule21},
- {42829, 1, &rule22},
- {42830, 1, &rule21},
- {42831, 1, &rule22},
- {42832, 1, &rule21},
- {42833, 1, &rule22},
- {42834, 1, &rule21},
- {42835, 1, &rule22},
- {42836, 1, &rule21},
- {42837, 1, &rule22},
- {42838, 1, &rule21},
- {42839, 1, &rule22},
- {42840, 1, &rule21},
- {42841, 1, &rule22},
- {42842, 1, &rule21},
- {42843, 1, &rule22},
- {42844, 1, &rule21},
- {42845, 1, &rule22},
- {42846, 1, &rule21},
- {42847, 1, &rule22},
- {42848, 1, &rule21},
- {42849, 1, &rule22},
- {42850, 1, &rule21},
- {42851, 1, &rule22},
- {42852, 1, &rule21},
- {42853, 1, &rule22},
- {42854, 1, &rule21},
- {42855, 1, &rule22},
- {42856, 1, &rule21},
- {42857, 1, &rule22},
- {42858, 1, &rule21},
- {42859, 1, &rule22},
- {42860, 1, &rule21},
- {42861, 1, &rule22},
- {42862, 1, &rule21},
- {42863, 1, &rule22},
- {42864, 1, &rule83},
- {42865, 8, &rule14},
- {42873, 1, &rule21},
- {42874, 1, &rule22},
- {42875, 1, &rule21},
- {42876, 1, &rule22},
- {42877, 1, &rule161},
- {42878, 1, &rule21},
- {42879, 1, &rule22},
- {42880, 1, &rule21},
- {42881, 1, &rule22},
- {42882, 1, &rule21},
- {42883, 1, &rule22},
- {42884, 1, &rule21},
- {42885, 1, &rule22},
- {42886, 1, &rule21},
- {42887, 1, &rule22},
- {42888, 1, &rule83},
+ {42786, 1, &rule22},
+ {42787, 1, &rule23},
+ {42788, 1, &rule22},
+ {42789, 1, &rule23},
+ {42790, 1, &rule22},
+ {42791, 1, &rule23},
+ {42792, 1, &rule22},
+ {42793, 1, &rule23},
+ {42794, 1, &rule22},
+ {42795, 1, &rule23},
+ {42796, 1, &rule22},
+ {42797, 1, &rule23},
+ {42798, 1, &rule22},
+ {42799, 1, &rule23},
+ {42800, 2, &rule20},
+ {42802, 1, &rule22},
+ {42803, 1, &rule23},
+ {42804, 1, &rule22},
+ {42805, 1, &rule23},
+ {42806, 1, &rule22},
+ {42807, 1, &rule23},
+ {42808, 1, &rule22},
+ {42809, 1, &rule23},
+ {42810, 1, &rule22},
+ {42811, 1, &rule23},
+ {42812, 1, &rule22},
+ {42813, 1, &rule23},
+ {42814, 1, &rule22},
+ {42815, 1, &rule23},
+ {42816, 1, &rule22},
+ {42817, 1, &rule23},
+ {42818, 1, &rule22},
+ {42819, 1, &rule23},
+ {42820, 1, &rule22},
+ {42821, 1, &rule23},
+ {42822, 1, &rule22},
+ {42823, 1, &rule23},
+ {42824, 1, &rule22},
+ {42825, 1, &rule23},
+ {42826, 1, &rule22},
+ {42827, 1, &rule23},
+ {42828, 1, &rule22},
+ {42829, 1, &rule23},
+ {42830, 1, &rule22},
+ {42831, 1, &rule23},
+ {42832, 1, &rule22},
+ {42833, 1, &rule23},
+ {42834, 1, &rule22},
+ {42835, 1, &rule23},
+ {42836, 1, &rule22},
+ {42837, 1, &rule23},
+ {42838, 1, &rule22},
+ {42839, 1, &rule23},
+ {42840, 1, &rule22},
+ {42841, 1, &rule23},
+ {42842, 1, &rule22},
+ {42843, 1, &rule23},
+ {42844, 1, &rule22},
+ {42845, 1, &rule23},
+ {42846, 1, &rule22},
+ {42847, 1, &rule23},
+ {42848, 1, &rule22},
+ {42849, 1, &rule23},
+ {42850, 1, &rule22},
+ {42851, 1, &rule23},
+ {42852, 1, &rule22},
+ {42853, 1, &rule23},
+ {42854, 1, &rule22},
+ {42855, 1, &rule23},
+ {42856, 1, &rule22},
+ {42857, 1, &rule23},
+ {42858, 1, &rule22},
+ {42859, 1, &rule23},
+ {42860, 1, &rule22},
+ {42861, 1, &rule23},
+ {42862, 1, &rule22},
+ {42863, 1, &rule23},
+ {42864, 1, &rule89},
+ {42865, 8, &rule20},
+ {42873, 1, &rule22},
+ {42874, 1, &rule23},
+ {42875, 1, &rule22},
+ {42876, 1, &rule23},
+ {42877, 1, &rule169},
+ {42878, 1, &rule22},
+ {42879, 1, &rule23},
+ {42880, 1, &rule22},
+ {42881, 1, &rule23},
+ {42882, 1, &rule22},
+ {42883, 1, &rule23},
+ {42884, 1, &rule22},
+ {42885, 1, &rule23},
+ {42886, 1, &rule22},
+ {42887, 1, &rule23},
+ {42888, 1, &rule89},
{42889, 2, &rule10},
- {42891, 1, &rule21},
- {42892, 1, &rule22},
- {42893, 1, &rule162},
- {42894, 1, &rule14},
- {42896, 1, &rule21},
- {42897, 1, &rule22},
- {42912, 1, &rule21},
- {42913, 1, &rule22},
- {42914, 1, &rule21},
- {42915, 1, &rule22},
- {42916, 1, &rule21},
- {42917, 1, &rule22},
- {42918, 1, &rule21},
- {42919, 1, &rule22},
- {42920, 1, &rule21},
- {42921, 1, &rule22},
- {43002, 1, &rule14},
- {43003, 7, &rule45},
- {43010, 1, &rule84},
- {43011, 3, &rule45},
- {43014, 1, &rule84},
- {43015, 4, &rule45},
- {43019, 1, &rule84},
- {43020, 23, &rule45},
- {43043, 2, &rule114},
- {43045, 2, &rule84},
- {43047, 1, &rule114},
+ {42891, 1, &rule22},
+ {42892, 1, &rule23},
+ {42893, 1, &rule170},
+ {42894, 1, &rule20},
+ {42896, 1, &rule22},
+ {42897, 1, &rule23},
+ {42898, 1, &rule22},
+ {42899, 1, &rule23},
+ {42900, 2, &rule20},
+ {42902, 1, &rule22},
+ {42903, 1, &rule23},
+ {42904, 1, &rule22},
+ {42905, 1, &rule23},
+ {42906, 1, &rule22},
+ {42907, 1, &rule23},
+ {42908, 1, &rule22},
+ {42909, 1, &rule23},
+ {42910, 1, &rule22},
+ {42911, 1, &rule23},
+ {42912, 1, &rule22},
+ {42913, 1, &rule23},
+ {42914, 1, &rule22},
+ {42915, 1, &rule23},
+ {42916, 1, &rule22},
+ {42917, 1, &rule23},
+ {42918, 1, &rule22},
+ {42919, 1, &rule23},
+ {42920, 1, &rule22},
+ {42921, 1, &rule23},
+ {42922, 1, &rule171},
+ {42923, 1, &rule172},
+ {42924, 1, &rule173},
+ {42925, 1, &rule174},
+ {42928, 1, &rule175},
+ {42929, 1, &rule176},
+ {42999, 1, &rule14},
+ {43000, 2, &rule89},
+ {43002, 1, &rule20},
+ {43003, 7, &rule14},
+ {43010, 1, &rule90},
+ {43011, 3, &rule14},
+ {43014, 1, &rule90},
+ {43015, 4, &rule14},
+ {43019, 1, &rule90},
+ {43020, 23, &rule14},
+ {43043, 2, &rule122},
+ {43045, 2, &rule90},
+ {43047, 1, &rule122},
{43048, 4, &rule13},
{43056, 6, &rule17},
{43062, 2, &rule13},
{43064, 1, &rule3},
{43065, 1, &rule13},
- {43072, 52, &rule45},
+ {43072, 52, &rule14},
{43124, 4, &rule2},
- {43136, 2, &rule114},
- {43138, 50, &rule45},
- {43188, 16, &rule114},
- {43204, 1, &rule84},
+ {43136, 2, &rule122},
+ {43138, 50, &rule14},
+ {43188, 16, &rule122},
+ {43204, 1, &rule90},
{43214, 2, &rule2},
{43216, 10, &rule8},
- {43232, 18, &rule84},
- {43250, 6, &rule45},
+ {43232, 18, &rule90},
+ {43250, 6, &rule14},
{43256, 3, &rule2},
- {43259, 1, &rule45},
+ {43259, 1, &rule14},
{43264, 10, &rule8},
- {43274, 28, &rule45},
- {43302, 8, &rule84},
+ {43274, 28, &rule14},
+ {43302, 8, &rule90},
{43310, 2, &rule2},
- {43312, 23, &rule45},
- {43335, 11, &rule84},
- {43346, 2, &rule114},
+ {43312, 23, &rule14},
+ {43335, 11, &rule90},
+ {43346, 2, &rule122},
{43359, 1, &rule2},
- {43360, 29, &rule45},
- {43392, 3, &rule84},
- {43395, 1, &rule114},
- {43396, 47, &rule45},
- {43443, 1, &rule84},
- {43444, 2, &rule114},
- {43446, 4, &rule84},
- {43450, 2, &rule114},
- {43452, 1, &rule84},
- {43453, 4, &rule114},
+ {43360, 29, &rule14},
+ {43392, 3, &rule90},
+ {43395, 1, &rule122},
+ {43396, 47, &rule14},
+ {43443, 1, &rule90},
+ {43444, 2, &rule122},
+ {43446, 4, &rule90},
+ {43450, 2, &rule122},
+ {43452, 1, &rule90},
+ {43453, 4, &rule122},
{43457, 13, &rule2},
- {43471, 1, &rule83},
+ {43471, 1, &rule89},
{43472, 10, &rule8},
{43486, 2, &rule2},
- {43520, 41, &rule45},
- {43561, 6, &rule84},
- {43567, 2, &rule114},
- {43569, 2, &rule84},
- {43571, 2, &rule114},
- {43573, 2, &rule84},
- {43584, 3, &rule45},
- {43587, 1, &rule84},
- {43588, 8, &rule45},
- {43596, 1, &rule84},
- {43597, 1, &rule114},
+ {43488, 5, &rule14},
+ {43493, 1, &rule90},
+ {43494, 1, &rule89},
+ {43495, 9, &rule14},
+ {43504, 10, &rule8},
+ {43514, 5, &rule14},
+ {43520, 41, &rule14},
+ {43561, 6, &rule90},
+ {43567, 2, &rule122},
+ {43569, 2, &rule90},
+ {43571, 2, &rule122},
+ {43573, 2, &rule90},
+ {43584, 3, &rule14},
+ {43587, 1, &rule90},
+ {43588, 8, &rule14},
+ {43596, 1, &rule90},
+ {43597, 1, &rule122},
{43600, 10, &rule8},
{43612, 4, &rule2},
- {43616, 16, &rule45},
- {43632, 1, &rule83},
- {43633, 6, &rule45},
+ {43616, 16, &rule14},
+ {43632, 1, &rule89},
+ {43633, 6, &rule14},
{43639, 3, &rule13},
- {43642, 1, &rule45},
- {43643, 1, &rule114},
- {43648, 48, &rule45},
- {43696, 1, &rule84},
- {43697, 1, &rule45},
- {43698, 3, &rule84},
- {43701, 2, &rule45},
- {43703, 2, &rule84},
- {43705, 5, &rule45},
- {43710, 2, &rule84},
- {43712, 1, &rule45},
- {43713, 1, &rule84},
- {43714, 1, &rule45},
- {43739, 2, &rule45},
- {43741, 1, &rule83},
+ {43642, 1, &rule14},
+ {43643, 1, &rule122},
+ {43644, 1, &rule90},
+ {43645, 1, &rule122},
+ {43646, 50, &rule14},
+ {43696, 1, &rule90},
+ {43697, 1, &rule14},
+ {43698, 3, &rule90},
+ {43701, 2, &rule14},
+ {43703, 2, &rule90},
+ {43705, 5, &rule14},
+ {43710, 2, &rule90},
+ {43712, 1, &rule14},
+ {43713, 1, &rule90},
+ {43714, 1, &rule14},
+ {43739, 2, &rule14},
+ {43741, 1, &rule89},
{43742, 2, &rule2},
- {43777, 6, &rule45},
- {43785, 6, &rule45},
- {43793, 6, &rule45},
- {43808, 7, &rule45},
- {43816, 7, &rule45},
- {43968, 35, &rule45},
- {44003, 2, &rule114},
- {44005, 1, &rule84},
- {44006, 2, &rule114},
- {44008, 1, &rule84},
- {44009, 2, &rule114},
+ {43744, 11, &rule14},
+ {43755, 1, &rule122},
+ {43756, 2, &rule90},
+ {43758, 2, &rule122},
+ {43760, 2, &rule2},
+ {43762, 1, &rule14},
+ {43763, 2, &rule89},
+ {43765, 1, &rule122},
+ {43766, 1, &rule90},
+ {43777, 6, &rule14},
+ {43785, 6, &rule14},
+ {43793, 6, &rule14},
+ {43808, 7, &rule14},
+ {43816, 7, &rule14},
+ {43824, 43, &rule20},
+ {43867, 1, &rule10},
+ {43868, 4, &rule89},
+ {43876, 2, &rule20},
+ {43968, 35, &rule14},
+ {44003, 2, &rule122},
+ {44005, 1, &rule90},
+ {44006, 2, &rule122},
+ {44008, 1, &rule90},
+ {44009, 2, &rule122},
{44011, 1, &rule2},
- {44012, 1, &rule114},
- {44013, 1, &rule84},
+ {44012, 1, &rule122},
+ {44013, 1, &rule90},
{44016, 10, &rule8},
- {44032, 11172, &rule45},
- {55216, 23, &rule45},
- {55243, 49, &rule45},
- {55296, 896, &rule163},
- {56192, 128, &rule163},
- {56320, 1024, &rule163},
- {57344, 6400, &rule164},
- {63744, 302, &rule45},
- {64048, 62, &rule45},
- {64112, 106, &rule45},
- {64256, 7, &rule14},
- {64275, 5, &rule14},
- {64285, 1, &rule45},
- {64286, 1, &rule84},
- {64287, 10, &rule45},
+ {44032, 11172, &rule14},
+ {55216, 23, &rule14},
+ {55243, 49, &rule14},
+ {55296, 896, &rule177},
+ {56192, 128, &rule177},
+ {56320, 1024, &rule177},
+ {57344, 6400, &rule178},
+ {63744, 366, &rule14},
+ {64112, 106, &rule14},
+ {64256, 7, &rule20},
+ {64275, 5, &rule20},
+ {64285, 1, &rule14},
+ {64286, 1, &rule90},
+ {64287, 10, &rule14},
{64297, 1, &rule6},
- {64298, 13, &rule45},
- {64312, 5, &rule45},
- {64318, 1, &rule45},
- {64320, 2, &rule45},
- {64323, 2, &rule45},
- {64326, 108, &rule45},
+ {64298, 13, &rule14},
+ {64312, 5, &rule14},
+ {64318, 1, &rule14},
+ {64320, 2, &rule14},
+ {64323, 2, &rule14},
+ {64326, 108, &rule14},
{64434, 16, &rule10},
- {64467, 363, &rule45},
- {64830, 1, &rule4},
- {64831, 1, &rule5},
- {64848, 64, &rule45},
- {64914, 54, &rule45},
- {65008, 12, &rule45},
+ {64467, 363, &rule14},
+ {64830, 1, &rule5},
+ {64831, 1, &rule4},
+ {64848, 64, &rule14},
+ {64914, 54, &rule14},
+ {65008, 12, &rule14},
{65020, 1, &rule3},
{65021, 1, &rule13},
- {65024, 16, &rule84},
+ {65024, 16, &rule90},
{65040, 7, &rule2},
{65047, 1, &rule4},
{65048, 1, &rule5},
{65049, 1, &rule2},
- {65056, 7, &rule84},
+ {65056, 14, &rule90},
{65072, 1, &rule2},
{65073, 2, &rule7},
{65075, 2, &rule11},
@@ -2756,8 +2869,8 @@ static const struct _charblock_ allchars[]={
{65128, 1, &rule2},
{65129, 1, &rule3},
{65130, 2, &rule2},
- {65136, 5, &rule45},
- {65142, 135, &rule45},
+ {65136, 5, &rule14},
+ {65142, 135, &rule14},
{65279, 1, &rule16},
{65281, 3, &rule2},
{65284, 1, &rule3},
@@ -2791,15 +2904,15 @@ static const struct _charblock_ allchars[]={
{65378, 1, &rule4},
{65379, 1, &rule5},
{65380, 2, &rule2},
- {65382, 10, &rule45},
- {65392, 1, &rule83},
- {65393, 45, &rule45},
- {65438, 2, &rule83},
- {65440, 31, &rule45},
- {65474, 6, &rule45},
- {65482, 6, &rule45},
- {65490, 6, &rule45},
- {65498, 3, &rule45},
+ {65382, 10, &rule14},
+ {65392, 1, &rule89},
+ {65393, 45, &rule14},
+ {65438, 2, &rule89},
+ {65440, 31, &rule14},
+ {65474, 6, &rule14},
+ {65482, 6, &rule14},
+ {65490, 6, &rule14},
+ {65498, 3, &rule14},
{65504, 2, &rule3},
{65506, 1, &rule6},
{65507, 1, &rule10},
@@ -2810,241 +2923,433 @@ static const struct _charblock_ allchars[]={
{65517, 2, &rule13},
{65529, 3, &rule16},
{65532, 2, &rule13},
- {65536, 12, &rule45},
- {65549, 26, &rule45},
- {65576, 19, &rule45},
- {65596, 2, &rule45},
- {65599, 15, &rule45},
- {65616, 14, &rule45},
- {65664, 123, &rule45},
- {65792, 2, &rule2},
- {65794, 1, &rule13},
+ {65536, 12, &rule14},
+ {65549, 26, &rule14},
+ {65576, 19, &rule14},
+ {65596, 2, &rule14},
+ {65599, 15, &rule14},
+ {65616, 14, &rule14},
+ {65664, 123, &rule14},
+ {65792, 3, &rule2},
{65799, 45, &rule17},
{65847, 9, &rule13},
- {65856, 53, &rule116},
+ {65856, 53, &rule124},
{65909, 4, &rule17},
{65913, 17, &rule13},
- {65930, 1, &rule17},
+ {65930, 2, &rule17},
+ {65932, 1, &rule13},
{65936, 12, &rule13},
+ {65952, 1, &rule13},
{66000, 45, &rule13},
- {66045, 1, &rule84},
- {66176, 29, &rule45},
- {66208, 49, &rule45},
- {66304, 31, &rule45},
+ {66045, 1, &rule90},
+ {66176, 29, &rule14},
+ {66208, 49, &rule14},
+ {66272, 1, &rule90},
+ {66273, 27, &rule17},
+ {66304, 32, &rule14},
{66336, 4, &rule17},
- {66352, 17, &rule45},
- {66369, 1, &rule116},
- {66370, 8, &rule45},
- {66378, 1, &rule116},
- {66432, 30, &rule45},
+ {66352, 17, &rule14},
+ {66369, 1, &rule124},
+ {66370, 8, &rule14},
+ {66378, 1, &rule124},
+ {66384, 38, &rule14},
+ {66422, 5, &rule90},
+ {66432, 30, &rule14},
{66463, 1, &rule2},
- {66464, 36, &rule45},
- {66504, 8, &rule45},
+ {66464, 36, &rule14},
+ {66504, 8, &rule14},
{66512, 1, &rule2},
- {66513, 5, &rule116},
- {66560, 40, &rule165},
- {66600, 40, &rule166},
- {66640, 78, &rule45},
+ {66513, 5, &rule124},
+ {66560, 40, &rule179},
+ {66600, 40, &rule180},
+ {66640, 78, &rule14},
{66720, 10, &rule8},
- {67584, 6, &rule45},
- {67592, 1, &rule45},
- {67594, 44, &rule45},
- {67639, 2, &rule45},
- {67644, 1, &rule45},
- {67647, 23, &rule45},
+ {66816, 40, &rule14},
+ {66864, 52, &rule14},
+ {66927, 1, &rule2},
+ {67072, 311, &rule14},
+ {67392, 22, &rule14},
+ {67424, 8, &rule14},
+ {67584, 6, &rule14},
+ {67592, 1, &rule14},
+ {67594, 44, &rule14},
+ {67639, 2, &rule14},
+ {67644, 1, &rule14},
+ {67647, 23, &rule14},
{67671, 1, &rule2},
{67672, 8, &rule17},
- {67840, 22, &rule45},
+ {67680, 23, &rule14},
+ {67703, 2, &rule13},
+ {67705, 7, &rule17},
+ {67712, 31, &rule14},
+ {67751, 9, &rule17},
+ {67840, 22, &rule14},
{67862, 6, &rule17},
{67871, 1, &rule2},
- {67872, 26, &rule45},
+ {67872, 26, &rule14},
{67903, 1, &rule2},
- {68096, 1, &rule45},
- {68097, 3, &rule84},
- {68101, 2, &rule84},
- {68108, 4, &rule84},
- {68112, 4, &rule45},
- {68117, 3, &rule45},
- {68121, 27, &rule45},
- {68152, 3, &rule84},
- {68159, 1, &rule84},
+ {67968, 56, &rule14},
+ {68030, 2, &rule14},
+ {68096, 1, &rule14},
+ {68097, 3, &rule90},
+ {68101, 2, &rule90},
+ {68108, 4, &rule90},
+ {68112, 4, &rule14},
+ {68117, 3, &rule14},
+ {68121, 27, &rule14},
+ {68152, 3, &rule90},
+ {68159, 1, &rule90},
{68160, 8, &rule17},
{68176, 9, &rule2},
- {68192, 29, &rule45},
+ {68192, 29, &rule14},
{68221, 2, &rule17},
{68223, 1, &rule2},
- {68352, 54, &rule45},
+ {68224, 29, &rule14},
+ {68253, 3, &rule17},
+ {68288, 8, &rule14},
+ {68296, 1, &rule13},
+ {68297, 28, &rule14},
+ {68325, 2, &rule90},
+ {68331, 5, &rule17},
+ {68336, 7, &rule2},
+ {68352, 54, &rule14},
{68409, 7, &rule2},
- {68416, 22, &rule45},
+ {68416, 22, &rule14},
{68440, 8, &rule17},
- {68448, 19, &rule45},
+ {68448, 19, &rule14},
{68472, 8, &rule17},
- {68608, 73, &rule45},
+ {68480, 18, &rule14},
+ {68505, 4, &rule2},
+ {68521, 7, &rule17},
+ {68608, 73, &rule14},
{69216, 31, &rule17},
- {69632, 1, &rule114},
- {69633, 1, &rule84},
- {69634, 1, &rule114},
- {69635, 53, &rule45},
- {69688, 15, &rule84},
+ {69632, 1, &rule122},
+ {69633, 1, &rule90},
+ {69634, 1, &rule122},
+ {69635, 53, &rule14},
+ {69688, 15, &rule90},
{69703, 7, &rule2},
{69714, 20, &rule17},
{69734, 10, &rule8},
- {69760, 2, &rule84},
- {69762, 1, &rule114},
- {69763, 45, &rule45},
- {69808, 3, &rule114},
- {69811, 4, &rule84},
- {69815, 2, &rule114},
- {69817, 2, &rule84},
+ {69759, 3, &rule90},
+ {69762, 1, &rule122},
+ {69763, 45, &rule14},
+ {69808, 3, &rule122},
+ {69811, 4, &rule90},
+ {69815, 2, &rule122},
+ {69817, 2, &rule90},
{69819, 2, &rule2},
{69821, 1, &rule16},
{69822, 4, &rule2},
- {73728, 879, &rule45},
- {74752, 99, &rule116},
- {74864, 4, &rule2},
- {77824, 1071, &rule45},
- {92160, 569, &rule45},
- {110592, 2, &rule45},
+ {69840, 25, &rule14},
+ {69872, 10, &rule8},
+ {69888, 3, &rule90},
+ {69891, 36, &rule14},
+ {69927, 5, &rule90},
+ {69932, 1, &rule122},
+ {69933, 8, &rule90},
+ {69942, 10, &rule8},
+ {69952, 4, &rule2},
+ {69968, 35, &rule14},
+ {70003, 1, &rule90},
+ {70004, 2, &rule2},
+ {70006, 1, &rule14},
+ {70016, 2, &rule90},
+ {70018, 1, &rule122},
+ {70019, 48, &rule14},
+ {70067, 3, &rule122},
+ {70070, 9, &rule90},
+ {70079, 2, &rule122},
+ {70081, 4, &rule14},
+ {70085, 4, &rule2},
+ {70093, 1, &rule2},
+ {70096, 10, &rule8},
+ {70106, 1, &rule14},
+ {70113, 20, &rule17},
+ {70144, 18, &rule14},
+ {70163, 25, &rule14},
+ {70188, 3, &rule122},
+ {70191, 3, &rule90},
+ {70194, 2, &rule122},
+ {70196, 1, &rule90},
+ {70197, 1, &rule122},
+ {70198, 2, &rule90},
+ {70200, 6, &rule2},
+ {70320, 47, &rule14},
+ {70367, 1, &rule90},
+ {70368, 3, &rule122},
+ {70371, 8, &rule90},
+ {70384, 10, &rule8},
+ {70401, 1, &rule90},
+ {70402, 2, &rule122},
+ {70405, 8, &rule14},
+ {70415, 2, &rule14},
+ {70419, 22, &rule14},
+ {70442, 7, &rule14},
+ {70450, 2, &rule14},
+ {70453, 5, &rule14},
+ {70460, 1, &rule90},
+ {70461, 1, &rule14},
+ {70462, 2, &rule122},
+ {70464, 1, &rule90},
+ {70465, 4, &rule122},
+ {70471, 2, &rule122},
+ {70475, 3, &rule122},
+ {70487, 1, &rule122},
+ {70493, 5, &rule14},
+ {70498, 2, &rule122},
+ {70502, 7, &rule90},
+ {70512, 5, &rule90},
+ {70784, 48, &rule14},
+ {70832, 3, &rule122},
+ {70835, 6, &rule90},
+ {70841, 1, &rule122},
+ {70842, 1, &rule90},
+ {70843, 4, &rule122},
+ {70847, 2, &rule90},
+ {70849, 1, &rule122},
+ {70850, 2, &rule90},
+ {70852, 2, &rule14},
+ {70854, 1, &rule2},
+ {70855, 1, &rule14},
+ {70864, 10, &rule8},
+ {71040, 47, &rule14},
+ {71087, 3, &rule122},
+ {71090, 4, &rule90},
+ {71096, 4, &rule122},
+ {71100, 2, &rule90},
+ {71102, 1, &rule122},
+ {71103, 2, &rule90},
+ {71105, 9, &rule2},
+ {71168, 48, &rule14},
+ {71216, 3, &rule122},
+ {71219, 8, &rule90},
+ {71227, 2, &rule122},
+ {71229, 1, &rule90},
+ {71230, 1, &rule122},
+ {71231, 2, &rule90},
+ {71233, 3, &rule2},
+ {71236, 1, &rule14},
+ {71248, 10, &rule8},
+ {71296, 43, &rule14},
+ {71339, 1, &rule90},
+ {71340, 1, &rule122},
+ {71341, 1, &rule90},
+ {71342, 2, &rule122},
+ {71344, 6, &rule90},
+ {71350, 1, &rule122},
+ {71351, 1, &rule90},
+ {71360, 10, &rule8},
+ {71840, 32, &rule9},
+ {71872, 32, &rule12},
+ {71904, 10, &rule8},
+ {71914, 9, &rule17},
+ {71935, 1, &rule14},
+ {72384, 57, &rule14},
+ {73728, 921, &rule14},
+ {74752, 111, &rule124},
+ {74864, 5, &rule2},
+ {77824, 1071, &rule14},
+ {92160, 569, &rule14},
+ {92736, 31, &rule14},
+ {92768, 10, &rule8},
+ {92782, 2, &rule2},
+ {92880, 30, &rule14},
+ {92912, 5, &rule90},
+ {92917, 1, &rule2},
+ {92928, 48, &rule14},
+ {92976, 7, &rule90},
+ {92983, 5, &rule2},
+ {92988, 4, &rule13},
+ {92992, 4, &rule89},
+ {92996, 1, &rule2},
+ {92997, 1, &rule13},
+ {93008, 10, &rule8},
+ {93019, 7, &rule17},
+ {93027, 21, &rule14},
+ {93053, 19, &rule14},
+ {93952, 69, &rule14},
+ {94032, 1, &rule14},
+ {94033, 46, &rule122},
+ {94095, 4, &rule90},
+ {94099, 13, &rule89},
+ {110592, 2, &rule14},
+ {113664, 107, &rule14},
+ {113776, 13, &rule14},
+ {113792, 9, &rule14},
+ {113808, 10, &rule14},
+ {113820, 1, &rule13},
+ {113821, 2, &rule90},
+ {113823, 1, &rule2},
+ {113824, 4, &rule16},
{118784, 246, &rule13},
{119040, 39, &rule13},
{119081, 60, &rule13},
- {119141, 2, &rule114},
- {119143, 3, &rule84},
+ {119141, 2, &rule122},
+ {119143, 3, &rule90},
{119146, 3, &rule13},
- {119149, 6, &rule114},
+ {119149, 6, &rule122},
{119155, 8, &rule16},
- {119163, 8, &rule84},
+ {119163, 8, &rule90},
{119171, 2, &rule13},
- {119173, 7, &rule84},
+ {119173, 7, &rule90},
{119180, 30, &rule13},
- {119210, 4, &rule84},
+ {119210, 4, &rule90},
{119214, 48, &rule13},
{119296, 66, &rule13},
- {119362, 3, &rule84},
+ {119362, 3, &rule90},
{119365, 1, &rule13},
{119552, 87, &rule13},
{119648, 18, &rule17},
- {119808, 26, &rule98},
- {119834, 26, &rule14},
- {119860, 26, &rule98},
- {119886, 7, &rule14},
- {119894, 18, &rule14},
- {119912, 26, &rule98},
- {119938, 26, &rule14},
- {119964, 1, &rule98},
- {119966, 2, &rule98},
- {119970, 1, &rule98},
- {119973, 2, &rule98},
- {119977, 4, &rule98},
- {119982, 8, &rule98},
- {119990, 4, &rule14},
- {119995, 1, &rule14},
- {119997, 7, &rule14},
- {120005, 11, &rule14},
- {120016, 26, &rule98},
- {120042, 26, &rule14},
- {120068, 2, &rule98},
- {120071, 4, &rule98},
- {120077, 8, &rule98},
- {120086, 7, &rule98},
- {120094, 26, &rule14},
- {120120, 2, &rule98},
- {120123, 4, &rule98},
- {120128, 5, &rule98},
- {120134, 1, &rule98},
- {120138, 7, &rule98},
- {120146, 26, &rule14},
- {120172, 26, &rule98},
- {120198, 26, &rule14},
- {120224, 26, &rule98},
- {120250, 26, &rule14},
- {120276, 26, &rule98},
- {120302, 26, &rule14},
- {120328, 26, &rule98},
- {120354, 26, &rule14},
- {120380, 26, &rule98},
- {120406, 26, &rule14},
- {120432, 26, &rule98},
- {120458, 28, &rule14},
- {120488, 25, &rule98},
+ {119808, 26, &rule105},
+ {119834, 26, &rule20},
+ {119860, 26, &rule105},
+ {119886, 7, &rule20},
+ {119894, 18, &rule20},
+ {119912, 26, &rule105},
+ {119938, 26, &rule20},
+ {119964, 1, &rule105},
+ {119966, 2, &rule105},
+ {119970, 1, &rule105},
+ {119973, 2, &rule105},
+ {119977, 4, &rule105},
+ {119982, 8, &rule105},
+ {119990, 4, &rule20},
+ {119995, 1, &rule20},
+ {119997, 7, &rule20},
+ {120005, 11, &rule20},
+ {120016, 26, &rule105},
+ {120042, 26, &rule20},
+ {120068, 2, &rule105},
+ {120071, 4, &rule105},
+ {120077, 8, &rule105},
+ {120086, 7, &rule105},
+ {120094, 26, &rule20},
+ {120120, 2, &rule105},
+ {120123, 4, &rule105},
+ {120128, 5, &rule105},
+ {120134, 1, &rule105},
+ {120138, 7, &rule105},
+ {120146, 26, &rule20},
+ {120172, 26, &rule105},
+ {120198, 26, &rule20},
+ {120224, 26, &rule105},
+ {120250, 26, &rule20},
+ {120276, 26, &rule105},
+ {120302, 26, &rule20},
+ {120328, 26, &rule105},
+ {120354, 26, &rule20},
+ {120380, 26, &rule105},
+ {120406, 26, &rule20},
+ {120432, 26, &rule105},
+ {120458, 28, &rule20},
+ {120488, 25, &rule105},
{120513, 1, &rule6},
- {120514, 25, &rule14},
+ {120514, 25, &rule20},
{120539, 1, &rule6},
- {120540, 6, &rule14},
- {120546, 25, &rule98},
+ {120540, 6, &rule20},
+ {120546, 25, &rule105},
{120571, 1, &rule6},
- {120572, 25, &rule14},
+ {120572, 25, &rule20},
{120597, 1, &rule6},
- {120598, 6, &rule14},
- {120604, 25, &rule98},
+ {120598, 6, &rule20},
+ {120604, 25, &rule105},
{120629, 1, &rule6},
- {120630, 25, &rule14},
+ {120630, 25, &rule20},
{120655, 1, &rule6},
- {120656, 6, &rule14},
- {120662, 25, &rule98},
+ {120656, 6, &rule20},
+ {120662, 25, &rule105},
{120687, 1, &rule6},
- {120688, 25, &rule14},
+ {120688, 25, &rule20},
{120713, 1, &rule6},
- {120714, 6, &rule14},
- {120720, 25, &rule98},
+ {120714, 6, &rule20},
+ {120720, 25, &rule105},
{120745, 1, &rule6},
- {120746, 25, &rule14},
+ {120746, 25, &rule20},
{120771, 1, &rule6},
- {120772, 6, &rule14},
- {120778, 1, &rule98},
- {120779, 1, &rule14},
+ {120772, 6, &rule20},
+ {120778, 1, &rule105},
+ {120779, 1, &rule20},
{120782, 50, &rule8},
+ {124928, 197, &rule14},
+ {125127, 9, &rule17},
+ {125136, 7, &rule90},
+ {126464, 4, &rule14},
+ {126469, 27, &rule14},
+ {126497, 2, &rule14},
+ {126500, 1, &rule14},
+ {126503, 1, &rule14},
+ {126505, 10, &rule14},
+ {126516, 4, &rule14},
+ {126521, 1, &rule14},
+ {126523, 1, &rule14},
+ {126530, 1, &rule14},
+ {126535, 1, &rule14},
+ {126537, 1, &rule14},
+ {126539, 1, &rule14},
+ {126541, 3, &rule14},
+ {126545, 2, &rule14},
+ {126548, 1, &rule14},
+ {126551, 1, &rule14},
+ {126553, 1, &rule14},
+ {126555, 1, &rule14},
+ {126557, 1, &rule14},
+ {126559, 1, &rule14},
+ {126561, 2, &rule14},
+ {126564, 1, &rule14},
+ {126567, 4, &rule14},
+ {126572, 7, &rule14},
+ {126580, 4, &rule14},
+ {126585, 4, &rule14},
+ {126590, 1, &rule14},
+ {126592, 10, &rule14},
+ {126603, 17, &rule14},
+ {126625, 3, &rule14},
+ {126629, 5, &rule14},
+ {126635, 17, &rule14},
+ {126704, 2, &rule6},
{126976, 44, &rule13},
{127024, 100, &rule13},
{127136, 15, &rule13},
- {127153, 14, &rule13},
+ {127153, 15, &rule13},
{127169, 15, &rule13},
- {127185, 15, &rule13},
- {127232, 11, &rule17},
+ {127185, 37, &rule13},
+ {127232, 13, &rule17},
{127248, 31, &rule13},
- {127280, 58, &rule13},
+ {127280, 60, &rule13},
{127344, 43, &rule13},
{127462, 29, &rule13},
{127504, 43, &rule13},
{127552, 9, &rule13},
{127568, 2, &rule13},
- {127744, 33, &rule13},
- {127792, 6, &rule13},
- {127799, 70, &rule13},
- {127872, 20, &rule13},
- {127904, 37, &rule13},
- {127942, 5, &rule13},
- {127968, 17, &rule13},
- {128000, 63, &rule13},
- {128064, 1, &rule13},
- {128066, 182, &rule13},
- {128249, 4, &rule13},
- {128256, 62, &rule13},
- {128336, 24, &rule13},
- {128507, 5, &rule13},
- {128513, 16, &rule13},
- {128530, 3, &rule13},
- {128534, 1, &rule13},
- {128536, 1, &rule13},
- {128538, 1, &rule13},
- {128540, 3, &rule13},
- {128544, 6, &rule13},
- {128552, 4, &rule13},
- {128557, 1, &rule13},
- {128560, 4, &rule13},
- {128565, 12, &rule13},
- {128581, 11, &rule13},
- {128640, 70, &rule13},
+ {127744, 45, &rule13},
+ {127792, 78, &rule13},
+ {127872, 79, &rule13},
+ {127956, 36, &rule13},
+ {128000, 255, &rule13},
+ {128256, 75, &rule13},
+ {128336, 42, &rule13},
+ {128379, 41, &rule13},
+ {128421, 158, &rule13},
+ {128581, 139, &rule13},
+ {128736, 13, &rule13},
+ {128752, 4, &rule13},
{128768, 116, &rule13},
- {131072, 42711, &rule45},
- {173824, 4149, &rule45},
- {177984, 222, &rule45},
- {194560, 542, &rule45},
+ {128896, 85, &rule13},
+ {129024, 12, &rule13},
+ {129040, 56, &rule13},
+ {129104, 10, &rule13},
+ {129120, 40, &rule13},
+ {129168, 30, &rule13},
+ {131072, 42711, &rule14},
+ {173824, 4149, &rule14},
+ {177984, 222, &rule14},
+ {194560, 542, &rule14},
{917505, 1, &rule16},
{917536, 96, &rule16},
- {917760, 240, &rule84},
- {983040, 65534, &rule164},
- {1048576, 65534, &rule164}
+ {917760, 240, &rule90},
+ {983040, 65534, &rule178},
+ {1048576, 65534, &rule178}
};
static const struct _charblock_ convchars[]={
{65, 26, &rule9},
@@ -3054,187 +3359,187 @@ static const struct _charblock_ convchars[]={
{216, 7, &rule9},
{224, 23, &rule12},
{248, 7, &rule12},
- {255, 1, &rule20},
- {256, 1, &rule21},
- {257, 1, &rule22},
- {258, 1, &rule21},
- {259, 1, &rule22},
- {260, 1, &rule21},
- {261, 1, &rule22},
- {262, 1, &rule21},
- {263, 1, &rule22},
- {264, 1, &rule21},
- {265, 1, &rule22},
- {266, 1, &rule21},
- {267, 1, &rule22},
- {268, 1, &rule21},
- {269, 1, &rule22},
- {270, 1, &rule21},
- {271, 1, &rule22},
- {272, 1, &rule21},
- {273, 1, &rule22},
- {274, 1, &rule21},
- {275, 1, &rule22},
- {276, 1, &rule21},
- {277, 1, &rule22},
- {278, 1, &rule21},
- {279, 1, &rule22},
- {280, 1, &rule21},
- {281, 1, &rule22},
- {282, 1, &rule21},
- {283, 1, &rule22},
- {284, 1, &rule21},
- {285, 1, &rule22},
- {286, 1, &rule21},
- {287, 1, &rule22},
- {288, 1, &rule21},
- {289, 1, &rule22},
- {290, 1, &rule21},
- {291, 1, &rule22},
- {292, 1, &rule21},
- {293, 1, &rule22},
- {294, 1, &rule21},
- {295, 1, &rule22},
- {296, 1, &rule21},
- {297, 1, &rule22},
- {298, 1, &rule21},
- {299, 1, &rule22},
- {300, 1, &rule21},
- {301, 1, &rule22},
- {302, 1, &rule21},
- {303, 1, &rule22},
- {304, 1, &rule23},
- {305, 1, &rule24},
- {306, 1, &rule21},
- {307, 1, &rule22},
- {308, 1, &rule21},
- {309, 1, &rule22},
- {310, 1, &rule21},
- {311, 1, &rule22},
- {313, 1, &rule21},
- {314, 1, &rule22},
- {315, 1, &rule21},
- {316, 1, &rule22},
- {317, 1, &rule21},
- {318, 1, &rule22},
- {319, 1, &rule21},
- {320, 1, &rule22},
- {321, 1, &rule21},
- {322, 1, &rule22},
- {323, 1, &rule21},
- {324, 1, &rule22},
- {325, 1, &rule21},
- {326, 1, &rule22},
- {327, 1, &rule21},
- {328, 1, &rule22},
- {330, 1, &rule21},
- {331, 1, &rule22},
- {332, 1, &rule21},
- {333, 1, &rule22},
- {334, 1, &rule21},
- {335, 1, &rule22},
- {336, 1, &rule21},
- {337, 1, &rule22},
- {338, 1, &rule21},
- {339, 1, &rule22},
- {340, 1, &rule21},
- {341, 1, &rule22},
- {342, 1, &rule21},
- {343, 1, &rule22},
- {344, 1, &rule21},
- {345, 1, &rule22},
- {346, 1, &rule21},
- {347, 1, &rule22},
- {348, 1, &rule21},
- {349, 1, &rule22},
- {350, 1, &rule21},
- {351, 1, &rule22},
- {352, 1, &rule21},
- {353, 1, &rule22},
- {354, 1, &rule21},
- {355, 1, &rule22},
- {356, 1, &rule21},
- {357, 1, &rule22},
- {358, 1, &rule21},
- {359, 1, &rule22},
- {360, 1, &rule21},
- {361, 1, &rule22},
- {362, 1, &rule21},
- {363, 1, &rule22},
- {364, 1, &rule21},
- {365, 1, &rule22},
- {366, 1, &rule21},
- {367, 1, &rule22},
- {368, 1, &rule21},
- {369, 1, &rule22},
- {370, 1, &rule21},
- {371, 1, &rule22},
- {372, 1, &rule21},
- {373, 1, &rule22},
- {374, 1, &rule21},
- {375, 1, &rule22},
- {376, 1, &rule25},
- {377, 1, &rule21},
- {378, 1, &rule22},
- {379, 1, &rule21},
- {380, 1, &rule22},
- {381, 1, &rule21},
- {382, 1, &rule22},
- {383, 1, &rule26},
- {384, 1, &rule27},
- {385, 1, &rule28},
- {386, 1, &rule21},
- {387, 1, &rule22},
- {388, 1, &rule21},
- {389, 1, &rule22},
- {390, 1, &rule29},
- {391, 1, &rule21},
- {392, 1, &rule22},
- {393, 2, &rule30},
- {395, 1, &rule21},
- {396, 1, &rule22},
- {398, 1, &rule31},
- {399, 1, &rule32},
- {400, 1, &rule33},
- {401, 1, &rule21},
- {402, 1, &rule22},
- {403, 1, &rule30},
- {404, 1, &rule34},
- {405, 1, &rule35},
- {406, 1, &rule36},
- {407, 1, &rule37},
- {408, 1, &rule21},
- {409, 1, &rule22},
- {410, 1, &rule38},
- {412, 1, &rule36},
- {413, 1, &rule39},
- {414, 1, &rule40},
- {415, 1, &rule41},
- {416, 1, &rule21},
- {417, 1, &rule22},
- {418, 1, &rule21},
- {419, 1, &rule22},
- {420, 1, &rule21},
- {421, 1, &rule22},
- {422, 1, &rule42},
- {423, 1, &rule21},
- {424, 1, &rule22},
- {425, 1, &rule42},
- {428, 1, &rule21},
- {429, 1, &rule22},
- {430, 1, &rule42},
- {431, 1, &rule21},
- {432, 1, &rule22},
- {433, 2, &rule43},
- {435, 1, &rule21},
- {436, 1, &rule22},
- {437, 1, &rule21},
- {438, 1, &rule22},
- {439, 1, &rule44},
- {440, 1, &rule21},
- {441, 1, &rule22},
- {444, 1, &rule21},
- {445, 1, &rule22},
+ {255, 1, &rule21},
+ {256, 1, &rule22},
+ {257, 1, &rule23},
+ {258, 1, &rule22},
+ {259, 1, &rule23},
+ {260, 1, &rule22},
+ {261, 1, &rule23},
+ {262, 1, &rule22},
+ {263, 1, &rule23},
+ {264, 1, &rule22},
+ {265, 1, &rule23},
+ {266, 1, &rule22},
+ {267, 1, &rule23},
+ {268, 1, &rule22},
+ {269, 1, &rule23},
+ {270, 1, &rule22},
+ {271, 1, &rule23},
+ {272, 1, &rule22},
+ {273, 1, &rule23},
+ {274, 1, &rule22},
+ {275, 1, &rule23},
+ {276, 1, &rule22},
+ {277, 1, &rule23},
+ {278, 1, &rule22},
+ {279, 1, &rule23},
+ {280, 1, &rule22},
+ {281, 1, &rule23},
+ {282, 1, &rule22},
+ {283, 1, &rule23},
+ {284, 1, &rule22},
+ {285, 1, &rule23},
+ {286, 1, &rule22},
+ {287, 1, &rule23},
+ {288, 1, &rule22},
+ {289, 1, &rule23},
+ {290, 1, &rule22},
+ {291, 1, &rule23},
+ {292, 1, &rule22},
+ {293, 1, &rule23},
+ {294, 1, &rule22},
+ {295, 1, &rule23},
+ {296, 1, &rule22},
+ {297, 1, &rule23},
+ {298, 1, &rule22},
+ {299, 1, &rule23},
+ {300, 1, &rule22},
+ {301, 1, &rule23},
+ {302, 1, &rule22},
+ {303, 1, &rule23},
+ {304, 1, &rule24},
+ {305, 1, &rule25},
+ {306, 1, &rule22},
+ {307, 1, &rule23},
+ {308, 1, &rule22},
+ {309, 1, &rule23},
+ {310, 1, &rule22},
+ {311, 1, &rule23},
+ {313, 1, &rule22},
+ {314, 1, &rule23},
+ {315, 1, &rule22},
+ {316, 1, &rule23},
+ {317, 1, &rule22},
+ {318, 1, &rule23},
+ {319, 1, &rule22},
+ {320, 1, &rule23},
+ {321, 1, &rule22},
+ {322, 1, &rule23},
+ {323, 1, &rule22},
+ {324, 1, &rule23},
+ {325, 1, &rule22},
+ {326, 1, &rule23},
+ {327, 1, &rule22},
+ {328, 1, &rule23},
+ {330, 1, &rule22},
+ {331, 1, &rule23},
+ {332, 1, &rule22},
+ {333, 1, &rule23},
+ {334, 1, &rule22},
+ {335, 1, &rule23},
+ {336, 1, &rule22},
+ {337, 1, &rule23},
+ {338, 1, &rule22},
+ {339, 1, &rule23},
+ {340, 1, &rule22},
+ {341, 1, &rule23},
+ {342, 1, &rule22},
+ {343, 1, &rule23},
+ {344, 1, &rule22},
+ {345, 1, &rule23},
+ {346, 1, &rule22},
+ {347, 1, &rule23},
+ {348, 1, &rule22},
+ {349, 1, &rule23},
+ {350, 1, &rule22},
+ {351, 1, &rule23},
+ {352, 1, &rule22},
+ {353, 1, &rule23},
+ {354, 1, &rule22},
+ {355, 1, &rule23},
+ {356, 1, &rule22},
+ {357, 1, &rule23},
+ {358, 1, &rule22},
+ {359, 1, &rule23},
+ {360, 1, &rule22},
+ {361, 1, &rule23},
+ {362, 1, &rule22},
+ {363, 1, &rule23},
+ {364, 1, &rule22},
+ {365, 1, &rule23},
+ {366, 1, &rule22},
+ {367, 1, &rule23},
+ {368, 1, &rule22},
+ {369, 1, &rule23},
+ {370, 1, &rule22},
+ {371, 1, &rule23},
+ {372, 1, &rule22},
+ {373, 1, &rule23},
+ {374, 1, &rule22},
+ {375, 1, &rule23},
+ {376, 1, &rule26},
+ {377, 1, &rule22},
+ {378, 1, &rule23},
+ {379, 1, &rule22},
+ {380, 1, &rule23},
+ {381, 1, &rule22},
+ {382, 1, &rule23},
+ {383, 1, &rule27},
+ {384, 1, &rule28},
+ {385, 1, &rule29},
+ {386, 1, &rule22},
+ {387, 1, &rule23},
+ {388, 1, &rule22},
+ {389, 1, &rule23},
+ {390, 1, &rule30},
+ {391, 1, &rule22},
+ {392, 1, &rule23},
+ {393, 2, &rule31},
+ {395, 1, &rule22},
+ {396, 1, &rule23},
+ {398, 1, &rule32},
+ {399, 1, &rule33},
+ {400, 1, &rule34},
+ {401, 1, &rule22},
+ {402, 1, &rule23},
+ {403, 1, &rule31},
+ {404, 1, &rule35},
+ {405, 1, &rule36},
+ {406, 1, &rule37},
+ {407, 1, &rule38},
+ {408, 1, &rule22},
+ {409, 1, &rule23},
+ {410, 1, &rule39},
+ {412, 1, &rule37},
+ {413, 1, &rule40},
+ {414, 1, &rule41},
+ {415, 1, &rule42},
+ {416, 1, &rule22},
+ {417, 1, &rule23},
+ {418, 1, &rule22},
+ {419, 1, &rule23},
+ {420, 1, &rule22},
+ {421, 1, &rule23},
+ {422, 1, &rule43},
+ {423, 1, &rule22},
+ {424, 1, &rule23},
+ {425, 1, &rule43},
+ {428, 1, &rule22},
+ {429, 1, &rule23},
+ {430, 1, &rule43},
+ {431, 1, &rule22},
+ {432, 1, &rule23},
+ {433, 2, &rule44},
+ {435, 1, &rule22},
+ {436, 1, &rule23},
+ {437, 1, &rule22},
+ {438, 1, &rule23},
+ {439, 1, &rule45},
+ {440, 1, &rule22},
+ {441, 1, &rule23},
+ {444, 1, &rule22},
+ {445, 1, &rule23},
{447, 1, &rule46},
{452, 1, &rule47},
{453, 1, &rule48},
@@ -3245,128 +3550,128 @@ static const struct _charblock_ convchars[]={
{458, 1, &rule47},
{459, 1, &rule48},
{460, 1, &rule49},
- {461, 1, &rule21},
- {462, 1, &rule22},
- {463, 1, &rule21},
- {464, 1, &rule22},
- {465, 1, &rule21},
- {466, 1, &rule22},
- {467, 1, &rule21},
- {468, 1, &rule22},
- {469, 1, &rule21},
- {470, 1, &rule22},
- {471, 1, &rule21},
- {472, 1, &rule22},
- {473, 1, &rule21},
- {474, 1, &rule22},
- {475, 1, &rule21},
- {476, 1, &rule22},
+ {461, 1, &rule22},
+ {462, 1, &rule23},
+ {463, 1, &rule22},
+ {464, 1, &rule23},
+ {465, 1, &rule22},
+ {466, 1, &rule23},
+ {467, 1, &rule22},
+ {468, 1, &rule23},
+ {469, 1, &rule22},
+ {470, 1, &rule23},
+ {471, 1, &rule22},
+ {472, 1, &rule23},
+ {473, 1, &rule22},
+ {474, 1, &rule23},
+ {475, 1, &rule22},
+ {476, 1, &rule23},
{477, 1, &rule50},
- {478, 1, &rule21},
- {479, 1, &rule22},
- {480, 1, &rule21},
- {481, 1, &rule22},
- {482, 1, &rule21},
- {483, 1, &rule22},
- {484, 1, &rule21},
- {485, 1, &rule22},
- {486, 1, &rule21},
- {487, 1, &rule22},
- {488, 1, &rule21},
- {489, 1, &rule22},
- {490, 1, &rule21},
- {491, 1, &rule22},
- {492, 1, &rule21},
- {493, 1, &rule22},
- {494, 1, &rule21},
- {495, 1, &rule22},
+ {478, 1, &rule22},
+ {479, 1, &rule23},
+ {480, 1, &rule22},
+ {481, 1, &rule23},
+ {482, 1, &rule22},
+ {483, 1, &rule23},
+ {484, 1, &rule22},
+ {485, 1, &rule23},
+ {486, 1, &rule22},
+ {487, 1, &rule23},
+ {488, 1, &rule22},
+ {489, 1, &rule23},
+ {490, 1, &rule22},
+ {491, 1, &rule23},
+ {492, 1, &rule22},
+ {493, 1, &rule23},
+ {494, 1, &rule22},
+ {495, 1, &rule23},
{497, 1, &rule47},
{498, 1, &rule48},
{499, 1, &rule49},
- {500, 1, &rule21},
- {501, 1, &rule22},
+ {500, 1, &rule22},
+ {501, 1, &rule23},
{502, 1, &rule51},
{503, 1, &rule52},
- {504, 1, &rule21},
- {505, 1, &rule22},
- {506, 1, &rule21},
- {507, 1, &rule22},
- {508, 1, &rule21},
- {509, 1, &rule22},
- {510, 1, &rule21},
- {511, 1, &rule22},
- {512, 1, &rule21},
- {513, 1, &rule22},
- {514, 1, &rule21},
- {515, 1, &rule22},
- {516, 1, &rule21},
- {517, 1, &rule22},
- {518, 1, &rule21},
- {519, 1, &rule22},
- {520, 1, &rule21},
- {521, 1, &rule22},
- {522, 1, &rule21},
- {523, 1, &rule22},
- {524, 1, &rule21},
- {525, 1, &rule22},
- {526, 1, &rule21},
- {527, 1, &rule22},
- {528, 1, &rule21},
- {529, 1, &rule22},
- {530, 1, &rule21},
- {531, 1, &rule22},
- {532, 1, &rule21},
- {533, 1, &rule22},
- {534, 1, &rule21},
- {535, 1, &rule22},
- {536, 1, &rule21},
- {537, 1, &rule22},
- {538, 1, &rule21},
- {539, 1, &rule22},
- {540, 1, &rule21},
- {541, 1, &rule22},
- {542, 1, &rule21},
- {543, 1, &rule22},
+ {504, 1, &rule22},
+ {505, 1, &rule23},
+ {506, 1, &rule22},
+ {507, 1, &rule23},
+ {508, 1, &rule22},
+ {509, 1, &rule23},
+ {510, 1, &rule22},
+ {511, 1, &rule23},
+ {512, 1, &rule22},
+ {513, 1, &rule23},
+ {514, 1, &rule22},
+ {515, 1, &rule23},
+ {516, 1, &rule22},
+ {517, 1, &rule23},
+ {518, 1, &rule22},
+ {519, 1, &rule23},
+ {520, 1, &rule22},
+ {521, 1, &rule23},
+ {522, 1, &rule22},
+ {523, 1, &rule23},
+ {524, 1, &rule22},
+ {525, 1, &rule23},
+ {526, 1, &rule22},
+ {527, 1, &rule23},
+ {528, 1, &rule22},
+ {529, 1, &rule23},
+ {530, 1, &rule22},
+ {531, 1, &rule23},
+ {532, 1, &rule22},
+ {533, 1, &rule23},
+ {534, 1, &rule22},
+ {535, 1, &rule23},
+ {536, 1, &rule22},
+ {537, 1, &rule23},
+ {538, 1, &rule22},
+ {539, 1, &rule23},
+ {540, 1, &rule22},
+ {541, 1, &rule23},
+ {542, 1, &rule22},
+ {543, 1, &rule23},
{544, 1, &rule53},
- {546, 1, &rule21},
- {547, 1, &rule22},
- {548, 1, &rule21},
- {549, 1, &rule22},
- {550, 1, &rule21},
- {551, 1, &rule22},
- {552, 1, &rule21},
- {553, 1, &rule22},
- {554, 1, &rule21},
- {555, 1, &rule22},
- {556, 1, &rule21},
- {557, 1, &rule22},
- {558, 1, &rule21},
- {559, 1, &rule22},
- {560, 1, &rule21},
- {561, 1, &rule22},
- {562, 1, &rule21},
- {563, 1, &rule22},
+ {546, 1, &rule22},
+ {547, 1, &rule23},
+ {548, 1, &rule22},
+ {549, 1, &rule23},
+ {550, 1, &rule22},
+ {551, 1, &rule23},
+ {552, 1, &rule22},
+ {553, 1, &rule23},
+ {554, 1, &rule22},
+ {555, 1, &rule23},
+ {556, 1, &rule22},
+ {557, 1, &rule23},
+ {558, 1, &rule22},
+ {559, 1, &rule23},
+ {560, 1, &rule22},
+ {561, 1, &rule23},
+ {562, 1, &rule22},
+ {563, 1, &rule23},
{570, 1, &rule54},
- {571, 1, &rule21},
- {572, 1, &rule22},
+ {571, 1, &rule22},
+ {572, 1, &rule23},
{573, 1, &rule55},
{574, 1, &rule56},
{575, 2, &rule57},
- {577, 1, &rule21},
- {578, 1, &rule22},
+ {577, 1, &rule22},
+ {578, 1, &rule23},
{579, 1, &rule58},
{580, 1, &rule59},
{581, 1, &rule60},
- {582, 1, &rule21},
- {583, 1, &rule22},
- {584, 1, &rule21},
- {585, 1, &rule22},
- {586, 1, &rule21},
- {587, 1, &rule22},
- {588, 1, &rule21},
- {589, 1, &rule22},
- {590, 1, &rule21},
- {591, 1, &rule22},
+ {582, 1, &rule22},
+ {583, 1, &rule23},
+ {584, 1, &rule22},
+ {585, 1, &rule23},
+ {586, 1, &rule22},
+ {587, 1, &rule23},
+ {588, 1, &rule22},
+ {589, 1, &rule23},
+ {590, 1, &rule22},
+ {591, 1, &rule23},
{592, 1, &rule61},
{593, 1, &rule62},
{594, 1, &rule63},
@@ -3375,914 +3680,959 @@ static const struct _charblock_ convchars[]={
{598, 2, &rule66},
{601, 1, &rule67},
{603, 1, &rule68},
+ {604, 1, &rule69},
{608, 1, &rule66},
- {611, 1, &rule69},
- {613, 1, &rule70},
- {616, 1, &rule71},
- {617, 1, &rule72},
- {619, 1, &rule73},
- {623, 1, &rule72},
- {625, 1, &rule74},
- {626, 1, &rule75},
- {629, 1, &rule76},
- {637, 1, &rule77},
- {640, 1, &rule78},
- {643, 1, &rule78},
- {648, 1, &rule78},
- {649, 1, &rule79},
- {650, 2, &rule80},
- {652, 1, &rule81},
- {658, 1, &rule82},
- {837, 1, &rule85},
- {880, 1, &rule21},
- {881, 1, &rule22},
- {882, 1, &rule21},
- {883, 1, &rule22},
- {886, 1, &rule21},
- {887, 1, &rule22},
- {891, 3, &rule40},
- {902, 1, &rule86},
- {904, 3, &rule87},
- {908, 1, &rule88},
- {910, 2, &rule89},
+ {609, 1, &rule70},
+ {611, 1, &rule71},
+ {613, 1, &rule72},
+ {614, 1, &rule73},
+ {616, 1, &rule74},
+ {617, 1, &rule75},
+ {619, 1, &rule76},
+ {620, 1, &rule77},
+ {623, 1, &rule75},
+ {625, 1, &rule78},
+ {626, 1, &rule79},
+ {629, 1, &rule80},
+ {637, 1, &rule81},
+ {640, 1, &rule82},
+ {643, 1, &rule82},
+ {647, 1, &rule83},
+ {648, 1, &rule82},
+ {649, 1, &rule84},
+ {650, 2, &rule85},
+ {652, 1, &rule86},
+ {658, 1, &rule87},
+ {670, 1, &rule88},
+ {837, 1, &rule91},
+ {880, 1, &rule22},
+ {881, 1, &rule23},
+ {882, 1, &rule22},
+ {883, 1, &rule23},
+ {886, 1, &rule22},
+ {887, 1, &rule23},
+ {891, 3, &rule41},
+ {895, 1, &rule92},
+ {902, 1, &rule93},
+ {904, 3, &rule94},
+ {908, 1, &rule95},
+ {910, 2, &rule96},
{913, 17, &rule9},
{931, 9, &rule9},
- {940, 1, &rule90},
- {941, 3, &rule91},
+ {940, 1, &rule97},
+ {941, 3, &rule98},
{945, 17, &rule12},
- {962, 1, &rule92},
+ {962, 1, &rule99},
{963, 9, &rule12},
- {972, 1, &rule93},
- {973, 2, &rule94},
- {975, 1, &rule95},
- {976, 1, &rule96},
- {977, 1, &rule97},
- {981, 1, &rule99},
- {982, 1, &rule100},
- {983, 1, &rule101},
- {984, 1, &rule21},
- {985, 1, &rule22},
- {986, 1, &rule21},
- {987, 1, &rule22},
- {988, 1, &rule21},
- {989, 1, &rule22},
- {990, 1, &rule21},
- {991, 1, &rule22},
- {992, 1, &rule21},
- {993, 1, &rule22},
- {994, 1, &rule21},
- {995, 1, &rule22},
- {996, 1, &rule21},
- {997, 1, &rule22},
- {998, 1, &rule21},
- {999, 1, &rule22},
- {1000, 1, &rule21},
- {1001, 1, &rule22},
- {1002, 1, &rule21},
- {1003, 1, &rule22},
- {1004, 1, &rule21},
- {1005, 1, &rule22},
- {1006, 1, &rule21},
- {1007, 1, &rule22},
- {1008, 1, &rule102},
- {1009, 1, &rule103},
- {1010, 1, &rule104},
- {1012, 1, &rule105},
- {1013, 1, &rule106},
- {1015, 1, &rule21},
- {1016, 1, &rule22},
- {1017, 1, &rule107},
- {1018, 1, &rule21},
- {1019, 1, &rule22},
+ {972, 1, &rule100},
+ {973, 2, &rule101},
+ {975, 1, &rule102},
+ {976, 1, &rule103},
+ {977, 1, &rule104},
+ {981, 1, &rule106},
+ {982, 1, &rule107},
+ {983, 1, &rule108},
+ {984, 1, &rule22},
+ {985, 1, &rule23},
+ {986, 1, &rule22},
+ {987, 1, &rule23},
+ {988, 1, &rule22},
+ {989, 1, &rule23},
+ {990, 1, &rule22},
+ {991, 1, &rule23},
+ {992, 1, &rule22},
+ {993, 1, &rule23},
+ {994, 1, &rule22},
+ {995, 1, &rule23},
+ {996, 1, &rule22},
+ {997, 1, &rule23},
+ {998, 1, &rule22},
+ {999, 1, &rule23},
+ {1000, 1, &rule22},
+ {1001, 1, &rule23},
+ {1002, 1, &rule22},
+ {1003, 1, &rule23},
+ {1004, 1, &rule22},
+ {1005, 1, &rule23},
+ {1006, 1, &rule22},
+ {1007, 1, &rule23},
+ {1008, 1, &rule109},
+ {1009, 1, &rule110},
+ {1010, 1, &rule111},
+ {1011, 1, &rule112},
+ {1012, 1, &rule113},
+ {1013, 1, &rule114},
+ {1015, 1, &rule22},
+ {1016, 1, &rule23},
+ {1017, 1, &rule115},
+ {1018, 1, &rule22},
+ {1019, 1, &rule23},
{1021, 3, &rule53},
- {1024, 16, &rule108},
+ {1024, 16, &rule116},
{1040, 32, &rule9},
{1072, 32, &rule12},
- {1104, 16, &rule103},
- {1120, 1, &rule21},
- {1121, 1, &rule22},
- {1122, 1, &rule21},
- {1123, 1, &rule22},
- {1124, 1, &rule21},
- {1125, 1, &rule22},
- {1126, 1, &rule21},
- {1127, 1, &rule22},
- {1128, 1, &rule21},
- {1129, 1, &rule22},
- {1130, 1, &rule21},
- {1131, 1, &rule22},
- {1132, 1, &rule21},
- {1133, 1, &rule22},
- {1134, 1, &rule21},
- {1135, 1, &rule22},
- {1136, 1, &rule21},
- {1137, 1, &rule22},
- {1138, 1, &rule21},
- {1139, 1, &rule22},
- {1140, 1, &rule21},
- {1141, 1, &rule22},
- {1142, 1, &rule21},
- {1143, 1, &rule22},
- {1144, 1, &rule21},
- {1145, 1, &rule22},
- {1146, 1, &rule21},
- {1147, 1, &rule22},
- {1148, 1, &rule21},
- {1149, 1, &rule22},
- {1150, 1, &rule21},
- {1151, 1, &rule22},
- {1152, 1, &rule21},
- {1153, 1, &rule22},
- {1162, 1, &rule21},
- {1163, 1, &rule22},
- {1164, 1, &rule21},
- {1165, 1, &rule22},
- {1166, 1, &rule21},
- {1167, 1, &rule22},
- {1168, 1, &rule21},
- {1169, 1, &rule22},
- {1170, 1, &rule21},
- {1171, 1, &rule22},
- {1172, 1, &rule21},
- {1173, 1, &rule22},
- {1174, 1, &rule21},
- {1175, 1, &rule22},
- {1176, 1, &rule21},
- {1177, 1, &rule22},
- {1178, 1, &rule21},
- {1179, 1, &rule22},
- {1180, 1, &rule21},
- {1181, 1, &rule22},
- {1182, 1, &rule21},
- {1183, 1, &rule22},
- {1184, 1, &rule21},
- {1185, 1, &rule22},
- {1186, 1, &rule21},
- {1187, 1, &rule22},
- {1188, 1, &rule21},
- {1189, 1, &rule22},
- {1190, 1, &rule21},
- {1191, 1, &rule22},
- {1192, 1, &rule21},
- {1193, 1, &rule22},
- {1194, 1, &rule21},
- {1195, 1, &rule22},
- {1196, 1, &rule21},
- {1197, 1, &rule22},
- {1198, 1, &rule21},
- {1199, 1, &rule22},
- {1200, 1, &rule21},
- {1201, 1, &rule22},
- {1202, 1, &rule21},
- {1203, 1, &rule22},
- {1204, 1, &rule21},
- {1205, 1, &rule22},
- {1206, 1, &rule21},
- {1207, 1, &rule22},
- {1208, 1, &rule21},
- {1209, 1, &rule22},
- {1210, 1, &rule21},
- {1211, 1, &rule22},
- {1212, 1, &rule21},
- {1213, 1, &rule22},
- {1214, 1, &rule21},
- {1215, 1, &rule22},
- {1216, 1, &rule110},
- {1217, 1, &rule21},
- {1218, 1, &rule22},
- {1219, 1, &rule21},
- {1220, 1, &rule22},
- {1221, 1, &rule21},
- {1222, 1, &rule22},
- {1223, 1, &rule21},
- {1224, 1, &rule22},
- {1225, 1, &rule21},
- {1226, 1, &rule22},
- {1227, 1, &rule21},
- {1228, 1, &rule22},
- {1229, 1, &rule21},
- {1230, 1, &rule22},
- {1231, 1, &rule111},
- {1232, 1, &rule21},
- {1233, 1, &rule22},
- {1234, 1, &rule21},
- {1235, 1, &rule22},
- {1236, 1, &rule21},
- {1237, 1, &rule22},
- {1238, 1, &rule21},
- {1239, 1, &rule22},
- {1240, 1, &rule21},
- {1241, 1, &rule22},
- {1242, 1, &rule21},
- {1243, 1, &rule22},
- {1244, 1, &rule21},
- {1245, 1, &rule22},
- {1246, 1, &rule21},
- {1247, 1, &rule22},
- {1248, 1, &rule21},
- {1249, 1, &rule22},
- {1250, 1, &rule21},
- {1251, 1, &rule22},
- {1252, 1, &rule21},
- {1253, 1, &rule22},
- {1254, 1, &rule21},
- {1255, 1, &rule22},
- {1256, 1, &rule21},
- {1257, 1, &rule22},
- {1258, 1, &rule21},
- {1259, 1, &rule22},
- {1260, 1, &rule21},
- {1261, 1, &rule22},
- {1262, 1, &rule21},
- {1263, 1, &rule22},
- {1264, 1, &rule21},
- {1265, 1, &rule22},
- {1266, 1, &rule21},
- {1267, 1, &rule22},
- {1268, 1, &rule21},
- {1269, 1, &rule22},
- {1270, 1, &rule21},
- {1271, 1, &rule22},
- {1272, 1, &rule21},
- {1273, 1, &rule22},
- {1274, 1, &rule21},
- {1275, 1, &rule22},
- {1276, 1, &rule21},
- {1277, 1, &rule22},
- {1278, 1, &rule21},
- {1279, 1, &rule22},
- {1280, 1, &rule21},
- {1281, 1, &rule22},
- {1282, 1, &rule21},
- {1283, 1, &rule22},
- {1284, 1, &rule21},
- {1285, 1, &rule22},
- {1286, 1, &rule21},
- {1287, 1, &rule22},
- {1288, 1, &rule21},
- {1289, 1, &rule22},
- {1290, 1, &rule21},
- {1291, 1, &rule22},
- {1292, 1, &rule21},
- {1293, 1, &rule22},
- {1294, 1, &rule21},
- {1295, 1, &rule22},
- {1296, 1, &rule21},
- {1297, 1, &rule22},
- {1298, 1, &rule21},
- {1299, 1, &rule22},
- {1300, 1, &rule21},
- {1301, 1, &rule22},
- {1302, 1, &rule21},
- {1303, 1, &rule22},
- {1304, 1, &rule21},
- {1305, 1, &rule22},
- {1306, 1, &rule21},
- {1307, 1, &rule22},
- {1308, 1, &rule21},
- {1309, 1, &rule22},
- {1310, 1, &rule21},
- {1311, 1, &rule22},
- {1312, 1, &rule21},
- {1313, 1, &rule22},
- {1314, 1, &rule21},
- {1315, 1, &rule22},
- {1316, 1, &rule21},
- {1317, 1, &rule22},
- {1318, 1, &rule21},
- {1319, 1, &rule22},
- {1329, 38, &rule112},
- {1377, 38, &rule113},
- {4256, 38, &rule115},
- {7545, 1, &rule117},
- {7549, 1, &rule118},
- {7680, 1, &rule21},
- {7681, 1, &rule22},
- {7682, 1, &rule21},
- {7683, 1, &rule22},
- {7684, 1, &rule21},
- {7685, 1, &rule22},
- {7686, 1, &rule21},
- {7687, 1, &rule22},
- {7688, 1, &rule21},
- {7689, 1, &rule22},
- {7690, 1, &rule21},
- {7691, 1, &rule22},
- {7692, 1, &rule21},
- {7693, 1, &rule22},
- {7694, 1, &rule21},
- {7695, 1, &rule22},
- {7696, 1, &rule21},
- {7697, 1, &rule22},
- {7698, 1, &rule21},
- {7699, 1, &rule22},
- {7700, 1, &rule21},
- {7701, 1, &rule22},
- {7702, 1, &rule21},
- {7703, 1, &rule22},
- {7704, 1, &rule21},
- {7705, 1, &rule22},
- {7706, 1, &rule21},
- {7707, 1, &rule22},
- {7708, 1, &rule21},
- {7709, 1, &rule22},
- {7710, 1, &rule21},
- {7711, 1, &rule22},
- {7712, 1, &rule21},
- {7713, 1, &rule22},
- {7714, 1, &rule21},
- {7715, 1, &rule22},
- {7716, 1, &rule21},
- {7717, 1, &rule22},
- {7718, 1, &rule21},
- {7719, 1, &rule22},
- {7720, 1, &rule21},
- {7721, 1, &rule22},
- {7722, 1, &rule21},
- {7723, 1, &rule22},
- {7724, 1, &rule21},
- {7725, 1, &rule22},
- {7726, 1, &rule21},
- {7727, 1, &rule22},
- {7728, 1, &rule21},
- {7729, 1, &rule22},
- {7730, 1, &rule21},
- {7731, 1, &rule22},
- {7732, 1, &rule21},
- {7733, 1, &rule22},
- {7734, 1, &rule21},
- {7735, 1, &rule22},
- {7736, 1, &rule21},
- {7737, 1, &rule22},
- {7738, 1, &rule21},
- {7739, 1, &rule22},
- {7740, 1, &rule21},
- {7741, 1, &rule22},
- {7742, 1, &rule21},
- {7743, 1, &rule22},
- {7744, 1, &rule21},
- {7745, 1, &rule22},
- {7746, 1, &rule21},
- {7747, 1, &rule22},
- {7748, 1, &rule21},
- {7749, 1, &rule22},
- {7750, 1, &rule21},
- {7751, 1, &rule22},
- {7752, 1, &rule21},
- {7753, 1, &rule22},
- {7754, 1, &rule21},
- {7755, 1, &rule22},
- {7756, 1, &rule21},
- {7757, 1, &rule22},
- {7758, 1, &rule21},
- {7759, 1, &rule22},
- {7760, 1, &rule21},
- {7761, 1, &rule22},
- {7762, 1, &rule21},
- {7763, 1, &rule22},
- {7764, 1, &rule21},
- {7765, 1, &rule22},
- {7766, 1, &rule21},
- {7767, 1, &rule22},
- {7768, 1, &rule21},
- {7769, 1, &rule22},
- {7770, 1, &rule21},
- {7771, 1, &rule22},
- {7772, 1, &rule21},
- {7773, 1, &rule22},
- {7774, 1, &rule21},
- {7775, 1, &rule22},
- {7776, 1, &rule21},
- {7777, 1, &rule22},
- {7778, 1, &rule21},
- {7779, 1, &rule22},
- {7780, 1, &rule21},
- {7781, 1, &rule22},
- {7782, 1, &rule21},
- {7783, 1, &rule22},
- {7784, 1, &rule21},
- {7785, 1, &rule22},
- {7786, 1, &rule21},
- {7787, 1, &rule22},
- {7788, 1, &rule21},
- {7789, 1, &rule22},
- {7790, 1, &rule21},
- {7791, 1, &rule22},
- {7792, 1, &rule21},
- {7793, 1, &rule22},
- {7794, 1, &rule21},
- {7795, 1, &rule22},
- {7796, 1, &rule21},
- {7797, 1, &rule22},
- {7798, 1, &rule21},
- {7799, 1, &rule22},
- {7800, 1, &rule21},
- {7801, 1, &rule22},
- {7802, 1, &rule21},
- {7803, 1, &rule22},
- {7804, 1, &rule21},
- {7805, 1, &rule22},
- {7806, 1, &rule21},
- {7807, 1, &rule22},
- {7808, 1, &rule21},
- {7809, 1, &rule22},
- {7810, 1, &rule21},
- {7811, 1, &rule22},
- {7812, 1, &rule21},
- {7813, 1, &rule22},
- {7814, 1, &rule21},
- {7815, 1, &rule22},
- {7816, 1, &rule21},
- {7817, 1, &rule22},
- {7818, 1, &rule21},
- {7819, 1, &rule22},
- {7820, 1, &rule21},
- {7821, 1, &rule22},
- {7822, 1, &rule21},
- {7823, 1, &rule22},
- {7824, 1, &rule21},
- {7825, 1, &rule22},
- {7826, 1, &rule21},
- {7827, 1, &rule22},
- {7828, 1, &rule21},
- {7829, 1, &rule22},
- {7835, 1, &rule119},
- {7838, 1, &rule120},
- {7840, 1, &rule21},
- {7841, 1, &rule22},
- {7842, 1, &rule21},
- {7843, 1, &rule22},
- {7844, 1, &rule21},
- {7845, 1, &rule22},
- {7846, 1, &rule21},
- {7847, 1, &rule22},
- {7848, 1, &rule21},
- {7849, 1, &rule22},
- {7850, 1, &rule21},
- {7851, 1, &rule22},
- {7852, 1, &rule21},
- {7853, 1, &rule22},
- {7854, 1, &rule21},
- {7855, 1, &rule22},
- {7856, 1, &rule21},
- {7857, 1, &rule22},
- {7858, 1, &rule21},
- {7859, 1, &rule22},
- {7860, 1, &rule21},
- {7861, 1, &rule22},
- {7862, 1, &rule21},
- {7863, 1, &rule22},
- {7864, 1, &rule21},
- {7865, 1, &rule22},
- {7866, 1, &rule21},
- {7867, 1, &rule22},
- {7868, 1, &rule21},
- {7869, 1, &rule22},
- {7870, 1, &rule21},
- {7871, 1, &rule22},
- {7872, 1, &rule21},
- {7873, 1, &rule22},
- {7874, 1, &rule21},
- {7875, 1, &rule22},
- {7876, 1, &rule21},
- {7877, 1, &rule22},
- {7878, 1, &rule21},
- {7879, 1, &rule22},
- {7880, 1, &rule21},
- {7881, 1, &rule22},
- {7882, 1, &rule21},
- {7883, 1, &rule22},
- {7884, 1, &rule21},
- {7885, 1, &rule22},
- {7886, 1, &rule21},
- {7887, 1, &rule22},
- {7888, 1, &rule21},
- {7889, 1, &rule22},
- {7890, 1, &rule21},
- {7891, 1, &rule22},
- {7892, 1, &rule21},
- {7893, 1, &rule22},
- {7894, 1, &rule21},
- {7895, 1, &rule22},
- {7896, 1, &rule21},
- {7897, 1, &rule22},
- {7898, 1, &rule21},
- {7899, 1, &rule22},
- {7900, 1, &rule21},
- {7901, 1, &rule22},
- {7902, 1, &rule21},
- {7903, 1, &rule22},
- {7904, 1, &rule21},
- {7905, 1, &rule22},
- {7906, 1, &rule21},
- {7907, 1, &rule22},
- {7908, 1, &rule21},
- {7909, 1, &rule22},
- {7910, 1, &rule21},
- {7911, 1, &rule22},
- {7912, 1, &rule21},
- {7913, 1, &rule22},
- {7914, 1, &rule21},
- {7915, 1, &rule22},
- {7916, 1, &rule21},
- {7917, 1, &rule22},
- {7918, 1, &rule21},
- {7919, 1, &rule22},
- {7920, 1, &rule21},
- {7921, 1, &rule22},
- {7922, 1, &rule21},
- {7923, 1, &rule22},
- {7924, 1, &rule21},
- {7925, 1, &rule22},
- {7926, 1, &rule21},
- {7927, 1, &rule22},
- {7928, 1, &rule21},
- {7929, 1, &rule22},
- {7930, 1, &rule21},
- {7931, 1, &rule22},
- {7932, 1, &rule21},
- {7933, 1, &rule22},
- {7934, 1, &rule21},
- {7935, 1, &rule22},
- {7936, 8, &rule121},
- {7944, 8, &rule122},
- {7952, 6, &rule121},
- {7960, 6, &rule122},
- {7968, 8, &rule121},
- {7976, 8, &rule122},
- {7984, 8, &rule121},
- {7992, 8, &rule122},
- {8000, 6, &rule121},
- {8008, 6, &rule122},
- {8017, 1, &rule121},
- {8019, 1, &rule121},
- {8021, 1, &rule121},
- {8023, 1, &rule121},
- {8025, 1, &rule122},
- {8027, 1, &rule122},
- {8029, 1, &rule122},
- {8031, 1, &rule122},
- {8032, 8, &rule121},
- {8040, 8, &rule122},
- {8048, 2, &rule123},
- {8050, 4, &rule124},
- {8054, 2, &rule125},
- {8056, 2, &rule126},
- {8058, 2, &rule127},
- {8060, 2, &rule128},
- {8064, 8, &rule121},
- {8072, 8, &rule129},
- {8080, 8, &rule121},
- {8088, 8, &rule129},
- {8096, 8, &rule121},
- {8104, 8, &rule129},
- {8112, 2, &rule121},
- {8115, 1, &rule130},
- {8120, 2, &rule122},
- {8122, 2, &rule131},
- {8124, 1, &rule132},
- {8126, 1, &rule133},
- {8131, 1, &rule130},
- {8136, 4, &rule134},
- {8140, 1, &rule132},
- {8144, 2, &rule121},
- {8152, 2, &rule122},
- {8154, 2, &rule135},
- {8160, 2, &rule121},
- {8165, 1, &rule104},
- {8168, 2, &rule122},
- {8170, 2, &rule136},
- {8172, 1, &rule107},
- {8179, 1, &rule130},
- {8184, 2, &rule137},
- {8186, 2, &rule138},
- {8188, 1, &rule132},
- {8486, 1, &rule141},
- {8490, 1, &rule142},
- {8491, 1, &rule143},
- {8498, 1, &rule144},
- {8526, 1, &rule145},
- {8544, 16, &rule146},
- {8560, 16, &rule147},
- {8579, 1, &rule21},
- {8580, 1, &rule22},
- {9398, 26, &rule148},
- {9424, 26, &rule149},
- {11264, 47, &rule112},
- {11312, 47, &rule113},
- {11360, 1, &rule21},
- {11361, 1, &rule22},
- {11362, 1, &rule150},
- {11363, 1, &rule151},
- {11364, 1, &rule152},
- {11365, 1, &rule153},
- {11366, 1, &rule154},
- {11367, 1, &rule21},
- {11368, 1, &rule22},
- {11369, 1, &rule21},
- {11370, 1, &rule22},
- {11371, 1, &rule21},
- {11372, 1, &rule22},
- {11373, 1, &rule155},
- {11374, 1, &rule156},
- {11375, 1, &rule157},
- {11376, 1, &rule158},
- {11378, 1, &rule21},
- {11379, 1, &rule22},
- {11381, 1, &rule21},
- {11382, 1, &rule22},
- {11390, 2, &rule159},
- {11392, 1, &rule21},
- {11393, 1, &rule22},
- {11394, 1, &rule21},
- {11395, 1, &rule22},
- {11396, 1, &rule21},
- {11397, 1, &rule22},
- {11398, 1, &rule21},
- {11399, 1, &rule22},
- {11400, 1, &rule21},
- {11401, 1, &rule22},
- {11402, 1, &rule21},
- {11403, 1, &rule22},
- {11404, 1, &rule21},
- {11405, 1, &rule22},
- {11406, 1, &rule21},
- {11407, 1, &rule22},
- {11408, 1, &rule21},
- {11409, 1, &rule22},
- {11410, 1, &rule21},
- {11411, 1, &rule22},
- {11412, 1, &rule21},
- {11413, 1, &rule22},
- {11414, 1, &rule21},
- {11415, 1, &rule22},
- {11416, 1, &rule21},
- {11417, 1, &rule22},
- {11418, 1, &rule21},
- {11419, 1, &rule22},
- {11420, 1, &rule21},
- {11421, 1, &rule22},
- {11422, 1, &rule21},
- {11423, 1, &rule22},
- {11424, 1, &rule21},
- {11425, 1, &rule22},
- {11426, 1, &rule21},
- {11427, 1, &rule22},
- {11428, 1, &rule21},
- {11429, 1, &rule22},
- {11430, 1, &rule21},
- {11431, 1, &rule22},
- {11432, 1, &rule21},
- {11433, 1, &rule22},
- {11434, 1, &rule21},
- {11435, 1, &rule22},
- {11436, 1, &rule21},
- {11437, 1, &rule22},
- {11438, 1, &rule21},
- {11439, 1, &rule22},
- {11440, 1, &rule21},
- {11441, 1, &rule22},
- {11442, 1, &rule21},
- {11443, 1, &rule22},
- {11444, 1, &rule21},
- {11445, 1, &rule22},
- {11446, 1, &rule21},
- {11447, 1, &rule22},
- {11448, 1, &rule21},
- {11449, 1, &rule22},
- {11450, 1, &rule21},
- {11451, 1, &rule22},
- {11452, 1, &rule21},
- {11453, 1, &rule22},
- {11454, 1, &rule21},
- {11455, 1, &rule22},
- {11456, 1, &rule21},
- {11457, 1, &rule22},
- {11458, 1, &rule21},
- {11459, 1, &rule22},
- {11460, 1, &rule21},
- {11461, 1, &rule22},
- {11462, 1, &rule21},
- {11463, 1, &rule22},
- {11464, 1, &rule21},
- {11465, 1, &rule22},
- {11466, 1, &rule21},
- {11467, 1, &rule22},
- {11468, 1, &rule21},
- {11469, 1, &rule22},
- {11470, 1, &rule21},
- {11471, 1, &rule22},
- {11472, 1, &rule21},
- {11473, 1, &rule22},
- {11474, 1, &rule21},
- {11475, 1, &rule22},
- {11476, 1, &rule21},
- {11477, 1, &rule22},
- {11478, 1, &rule21},
- {11479, 1, &rule22},
- {11480, 1, &rule21},
- {11481, 1, &rule22},
- {11482, 1, &rule21},
- {11483, 1, &rule22},
- {11484, 1, &rule21},
- {11485, 1, &rule22},
- {11486, 1, &rule21},
- {11487, 1, &rule22},
- {11488, 1, &rule21},
- {11489, 1, &rule22},
- {11490, 1, &rule21},
- {11491, 1, &rule22},
- {11499, 1, &rule21},
- {11500, 1, &rule22},
- {11501, 1, &rule21},
- {11502, 1, &rule22},
- {11520, 38, &rule160},
- {42560, 1, &rule21},
- {42561, 1, &rule22},
- {42562, 1, &rule21},
- {42563, 1, &rule22},
- {42564, 1, &rule21},
- {42565, 1, &rule22},
- {42566, 1, &rule21},
- {42567, 1, &rule22},
- {42568, 1, &rule21},
- {42569, 1, &rule22},
- {42570, 1, &rule21},
- {42571, 1, &rule22},
- {42572, 1, &rule21},
- {42573, 1, &rule22},
- {42574, 1, &rule21},
- {42575, 1, &rule22},
- {42576, 1, &rule21},
- {42577, 1, &rule22},
- {42578, 1, &rule21},
- {42579, 1, &rule22},
- {42580, 1, &rule21},
- {42581, 1, &rule22},
- {42582, 1, &rule21},
- {42583, 1, &rule22},
- {42584, 1, &rule21},
- {42585, 1, &rule22},
- {42586, 1, &rule21},
- {42587, 1, &rule22},
- {42588, 1, &rule21},
- {42589, 1, &rule22},
- {42590, 1, &rule21},
- {42591, 1, &rule22},
- {42592, 1, &rule21},
- {42593, 1, &rule22},
- {42594, 1, &rule21},
- {42595, 1, &rule22},
- {42596, 1, &rule21},
- {42597, 1, &rule22},
- {42598, 1, &rule21},
- {42599, 1, &rule22},
- {42600, 1, &rule21},
- {42601, 1, &rule22},
- {42602, 1, &rule21},
- {42603, 1, &rule22},
- {42604, 1, &rule21},
- {42605, 1, &rule22},
- {42624, 1, &rule21},
- {42625, 1, &rule22},
- {42626, 1, &rule21},
- {42627, 1, &rule22},
- {42628, 1, &rule21},
- {42629, 1, &rule22},
- {42630, 1, &rule21},
- {42631, 1, &rule22},
- {42632, 1, &rule21},
- {42633, 1, &rule22},
- {42634, 1, &rule21},
- {42635, 1, &rule22},
- {42636, 1, &rule21},
- {42637, 1, &rule22},
- {42638, 1, &rule21},
- {42639, 1, &rule22},
- {42640, 1, &rule21},
- {42641, 1, &rule22},
- {42642, 1, &rule21},
- {42643, 1, &rule22},
- {42644, 1, &rule21},
- {42645, 1, &rule22},
- {42646, 1, &rule21},
- {42647, 1, &rule22},
- {42786, 1, &rule21},
- {42787, 1, &rule22},
- {42788, 1, &rule21},
- {42789, 1, &rule22},
- {42790, 1, &rule21},
- {42791, 1, &rule22},
- {42792, 1, &rule21},
- {42793, 1, &rule22},
- {42794, 1, &rule21},
- {42795, 1, &rule22},
- {42796, 1, &rule21},
- {42797, 1, &rule22},
- {42798, 1, &rule21},
- {42799, 1, &rule22},
- {42802, 1, &rule21},
- {42803, 1, &rule22},
- {42804, 1, &rule21},
- {42805, 1, &rule22},
- {42806, 1, &rule21},
- {42807, 1, &rule22},
- {42808, 1, &rule21},
- {42809, 1, &rule22},
- {42810, 1, &rule21},
- {42811, 1, &rule22},
- {42812, 1, &rule21},
- {42813, 1, &rule22},
- {42814, 1, &rule21},
- {42815, 1, &rule22},
- {42816, 1, &rule21},
- {42817, 1, &rule22},
- {42818, 1, &rule21},
- {42819, 1, &rule22},
- {42820, 1, &rule21},
- {42821, 1, &rule22},
- {42822, 1, &rule21},
- {42823, 1, &rule22},
- {42824, 1, &rule21},
- {42825, 1, &rule22},
- {42826, 1, &rule21},
- {42827, 1, &rule22},
- {42828, 1, &rule21},
- {42829, 1, &rule22},
- {42830, 1, &rule21},
- {42831, 1, &rule22},
- {42832, 1, &rule21},
- {42833, 1, &rule22},
- {42834, 1, &rule21},
- {42835, 1, &rule22},
- {42836, 1, &rule21},
- {42837, 1, &rule22},
- {42838, 1, &rule21},
- {42839, 1, &rule22},
- {42840, 1, &rule21},
- {42841, 1, &rule22},
- {42842, 1, &rule21},
- {42843, 1, &rule22},
- {42844, 1, &rule21},
- {42845, 1, &rule22},
- {42846, 1, &rule21},
- {42847, 1, &rule22},
- {42848, 1, &rule21},
- {42849, 1, &rule22},
- {42850, 1, &rule21},
- {42851, 1, &rule22},
- {42852, 1, &rule21},
- {42853, 1, &rule22},
- {42854, 1, &rule21},
- {42855, 1, &rule22},
- {42856, 1, &rule21},
- {42857, 1, &rule22},
- {42858, 1, &rule21},
- {42859, 1, &rule22},
- {42860, 1, &rule21},
- {42861, 1, &rule22},
- {42862, 1, &rule21},
- {42863, 1, &rule22},
- {42873, 1, &rule21},
- {42874, 1, &rule22},
- {42875, 1, &rule21},
- {42876, 1, &rule22},
- {42877, 1, &rule161},
- {42878, 1, &rule21},
- {42879, 1, &rule22},
- {42880, 1, &rule21},
- {42881, 1, &rule22},
- {42882, 1, &rule21},
- {42883, 1, &rule22},
- {42884, 1, &rule21},
- {42885, 1, &rule22},
- {42886, 1, &rule21},
- {42887, 1, &rule22},
- {42891, 1, &rule21},
- {42892, 1, &rule22},
- {42893, 1, &rule162},
- {42896, 1, &rule21},
- {42897, 1, &rule22},
- {42912, 1, &rule21},
- {42913, 1, &rule22},
- {42914, 1, &rule21},
- {42915, 1, &rule22},
- {42916, 1, &rule21},
- {42917, 1, &rule22},
- {42918, 1, &rule21},
- {42919, 1, &rule22},
- {42920, 1, &rule21},
- {42921, 1, &rule22},
+ {1104, 16, &rule110},
+ {1120, 1, &rule22},
+ {1121, 1, &rule23},
+ {1122, 1, &rule22},
+ {1123, 1, &rule23},
+ {1124, 1, &rule22},
+ {1125, 1, &rule23},
+ {1126, 1, &rule22},
+ {1127, 1, &rule23},
+ {1128, 1, &rule22},
+ {1129, 1, &rule23},
+ {1130, 1, &rule22},
+ {1131, 1, &rule23},
+ {1132, 1, &rule22},
+ {1133, 1, &rule23},
+ {1134, 1, &rule22},
+ {1135, 1, &rule23},
+ {1136, 1, &rule22},
+ {1137, 1, &rule23},
+ {1138, 1, &rule22},
+ {1139, 1, &rule23},
+ {1140, 1, &rule22},
+ {1141, 1, &rule23},
+ {1142, 1, &rule22},
+ {1143, 1, &rule23},
+ {1144, 1, &rule22},
+ {1145, 1, &rule23},
+ {1146, 1, &rule22},
+ {1147, 1, &rule23},
+ {1148, 1, &rule22},
+ {1149, 1, &rule23},
+ {1150, 1, &rule22},
+ {1151, 1, &rule23},
+ {1152, 1, &rule22},
+ {1153, 1, &rule23},
+ {1162, 1, &rule22},
+ {1163, 1, &rule23},
+ {1164, 1, &rule22},
+ {1165, 1, &rule23},
+ {1166, 1, &rule22},
+ {1167, 1, &rule23},
+ {1168, 1, &rule22},
+ {1169, 1, &rule23},
+ {1170, 1, &rule22},
+ {1171, 1, &rule23},
+ {1172, 1, &rule22},
+ {1173, 1, &rule23},
+ {1174, 1, &rule22},
+ {1175, 1, &rule23},
+ {1176, 1, &rule22},
+ {1177, 1, &rule23},
+ {1178, 1, &rule22},
+ {1179, 1, &rule23},
+ {1180, 1, &rule22},
+ {1181, 1, &rule23},
+ {1182, 1, &rule22},
+ {1183, 1, &rule23},
+ {1184, 1, &rule22},
+ {1185, 1, &rule23},
+ {1186, 1, &rule22},
+ {1187, 1, &rule23},
+ {1188, 1, &rule22},
+ {1189, 1, &rule23},
+ {1190, 1, &rule22},
+ {1191, 1, &rule23},
+ {1192, 1, &rule22},
+ {1193, 1, &rule23},
+ {1194, 1, &rule22},
+ {1195, 1, &rule23},
+ {1196, 1, &rule22},
+ {1197, 1, &rule23},
+ {1198, 1, &rule22},
+ {1199, 1, &rule23},
+ {1200, 1, &rule22},
+ {1201, 1, &rule23},
+ {1202, 1, &rule22},
+ {1203, 1, &rule23},
+ {1204, 1, &rule22},
+ {1205, 1, &rule23},
+ {1206, 1, &rule22},
+ {1207, 1, &rule23},
+ {1208, 1, &rule22},
+ {1209, 1, &rule23},
+ {1210, 1, &rule22},
+ {1211, 1, &rule23},
+ {1212, 1, &rule22},
+ {1213, 1, &rule23},
+ {1214, 1, &rule22},
+ {1215, 1, &rule23},
+ {1216, 1, &rule118},
+ {1217, 1, &rule22},
+ {1218, 1, &rule23},
+ {1219, 1, &rule22},
+ {1220, 1, &rule23},
+ {1221, 1, &rule22},
+ {1222, 1, &rule23},
+ {1223, 1, &rule22},
+ {1224, 1, &rule23},
+ {1225, 1, &rule22},
+ {1226, 1, &rule23},
+ {1227, 1, &rule22},
+ {1228, 1, &rule23},
+ {1229, 1, &rule22},
+ {1230, 1, &rule23},
+ {1231, 1, &rule119},
+ {1232, 1, &rule22},
+ {1233, 1, &rule23},
+ {1234, 1, &rule22},
+ {1235, 1, &rule23},
+ {1236, 1, &rule22},
+ {1237, 1, &rule23},
+ {1238, 1, &rule22},
+ {1239, 1, &rule23},
+ {1240, 1, &rule22},
+ {1241, 1, &rule23},
+ {1242, 1, &rule22},
+ {1243, 1, &rule23},
+ {1244, 1, &rule22},
+ {1245, 1, &rule23},
+ {1246, 1, &rule22},
+ {1247, 1, &rule23},
+ {1248, 1, &rule22},
+ {1249, 1, &rule23},
+ {1250, 1, &rule22},
+ {1251, 1, &rule23},
+ {1252, 1, &rule22},
+ {1253, 1, &rule23},
+ {1254, 1, &rule22},
+ {1255, 1, &rule23},
+ {1256, 1, &rule22},
+ {1257, 1, &rule23},
+ {1258, 1, &rule22},
+ {1259, 1, &rule23},
+ {1260, 1, &rule22},
+ {1261, 1, &rule23},
+ {1262, 1, &rule22},
+ {1263, 1, &rule23},
+ {1264, 1, &rule22},
+ {1265, 1, &rule23},
+ {1266, 1, &rule22},
+ {1267, 1, &rule23},
+ {1268, 1, &rule22},
+ {1269, 1, &rule23},
+ {1270, 1, &rule22},
+ {1271, 1, &rule23},
+ {1272, 1, &rule22},
+ {1273, 1, &rule23},
+ {1274, 1, &rule22},
+ {1275, 1, &rule23},
+ {1276, 1, &rule22},
+ {1277, 1, &rule23},
+ {1278, 1, &rule22},
+ {1279, 1, &rule23},
+ {1280, 1, &rule22},
+ {1281, 1, &rule23},
+ {1282, 1, &rule22},
+ {1283, 1, &rule23},
+ {1284, 1, &rule22},
+ {1285, 1, &rule23},
+ {1286, 1, &rule22},
+ {1287, 1, &rule23},
+ {1288, 1, &rule22},
+ {1289, 1, &rule23},
+ {1290, 1, &rule22},
+ {1291, 1, &rule23},
+ {1292, 1, &rule22},
+ {1293, 1, &rule23},
+ {1294, 1, &rule22},
+ {1295, 1, &rule23},
+ {1296, 1, &rule22},
+ {1297, 1, &rule23},
+ {1298, 1, &rule22},
+ {1299, 1, &rule23},
+ {1300, 1, &rule22},
+ {1301, 1, &rule23},
+ {1302, 1, &rule22},
+ {1303, 1, &rule23},
+ {1304, 1, &rule22},
+ {1305, 1, &rule23},
+ {1306, 1, &rule22},
+ {1307, 1, &rule23},
+ {1308, 1, &rule22},
+ {1309, 1, &rule23},
+ {1310, 1, &rule22},
+ {1311, 1, &rule23},
+ {1312, 1, &rule22},
+ {1313, 1, &rule23},
+ {1314, 1, &rule22},
+ {1315, 1, &rule23},
+ {1316, 1, &rule22},
+ {1317, 1, &rule23},
+ {1318, 1, &rule22},
+ {1319, 1, &rule23},
+ {1320, 1, &rule22},
+ {1321, 1, &rule23},
+ {1322, 1, &rule22},
+ {1323, 1, &rule23},
+ {1324, 1, &rule22},
+ {1325, 1, &rule23},
+ {1326, 1, &rule22},
+ {1327, 1, &rule23},
+ {1329, 38, &rule120},
+ {1377, 38, &rule121},
+ {4256, 38, &rule123},
+ {4295, 1, &rule123},
+ {4301, 1, &rule123},
+ {7545, 1, &rule125},
+ {7549, 1, &rule126},
+ {7680, 1, &rule22},
+ {7681, 1, &rule23},
+ {7682, 1, &rule22},
+ {7683, 1, &rule23},
+ {7684, 1, &rule22},
+ {7685, 1, &rule23},
+ {7686, 1, &rule22},
+ {7687, 1, &rule23},
+ {7688, 1, &rule22},
+ {7689, 1, &rule23},
+ {7690, 1, &rule22},
+ {7691, 1, &rule23},
+ {7692, 1, &rule22},
+ {7693, 1, &rule23},
+ {7694, 1, &rule22},
+ {7695, 1, &rule23},
+ {7696, 1, &rule22},
+ {7697, 1, &rule23},
+ {7698, 1, &rule22},
+ {7699, 1, &rule23},
+ {7700, 1, &rule22},
+ {7701, 1, &rule23},
+ {7702, 1, &rule22},
+ {7703, 1, &rule23},
+ {7704, 1, &rule22},
+ {7705, 1, &rule23},
+ {7706, 1, &rule22},
+ {7707, 1, &rule23},
+ {7708, 1, &rule22},
+ {7709, 1, &rule23},
+ {7710, 1, &rule22},
+ {7711, 1, &rule23},
+ {7712, 1, &rule22},
+ {7713, 1, &rule23},
+ {7714, 1, &rule22},
+ {7715, 1, &rule23},
+ {7716, 1, &rule22},
+ {7717, 1, &rule23},
+ {7718, 1, &rule22},
+ {7719, 1, &rule23},
+ {7720, 1, &rule22},
+ {7721, 1, &rule23},
+ {7722, 1, &rule22},
+ {7723, 1, &rule23},
+ {7724, 1, &rule22},
+ {7725, 1, &rule23},
+ {7726, 1, &rule22},
+ {7727, 1, &rule23},
+ {7728, 1, &rule22},
+ {7729, 1, &rule23},
+ {7730, 1, &rule22},
+ {7731, 1, &rule23},
+ {7732, 1, &rule22},
+ {7733, 1, &rule23},
+ {7734, 1, &rule22},
+ {7735, 1, &rule23},
+ {7736, 1, &rule22},
+ {7737, 1, &rule23},
+ {7738, 1, &rule22},
+ {7739, 1, &rule23},
+ {7740, 1, &rule22},
+ {7741, 1, &rule23},
+ {7742, 1, &rule22},
+ {7743, 1, &rule23},
+ {7744, 1, &rule22},
+ {7745, 1, &rule23},
+ {7746, 1, &rule22},
+ {7747, 1, &rule23},
+ {7748, 1, &rule22},
+ {7749, 1, &rule23},
+ {7750, 1, &rule22},
+ {7751, 1, &rule23},
+ {7752, 1, &rule22},
+ {7753, 1, &rule23},
+ {7754, 1, &rule22},
+ {7755, 1, &rule23},
+ {7756, 1, &rule22},
+ {7757, 1, &rule23},
+ {7758, 1, &rule22},
+ {7759, 1, &rule23},
+ {7760, 1, &rule22},
+ {7761, 1, &rule23},
+ {7762, 1, &rule22},
+ {7763, 1, &rule23},
+ {7764, 1, &rule22},
+ {7765, 1, &rule23},
+ {7766, 1, &rule22},
+ {7767, 1, &rule23},
+ {7768, 1, &rule22},
+ {7769, 1, &rule23},
+ {7770, 1, &rule22},
+ {7771, 1, &rule23},
+ {7772, 1, &rule22},
+ {7773, 1, &rule23},
+ {7774, 1, &rule22},
+ {7775, 1, &rule23},
+ {7776, 1, &rule22},
+ {7777, 1, &rule23},
+ {7778, 1, &rule22},
+ {7779, 1, &rule23},
+ {7780, 1, &rule22},
+ {7781, 1, &rule23},
+ {7782, 1, &rule22},
+ {7783, 1, &rule23},
+ {7784, 1, &rule22},
+ {7785, 1, &rule23},
+ {7786, 1, &rule22},
+ {7787, 1, &rule23},
+ {7788, 1, &rule22},
+ {7789, 1, &rule23},
+ {7790, 1, &rule22},
+ {7791, 1, &rule23},
+ {7792, 1, &rule22},
+ {7793, 1, &rule23},
+ {7794, 1, &rule22},
+ {7795, 1, &rule23},
+ {7796, 1, &rule22},
+ {7797, 1, &rule23},
+ {7798, 1, &rule22},
+ {7799, 1, &rule23},
+ {7800, 1, &rule22},
+ {7801, 1, &rule23},
+ {7802, 1, &rule22},
+ {7803, 1, &rule23},
+ {7804, 1, &rule22},
+ {7805, 1, &rule23},
+ {7806, 1, &rule22},
+ {7807, 1, &rule23},
+ {7808, 1, &rule22},
+ {7809, 1, &rule23},
+ {7810, 1, &rule22},
+ {7811, 1, &rule23},
+ {7812, 1, &rule22},
+ {7813, 1, &rule23},
+ {7814, 1, &rule22},
+ {7815, 1, &rule23},
+ {7816, 1, &rule22},
+ {7817, 1, &rule23},
+ {7818, 1, &rule22},
+ {7819, 1, &rule23},
+ {7820, 1, &rule22},
+ {7821, 1, &rule23},
+ {7822, 1, &rule22},
+ {7823, 1, &rule23},
+ {7824, 1, &rule22},
+ {7825, 1, &rule23},
+ {7826, 1, &rule22},
+ {7827, 1, &rule23},
+ {7828, 1, &rule22},
+ {7829, 1, &rule23},
+ {7835, 1, &rule127},
+ {7838, 1, &rule128},
+ {7840, 1, &rule22},
+ {7841, 1, &rule23},
+ {7842, 1, &rule22},
+ {7843, 1, &rule23},
+ {7844, 1, &rule22},
+ {7845, 1, &rule23},
+ {7846, 1, &rule22},
+ {7847, 1, &rule23},
+ {7848, 1, &rule22},
+ {7849, 1, &rule23},
+ {7850, 1, &rule22},
+ {7851, 1, &rule23},
+ {7852, 1, &rule22},
+ {7853, 1, &rule23},
+ {7854, 1, &rule22},
+ {7855, 1, &rule23},
+ {7856, 1, &rule22},
+ {7857, 1, &rule23},
+ {7858, 1, &rule22},
+ {7859, 1, &rule23},
+ {7860, 1, &rule22},
+ {7861, 1, &rule23},
+ {7862, 1, &rule22},
+ {7863, 1, &rule23},
+ {7864, 1, &rule22},
+ {7865, 1, &rule23},
+ {7866, 1, &rule22},
+ {7867, 1, &rule23},
+ {7868, 1, &rule22},
+ {7869, 1, &rule23},
+ {7870, 1, &rule22},
+ {7871, 1, &rule23},
+ {7872, 1, &rule22},
+ {7873, 1, &rule23},
+ {7874, 1, &rule22},
+ {7875, 1, &rule23},
+ {7876, 1, &rule22},
+ {7877, 1, &rule23},
+ {7878, 1, &rule22},
+ {7879, 1, &rule23},
+ {7880, 1, &rule22},
+ {7881, 1, &rule23},
+ {7882, 1, &rule22},
+ {7883, 1, &rule23},
+ {7884, 1, &rule22},
+ {7885, 1, &rule23},
+ {7886, 1, &rule22},
+ {7887, 1, &rule23},
+ {7888, 1, &rule22},
+ {7889, 1, &rule23},
+ {7890, 1, &rule22},
+ {7891, 1, &rule23},
+ {7892, 1, &rule22},
+ {7893, 1, &rule23},
+ {7894, 1, &rule22},
+ {7895, 1, &rule23},
+ {7896, 1, &rule22},
+ {7897, 1, &rule23},
+ {7898, 1, &rule22},
+ {7899, 1, &rule23},
+ {7900, 1, &rule22},
+ {7901, 1, &rule23},
+ {7902, 1, &rule22},
+ {7903, 1, &rule23},
+ {7904, 1, &rule22},
+ {7905, 1, &rule23},
+ {7906, 1, &rule22},
+ {7907, 1, &rule23},
+ {7908, 1, &rule22},
+ {7909, 1, &rule23},
+ {7910, 1, &rule22},
+ {7911, 1, &rule23},
+ {7912, 1, &rule22},
+ {7913, 1, &rule23},
+ {7914, 1, &rule22},
+ {7915, 1, &rule23},
+ {7916, 1, &rule22},
+ {7917, 1, &rule23},
+ {7918, 1, &rule22},
+ {7919, 1, &rule23},
+ {7920, 1, &rule22},
+ {7921, 1, &rule23},
+ {7922, 1, &rule22},
+ {7923, 1, &rule23},
+ {7924, 1, &rule22},
+ {7925, 1, &rule23},
+ {7926, 1, &rule22},
+ {7927, 1, &rule23},
+ {7928, 1, &rule22},
+ {7929, 1, &rule23},
+ {7930, 1, &rule22},
+ {7931, 1, &rule23},
+ {7932, 1, &rule22},
+ {7933, 1, &rule23},
+ {7934, 1, &rule22},
+ {7935, 1, &rule23},
+ {7936, 8, &rule129},
+ {7944, 8, &rule130},
+ {7952, 6, &rule129},
+ {7960, 6, &rule130},
+ {7968, 8, &rule129},
+ {7976, 8, &rule130},
+ {7984, 8, &rule129},
+ {7992, 8, &rule130},
+ {8000, 6, &rule129},
+ {8008, 6, &rule130},
+ {8017, 1, &rule129},
+ {8019, 1, &rule129},
+ {8021, 1, &rule129},
+ {8023, 1, &rule129},
+ {8025, 1, &rule130},
+ {8027, 1, &rule130},
+ {8029, 1, &rule130},
+ {8031, 1, &rule130},
+ {8032, 8, &rule129},
+ {8040, 8, &rule130},
+ {8048, 2, &rule131},
+ {8050, 4, &rule132},
+ {8054, 2, &rule133},
+ {8056, 2, &rule134},
+ {8058, 2, &rule135},
+ {8060, 2, &rule136},
+ {8064, 8, &rule129},
+ {8072, 8, &rule137},
+ {8080, 8, &rule129},
+ {8088, 8, &rule137},
+ {8096, 8, &rule129},
+ {8104, 8, &rule137},
+ {8112, 2, &rule129},
+ {8115, 1, &rule138},
+ {8120, 2, &rule130},
+ {8122, 2, &rule139},
+ {8124, 1, &rule140},
+ {8126, 1, &rule141},
+ {8131, 1, &rule138},
+ {8136, 4, &rule142},
+ {8140, 1, &rule140},
+ {8144, 2, &rule129},
+ {8152, 2, &rule130},
+ {8154, 2, &rule143},
+ {8160, 2, &rule129},
+ {8165, 1, &rule111},
+ {8168, 2, &rule130},
+ {8170, 2, &rule144},
+ {8172, 1, &rule115},
+ {8179, 1, &rule138},
+ {8184, 2, &rule145},
+ {8186, 2, &rule146},
+ {8188, 1, &rule140},
+ {8486, 1, &rule149},
+ {8490, 1, &rule150},
+ {8491, 1, &rule151},
+ {8498, 1, &rule152},
+ {8526, 1, &rule153},
+ {8544, 16, &rule154},
+ {8560, 16, &rule155},
+ {8579, 1, &rule22},
+ {8580, 1, &rule23},
+ {9398, 26, &rule156},
+ {9424, 26, &rule157},
+ {11264, 47, &rule120},
+ {11312, 47, &rule121},
+ {11360, 1, &rule22},
+ {11361, 1, &rule23},
+ {11362, 1, &rule158},
+ {11363, 1, &rule159},
+ {11364, 1, &rule160},
+ {11365, 1, &rule161},
+ {11366, 1, &rule162},
+ {11367, 1, &rule22},
+ {11368, 1, &rule23},
+ {11369, 1, &rule22},
+ {11370, 1, &rule23},
+ {11371, 1, &rule22},
+ {11372, 1, &rule23},
+ {11373, 1, &rule163},
+ {11374, 1, &rule164},
+ {11375, 1, &rule165},
+ {11376, 1, &rule166},
+ {11378, 1, &rule22},
+ {11379, 1, &rule23},
+ {11381, 1, &rule22},
+ {11382, 1, &rule23},
+ {11390, 2, &rule167},
+ {11392, 1, &rule22},
+ {11393, 1, &rule23},
+ {11394, 1, &rule22},
+ {11395, 1, &rule23},
+ {11396, 1, &rule22},
+ {11397, 1, &rule23},
+ {11398, 1, &rule22},
+ {11399, 1, &rule23},
+ {11400, 1, &rule22},
+ {11401, 1, &rule23},
+ {11402, 1, &rule22},
+ {11403, 1, &rule23},
+ {11404, 1, &rule22},
+ {11405, 1, &rule23},
+ {11406, 1, &rule22},
+ {11407, 1, &rule23},
+ {11408, 1, &rule22},
+ {11409, 1, &rule23},
+ {11410, 1, &rule22},
+ {11411, 1, &rule23},
+ {11412, 1, &rule22},
+ {11413, 1, &rule23},
+ {11414, 1, &rule22},
+ {11415, 1, &rule23},
+ {11416, 1, &rule22},
+ {11417, 1, &rule23},
+ {11418, 1, &rule22},
+ {11419, 1, &rule23},
+ {11420, 1, &rule22},
+ {11421, 1, &rule23},
+ {11422, 1, &rule22},
+ {11423, 1, &rule23},
+ {11424, 1, &rule22},
+ {11425, 1, &rule23},
+ {11426, 1, &rule22},
+ {11427, 1, &rule23},
+ {11428, 1, &rule22},
+ {11429, 1, &rule23},
+ {11430, 1, &rule22},
+ {11431, 1, &rule23},
+ {11432, 1, &rule22},
+ {11433, 1, &rule23},
+ {11434, 1, &rule22},
+ {11435, 1, &rule23},
+ {11436, 1, &rule22},
+ {11437, 1, &rule23},
+ {11438, 1, &rule22},
+ {11439, 1, &rule23},
+ {11440, 1, &rule22},
+ {11441, 1, &rule23},
+ {11442, 1, &rule22},
+ {11443, 1, &rule23},
+ {11444, 1, &rule22},
+ {11445, 1, &rule23},
+ {11446, 1, &rule22},
+ {11447, 1, &rule23},
+ {11448, 1, &rule22},
+ {11449, 1, &rule23},
+ {11450, 1, &rule22},
+ {11451, 1, &rule23},
+ {11452, 1, &rule22},
+ {11453, 1, &rule23},
+ {11454, 1, &rule22},
+ {11455, 1, &rule23},
+ {11456, 1, &rule22},
+ {11457, 1, &rule23},
+ {11458, 1, &rule22},
+ {11459, 1, &rule23},
+ {11460, 1, &rule22},
+ {11461, 1, &rule23},
+ {11462, 1, &rule22},
+ {11463, 1, &rule23},
+ {11464, 1, &rule22},
+ {11465, 1, &rule23},
+ {11466, 1, &rule22},
+ {11467, 1, &rule23},
+ {11468, 1, &rule22},
+ {11469, 1, &rule23},
+ {11470, 1, &rule22},
+ {11471, 1, &rule23},
+ {11472, 1, &rule22},
+ {11473, 1, &rule23},
+ {11474, 1, &rule22},
+ {11475, 1, &rule23},
+ {11476, 1, &rule22},
+ {11477, 1, &rule23},
+ {11478, 1, &rule22},
+ {11479, 1, &rule23},
+ {11480, 1, &rule22},
+ {11481, 1, &rule23},
+ {11482, 1, &rule22},
+ {11483, 1, &rule23},
+ {11484, 1, &rule22},
+ {11485, 1, &rule23},
+ {11486, 1, &rule22},
+ {11487, 1, &rule23},
+ {11488, 1, &rule22},
+ {11489, 1, &rule23},
+ {11490, 1, &rule22},
+ {11491, 1, &rule23},
+ {11499, 1, &rule22},
+ {11500, 1, &rule23},
+ {11501, 1, &rule22},
+ {11502, 1, &rule23},
+ {11506, 1, &rule22},
+ {11507, 1, &rule23},
+ {11520, 38, &rule168},
+ {11559, 1, &rule168},
+ {11565, 1, &rule168},
+ {42560, 1, &rule22},
+ {42561, 1, &rule23},
+ {42562, 1, &rule22},
+ {42563, 1, &rule23},
+ {42564, 1, &rule22},
+ {42565, 1, &rule23},
+ {42566, 1, &rule22},
+ {42567, 1, &rule23},
+ {42568, 1, &rule22},
+ {42569, 1, &rule23},
+ {42570, 1, &rule22},
+ {42571, 1, &rule23},
+ {42572, 1, &rule22},
+ {42573, 1, &rule23},
+ {42574, 1, &rule22},
+ {42575, 1, &rule23},
+ {42576, 1, &rule22},
+ {42577, 1, &rule23},
+ {42578, 1, &rule22},
+ {42579, 1, &rule23},
+ {42580, 1, &rule22},
+ {42581, 1, &rule23},
+ {42582, 1, &rule22},
+ {42583, 1, &rule23},
+ {42584, 1, &rule22},
+ {42585, 1, &rule23},
+ {42586, 1, &rule22},
+ {42587, 1, &rule23},
+ {42588, 1, &rule22},
+ {42589, 1, &rule23},
+ {42590, 1, &rule22},
+ {42591, 1, &rule23},
+ {42592, 1, &rule22},
+ {42593, 1, &rule23},
+ {42594, 1, &rule22},
+ {42595, 1, &rule23},
+ {42596, 1, &rule22},
+ {42597, 1, &rule23},
+ {42598, 1, &rule22},
+ {42599, 1, &rule23},
+ {42600, 1, &rule22},
+ {42601, 1, &rule23},
+ {42602, 1, &rule22},
+ {42603, 1, &rule23},
+ {42604, 1, &rule22},
+ {42605, 1, &rule23},
+ {42624, 1, &rule22},
+ {42625, 1, &rule23},
+ {42626, 1, &rule22},
+ {42627, 1, &rule23},
+ {42628, 1, &rule22},
+ {42629, 1, &rule23},
+ {42630, 1, &rule22},
+ {42631, 1, &rule23},
+ {42632, 1, &rule22},
+ {42633, 1, &rule23},
+ {42634, 1, &rule22},
+ {42635, 1, &rule23},
+ {42636, 1, &rule22},
+ {42637, 1, &rule23},
+ {42638, 1, &rule22},
+ {42639, 1, &rule23},
+ {42640, 1, &rule22},
+ {42641, 1, &rule23},
+ {42642, 1, &rule22},
+ {42643, 1, &rule23},
+ {42644, 1, &rule22},
+ {42645, 1, &rule23},
+ {42646, 1, &rule22},
+ {42647, 1, &rule23},
+ {42648, 1, &rule22},
+ {42649, 1, &rule23},
+ {42650, 1, &rule22},
+ {42651, 1, &rule23},
+ {42786, 1, &rule22},
+ {42787, 1, &rule23},
+ {42788, 1, &rule22},
+ {42789, 1, &rule23},
+ {42790, 1, &rule22},
+ {42791, 1, &rule23},
+ {42792, 1, &rule22},
+ {42793, 1, &rule23},
+ {42794, 1, &rule22},
+ {42795, 1, &rule23},
+ {42796, 1, &rule22},
+ {42797, 1, &rule23},
+ {42798, 1, &rule22},
+ {42799, 1, &rule23},
+ {42802, 1, &rule22},
+ {42803, 1, &rule23},
+ {42804, 1, &rule22},
+ {42805, 1, &rule23},
+ {42806, 1, &rule22},
+ {42807, 1, &rule23},
+ {42808, 1, &rule22},
+ {42809, 1, &rule23},
+ {42810, 1, &rule22},
+ {42811, 1, &rule23},
+ {42812, 1, &rule22},
+ {42813, 1, &rule23},
+ {42814, 1, &rule22},
+ {42815, 1, &rule23},
+ {42816, 1, &rule22},
+ {42817, 1, &rule23},
+ {42818, 1, &rule22},
+ {42819, 1, &rule23},
+ {42820, 1, &rule22},
+ {42821, 1, &rule23},
+ {42822, 1, &rule22},
+ {42823, 1, &rule23},
+ {42824, 1, &rule22},
+ {42825, 1, &rule23},
+ {42826, 1, &rule22},
+ {42827, 1, &rule23},
+ {42828, 1, &rule22},
+ {42829, 1, &rule23},
+ {42830, 1, &rule22},
+ {42831, 1, &rule23},
+ {42832, 1, &rule22},
+ {42833, 1, &rule23},
+ {42834, 1, &rule22},
+ {42835, 1, &rule23},
+ {42836, 1, &rule22},
+ {42837, 1, &rule23},
+ {42838, 1, &rule22},
+ {42839, 1, &rule23},
+ {42840, 1, &rule22},
+ {42841, 1, &rule23},
+ {42842, 1, &rule22},
+ {42843, 1, &rule23},
+ {42844, 1, &rule22},
+ {42845, 1, &rule23},
+ {42846, 1, &rule22},
+ {42847, 1, &rule23},
+ {42848, 1, &rule22},
+ {42849, 1, &rule23},
+ {42850, 1, &rule22},
+ {42851, 1, &rule23},
+ {42852, 1, &rule22},
+ {42853, 1, &rule23},
+ {42854, 1, &rule22},
+ {42855, 1, &rule23},
+ {42856, 1, &rule22},
+ {42857, 1, &rule23},
+ {42858, 1, &rule22},
+ {42859, 1, &rule23},
+ {42860, 1, &rule22},
+ {42861, 1, &rule23},
+ {42862, 1, &rule22},
+ {42863, 1, &rule23},
+ {42873, 1, &rule22},
+ {42874, 1, &rule23},
+ {42875, 1, &rule22},
+ {42876, 1, &rule23},
+ {42877, 1, &rule169},
+ {42878, 1, &rule22},
+ {42879, 1, &rule23},
+ {42880, 1, &rule22},
+ {42881, 1, &rule23},
+ {42882, 1, &rule22},
+ {42883, 1, &rule23},
+ {42884, 1, &rule22},
+ {42885, 1, &rule23},
+ {42886, 1, &rule22},
+ {42887, 1, &rule23},
+ {42891, 1, &rule22},
+ {42892, 1, &rule23},
+ {42893, 1, &rule170},
+ {42896, 1, &rule22},
+ {42897, 1, &rule23},
+ {42898, 1, &rule22},
+ {42899, 1, &rule23},
+ {42902, 1, &rule22},
+ {42903, 1, &rule23},
+ {42904, 1, &rule22},
+ {42905, 1, &rule23},
+ {42906, 1, &rule22},
+ {42907, 1, &rule23},
+ {42908, 1, &rule22},
+ {42909, 1, &rule23},
+ {42910, 1, &rule22},
+ {42911, 1, &rule23},
+ {42912, 1, &rule22},
+ {42913, 1, &rule23},
+ {42914, 1, &rule22},
+ {42915, 1, &rule23},
+ {42916, 1, &rule22},
+ {42917, 1, &rule23},
+ {42918, 1, &rule22},
+ {42919, 1, &rule23},
+ {42920, 1, &rule22},
+ {42921, 1, &rule23},
+ {42922, 1, &rule171},
+ {42923, 1, &rule172},
+ {42924, 1, &rule173},
+ {42925, 1, &rule174},
+ {42928, 1, &rule175},
+ {42929, 1, &rule176},
{65313, 26, &rule9},
{65345, 26, &rule12},
- {66560, 40, &rule165},
- {66600, 40, &rule166}
+ {66560, 40, &rule179},
+ {66600, 40, &rule180},
+ {71840, 32, &rule9},
+ {71872, 32, &rule12}
};
static const struct _charblock_ spacechars[]={
{32, 1, &rule1},
{160, 1, &rule1},
{5760, 1, &rule1},
- {6158, 1, &rule1},
{8192, 11, &rule1},
{8239, 1, &rule1},
{8287, 1, &rule1},
diff --git a/libraries/base/cbits/ubconfc b/libraries/base/cbits/ubconfc
index fc768cc4d0..509049d664 100644
--- a/libraries/base/cbits/ubconfc
+++ b/libraries/base/cbits/ubconfc
@@ -20,6 +20,7 @@
echo "/*-------------------------------------------------------------------------"
echo "This is an automatically generated file: do not edit"
echo "Generated by `basename $0` at `date`"
+echo "@generated"
echo "-------------------------------------------------------------------------*/"
echo
echo "#include \"WCsubst.h\""
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index ed93b465c8..76fe87af68 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -84,6 +84,9 @@
* Remove deprecated `Data.OldTypeable` (#9639)
+ * New module `Data.Bifunctor` providing the `Bifunctor(bimap,first,second)`
+ class (previously defined in `bifunctors` package) (#9682)
+
## 4.7.0.1 *Jul 2014*
* Bundled with GHC 7.8.3
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index f80f5425d9..edb5fc3b16 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -86,6 +86,7 @@ test('exceptionsrun002', normal, compile_and_run, [''])
test('list001' , when(fast(), skip), compile_and_run, [''])
test('list002', when(fast(), skip), compile_and_run, [''])
test('list003', when(fast(), skip), compile_and_run, [''])
+test('isSuffixOf', normal, compile_and_run, [''])
test('memo001',
[extra_run_opts('+RTS -A10k -RTS'),
diff --git a/libraries/base/tests/isSuffixOf.hs b/libraries/base/tests/isSuffixOf.hs
new file mode 100644
index 0000000000..bcbb77f394
--- /dev/null
+++ b/libraries/base/tests/isSuffixOf.hs
@@ -0,0 +1,10 @@
+module Main (main) where
+import Data.List
+
+needles = ["","1","2","12","123","1234"]
+haystacks = ["","a","ab","abc","1","2","3","a1","1a",
+ "23","123","a123","ab123","abc123"]
+
+main :: IO()
+main = mapM_ print $ [needle `isSuffixOf` haystack
+ | needle <- needles, haystack <- haystacks]
diff --git a/libraries/base/tests/isSuffixOf.stdout b/libraries/base/tests/isSuffixOf.stdout
new file mode 100644
index 0000000000..adba3959ad
--- /dev/null
+++ b/libraries/base/tests/isSuffixOf.stdout
@@ -0,0 +1,84 @@
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+True
+False
+False
+False
+False
+True
+False
+False
+True
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+True
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+True
+True
+True
+True
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
+False
diff --git a/libraries/base/tests/unicode002.stdout b/libraries/base/tests/unicode002.stdout
index 5c1f4c3342..800cce71af 100644
--- a/libraries/base/tests/unicode002.stdout
+++ b/libraries/base/tests/unicode002.stdout
@@ -169,7 +169,7 @@ Code C P S U L A D
167 F T F F F F F
168 F T F F F F F
169 F T F F F F F
-170 F T F F T T F
+170 F T F F F T F
171 F T F F F F F
172 F T F F F F F
173 F F F F F F F
@@ -185,7 +185,7 @@ Code C P S U L A D
183 F T F F F F F
184 F T F F F F F
185 F T F F F F F
-186 F T F F T T F
+186 F T F F F T F
187 F T F F F F F
188 F T F F F F F
189 F T F F F F F
@@ -894,7 +894,7 @@ Code C P S U L A D
892 F T F F T T F
893 F T F F T T F
894 F T F F F F F
-895 F F F F F F F
+895 F T F T F T F
896 F F F F F F F
897 F F F F F F F
898 F F F F F F F
@@ -1319,14 +1319,14 @@ Code C P S U L A D
1317 F T F F T T F
1318 F T F T F T F
1319 F T F F T T F
-1320 F F F F F F F
-1321 F F F F F F F
-1322 F F F F F F F
-1323 F F F F F F F
-1324 F F F F F F F
-1325 F F F F F F F
-1326 F F F F F F F
-1327 F F F F F F F
+1320 F T F T F T F
+1321 F T F F T T F
+1322 F T F T F T F
+1323 F T F F T T F
+1324 F T F T F T F
+1325 F T F F T T F
+1326 F T F T F T F
+1327 F T F F T T F
1328 F F F F F F F
1329 F T F T F T F
1330 F T F T F T F
@@ -1420,9 +1420,9 @@ Code C P S U L A D
1418 F T F F F F F
1419 F F F F F F F
1420 F F F F F F F
-1421 F F F F F F F
-1422 F F F F F F F
-1423 F F F F F F F
+1421 F T F F F F F
+1422 F T F F F F F
+1423 F T F F F F F
1424 F F F F F F F
1425 F T F F F F F
1426 F T F F F F F
@@ -2207,25 +2207,25 @@ Code C P S U L A D
2205 F F F F F F F
2206 F F F F F F F
2207 F F F F F F F
-2208 F F F F F F F
-2209 F F F F F F F
-2210 F F F F F F F
-2211 F F F F F F F
-2212 F F F F F F F
-2213 F F F F F F F
-2214 F F F F F F F
-2215 F F F F F F F
-2216 F F F F F F F
-2217 F F F F F F F
-2218 F F F F F F F
-2219 F F F F F F F
-2220 F F F F F F F
-2221 F F F F F F F
-2222 F F F F F F F
-2223 F F F F F F F
-2224 F F F F F F F
-2225 F F F F F F F
-2226 F F F F F F F
+2208 F T F F F T F
+2209 F T F F F T F
+2210 F T F F F T F
+2211 F T F F F T F
+2212 F T F F F T F
+2213 F T F F F T F
+2214 F T F F F T F
+2215 F T F F F T F
+2216 F T F F F T F
+2217 F T F F F T F
+2218 F T F F F T F
+2219 F T F F F T F
+2220 F T F F F T F
+2221 F T F F F T F
+2222 F T F F F T F
+2223 F T F F F T F
+2224 F T F F F T F
+2225 F T F F F T F
+2226 F T F F F T F
2227 F F F F F F F
2228 F F F F F F F
2229 F F F F F F F
@@ -2275,34 +2275,34 @@ Code C P S U L A D
2273 F F F F F F F
2274 F F F F F F F
2275 F F F F F F F
-2276 F F F F F F F
-2277 F F F F F F F
-2278 F F F F F F F
-2279 F F F F F F F
-2280 F F F F F F F
-2281 F F F F F F F
-2282 F F F F F F F
-2283 F F F F F F F
-2284 F F F F F F F
-2285 F F F F F F F
-2286 F F F F F F F
-2287 F F F F F F F
-2288 F F F F F F F
-2289 F F F F F F F
-2290 F F F F F F F
-2291 F F F F F F F
-2292 F F F F F F F
-2293 F F F F F F F
-2294 F F F F F F F
-2295 F F F F F F F
-2296 F F F F F F F
-2297 F F F F F F F
-2298 F F F F F F F
-2299 F F F F F F F
-2300 F F F F F F F
-2301 F F F F F F F
-2302 F F F F F F F
-2303 F F F F F F F
+2276 F T F F F F F
+2277 F T F F F F F
+2278 F T F F F F F
+2279 F T F F F F F
+2280 F T F F F F F
+2281 F T F F F F F
+2282 F T F F F F F
+2283 F T F F F F F
+2284 F T F F F F F
+2285 F T F F F F F
+2286 F T F F F F F
+2287 F T F F F F F
+2288 F T F F F F F
+2289 F T F F F F F
+2290 F T F F F F F
+2291 F T F F F F F
+2292 F T F F F F F
+2293 F T F F F F F
+2294 F T F F F F F
+2295 F T F F F F F
+2296 F T F F F F F
+2297 F T F F F F F
+2298 F T F F F F F
+2299 F T F F F F F
+2300 F T F F F F F
+2301 F T F F F F F
+2302 F T F F F F F
+2303 F T F F F F F
2304 F T F F F F F
2305 F T F F F F F
2306 F T F F F F F
@@ -2423,7 +2423,7 @@ Code C P S U L A D
2421 F T F F F T F
2422 F T F F F T F
2423 F T F F F T F
-2424 F F F F F F F
+2424 F T F F F T F
2425 F T F F F T F
2426 F T F F F T F
2427 F T F F F T F
@@ -2431,7 +2431,7 @@ Code C P S U L A D
2429 F T F F F T F
2430 F T F F F T F
2431 F T F F F T F
-2432 F F F F F F F
+2432 F T F F F T F
2433 F T F F F F F
2434 F T F F F F F
2435 F T F F F F F
@@ -2799,7 +2799,7 @@ Code C P S U L A D
2797 F T F F F F F
2798 F T F F F F F
2799 F T F F F F F
-2800 F F F F F F F
+2800 F T F F F F F
2801 F T F F F F F
2802 F F F F F F F
2803 F F F F F F F
@@ -3071,7 +3071,7 @@ Code C P S U L A D
3069 F F F F F F F
3070 F F F F F F F
3071 F F F F F F F
-3072 F F F F F F F
+3072 F T F F F F F
3073 F T F F F F F
3074 F T F F F F F
3075 F T F F F F F
@@ -3123,7 +3123,7 @@ Code C P S U L A D
3121 F T F F F T F
3122 F T F F F T F
3123 F T F F F T F
-3124 F F F F F F F
+3124 F T F F F T F
3125 F T F F F T F
3126 F T F F F T F
3127 F T F F F T F
@@ -3200,7 +3200,7 @@ Code C P S U L A D
3198 F T F F F F F
3199 F T F F F F F
3200 F F F F F F F
-3201 F F F F F F F
+3201 F T F F F F F
3202 F T F F F F F
3203 F T F F F F F
3204 F F F F F F F
@@ -3328,7 +3328,7 @@ Code C P S U L A D
3326 F F F F F F F
3327 F F F F F F F
3328 F F F F F F F
-3329 F F F F F F F
+3329 F T F F F F F
3330 F T F F F F F
3331 F T F F F F F
3332 F F F F F F F
@@ -3557,16 +3557,16 @@ Code C P S U L A D
3555 F F F F F F F
3556 F F F F F F F
3557 F F F F F F F
-3558 F F F F F F F
-3559 F F F F F F F
-3560 F F F F F F F
-3561 F F F F F F F
-3562 F F F F F F F
-3563 F F F F F F F
-3564 F F F F F F F
-3565 F F F F F F F
-3566 F F F F F F F
-3567 F F F F F F F
+3558 F T F F F F F
+3559 F T F F F F F
+3560 F T F F F F F
+3561 F T F F F F F
+3562 F T F F F F F
+3563 F T F F F F F
+3564 F T F F F F F
+3565 F T F F F F F
+3566 F T F F F F F
+3567 F T F F F F F
3568 F F F F F F F
3569 F F F F F F F
3570 F T F F F F F
@@ -3805,8 +3805,8 @@ Code C P S U L A D
3803 F F F F F F F
3804 F T F F F T F
3805 F T F F F T F
-3806 F F F F F F F
-3807 F F F F F F F
+3806 F T F F F T F
+3807 F T F F F T F
3808 F F F F F F F
3809 F F F F F F F
3810 F F F F F F F
@@ -4294,13 +4294,13 @@ Code C P S U L A D
4292 F T F T F T F
4293 F T F T F T F
4294 F F F F F F F
-4295 F F F F F F F
+4295 F T F T F T F
4296 F F F F F F F
4297 F F F F F F F
4298 F F F F F F F
4299 F F F F F F F
4300 F F F F F F F
-4301 F F F F F F F
+4301 F T F T F T F
4302 F F F F F F F
4303 F F F F F F F
4304 F T F F F T F
@@ -4348,9 +4348,9 @@ Code C P S U L A D
4346 F T F F F T F
4347 F T F F F F F
4348 F T F F F T F
-4349 F F F F F F F
-4350 F F F F F F F
-4351 F F F F F F F
+4349 F T F F F T F
+4350 F T F F F T F
+4351 F T F F F T F
4352 F T F F F T F
4353 F T F F F T F
4354 F T F F F T F
@@ -5872,14 +5872,14 @@ Code C P S U L A D
5870 F T F F F F F
5871 F T F F F F F
5872 F T F F F F F
-5873 F F F F F F F
-5874 F F F F F F F
-5875 F F F F F F F
-5876 F F F F F F F
-5877 F F F F F F F
-5878 F F F F F F F
-5879 F F F F F F F
-5880 F F F F F F F
+5873 F T F F F T F
+5874 F T F F F T F
+5875 F T F F F T F
+5876 F T F F F T F
+5877 F T F F F T F
+5878 F T F F F T F
+5879 F T F F F T F
+5880 F T F F F T F
5881 F F F F F F F
5882 F F F F F F F
5883 F F F F F F F
@@ -6067,8 +6067,8 @@ Code C P S U L A D
6065 F T F F F T F
6066 F T F F F T F
6067 F T F F F T F
-6068 F F F F F F F
-6069 F F F F F F F
+6068 F T F F F F F
+6069 F T F F F F F
6070 F T F F F F F
6071 F T F F F F F
6072 F T F F F F F
@@ -6157,7 +6157,7 @@ Code C P S U L A D
6155 F T F F F F F
6156 F T F F F F F
6157 F T F F F F F
-6158 F T T F F F F
+6158 F F F F F F F
6159 F F F F F F F
6160 F T F F F F F
6161 F T F F F F F
@@ -6428,8 +6428,8 @@ Code C P S U L A D
6426 F T F F F T F
6427 F T F F F T F
6428 F T F F F T F
-6429 F F F F F F F
-6430 F F F F F F F
+6429 F T F F F T F
+6430 F T F F F T F
6431 F F F F F F F
6432 F T F F F F F
6433 F T F F F F F
diff --git a/libraries/dph b/libraries/dph
-Subproject 3ebad521cd1e3b5573d97b483305ca465a9cba6
+Subproject 33eb2fb7e178c18f2afd0d537d791d021ff7523
diff --git a/libraries/ghc-prim/cbits/popcnt.c b/libraries/ghc-prim/cbits/popcnt.c
index fc44ee75a2..70662e8045 100644
--- a/libraries/ghc-prim/cbits/popcnt.c
+++ b/libraries/ghc-prim/cbits/popcnt.c
@@ -1,4 +1,5 @@
#include "Rts.h"
+#include "MachDeps.h"
static const unsigned char popcount_tab[] =
{
@@ -51,7 +52,7 @@ hs_popcnt64(StgWord64 x)
popcount_tab[(unsigned char)(x >> 56)];
}
-#ifdef i386_HOST_ARCH
+#if WORD_SIZE_IN_BITS == 32
extern StgWord hs_popcnt(StgWord x);
StgWord
@@ -63,7 +64,7 @@ hs_popcnt(StgWord x)
popcount_tab[(unsigned char)(x >> 24)];
}
-#else
+#elif WORD_SIZE_IN_BITS == 64
extern StgWord hs_popcnt(StgWord x);
StgWord
@@ -79,4 +80,8 @@ hs_popcnt(StgWord x)
popcount_tab[(unsigned char)(x >> 56)];
}
+#else
+
+#error Unknown machine word size
+
#endif
diff --git a/libraries/primitive b/libraries/primitive
-Subproject be63ee15d961dc1b08bc8853b9ff97708551ef3
+Subproject 29cb0db59803c9d9181f7c4ce35ef1c6cbc6ccf
diff --git a/libraries/vector b/libraries/vector
-Subproject a6049abce040713e9a5f175887cf70d12b9057c
+Subproject c0308f1c4f57859d9a8b10d504afe56eebbb27c
diff --git a/mk/validate-settings.mk b/mk/validate-settings.mk
index 734e28de7b..b05b289239 100644
--- a/mk/validate-settings.mk
+++ b/mk/validate-settings.mk
@@ -167,3 +167,12 @@ libraries/template-haskell_dist-install_EXTRA_HC_OPTS += -fno-warn-inline-rule-s
# We need -fno-warn-deprecated-flags to avoid failure with -Werror
GhcLibHcOpts += -fno-warn-deprecated-flags
GhcBootLibHcOpts += -fno-warn-deprecated-flags
+
+# The warning suppression flag below is a temporary kludge. While working with
+# modules that contain tabs, please de-tab them so this flag can be eventually
+# removed. See
+# http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
+# for details
+#
+GhcLibHcOpts += -fno-warn-tabs
+utils/hsc2hs_dist-install_EXTRA_HC_OPTS += -fno-warn-tabs
diff --git a/rts/Capability.c b/rts/Capability.c
index 8544944957..289eeb2c5b 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -130,7 +130,7 @@ findSpark (Capability *cap)
if (n_capabilities == 1) { return NULL; } // makes no sense...
debugTrace(DEBUG_sched,
- "cap %d: Trying to steal work from other capabilities",
+ "cap %d: Trying to steal work from other capabilities",
cap->no);
/* visit cap.s 0..n-1 in sequence until a theft succeeds. We could
@@ -158,7 +158,7 @@ findSpark (Capability *cap)
if (spark != NULL) {
cap->spark_stats.converted++;
traceEventSparkSteal(cap, robbed->no);
-
+
return spark;
}
// otherwise: no success, try next one
@@ -200,10 +200,10 @@ newReturningTask (Capability *cap, Task *task)
ASSERT_LOCK_HELD(&cap->lock);
ASSERT(task->next == NULL);
if (cap->returning_tasks_hd) {
- ASSERT(cap->returning_tasks_tl->next == NULL);
- cap->returning_tasks_tl->next = task;
+ ASSERT(cap->returning_tasks_tl->next == NULL);
+ cap->returning_tasks_tl->next = task;
} else {
- cap->returning_tasks_hd = task;
+ cap->returning_tasks_hd = task;
}
cap->returning_tasks_tl = task;
}
@@ -217,7 +217,7 @@ popReturningTask (Capability *cap)
ASSERT(task);
cap->returning_tasks_hd = task->next;
if (!cap->returning_tasks_hd) {
- cap->returning_tasks_tl = NULL;
+ cap->returning_tasks_tl = NULL;
}
task->next = NULL;
return task;
@@ -270,14 +270,14 @@ initCapability( Capability *cap, nat i )
cap->f.stgGCFun = (StgFunPtr)__stg_gc_fun;
cap->mut_lists = stgMallocBytes(sizeof(bdescr *) *
- RtsFlags.GcFlags.generations,
- "initCapability");
+ RtsFlags.GcFlags.generations,
+ "initCapability");
cap->saved_mut_lists = stgMallocBytes(sizeof(bdescr *) *
RtsFlags.GcFlags.generations,
"initCapability");
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- cap->mut_lists[g] = NULL;
+ cap->mut_lists[g] = NULL;
}
cap->weak_ptr_list_hd = NULL;
@@ -326,8 +326,8 @@ initCapabilities( void )
#ifndef REG_Base
// We can't support multiple CPUs if BaseReg is not a register
if (RtsFlags.ParFlags.nNodes > 1) {
- errorBelch("warning: multiple CPUs not supported in this build, reverting to 1");
- RtsFlags.ParFlags.nNodes = 1;
+ errorBelch("warning: multiple CPUs not supported in this build, reverting to 1");
+ RtsFlags.ParFlags.nNodes = 1;
}
#endif
@@ -364,7 +364,7 @@ moreCapabilities (nat from USED_IF_THREADS, nat to USED_IF_THREADS)
if (to == 1) {
// THREADED_RTS must work on builds that don't have a mutable
// BaseReg (eg. unregisterised), so in this case
- // capabilities[0] must coincide with &MainCapability.
+ // capabilities[0] must coincide with &MainCapability.
capabilities[0] = &MainCapability;
initCapability(&MainCapability, 0);
}
@@ -455,7 +455,7 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
#if defined(THREADED_RTS)
void
-releaseCapability_ (Capability* cap,
+releaseCapability_ (Capability* cap,
rtsBool always_wakeup)
{
Task *task;
@@ -469,9 +469,9 @@ releaseCapability_ (Capability* cap,
// Check to see whether a worker thread can be given
// the go-ahead to return the result of an external call..
if (cap->returning_tasks_hd != NULL) {
- giveCapabilityToTask(cap,cap->returning_tasks_hd);
- // The Task pops itself from the queue (see waitForReturnCapability())
- return;
+ giveCapabilityToTask(cap,cap->returning_tasks_hd);
+ // The Task pops itself from the queue (see waitForReturnCapability())
+ return;
}
// If there is a pending sync, then we should just leave the
@@ -481,44 +481,44 @@ releaseCapability_ (Capability* cap,
last_free_capability = cap; // needed?
debugTrace(DEBUG_sched, "sync pending, set capability %d free", cap->no);
return;
- }
+ }
// If the next thread on the run queue is a bound thread,
// give this Capability to the appropriate Task.
if (!emptyRunQueue(cap) && peekRunQueue(cap)->bound) {
- // Make sure we're not about to try to wake ourselves up
- // ASSERT(task != cap->run_queue_hd->bound);
+ // Make sure we're not about to try to wake ourselves up
+ // ASSERT(task != cap->run_queue_hd->bound);
// assertion is false: in schedule() we force a yield after
- // ThreadBlocked, but the thread may be back on the run queue
- // by now.
- task = peekRunQueue(cap)->bound->task;
- giveCapabilityToTask(cap, task);
- return;
+ // ThreadBlocked, but the thread may be back on the run queue
+ // by now.
+ task = peekRunQueue(cap)->bound->task;
+ giveCapabilityToTask(cap, task);
+ return;
}
if (!cap->spare_workers) {
- // Create a worker thread if we don't have one. If the system
- // is interrupted, we only create a worker task if there
- // are threads that need to be completed. If the system is
- // shutting down, we never create a new worker.
- if (sched_state < SCHED_SHUTTING_DOWN || !emptyRunQueue(cap)) {
- debugTrace(DEBUG_sched,
- "starting new worker on capability %d", cap->no);
- startWorkerTask(cap);
- return;
- }
+ // Create a worker thread if we don't have one. If the system
+ // is interrupted, we only create a worker task if there
+ // are threads that need to be completed. If the system is
+ // shutting down, we never create a new worker.
+ if (sched_state < SCHED_SHUTTING_DOWN || !emptyRunQueue(cap)) {
+ debugTrace(DEBUG_sched,
+ "starting new worker on capability %d", cap->no);
+ startWorkerTask(cap);
+ return;
+ }
}
// If we have an unbound thread on the run queue, or if there's
// anything else to do, give the Capability to a worker thread.
- if (always_wakeup ||
+ if (always_wakeup ||
!emptyRunQueue(cap) || !emptyInbox(cap) ||
(!cap->disabled && !emptySparkPoolCap(cap)) || globalWorkToDo()) {
- if (cap->spare_workers) {
- giveCapabilityToTask(cap, cap->spare_workers);
- // The worker Task pops itself from the queue;
- return;
- }
+ if (cap->spare_workers) {
+ giveCapabilityToTask(cap, cap->spare_workers);
+ // The worker Task pops itself from the queue;
+ return;
+ }
}
#ifdef PROFILING
@@ -612,29 +612,29 @@ waitForReturnCapability (Capability **pCap, Task *task)
Capability *cap = *pCap;
if (cap == NULL) {
- // Try last_free_capability first
- cap = last_free_capability;
- if (cap->running_task) {
- nat i;
- // otherwise, search for a free capability
+ // Try last_free_capability first
+ cap = last_free_capability;
+ if (cap->running_task) {
+ nat i;
+ // otherwise, search for a free capability
cap = NULL;
- for (i = 0; i < n_capabilities; i++) {
+ for (i = 0; i < n_capabilities; i++) {
if (!capabilities[i]->running_task) {
cap = capabilities[i];
- break;
- }
- }
+ break;
+ }
+ }
if (cap == NULL) {
// Can't find a free one, use last_free_capability.
cap = last_free_capability;
}
- }
+ }
- // record the Capability as the one this Task is now assocated with.
- task->cap = cap;
+ // record the Capability as the one this Task is now assocated with.
+ task->cap = cap;
} else {
- ASSERT(task->cap == cap);
+ ASSERT(task->cap == cap);
}
ACQUIRE_LOCK(&cap->lock);
@@ -642,36 +642,36 @@ waitForReturnCapability (Capability **pCap, Task *task)
debugTrace(DEBUG_sched, "returning; I want capability %d", cap->no);
if (!cap->running_task) {
- // It's free; just grab it
- cap->running_task = task;
- RELEASE_LOCK(&cap->lock);
+ // It's free; just grab it
+ cap->running_task = task;
+ RELEASE_LOCK(&cap->lock);
} else {
- newReturningTask(cap,task);
- RELEASE_LOCK(&cap->lock);
-
- for (;;) {
- ACQUIRE_LOCK(&task->lock);
- // task->lock held, cap->lock not held
- if (!task->wakeup) waitCondition(&task->cond, &task->lock);
- cap = task->cap;
- task->wakeup = rtsFalse;
- RELEASE_LOCK(&task->lock);
-
- // now check whether we should wake up...
- ACQUIRE_LOCK(&cap->lock);
- if (cap->running_task == NULL) {
- if (cap->returning_tasks_hd != task) {
- giveCapabilityToTask(cap,cap->returning_tasks_hd);
- RELEASE_LOCK(&cap->lock);
- continue;
- }
- cap->running_task = task;
- popReturningTask(cap);
- RELEASE_LOCK(&cap->lock);
- break;
- }
- RELEASE_LOCK(&cap->lock);
- }
+ newReturningTask(cap,task);
+ RELEASE_LOCK(&cap->lock);
+
+ for (;;) {
+ ACQUIRE_LOCK(&task->lock);
+ // task->lock held, cap->lock not held
+ if (!task->wakeup) waitCondition(&task->cond, &task->lock);
+ cap = task->cap;
+ task->wakeup = rtsFalse;
+ RELEASE_LOCK(&task->lock);
+
+ // now check whether we should wake up...
+ ACQUIRE_LOCK(&cap->lock);
+ if (cap->running_task == NULL) {
+ if (cap->returning_tasks_hd != task) {
+ giveCapabilityToTask(cap,cap->returning_tasks_hd);
+ RELEASE_LOCK(&cap->lock);
+ continue;
+ }
+ cap->running_task = task;
+ popReturningTask(cap);
+ RELEASE_LOCK(&cap->lock);
+ break;
+ }
+ RELEASE_LOCK(&cap->lock);
+ }
}
@@ -710,60 +710,60 @@ yieldCapability (Capability** pCap, Task *task, rtsBool gcAllowed)
}
}
- debugTrace(DEBUG_sched, "giving up capability %d", cap->no);
+ debugTrace(DEBUG_sched, "giving up capability %d", cap->no);
- // We must now release the capability and wait to be woken up
- // again.
- task->wakeup = rtsFalse;
- releaseCapabilityAndQueueWorker(cap);
+ // We must now release the capability and wait to be woken up
+ // again.
+ task->wakeup = rtsFalse;
+ releaseCapabilityAndQueueWorker(cap);
- for (;;) {
- ACQUIRE_LOCK(&task->lock);
- // task->lock held, cap->lock not held
- if (!task->wakeup) waitCondition(&task->cond, &task->lock);
- cap = task->cap;
- task->wakeup = rtsFalse;
- RELEASE_LOCK(&task->lock);
+ for (;;) {
+ ACQUIRE_LOCK(&task->lock);
+ // task->lock held, cap->lock not held
+ if (!task->wakeup) waitCondition(&task->cond, &task->lock);
+ cap = task->cap;
+ task->wakeup = rtsFalse;
+ RELEASE_LOCK(&task->lock);
- debugTrace(DEBUG_sched, "woken up on capability %d", cap->no);
+ debugTrace(DEBUG_sched, "woken up on capability %d", cap->no);
- ACQUIRE_LOCK(&cap->lock);
- if (cap->running_task != NULL) {
- debugTrace(DEBUG_sched,
- "capability %d is owned by another task", cap->no);
- RELEASE_LOCK(&cap->lock);
- continue;
- }
+ ACQUIRE_LOCK(&cap->lock);
+ if (cap->running_task != NULL) {
+ debugTrace(DEBUG_sched,
+ "capability %d is owned by another task", cap->no);
+ RELEASE_LOCK(&cap->lock);
+ continue;
+ }
if (task->cap != cap) {
// see Note [migrated bound threads]
debugTrace(DEBUG_sched,
"task has been migrated to cap %d", task->cap->no);
- RELEASE_LOCK(&cap->lock);
- continue;
- }
+ RELEASE_LOCK(&cap->lock);
+ continue;
+ }
if (task->incall->tso == NULL) {
- ASSERT(cap->spare_workers != NULL);
- // if we're not at the front of the queue, release it
- // again. This is unlikely to happen.
- if (cap->spare_workers != task) {
- giveCapabilityToTask(cap,cap->spare_workers);
- RELEASE_LOCK(&cap->lock);
- continue;
- }
- cap->spare_workers = task->next;
- task->next = NULL;
+ ASSERT(cap->spare_workers != NULL);
+ // if we're not at the front of the queue, release it
+ // again. This is unlikely to happen.
+ if (cap->spare_workers != task) {
+ giveCapabilityToTask(cap,cap->spare_workers);
+ RELEASE_LOCK(&cap->lock);
+ continue;
+ }
+ cap->spare_workers = task->next;
+ task->next = NULL;
cap->n_spare_workers--;
}
cap->running_task = task;
- RELEASE_LOCK(&cap->lock);
- break;
- }
+ RELEASE_LOCK(&cap->lock);
+ break;
+ }
debugTrace(DEBUG_sched, "resuming capability %d", cap->no);
- ASSERT(cap->running_task == task);
+ ASSERT(cap->running_task == task);
#ifdef PROFILING
cap->r.rCCCS = CCS_SYSTEM;
@@ -807,7 +807,7 @@ yieldCapability (Capability** pCap, Task *task, rtsBool gcAllowed)
/* ----------------------------------------------------------------------------
* prodCapability
*
- * If a Capability is currently idle, wake up a Task on it. Used to
+ * If a Capability is currently idle, wake up a Task on it. Used to
* get every Capability into the GC.
* ------------------------------------------------------------------------- */
@@ -835,8 +835,8 @@ tryGrabCapability (Capability *cap, Task *task)
if (cap->running_task != NULL) return rtsFalse;
ACQUIRE_LOCK(&cap->lock);
if (cap->running_task != NULL) {
- RELEASE_LOCK(&cap->lock);
- return rtsFalse;
+ RELEASE_LOCK(&cap->lock);
+ return rtsFalse;
}
task->cap = cap;
cap->running_task = task;
@@ -881,16 +881,16 @@ shutdownCapability (Capability *cap USED_IF_THREADS,
for (i = 0; /* i < 50 */; i++) {
ASSERT(sched_state == SCHED_SHUTTING_DOWN);
- debugTrace(DEBUG_sched,
- "shutting down capability %d, attempt %d", cap->no, i);
- ACQUIRE_LOCK(&cap->lock);
- if (cap->running_task) {
- RELEASE_LOCK(&cap->lock);
- debugTrace(DEBUG_sched, "not owner, yielding");
- yieldThread();
- continue;
- }
- cap->running_task = task;
+ debugTrace(DEBUG_sched,
+ "shutting down capability %d, attempt %d", cap->no, i);
+ ACQUIRE_LOCK(&cap->lock);
+ if (cap->running_task) {
+ RELEASE_LOCK(&cap->lock);
+ debugTrace(DEBUG_sched, "not owner, yielding");
+ yieldThread();
+ continue;
+ }
+ cap->running_task = task;
if (cap->spare_workers) {
// Look for workers that have died without removing
@@ -903,7 +903,7 @@ shutdownCapability (Capability *cap USED_IF_THREADS,
prev = NULL;
for (t = cap->spare_workers; t != NULL; t = t->next) {
if (!osThreadIsAlive(t->id)) {
- debugTrace(DEBUG_sched,
+ debugTrace(DEBUG_sched,
"worker thread %p has died unexpectedly", (void *)(size_t)t->id);
cap->n_spare_workers--;
if (!prev) {
@@ -916,14 +916,14 @@ shutdownCapability (Capability *cap USED_IF_THREADS,
}
}
- if (!emptyRunQueue(cap) || cap->spare_workers) {
- debugTrace(DEBUG_sched,
- "runnable threads or workers still alive, yielding");
- releaseCapability_(cap,rtsFalse); // this will wake up a worker
- RELEASE_LOCK(&cap->lock);
- yieldThread();
- continue;
- }
+ if (!emptyRunQueue(cap) || cap->spare_workers) {
+ debugTrace(DEBUG_sched,
+ "runnable threads or workers still alive, yielding");
+ releaseCapability_(cap,rtsFalse); // this will wake up a worker
+ RELEASE_LOCK(&cap->lock);
+ yieldThread();
+ continue;
+ }
// If "safe", then busy-wait for any threads currently doing
// foreign calls. If we're about to unload this DLL, for
@@ -932,10 +932,10 @@ shutdownCapability (Capability *cap USED_IF_THREADS,
// We can be a bit more relaxed when this is a standalone
// program that is about to terminate, and let safe=false.
if (cap->suspended_ccalls && safe) {
- debugTrace(DEBUG_sched,
- "thread(s) are involved in foreign calls, yielding");
+ debugTrace(DEBUG_sched,
+ "thread(s) are involved in foreign calls, yielding");
cap->running_task = NULL;
- RELEASE_LOCK(&cap->lock);
+ RELEASE_LOCK(&cap->lock);
// The IO manager thread might have been slow to start up,
// so the first attempt to kill it might not have
// succeeded. Just in case, try again - the kill message
@@ -949,14 +949,14 @@ shutdownCapability (Capability *cap USED_IF_THREADS,
}
traceSparkCounters(cap);
- RELEASE_LOCK(&cap->lock);
- break;
+ RELEASE_LOCK(&cap->lock);
+ break;
}
// we now have the Capability, its run queue and spare workers
// list are both empty.
// ToDo: we can't drop this mutex, because there might still be
- // threads performing foreign calls that will eventually try to
+ // threads performing foreign calls that will eventually try to
// return via resumeThread() and attempt to grab cap->lock.
// closeMutex(&cap->lock);
#endif
@@ -1068,7 +1068,7 @@ rtsBool checkSparkCountInvariant (void)
sparks.fizzled += capabilities[i]->spark_stats.fizzled;
remaining += sparkPoolSize(capabilities[i]->sparks);
}
-
+
/* The invariant is
* created = converted + remaining + gcd + fizzled
*/
diff --git a/rts/Capability.h b/rts/Capability.h
index 9ef7b24bb9..910c92c117 100644
--- a/rts/Capability.h
+++ b/rts/Capability.h
@@ -156,9 +156,9 @@ struct Capability_ {
#endif
// These properties should be true when a Task is holding a Capability
-#define ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task) \
- ASSERT(cap->running_task != NULL && cap->running_task == task); \
- ASSERT(task->cap == cap); \
+#define ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task) \
+ ASSERT(cap->running_task != NULL && cap->running_task == task); \
+ ASSERT(task->cap == cap); \
ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task)
// Sometimes a Task holds a Capability, but the Task is not associated
@@ -166,10 +166,10 @@ struct Capability_ {
// (a) a Task holds multiple Capabilities, and (b) when the current
// Task is bound, its thread has just blocked, and it may have been
// moved to another Capability.
-#define ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task) \
- ASSERT(cap->run_queue_hd == END_TSO_QUEUE ? \
- cap->run_queue_tl == END_TSO_QUEUE : 1); \
- ASSERT(myTask() == task); \
+#define ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task) \
+ ASSERT(cap->run_queue_hd == END_TSO_QUEUE ? \
+ cap->run_queue_tl == END_TSO_QUEUE : 1); \
+ ASSERT(myTask() == task); \
ASSERT_TASK_ID(task);
#if defined(THREADED_RTS)
@@ -201,18 +201,18 @@ void moreCapabilities (nat from, nat to);
#if defined(THREADED_RTS)
void releaseCapability (Capability* cap);
void releaseAndWakeupCapability (Capability* cap);
-void releaseCapability_ (Capability* cap, rtsBool always_wakeup);
+void releaseCapability_ (Capability* cap, rtsBool always_wakeup);
// assumes cap->lock is held
#else
// releaseCapability() is empty in non-threaded RTS
INLINE_HEADER void releaseCapability (Capability* cap STG_UNUSED) {};
INLINE_HEADER void releaseAndWakeupCapability (Capability* cap STG_UNUSED) {};
-INLINE_HEADER void releaseCapability_ (Capability* cap STG_UNUSED,
+INLINE_HEADER void releaseCapability_ (Capability* cap STG_UNUSED,
rtsBool always_wakeup STG_UNUSED) {};
#endif
// declared in includes/rts/Threads.h:
-// extern Capability MainCapability;
+// extern Capability MainCapability;
// declared in includes/rts/Threads.h:
// extern nat n_capabilities;
@@ -361,11 +361,11 @@ recordMutableCap (StgClosure *p, Capability *cap, nat gen)
// NO: assertion is violated by performPendingThrowTos()
bd = cap->mut_lists[gen];
if (bd->free >= bd->start + BLOCK_SIZE_W) {
- bdescr *new_bd;
- new_bd = allocBlock_lock();
- new_bd->link = bd;
- bd = new_bd;
- cap->mut_lists[gen] = bd;
+ bdescr *new_bd;
+ new_bd = allocBlock_lock();
+ new_bd->link = bd;
+ bd = new_bd;
+ cap->mut_lists[gen] = bd;
}
*bd->free++ = (StgWord)p;
}
@@ -381,15 +381,15 @@ recordClosureMutated (Capability *cap, StgClosure *p)
#if defined(THREADED_RTS)
INLINE_HEADER rtsBool
-emptySparkPoolCap (Capability *cap)
+emptySparkPoolCap (Capability *cap)
{ return looksEmpty(cap->sparks); }
INLINE_HEADER nat
-sparkPoolSizeCap (Capability *cap)
+sparkPoolSizeCap (Capability *cap)
{ return sparkPoolSize(cap->sparks); }
INLINE_HEADER void
-discardSparksCap (Capability *cap)
+discardSparksCap (Capability *cap)
{ discardSparks(cap->sparks); }
#endif
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
index 98f184b84c..c63a35a24e 100644
--- a/rts/CheckUnload.c
+++ b/rts/CheckUnload.c
@@ -92,91 +92,91 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd)
continue;
}
- p = bd->start;
- while (p < bd->free) {
- info = get_itbl((StgClosure *)p);
+ p = bd->start;
+ while (p < bd->free) {
+ info = get_itbl((StgClosure *)p);
prim = rtsFalse;
- switch (info->type) {
+ switch (info->type) {
- case THUNK:
+ case THUNK:
size = thunk_sizeW_fromITBL(info);
- break;
-
- case THUNK_1_1:
- case THUNK_0_2:
- case THUNK_2_0:
- size = sizeofW(StgThunkHeader) + 2;
- break;
-
- case THUNK_1_0:
- case THUNK_0_1:
- case THUNK_SELECTOR:
- size = sizeofW(StgThunkHeader) + 1;
- break;
-
- case CONSTR:
- case FUN:
+ break;
+
+ case THUNK_1_1:
+ case THUNK_0_2:
+ case THUNK_2_0:
+ size = sizeofW(StgThunkHeader) + 2;
+ break;
+
+ case THUNK_1_0:
+ case THUNK_0_1:
+ case THUNK_SELECTOR:
+ size = sizeofW(StgThunkHeader) + 1;
+ break;
+
+ case CONSTR:
+ case FUN:
case FUN_1_0:
- case FUN_0_1:
- case FUN_1_1:
- case FUN_0_2:
- case FUN_2_0:
- case CONSTR_1_0:
- case CONSTR_0_1:
- case CONSTR_1_1:
- case CONSTR_0_2:
- case CONSTR_2_0:
- size = sizeW_fromITBL(info);
- break;
-
- case IND_PERM:
- case BLACKHOLE:
- case BLOCKING_QUEUE:
+ case FUN_0_1:
+ case FUN_1_1:
+ case FUN_0_2:
+ case FUN_2_0:
+ case CONSTR_1_0:
+ case CONSTR_0_1:
+ case CONSTR_1_1:
+ case CONSTR_0_2:
+ case CONSTR_2_0:
+ size = sizeW_fromITBL(info);
+ break;
+
+ case IND_PERM:
+ case BLACKHOLE:
+ case BLOCKING_QUEUE:
prim = rtsTrue;
size = sizeW_fromITBL(info);
- break;
+ break;
case IND:
- // Special case/Delicate Hack: INDs don't normally
- // appear, since we're doing this heap census right
- // after GC. However, GarbageCollect() also does
- // resurrectThreads(), which can update some
- // blackholes when it calls raiseAsync() on the
- // resurrected threads. So we know that any IND will
- // be the size of a BLACKHOLE.
+ // Special case/Delicate Hack: INDs don't normally
+ // appear, since we're doing this heap census right
+ // after GC. However, GarbageCollect() also does
+ // resurrectThreads(), which can update some
+ // blackholes when it calls raiseAsync() on the
+ // resurrected threads. So we know that any IND will
+ // be the size of a BLACKHOLE.
prim = rtsTrue;
size = BLACKHOLE_sizeW();
- break;
+ break;
- case BCO:
+ case BCO:
prim = rtsTrue;
- size = bco_sizeW((StgBCO *)p);
- break;
+ size = bco_sizeW((StgBCO *)p);
+ break;
case MVAR_CLEAN:
case MVAR_DIRTY:
case TVAR:
case WEAK:
- case PRIM:
- case MUT_PRIM:
- case MUT_VAR_CLEAN:
- case MUT_VAR_DIRTY:
- prim = rtsTrue;
- size = sizeW_fromITBL(info);
- break;
-
- case AP:
+ case PRIM:
+ case MUT_PRIM:
+ case MUT_VAR_CLEAN:
+ case MUT_VAR_DIRTY:
+ prim = rtsTrue;
+ size = sizeW_fromITBL(info);
+ break;
+
+ case AP:
prim = rtsTrue;
size = ap_sizeW((StgAP *)p);
- break;
+ break;
- case PAP:
+ case PAP:
prim = rtsTrue;
size = pap_sizeW((StgPAP *)p);
- break;
+ break;
- case AP_STACK:
+ case AP_STACK:
{
StgAP_STACK *ap = (StgAP_STACK *)p;
prim = rtsTrue;
@@ -186,31 +186,31 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd)
break;
}
- case ARR_WORDS:
- prim = rtsTrue;
- size = arr_words_sizeW((StgArrWords*)p);
- break;
-
- case MUT_ARR_PTRS_CLEAN:
- case MUT_ARR_PTRS_DIRTY:
- case MUT_ARR_PTRS_FROZEN:
- case MUT_ARR_PTRS_FROZEN0:
- prim = rtsTrue;
- size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
- break;
-
- case SMALL_MUT_ARR_PTRS_CLEAN:
- case SMALL_MUT_ARR_PTRS_DIRTY:
- case SMALL_MUT_ARR_PTRS_FROZEN:
- case SMALL_MUT_ARR_PTRS_FROZEN0:
- prim = rtsTrue;
- size = small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs *)p);
- break;
-
- case TSO:
- prim = rtsTrue;
+ case ARR_WORDS:
+ prim = rtsTrue;
+ size = arr_words_sizeW((StgArrWords*)p);
+ break;
+
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
+ case MUT_ARR_PTRS_FROZEN:
+ case MUT_ARR_PTRS_FROZEN0:
+ prim = rtsTrue;
+ size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
+ break;
+
+ case SMALL_MUT_ARR_PTRS_CLEAN:
+ case SMALL_MUT_ARR_PTRS_DIRTY:
+ case SMALL_MUT_ARR_PTRS_FROZEN:
+ case SMALL_MUT_ARR_PTRS_FROZEN0:
+ prim = rtsTrue;
+ size = small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs *)p);
+ break;
+
+ case TSO:
+ prim = rtsTrue;
size = sizeofW(StgTSO);
- break;
+ break;
case STACK: {
StgStack *stack = (StgStack*)p;
@@ -218,24 +218,24 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd)
searchStackChunk(addrs, stack->sp,
stack->stack + stack->stack_size);
size = stack_sizeW(stack);
- break;
+ break;
}
case TREC_CHUNK:
- prim = rtsTrue;
- size = sizeofW(StgTRecChunk);
- break;
-
- default:
- barf("heapCensus, unknown object: %d", info->type);
- }
-
+ prim = rtsTrue;
+ size = sizeofW(StgTRecChunk);
+ break;
+
+ default:
+ barf("heapCensus, unknown object: %d", info->type);
+ }
+
if (!prim) {
checkAddress(addrs,info);
}
- p += size;
- }
+ p += size;
+ }
}
}
diff --git a/rts/Exception.cmm b/rts/Exception.cmm
index bc55911687..e03d53e1d5 100644
--- a/rts/Exception.cmm
+++ b/rts/Exception.cmm
@@ -20,8 +20,8 @@ import ghczmprim_GHCziTypes_True_closure;
A thread can request that asynchronous exceptions not be delivered
("masked") for the duration of an I/O computation. The primitives
-
- maskAsyncExceptions# :: IO a -> IO a
+
+ maskAsyncExceptions# :: IO a -> IO a
and
@@ -30,7 +30,7 @@ import ghczmprim_GHCziTypes_True_closure;
are used for this purpose. During a masked section, asynchronous
exceptions may be unmasked again temporarily:
- unmaskAsyncExceptions# :: IO a -> IO a
+ unmaskAsyncExceptions# :: IO a -> IO a
Furthermore, asynchronous exceptions are masked automatically during
the execution of an exception handler. All three of these primitives
@@ -70,7 +70,7 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr)
if (StgTSO_blocked_exceptions(CurrentTSO) != END_TSO_QUEUE) {
STK_CHK_P_LL (WDS(2), stg_unmaskAsyncExceptionszh_ret_info, R1);
- /*
+ /*
* We have to be very careful here, as in killThread#, since
* we are about to raise an async exception in the current
* thread, which might result in the thread being killed.
@@ -95,8 +95,8 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr)
/*
the thread might have been removed from the
blocked_exception list by someone else in the meantime.
- Just restore the stack pointer and continue.
- */
+ Just restore the stack pointer and continue.
+ */
Sp_adj(2);
}
}
@@ -109,9 +109,9 @@ INFO_TABLE_RET(stg_unmaskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr)
INFO_TABLE_RET(stg_maskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr)
return (P_ ret)
{
- StgTSO_flags(CurrentTSO) =
+ StgTSO_flags(CurrentTSO) =
%lobits32(
- TO_W_(StgTSO_flags(CurrentTSO))
+ TO_W_(StgTSO_flags(CurrentTSO))
| TSO_BLOCKEX | TSO_INTERRUPTIBLE
);
@@ -121,9 +121,9 @@ INFO_TABLE_RET(stg_maskAsyncExceptionszh_ret, RET_SMALL, W_ info_ptr)
INFO_TABLE_RET(stg_maskUninterruptiblezh_ret, RET_SMALL, W_ info_ptr)
return (P_ ret)
{
- StgTSO_flags(CurrentTSO) =
+ StgTSO_flags(CurrentTSO) =
%lobits32(
- (TO_W_(StgTSO_flags(CurrentTSO))
+ (TO_W_(StgTSO_flags(CurrentTSO))
| TSO_BLOCKEX)
& ~TSO_INTERRUPTIBLE
);
@@ -204,24 +204,24 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
/* If exceptions are already unmasked, there's nothing to do */
if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_BLOCKEX) != 0) {
- /* avoid growing the stack unnecessarily */
- if (Sp(0) == stg_unmaskAsyncExceptionszh_ret_info) {
- Sp_adj(1);
- } else {
- Sp_adj(-1);
+ /* avoid growing the stack unnecessarily */
+ if (Sp(0) == stg_unmaskAsyncExceptionszh_ret_info) {
+ Sp_adj(1);
+ } else {
+ Sp_adj(-1);
if ((TO_W_(StgTSO_flags(CurrentTSO)) & TSO_INTERRUPTIBLE) != 0) {
Sp(0) = stg_maskAsyncExceptionszh_ret_info;
} else {
Sp(0) = stg_maskUninterruptiblezh_ret_info;
}
- }
+ }
- StgTSO_flags(CurrentTSO) = %lobits32(
+ StgTSO_flags(CurrentTSO) = %lobits32(
TO_W_(StgTSO_flags(CurrentTSO)) & ~(TSO_BLOCKEX|TSO_INTERRUPTIBLE));
/* Eagerly raise a masked exception, if there is one */
if (StgTSO_blocked_exceptions(CurrentTSO) != END_TSO_QUEUE) {
- /*
+ /*
* We have to be very careful here, as in killThread#, since
* we are about to raise an async exception in the current
* thread, which might result in the thread being killed.
@@ -244,12 +244,12 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
if (r != 0::CInt) {
if (StgTSO_what_next(CurrentTSO) == ThreadKilled::I16) {
jump stg_threadFinished [];
- } else {
- LOAD_THREAD_STATE();
- ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
+ } else {
+ LOAD_THREAD_STATE();
+ ASSERT(StgTSO_what_next(CurrentTSO) == ThreadRunGHC::I16);
R1 = io;
jump %ENTRY_CODE(Sp(0)) [R1];
- }
+ }
} else {
/* we'll just call R1 directly, below */
Sp_adj(3);
@@ -267,7 +267,7 @@ stg_unmaskAsyncExceptionszh /* explicit stack */
stg_getMaskingStatezh ()
{
/* args: none */
- /*
+ /*
returns: 0 == unmasked,
1 == masked, non-interruptible,
2 == masked, interruptible
@@ -285,7 +285,7 @@ stg_killThreadzh (P_ target, P_ exception)
/* We call allocate in throwTo(), so better check for GC */
MAYBE_GC_PP (stg_killThreadzh, target, exception);
- /*
+ /*
* We might have killed ourselves. In which case, better be *very*
* careful. If the exception killed us, then return to the scheduler.
* If the exception went to a catch frame, we'll just continue from
@@ -306,19 +306,19 @@ stg_killThreadzh (P_ target, P_ exception)
} else {
W_ msg;
- (msg) = ccall throwTo(MyCapability() "ptr",
+ (msg) = ccall throwTo(MyCapability() "ptr",
CurrentTSO "ptr",
target "ptr",
exception "ptr");
-
+
if (msg == NULL) {
return ();
} else {
StgTSO_why_blocked(CurrentTSO) = BlockedOnMsgThrowTo;
StgTSO_block_info(CurrentTSO) = msg;
- // we must block, and unlock the message before returning
+ // we must block, and unlock the message before returning
jump stg_block_throwto (target, exception);
- }
+ }
}
}
@@ -335,7 +335,7 @@ stg_killMyself
SAVE_THREAD_STATE();
/* ToDo: what if the current thread is masking exceptions? */
- ccall throwToSingleThreaded(MyCapability() "ptr",
+ ccall throwToSingleThreaded(MyCapability() "ptr",
target "ptr", exception "ptr");
if (StgTSO_what_next(CurrentTSO) == ThreadKilled::I16) {
jump stg_threadFinished [];
@@ -392,7 +392,7 @@ stg_catchzh ( P_ io, /* :: IO a */
W_ exceptions_blocked;
STK_CHK_GEN();
-
+
exceptions_blocked =
TO_W_(StgTSO_flags(CurrentTSO)) & (TSO_BLOCKEX | TSO_INTERRUPTIBLE);
TICK_CATCHF_PUSHED();
@@ -409,7 +409,7 @@ stg_catchzh ( P_ io, /* :: IO a */
/* -----------------------------------------------------------------------------
* The raise infotable
- *
+ *
* This should be exactly the same as would be generated by this STG code
*
* raise = {err} \n {} -> raise#{err}
@@ -463,16 +463,16 @@ stg_raisezh /* explicit stack */
LOAD_THREAD_STATE();
}
#endif
-
+
retry_pop_stack:
SAVE_THREAD_STATE();
(frame_type) = ccall raiseExceptionHelper(BaseReg "ptr", CurrentTSO "ptr", exception "ptr");
LOAD_THREAD_STATE();
if (frame_type == ATOMICALLY_FRAME) {
- /* The exception has reached the edge of a memory transaction. Check that
+ /* The exception has reached the edge of a memory transaction. Check that
* the transaction is valid. If not then perhaps the exception should
* not have been thrown: re-run the transaction. "trec" will either be
- * a top-level transaction running the atomic block, or a nested
+ * a top-level transaction running the atomic block, or a nested
* transaction running an invariant check. In the latter case we
* abort and de-allocate the top-level transaction that encloses it
* as well (we could just abandon its transaction record, but this makes
@@ -502,7 +502,7 @@ retry_pop_stack:
StgTSO_trec(CurrentTSO) = trec;
R1 = StgAtomicallyFrame_code(Sp);
jump stg_ap_v_fast [R1];
- }
+ }
}
// After stripping the stack, see whether we should break here for
@@ -535,19 +535,19 @@ retry_pop_stack:
}
if (frame_type == STOP_FRAME) {
- /*
- * We've stripped the entire stack, the thread is now dead.
- * We will leave the stack in a GC'able state, see the stg_stop_thread
- * entry code in StgStartup.cmm.
- */
+ /*
+ * We've stripped the entire stack, the thread is now dead.
+ * We will leave the stack in a GC'able state, see the stg_stop_thread
+ * entry code in StgStartup.cmm.
+ */
W_ stack;
stack = StgTSO_stackobj(CurrentTSO);
Sp = stack + OFFSET_StgStack_stack
+ WDS(TO_W_(StgStack_stack_size(stack))) - WDS(2);
- Sp(1) = exception; /* save the exception */
- Sp(0) = stg_enter_info; /* so that GC can traverse this stack */
- StgTSO_what_next(CurrentTSO) = ThreadKilled::I16;
- SAVE_THREAD_STATE(); /* inline! */
+ Sp(1) = exception; /* save the exception */
+ Sp(0) = stg_enter_info; /* so that GC can traverse this stack */
+ StgTSO_what_next(CurrentTSO) = ThreadKilled::I16;
+ SAVE_THREAD_STATE(); /* inline! */
jump stg_threadFinished [];
}
@@ -563,7 +563,7 @@ retry_pop_stack:
}
/* Restore the masked/unmasked state for asynchronous exceptions
- * at the CATCH_FRAME.
+ * at the CATCH_FRAME.
*
* If exceptions were unmasked, arrange that they are unmasked
* again after executing the handler by pushing an
diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm
index f090bff5ad..0659fed89f 100644
--- a/rts/HeapStackCheck.cmm
+++ b/rts/HeapStackCheck.cmm
@@ -72,10 +72,10 @@ import LeaveCriticalSection;
* will either increase the size of our stack, or raise an exception if
* the stack is already too big.
*/
-
-#define PRE_RETURN(why,what_next) \
- StgTSO_what_next(CurrentTSO) = what_next::I16; \
- StgRegTable_rRet(BaseReg) = why; \
+
+#define PRE_RETURN(why,what_next) \
+ StgTSO_what_next(CurrentTSO) = what_next::I16; \
+ StgRegTable_rRet(BaseReg) = why; \
R1 = BaseReg;
/* Remember that the return address is *removed* when returning to a
@@ -122,24 +122,24 @@ stg_gc_noregs
jump stg_returnToSched [R1];
}
-#define HP_GENERIC \
+#define HP_GENERIC \
PRE_RETURN(HeapOverflow, ThreadRunGHC) \
jump stg_returnToSched [R1];
-#define BLOCK_GENERIC \
+#define BLOCK_GENERIC \
PRE_RETURN(ThreadBlocked, ThreadRunGHC) \
jump stg_returnToSched [R1];
-#define YIELD_GENERIC \
+#define YIELD_GENERIC \
PRE_RETURN(ThreadYielding, ThreadRunGHC) \
jump stg_returnToSched [R1];
-#define BLOCK_BUT_FIRST(c) \
+#define BLOCK_BUT_FIRST(c) \
PRE_RETURN(ThreadBlocked, ThreadRunGHC) \
R2 = c; \
jump stg_returnToSchedButFirst [R1,R2,R3];
-#define YIELD_TO_INTERPRETER \
+#define YIELD_TO_INTERPRETER \
PRE_RETURN(ThreadYielding, ThreadInterpret) \
jump stg_returnToSchedNotPaused [R1];
@@ -356,7 +356,7 @@ stg_gc_pppp return (P_ arg1, P_ arg2, P_ arg3, P_ arg4)
Generic function entry heap check code.
At a function entry point, the arguments are as per the calling convention,
- i.e. some in regs and some on the stack. There may or may not be
+ i.e. some in regs and some on the stack. There may or may not be
a pointer to the function closure in R1 - if there isn't, then the heap
check failure code in the function will arrange to load it.
@@ -365,16 +365,16 @@ stg_gc_pppp return (P_ arg1, P_ arg2, P_ arg3, P_ arg4)
registers and return to the scheduler.
This code arranges the stack like this:
-
+
| .... |
| args |
- +---------------------+
+ +---------------------+
| f_closure |
- +---------------------+
+ +---------------------+
| size |
- +---------------------+
+ +---------------------+
| stg_gc_fun_info |
- +---------------------+
+ +---------------------+
The size is the number of words of arguments on the stack, and is cached
in the frame in order to simplify stack walking: otherwise the size of
@@ -393,21 +393,21 @@ __stg_gc_fun /* explicit stack */
// cache the size
type = TO_W_(StgFunInfoExtra_fun_type(info));
if (type == ARG_GEN) {
- size = BITMAP_SIZE(StgFunInfoExtra_bitmap(info));
- } else {
- if (type == ARG_GEN_BIG) {
+ size = BITMAP_SIZE(StgFunInfoExtra_bitmap(info));
+ } else {
+ if (type == ARG_GEN_BIG) {
#ifdef TABLES_NEXT_TO_CODE
// bitmap field holds an offset
size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info)
+ %GET_ENTRY(UNTAG(R1)) /* ### */ );
#else
- size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info) );
+ size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info) );
#endif
- } else {
- size = BITMAP_SIZE(W_[stg_arg_bitmaps + WDS(type)]);
- }
+ } else {
+ size = BITMAP_SIZE(W_[stg_arg_bitmaps + WDS(type)]);
+ }
}
-
+
#ifdef NO_ARG_REGS
// we don't have to save any registers away
Sp_adj(-3);
@@ -427,9 +427,9 @@ __stg_gc_fun /* explicit stack */
Sp(0) = stg_gc_fun_info;
// DEBUG_ONLY(foreign "C" debugBelch("stg_fun_gc_gen(ARG_GEN)"););
jump stg_gc_noregs [];
- } else {
+ } else {
jump W_[stg_stack_save_entries + WDS(type)] [*]; // all regs live
- // jumps to stg_gc_noregs after saving stuff
+ // jumps to stg_gc_noregs after saving stuff
}
#endif /* !NO_ARG_REGS */
}
@@ -455,21 +455,21 @@ INFO_TABLE_RET ( stg_gc_fun, RET_FUN )
#else
W_ info;
W_ type;
-
+
info = %GET_FUN_INFO(UNTAG(R1));
type = TO_W_(StgFunInfoExtra_fun_type(info));
if (type == ARG_GEN || type == ARG_GEN_BIG) {
jump StgFunInfoExtra_slow_apply(info) [R1];
- } else {
- if (type == ARG_BCO) {
- // cover this case just to be on the safe side
- Sp_adj(-2);
- Sp(1) = R1;
- Sp(0) = stg_apply_interp_info;
+ } else {
+ if (type == ARG_BCO) {
+ // cover this case just to be on the safe side
+ Sp_adj(-2);
+ Sp(1) = R1;
+ Sp(0) = stg_apply_interp_info;
jump stg_yield_to_interpreter [];
- } else {
+ } else {
jump W_[stg_ap_stack_entries + WDS(type)] [R1];
- }
+ }
}
#endif
}
@@ -505,20 +505,20 @@ stg_block_noregs
* takeMVar/putMVar-specific blocks
*
* Stack layout for a thread blocked in takeMVar/readMVar:
- *
+ *
* ret. addr
* ptr to MVar (R1)
* stg_block_takemvar_info (or stg_block_readmvar_info)
*
* Stack layout for a thread blocked in putMVar:
- *
+ *
* ret. addr
* ptr to Value (R2)
* ptr to MVar (R1)
* stg_block_putmvar_info
*
* See PrimOps.hc for a description of the workings of take/putMVar.
- *
+ *
* -------------------------------------------------------------------------- */
INFO_TABLE_RET ( stg_block_takemvar, RET_SMALL, W_ info_ptr, P_ mvar )
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index f4fe816d28..501cc4fe4f 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -29,8 +29,8 @@
#endif
// When building the RTS in the non-dyn way on Windows, we don't
-// want declspec(__dllimport__) on the front of function prototypes
-// from libffi.
+// want declspec(__dllimport__) on the front of function prototypes
+// from libffi.
#if defined(mingw32_HOST_OS)
#if (defined(i386_HOST_ARCH) && !defined(__PIC__)) || defined(x86_64_HOST_ARCH)
# define LIBFFI_NOT_DLL
@@ -74,26 +74,26 @@
#define BCO_PTR(n) (W_)ptrs[n]
#define BCO_LIT(n) literals[n]
-#define LOAD_STACK_POINTERS \
+#define LOAD_STACK_POINTERS \
Sp = cap->r.rCurrentTSO->stackobj->sp; \
- /* We don't change this ... */ \
+ /* We don't change this ... */ \
SpLim = tso_SpLim(cap->r.rCurrentTSO);
-#define SAVE_STACK_POINTERS \
+#define SAVE_STACK_POINTERS \
ASSERT(Sp > SpLim); \
cap->r.rCurrentTSO->stackobj->sp = Sp
-#define RETURN_TO_SCHEDULER(todo,retcode) \
- SAVE_STACK_POINTERS; \
- cap->r.rCurrentTSO->what_next = (todo); \
- threadPaused(cap,cap->r.rCurrentTSO); \
- cap->r.rRet = (retcode); \
+#define RETURN_TO_SCHEDULER(todo,retcode) \
+ SAVE_STACK_POINTERS; \
+ cap->r.rCurrentTSO->what_next = (todo); \
+ threadPaused(cap,cap->r.rCurrentTSO); \
+ cap->r.rRet = (retcode); \
return cap;
-#define RETURN_TO_SCHEDULER_NO_PAUSE(todo,retcode) \
- SAVE_STACK_POINTERS; \
- cap->r.rCurrentTSO->what_next = (todo); \
- cap->r.rRet = (retcode); \
+#define RETURN_TO_SCHEDULER_NO_PAUSE(todo,retcode) \
+ SAVE_STACK_POINTERS; \
+ cap->r.rCurrentTSO->what_next = (todo); \
+ cap->r.rRet = (retcode); \
return cap;
@@ -137,7 +137,7 @@ void interp_startup ( void )
it_unknown_entries[i] = 0;
it_slides = it_insns = it_BCO_entries = 0;
for (i = 0; i < 27; i++) it_ofreq[i] = 0;
- for (i = 0; i < 27; i++)
+ for (i = 0; i < 27; i++)
for (j = 0; j < 27; j++)
it_oofreq[i][j] = 0;
it_lastopc = 0;
@@ -149,18 +149,18 @@ void interp_shutdown ( void )
debugBelch("%d constrs entered -> (%d BCO, %d UPD, %d ??? )\n",
it_retto_BCO + it_retto_UPDATE + it_retto_other,
it_retto_BCO, it_retto_UPDATE, it_retto_other );
- debugBelch("%d total entries, %d unknown entries \n",
+ debugBelch("%d total entries, %d unknown entries \n",
it_total_entries, it_total_unknown_entries);
for (i = 0; i < N_CLOSURE_TYPES; i++) {
if (it_unknown_entries[i] == 0) continue;
debugBelch(" type %2d: unknown entries (%4.1f%%) == %d\n",
- i, 100.0 * ((double)it_unknown_entries[i]) /
+ i, 100.0 * ((double)it_unknown_entries[i]) /
((double)it_total_unknown_entries),
it_unknown_entries[i]);
}
- debugBelch("%d insns, %d slides, %d BCO_entries\n",
+ debugBelch("%d insns, %d slides, %d BCO_entries\n",
it_insns, it_slides, it_BCO_entries);
- for (i = 0; i < 27; i++)
+ for (i = 0; i < 27; i++)
debugBelch("opcode %2d got %d\n", i, it_ofreq[i] );
for (k = 1; k < 20; k++) {
@@ -168,13 +168,13 @@ void interp_shutdown ( void )
i_max = j_max = 0;
for (i = 0; i < 27; i++) {
for (j = 0; j < 27; j++) {
- if (it_oofreq[i][j] > o_max) {
+ if (it_oofreq[i][j] > o_max) {
o_max = it_oofreq[i][j];
- i_max = i; j_max = j;
- }
- }
+ i_max = i; j_max = j;
+ }
+ }
}
-
+
debugBelch("%d: count (%4.1f%%) %6d is %d then %d\n",
k, ((double)o_max) * 100.0 / ((double)it_insns), o_max,
i_max, j_max );
@@ -218,14 +218,14 @@ interpretBCO (Capability* cap)
// ------------------------------------------------------------------------
// Case 1:
- //
+ //
// We have a closure to evaluate. Stack looks like:
- //
- // | XXXX_info |
- // +---------------+
+ //
+ // | XXXX_info |
+ // +---------------+
// Sp | -------------------> closure
- // +---------------+
- //
+ // +---------------+
+ //
if (Sp[0] == (W_)&stg_enter_info) {
Sp++;
goto eval;
@@ -233,22 +233,22 @@ interpretBCO (Capability* cap)
// ------------------------------------------------------------------------
// Case 2:
- //
+ //
// We have a BCO application to perform. Stack looks like:
//
- // | .... |
- // +---------------+
- // | arg1 |
- // +---------------+
- // | BCO |
- // +---------------+
+ // | .... |
+ // +---------------+
+ // | arg1 |
+ // +---------------+
+ // | BCO |
+ // +---------------+
// Sp | RET_BCO |
- // +---------------+
- //
+ // +---------------+
+ //
else if (Sp[0] == (W_)&stg_apply_interp_info) {
- obj = UNTAG_CLOSURE((StgClosure *)Sp[1]);
- Sp += 2;
- goto run_BCO_fun;
+ obj = UNTAG_CLOSURE((StgClosure *)Sp[1]);
+ Sp += 2;
+ goto run_BCO_fun;
}
// ------------------------------------------------------------------------
@@ -258,7 +258,7 @@ interpretBCO (Capability* cap)
// do_return_unboxed, below.
//
else {
- goto do_return_unboxed;
+ goto do_return_unboxed;
}
// Evaluate the object on top of the stack.
@@ -288,11 +288,11 @@ eval_obj:
case IND:
case IND_PERM:
case IND_STATIC:
- {
- tagged_obj = ((StgInd*)obj)->indirectee;
- goto eval_obj;
+ {
+ tagged_obj = ((StgInd*)obj)->indirectee;
+ goto eval_obj;
}
-
+
case CONSTR:
case CONSTR_1_0:
case CONSTR_0_1:
@@ -309,72 +309,72 @@ eval_obj:
case FUN_0_2:
case FUN_STATIC:
case PAP:
- // already in WHNF
- break;
-
+ // already in WHNF
+ break;
+
case BCO:
{
- ASSERT(((StgBCO *)obj)->arity > 0);
- break;
+ ASSERT(((StgBCO *)obj)->arity > 0);
+ break;
}
- case AP: /* Copied from stg_AP_entry. */
+ case AP: /* Copied from stg_AP_entry. */
{
- nat i, words;
- StgAP *ap;
-
- ap = (StgAP*)obj;
- words = ap->n_args;
-
- // Stack check
- if (Sp - (words+sizeofW(StgUpdateFrame)) < SpLim) {
- Sp -= 2;
- Sp[1] = (W_)tagged_obj;
- Sp[0] = (W_)&stg_enter_info;
- RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
- }
-
- /* Ok; we're safe. Party on. Push an update frame. */
- Sp -= sizeofW(StgUpdateFrame);
- {
- StgUpdateFrame *__frame;
- __frame = (StgUpdateFrame *)Sp;
- SET_INFO((StgClosure *)__frame, (StgInfoTable *)&stg_upd_frame_info);
- __frame->updatee = (StgClosure *)(ap);
- }
-
- /* Reload the stack */
- Sp -= words;
- for (i=0; i < words; i++) {
- Sp[i] = (W_)ap->payload[i];
- }
-
- obj = UNTAG_CLOSURE((StgClosure*)ap->fun);
- ASSERT(get_itbl(obj)->type == BCO);
- goto run_BCO_fun;
+ nat i, words;
+ StgAP *ap;
+
+ ap = (StgAP*)obj;
+ words = ap->n_args;
+
+ // Stack check
+ if (Sp - (words+sizeofW(StgUpdateFrame)) < SpLim) {
+ Sp -= 2;
+ Sp[1] = (W_)tagged_obj;
+ Sp[0] = (W_)&stg_enter_info;
+ RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
+ }
+
+ /* Ok; we're safe. Party on. Push an update frame. */
+ Sp -= sizeofW(StgUpdateFrame);
+ {
+ StgUpdateFrame *__frame;
+ __frame = (StgUpdateFrame *)Sp;
+ SET_INFO((StgClosure *)__frame, (StgInfoTable *)&stg_upd_frame_info);
+ __frame->updatee = (StgClosure *)(ap);
+ }
+
+ /* Reload the stack */
+ Sp -= words;
+ for (i=0; i < words; i++) {
+ Sp[i] = (W_)ap->payload[i];
+ }
+
+ obj = UNTAG_CLOSURE((StgClosure*)ap->fun);
+ ASSERT(get_itbl(obj)->type == BCO);
+ goto run_BCO_fun;
}
default:
#ifdef INTERP_STATS
- {
- int j;
-
- j = get_itbl(obj)->type;
- ASSERT(j >= 0 && j < N_CLOSURE_TYPES);
- it_unknown_entries[j]++;
- it_total_unknown_entries++;
+ {
+ int j;
+
+ j = get_itbl(obj)->type;
+ ASSERT(j >= 0 && j < N_CLOSURE_TYPES);
+ it_unknown_entries[j]++;
+ it_total_unknown_entries++;
}
#endif
{
- // Can't handle this object; yield to scheduler
- IF_DEBUG(interpreter,
- debugBelch("evaluating unknown closure -- yielding to sched\n");
- printObj(obj);
- );
- Sp -= 2;
- Sp[1] = (W_)tagged_obj;
- Sp[0] = (W_)&stg_enter_info;
- RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
+ // Can't handle this object; yield to scheduler
+ IF_DEBUG(interpreter,
+ debugBelch("evaluating unknown closure -- yielding to sched\n");
+ printObj(obj);
+ );
+ Sp -= 2;
+ Sp[1] = (W_)tagged_obj;
+ Sp[0] = (W_)&stg_enter_info;
+ RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
}
}
@@ -400,49 +400,49 @@ do_return:
switch (get_itbl((StgClosure *)Sp)->type) {
case RET_SMALL: {
- const StgInfoTable *info;
-
- // NOTE: not using get_itbl().
- info = ((StgClosure *)Sp)->header.info;
- if (info == (StgInfoTable *)&stg_ap_v_info) {
- n = 1; m = 0; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_f_info) {
- n = 1; m = 1; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_d_info) {
- n = 1; m = sizeofW(StgDouble); goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_l_info) {
- n = 1; m = sizeofW(StgInt64); goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_n_info) {
- n = 1; m = 1; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_p_info) {
- n = 1; m = 1; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_pp_info) {
- n = 2; m = 2; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_ppp_info) {
- n = 3; m = 3; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_pppp_info) {
- n = 4; m = 4; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_ppppp_info) {
- n = 5; m = 5; goto do_apply;
- }
- if (info == (StgInfoTable *)&stg_ap_pppppp_info) {
- n = 6; m = 6; goto do_apply;
- }
- goto do_return_unrecognised;
+ const StgInfoTable *info;
+
+ // NOTE: not using get_itbl().
+ info = ((StgClosure *)Sp)->header.info;
+ if (info == (StgInfoTable *)&stg_ap_v_info) {
+ n = 1; m = 0; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_f_info) {
+ n = 1; m = 1; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_d_info) {
+ n = 1; m = sizeofW(StgDouble); goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_l_info) {
+ n = 1; m = sizeofW(StgInt64); goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_n_info) {
+ n = 1; m = 1; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_p_info) {
+ n = 1; m = 1; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_pp_info) {
+ n = 2; m = 2; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_ppp_info) {
+ n = 3; m = 3; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_pppp_info) {
+ n = 4; m = 4; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_ppppp_info) {
+ n = 5; m = 5; goto do_apply;
+ }
+ if (info == (StgInfoTable *)&stg_ap_pppppp_info) {
+ n = 6; m = 6; goto do_apply;
+ }
+ goto do_return_unrecognised;
}
case UPDATE_FRAME:
- // Returning to an update frame: do the update, pop the update
- // frame, and continue with the next stack frame.
+ // Returning to an update frame: do the update, pop the update
+ // frame, and continue with the next stack frame.
//
// NB. we must update with the *tagged* pointer. Some tags
// are not optional, and if we omit the tag bits when updating
@@ -451,57 +451,57 @@ do_return:
// untagged pointer, and this untagged pointer was propagated
// to a PAP by the GC, violating the invariant that PAPs
// always contain a tagged pointer to the function.
- INTERP_TICK(it_retto_UPDATE);
- updateThunk(cap, cap->r.rCurrentTSO,
+ INTERP_TICK(it_retto_UPDATE);
+ updateThunk(cap, cap->r.rCurrentTSO,
((StgUpdateFrame *)Sp)->updatee, tagged_obj);
- Sp += sizeofW(StgUpdateFrame);
- goto do_return;
+ Sp += sizeofW(StgUpdateFrame);
+ goto do_return;
case RET_BCO:
- // Returning to an interpreted continuation: put the object on
- // the stack, and start executing the BCO.
- INTERP_TICK(it_retto_BCO);
- Sp--;
- Sp[0] = (W_)obj;
+ // Returning to an interpreted continuation: put the object on
+ // the stack, and start executing the BCO.
+ INTERP_TICK(it_retto_BCO);
+ Sp--;
+ Sp[0] = (W_)obj;
// NB. return the untagged object; the bytecode expects it to
// be untagged. XXX this doesn't seem right.
- obj = (StgClosure*)Sp[2];
- ASSERT(get_itbl(obj)->type == BCO);
- goto run_BCO_return;
+ obj = (StgClosure*)Sp[2];
+ ASSERT(get_itbl(obj)->type == BCO);
+ goto run_BCO_return;
default:
do_return_unrecognised:
{
- // Can't handle this return address; yield to scheduler
- INTERP_TICK(it_retto_other);
- IF_DEBUG(interpreter,
- debugBelch("returning to unknown frame -- yielding to sched\n");
+ // Can't handle this return address; yield to scheduler
+ INTERP_TICK(it_retto_other);
+ IF_DEBUG(interpreter,
+ debugBelch("returning to unknown frame -- yielding to sched\n");
printStackChunk(Sp,cap->r.rCurrentTSO->stackobj->stack+cap->r.rCurrentTSO->stackobj->stack_size);
- );
- Sp -= 2;
- Sp[1] = (W_)tagged_obj;
- Sp[0] = (W_)&stg_enter_info;
- RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
+ );
+ Sp -= 2;
+ Sp[1] = (W_)tagged_obj;
+ Sp[0] = (W_)&stg_enter_info;
+ RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
}
}
// -------------------------------------------------------------------------
// Returning an unboxed value. The stack looks like this:
//
- // | .... |
- // +---------------+
- // | fv2 |
- // +---------------+
- // | fv1 |
- // +---------------+
- // | BCO |
- // +---------------+
- // | stg_ctoi_ret_ |
- // +---------------+
- // | retval |
- // +---------------+
- // | XXXX_info |
- // +---------------+
+ // | .... |
+ // +---------------+
+ // | fv2 |
+ // +---------------+
+ // | fv1 |
+ // +---------------+
+ // | BCO |
+ // +---------------+
+ // | stg_ctoi_ret_ |
+ // +---------------+
+ // | retval |
+ // +---------------+
+ // | XXXX_info |
+ // +---------------+
//
// where XXXX_info is one of the stg_ret_*_info family.
//
@@ -509,41 +509,41 @@ do_return:
// is a BCO; otherwise we'll return to the scheduler.
do_return_unboxed:
- {
- int offset;
-
+ {
+ int offset;
+
ASSERT( Sp[0] == (W_)&stg_ret_v_info
|| Sp[0] == (W_)&stg_ret_p_info
|| Sp[0] == (W_)&stg_ret_n_info
|| Sp[0] == (W_)&stg_ret_f_info
|| Sp[0] == (W_)&stg_ret_d_info
|| Sp[0] == (W_)&stg_ret_l_info
- );
-
- // get the offset of the stg_ctoi_ret_XXX itbl
- offset = stack_frame_sizeW((StgClosure *)Sp);
-
- switch (get_itbl((StgClosure *)Sp+offset)->type) {
-
- case RET_BCO:
- // Returning to an interpreted continuation: put the object on
- // the stack, and start executing the BCO.
- INTERP_TICK(it_retto_BCO);
- obj = (StgClosure*)Sp[offset+1];
- ASSERT(get_itbl(obj)->type == BCO);
- goto run_BCO_return_unboxed;
-
- default:
- {
- // Can't handle this return address; yield to scheduler
- INTERP_TICK(it_retto_other);
- IF_DEBUG(interpreter,
- debugBelch("returning to unknown frame -- yielding to sched\n");
+ );
+
+ // get the offset of the stg_ctoi_ret_XXX itbl
+ offset = stack_frame_sizeW((StgClosure *)Sp);
+
+ switch (get_itbl((StgClosure *)Sp+offset)->type) {
+
+ case RET_BCO:
+ // Returning to an interpreted continuation: put the object on
+ // the stack, and start executing the BCO.
+ INTERP_TICK(it_retto_BCO);
+ obj = (StgClosure*)Sp[offset+1];
+ ASSERT(get_itbl(obj)->type == BCO);
+ goto run_BCO_return_unboxed;
+
+ default:
+ {
+ // Can't handle this return address; yield to scheduler
+ INTERP_TICK(it_retto_other);
+ IF_DEBUG(interpreter,
+ debugBelch("returning to unknown frame -- yielding to sched\n");
printStackChunk(Sp,cap->r.rCurrentTSO->stackobj->stack+cap->r.rCurrentTSO->stackobj->stack_size);
);
- RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
- }
- }
+ RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
+ }
+ }
}
// not reached.
@@ -557,18 +557,18 @@ do_apply:
// words on the stack. The info table (stg_ap_pp_info or whatever)
// is on top of the arguments on the stack.
{
- switch (get_itbl(obj)->type) {
+ switch (get_itbl(obj)->type) {
- case PAP: {
- StgPAP *pap;
- nat i, arity;
+ case PAP: {
+ StgPAP *pap;
+ nat i, arity;
- pap = (StgPAP *)obj;
+ pap = (StgPAP *)obj;
- // we only cope with PAPs whose function is a BCO
- if (get_itbl(UNTAG_CLOSURE(pap->fun))->type != BCO) {
- goto defer_apply_to_sched;
- }
+ // we only cope with PAPs whose function is a BCO
+ if (get_itbl(UNTAG_CLOSURE(pap->fun))->type != BCO) {
+ goto defer_apply_to_sched;
+ }
// Stack check: we're about to unpack the PAP onto the
// stack. The (+1) is for the (arity < n) case, where we
@@ -580,107 +580,107 @@ do_apply:
RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
}
- Sp++;
- arity = pap->arity;
- ASSERT(arity > 0);
- if (arity < n) {
- // n must be greater than 1, and the only kinds of
- // application we support with more than one argument
- // are all pointers...
- //
- // Shuffle the args for this function down, and put
- // the appropriate info table in the gap.
- for (i = 0; i < arity; i++) {
- Sp[(int)i-1] = Sp[i];
- // ^^^^^ careful, i-1 might be negative, but i in unsigned
- }
- Sp[arity-1] = app_ptrs_itbl[n-arity-1];
- Sp--;
- // unpack the PAP's arguments onto the stack
- Sp -= pap->n_args;
- for (i = 0; i < pap->n_args; i++) {
- Sp[i] = (W_)pap->payload[i];
- }
- obj = UNTAG_CLOSURE(pap->fun);
- goto run_BCO_fun;
- }
- else if (arity == n) {
- Sp -= pap->n_args;
- for (i = 0; i < pap->n_args; i++) {
- Sp[i] = (W_)pap->payload[i];
- }
- obj = UNTAG_CLOSURE(pap->fun);
- goto run_BCO_fun;
- }
- else /* arity > n */ {
- // build a new PAP and return it.
- StgPAP *new_pap;
- new_pap = (StgPAP *)allocate(cap, PAP_sizeW(pap->n_args + m));
+ Sp++;
+ arity = pap->arity;
+ ASSERT(arity > 0);
+ if (arity < n) {
+ // n must be greater than 1, and the only kinds of
+ // application we support with more than one argument
+ // are all pointers...
+ //
+ // Shuffle the args for this function down, and put
+ // the appropriate info table in the gap.
+ for (i = 0; i < arity; i++) {
+ Sp[(int)i-1] = Sp[i];
+ // ^^^^^ careful, i-1 might be negative, but i in unsigned
+ }
+ Sp[arity-1] = app_ptrs_itbl[n-arity-1];
+ Sp--;
+ // unpack the PAP's arguments onto the stack
+ Sp -= pap->n_args;
+ for (i = 0; i < pap->n_args; i++) {
+ Sp[i] = (W_)pap->payload[i];
+ }
+ obj = UNTAG_CLOSURE(pap->fun);
+ goto run_BCO_fun;
+ }
+ else if (arity == n) {
+ Sp -= pap->n_args;
+ for (i = 0; i < pap->n_args; i++) {
+ Sp[i] = (W_)pap->payload[i];
+ }
+ obj = UNTAG_CLOSURE(pap->fun);
+ goto run_BCO_fun;
+ }
+ else /* arity > n */ {
+ // build a new PAP and return it.
+ StgPAP *new_pap;
+ new_pap = (StgPAP *)allocate(cap, PAP_sizeW(pap->n_args + m));
SET_HDR(new_pap,&stg_PAP_info,cap->r.rCCCS);
- new_pap->arity = pap->arity - n;
- new_pap->n_args = pap->n_args + m;
- new_pap->fun = pap->fun;
- for (i = 0; i < pap->n_args; i++) {
- new_pap->payload[i] = pap->payload[i];
- }
- for (i = 0; i < m; i++) {
- new_pap->payload[pap->n_args + i] = (StgClosure *)Sp[i];
- }
- tagged_obj = (StgClosure *)new_pap;
- Sp += m;
- goto do_return;
- }
- }
-
- case BCO: {
- nat arity, i;
-
- Sp++;
- arity = ((StgBCO *)obj)->arity;
- ASSERT(arity > 0);
- if (arity < n) {
- // n must be greater than 1, and the only kinds of
- // application we support with more than one argument
- // are all pointers...
- //
- // Shuffle the args for this function down, and put
- // the appropriate info table in the gap.
- for (i = 0; i < arity; i++) {
- Sp[(int)i-1] = Sp[i];
- // ^^^^^ careful, i-1 might be negative, but i in unsigned
- }
- Sp[arity-1] = app_ptrs_itbl[n-arity-1];
- Sp--;
- goto run_BCO_fun;
- }
- else if (arity == n) {
- goto run_BCO_fun;
- }
- else /* arity > n */ {
- // build a PAP and return it.
- StgPAP *pap;
- nat i;
- pap = (StgPAP *)allocate(cap, PAP_sizeW(m));
+ new_pap->arity = pap->arity - n;
+ new_pap->n_args = pap->n_args + m;
+ new_pap->fun = pap->fun;
+ for (i = 0; i < pap->n_args; i++) {
+ new_pap->payload[i] = pap->payload[i];
+ }
+ for (i = 0; i < m; i++) {
+ new_pap->payload[pap->n_args + i] = (StgClosure *)Sp[i];
+ }
+ tagged_obj = (StgClosure *)new_pap;
+ Sp += m;
+ goto do_return;
+ }
+ }
+
+ case BCO: {
+ nat arity, i;
+
+ Sp++;
+ arity = ((StgBCO *)obj)->arity;
+ ASSERT(arity > 0);
+ if (arity < n) {
+ // n must be greater than 1, and the only kinds of
+ // application we support with more than one argument
+ // are all pointers...
+ //
+ // Shuffle the args for this function down, and put
+ // the appropriate info table in the gap.
+ for (i = 0; i < arity; i++) {
+ Sp[(int)i-1] = Sp[i];
+ // ^^^^^ careful, i-1 might be negative, but i in unsigned
+ }
+ Sp[arity-1] = app_ptrs_itbl[n-arity-1];
+ Sp--;
+ goto run_BCO_fun;
+ }
+ else if (arity == n) {
+ goto run_BCO_fun;
+ }
+ else /* arity > n */ {
+ // build a PAP and return it.
+ StgPAP *pap;
+ nat i;
+ pap = (StgPAP *)allocate(cap, PAP_sizeW(m));
SET_HDR(pap, &stg_PAP_info,cap->r.rCCCS);
- pap->arity = arity - n;
- pap->fun = obj;
- pap->n_args = m;
- for (i = 0; i < m; i++) {
- pap->payload[i] = (StgClosure *)Sp[i];
- }
- tagged_obj = (StgClosure *)pap;
- Sp += m;
- goto do_return;
- }
- }
-
- // No point in us applying machine-code functions
- default:
- defer_apply_to_sched:
- Sp -= 2;
- Sp[1] = (W_)tagged_obj;
- Sp[0] = (W_)&stg_enter_info;
- RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
+ pap->arity = arity - n;
+ pap->fun = obj;
+ pap->n_args = m;
+ for (i = 0; i < m; i++) {
+ pap->payload[i] = (StgClosure *)Sp[i];
+ }
+ tagged_obj = (StgClosure *)pap;
+ Sp += m;
+ goto do_return;
+ }
+ }
+
+ // No point in us applying machine-code functions
+ default:
+ defer_apply_to_sched:
+ Sp -= 2;
+ Sp[1] = (W_)tagged_obj;
+ Sp[0] = (W_)&stg_enter_info;
+ RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding);
}
// ------------------------------------------------------------------------
@@ -690,28 +690,28 @@ do_apply:
// The stack is in one of two states. First, if this BCO is a
// function:
//
- // | .... |
- // +---------------+
- // | arg2 |
- // +---------------+
- // | arg1 |
- // +---------------+
+ // | .... |
+ // +---------------+
+ // | arg2 |
+ // +---------------+
+ // | arg1 |
+ // +---------------+
//
// Second, if this BCO is a continuation:
//
- // | .... |
- // +---------------+
- // | fv2 |
- // +---------------+
- // | fv1 |
- // +---------------+
- // | BCO |
- // +---------------+
- // | stg_ctoi_ret_ |
- // +---------------+
- // | retval |
- // +---------------+
- //
+ // | .... |
+ // +---------------+
+ // | fv2 |
+ // +---------------+
+ // | fv1 |
+ // +---------------+
+ // | BCO |
+ // +---------------+
+ // | stg_ctoi_ret_ |
+ // +---------------+
+ // | retval |
+ // +---------------+
+ //
// where retval is the value being returned to this continuation.
// In the event of a stack check, heap check, or context switch,
// we need to leave the stack in a sane state so the garbage
@@ -730,103 +730,103 @@ do_apply:
run_BCO_return:
// Heap check
if (doYouWantToGC(cap)) {
- Sp--; Sp[0] = (W_)&stg_enter_info;
- RETURN_TO_SCHEDULER(ThreadInterpret, HeapOverflow);
+ Sp--; Sp[0] = (W_)&stg_enter_info;
+ RETURN_TO_SCHEDULER(ThreadInterpret, HeapOverflow);
}
// Stack checks aren't necessary at return points, the stack use
// is aggregated into the enclosing function entry point.
goto run_BCO;
-
+
run_BCO_return_unboxed:
// Heap check
if (doYouWantToGC(cap)) {
- RETURN_TO_SCHEDULER(ThreadInterpret, HeapOverflow);
+ RETURN_TO_SCHEDULER(ThreadInterpret, HeapOverflow);
}
// Stack checks aren't necessary at return points, the stack use
// is aggregated into the enclosing function entry point.
goto run_BCO;
-
+
run_BCO_fun:
IF_DEBUG(sanity,
- Sp -= 2;
- Sp[1] = (W_)obj;
- Sp[0] = (W_)&stg_apply_interp_info;
- checkStackChunk(Sp,SpLim);
- Sp += 2;
- );
+ Sp -= 2;
+ Sp[1] = (W_)obj;
+ Sp[0] = (W_)&stg_apply_interp_info;
+ checkStackChunk(Sp,SpLim);
+ Sp += 2;
+ );
// Heap check
if (doYouWantToGC(cap)) {
- Sp -= 2;
- Sp[1] = (W_)obj;
- Sp[0] = (W_)&stg_apply_interp_info; // placeholder, really
- RETURN_TO_SCHEDULER(ThreadInterpret, HeapOverflow);
+ Sp -= 2;
+ Sp[1] = (W_)obj;
+ Sp[0] = (W_)&stg_apply_interp_info; // placeholder, really
+ RETURN_TO_SCHEDULER(ThreadInterpret, HeapOverflow);
}
-
+
// Stack check
if (Sp - INTERP_STACK_CHECK_THRESH < SpLim) {
- Sp -= 2;
- Sp[1] = (W_)obj;
- Sp[0] = (W_)&stg_apply_interp_info; // placeholder, really
- RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
+ Sp -= 2;
+ Sp[1] = (W_)obj;
+ Sp[0] = (W_)&stg_apply_interp_info; // placeholder, really
+ RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
}
goto run_BCO;
-
+
// Now, actually interpret the BCO... (no returning to the
// scheduler again until the stack is in an orderly state).
run_BCO:
INTERP_TICK(it_BCO_entries);
{
- register int bciPtr = 0; /* instruction pointer */
+ register int bciPtr = 0; /* instruction pointer */
register StgWord16 bci;
- register StgBCO* bco = (StgBCO*)obj;
- register StgWord16* instrs = (StgWord16*)(bco->instrs->payload);
- register StgWord* literals = (StgWord*)(&bco->literals->payload[0]);
- register StgPtr* ptrs = (StgPtr*)(&bco->ptrs->payload[0]);
+ register StgBCO* bco = (StgBCO*)obj;
+ register StgWord16* instrs = (StgWord16*)(bco->instrs->payload);
+ register StgWord* literals = (StgWord*)(&bco->literals->payload[0]);
+ register StgPtr* ptrs = (StgPtr*)(&bco->ptrs->payload[0]);
#ifdef DEBUG
- int bcoSize;
+ int bcoSize;
bcoSize = bco->instrs->bytes / sizeof(StgWord16);
#endif
- IF_DEBUG(interpreter,debugBelch("bcoSize = %d\n", bcoSize));
+ IF_DEBUG(interpreter,debugBelch("bcoSize = %d\n", bcoSize));
#ifdef INTERP_STATS
- it_lastopc = 0; /* no opcode */
+ it_lastopc = 0; /* no opcode */
#endif
nextInsn:
- ASSERT(bciPtr < bcoSize);
- IF_DEBUG(interpreter,
- //if (do_print_stack) {
- //debugBelch("\n-- BEGIN stack\n");
- //printStack(Sp,cap->r.rCurrentTSO->stack+cap->r.rCurrentTSO->stack_size,iSu);
- //debugBelch("-- END stack\n\n");
- //}
+ ASSERT(bciPtr < bcoSize);
+ IF_DEBUG(interpreter,
+ //if (do_print_stack) {
+ //debugBelch("\n-- BEGIN stack\n");
+ //printStack(Sp,cap->r.rCurrentTSO->stack+cap->r.rCurrentTSO->stack_size,iSu);
+ //debugBelch("-- END stack\n\n");
+ //}
debugBelch("Sp = %p pc = %-4d ", Sp, bciPtr);
- disInstr(bco,bciPtr);
- if (0) { int i;
- debugBelch("\n");
- for (i = 8; i >= 0; i--) {
- debugBelch("%d %p\n", i, (StgPtr)(*(Sp+i)));
- }
- debugBelch("\n");
- }
- //if (do_print_stack) checkStack(Sp,cap->r.rCurrentTSO->stack+cap->r.rCurrentTSO->stack_size,iSu);
- );
+ disInstr(bco,bciPtr);
+ if (0) { int i;
+ debugBelch("\n");
+ for (i = 8; i >= 0; i--) {
+ debugBelch("%d %p\n", i, (StgPtr)(*(Sp+i)));
+ }
+ debugBelch("\n");
+ }
+ //if (do_print_stack) checkStack(Sp,cap->r.rCurrentTSO->stack+cap->r.rCurrentTSO->stack_size,iSu);
+ );
- INTERP_TICK(it_insns);
+ INTERP_TICK(it_insns);
#ifdef INTERP_STATS
- ASSERT( (int)instrs[bciPtr] >= 0 && (int)instrs[bciPtr] < 27 );
- it_ofreq[ (int)instrs[bciPtr] ] ++;
- it_oofreq[ it_lastopc ][ (int)instrs[bciPtr] ] ++;
- it_lastopc = (int)instrs[bciPtr];
+ ASSERT( (int)instrs[bciPtr] >= 0 && (int)instrs[bciPtr] < 27 );
+ it_ofreq[ (int)instrs[bciPtr] ] ++;
+ it_oofreq[ it_lastopc ][ (int)instrs[bciPtr] ] ++;
+ it_lastopc = (int)instrs[bciPtr];
#endif
- bci = BCO_NEXT;
+ bci = BCO_NEXT;
/* We use the high 8 bits for flags, only the highest of which is
* currently allocated */
ASSERT((bci & 0xFF00) == (bci & 0x8000));
@@ -834,7 +834,7 @@ run_BCO:
switch (bci & 0xFF) {
/* check for a breakpoint on the beginning of a let binding */
- case bci_BRK_FUN:
+ case bci_BRK_FUN:
{
int arg1_brk_array, arg2_array_index, arg3_freeVars;
StgArrWords *breakPoints;
@@ -852,7 +852,7 @@ run_BCO:
// check if we are returning from a breakpoint - this info
// is stored in the flags field of the current TSO
- returning_from_break = cap->r.rCurrentTSO->flags & TSO_STOPPED_ON_BREAKPOINT;
+ returning_from_break = cap->r.rCurrentTSO->flags & TSO_STOPPED_ON_BREAKPOINT;
// if we are returning from a break then skip this section
// and continue executing
@@ -864,7 +864,7 @@ run_BCO:
// "rts_stop_next_breakpoint" flag is true OR if the
// breakpoint flag for this particular expression is
// true
- if (rts_stop_next_breakpoint == rtsTrue ||
+ if (rts_stop_next_breakpoint == rtsTrue ||
breakPoints->payload[arg2_array_index] == rtsTrue)
{
// make sure we don't automatically stop at the
@@ -877,11 +877,11 @@ run_BCO:
// the BCO
size_words = BCO_BITMAP_SIZE(obj) + 2;
new_aps = (StgAP_STACK *) allocate(cap, AP_STACK_sizeW(size_words));
- SET_HDR(new_aps,&stg_AP_STACK_info,CCS_SYSTEM);
+ SET_HDR(new_aps,&stg_AP_STACK_info,CCS_SYSTEM);
new_aps->size = size_words;
- new_aps->fun = &stg_dummy_ret_closure;
+ new_aps->fun = &stg_dummy_ret_closure;
- // fill in the payload of the AP_STACK
+ // fill in the payload of the AP_STACK
new_aps->payload[0] = (StgClosure *)&stg_apply_interp_info;
new_aps->payload[1] = (StgClosure *)obj;
@@ -921,460 +921,460 @@ run_BCO:
cap->r.rCurrentTSO->flags &= ~TSO_STOPPED_ON_BREAKPOINT;
// continue normal execution of the byte code instructions
- goto nextInsn;
+ goto nextInsn;
+ }
+
+ case bci_STKCHECK: {
+ // Explicit stack check at the beginning of a function
+ // *only* (stack checks in case alternatives are
+ // propagated to the enclosing function).
+ StgWord stk_words_reqd = BCO_GET_LARGE_ARG + 1;
+ if (Sp - stk_words_reqd < SpLim) {
+ Sp -= 2;
+ Sp[1] = (W_)obj;
+ Sp[0] = (W_)&stg_apply_interp_info;
+ RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
+ } else {
+ goto nextInsn;
+ }
+ }
+
+ case bci_PUSH_L: {
+ int o1 = BCO_NEXT;
+ Sp[-1] = Sp[o1];
+ Sp--;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_LL: {
+ int o1 = BCO_NEXT;
+ int o2 = BCO_NEXT;
+ Sp[-1] = Sp[o1];
+ Sp[-2] = Sp[o2];
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_LLL: {
+ int o1 = BCO_NEXT;
+ int o2 = BCO_NEXT;
+ int o3 = BCO_NEXT;
+ Sp[-1] = Sp[o1];
+ Sp[-2] = Sp[o2];
+ Sp[-3] = Sp[o3];
+ Sp -= 3;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_G: {
+ int o1 = BCO_GET_LARGE_ARG;
+ Sp[-1] = BCO_PTR(o1);
+ Sp -= 1;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_ALTS: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_R1p_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_ALTS_P: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_R1unpt_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_ALTS_N: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_R1n_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
}
- case bci_STKCHECK: {
- // Explicit stack check at the beginning of a function
- // *only* (stack checks in case alternatives are
- // propagated to the enclosing function).
- StgWord stk_words_reqd = BCO_GET_LARGE_ARG + 1;
- if (Sp - stk_words_reqd < SpLim) {
- Sp -= 2;
- Sp[1] = (W_)obj;
- Sp[0] = (W_)&stg_apply_interp_info;
- RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
- } else {
- goto nextInsn;
- }
- }
-
- case bci_PUSH_L: {
- int o1 = BCO_NEXT;
- Sp[-1] = Sp[o1];
- Sp--;
- goto nextInsn;
- }
-
- case bci_PUSH_LL: {
- int o1 = BCO_NEXT;
- int o2 = BCO_NEXT;
- Sp[-1] = Sp[o1];
- Sp[-2] = Sp[o2];
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_LLL: {
- int o1 = BCO_NEXT;
- int o2 = BCO_NEXT;
- int o3 = BCO_NEXT;
- Sp[-1] = Sp[o1];
- Sp[-2] = Sp[o2];
- Sp[-3] = Sp[o3];
- Sp -= 3;
- goto nextInsn;
- }
-
- case bci_PUSH_G: {
- int o1 = BCO_GET_LARGE_ARG;
- Sp[-1] = BCO_PTR(o1);
- Sp -= 1;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_R1p_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS_P: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_R1unpt_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS_N: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_R1n_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS_F: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_F1_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS_D: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_D1_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS_L: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_L1_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_ALTS_V: {
- int o_bco = BCO_GET_LARGE_ARG;
- Sp[-2] = (W_)&stg_ctoi_V_info;
- Sp[-1] = BCO_PTR(o_bco);
- Sp -= 2;
- goto nextInsn;
- }
-
- case bci_PUSH_APPLY_N:
- Sp--; Sp[0] = (W_)&stg_ap_n_info;
- goto nextInsn;
- case bci_PUSH_APPLY_V:
- Sp--; Sp[0] = (W_)&stg_ap_v_info;
- goto nextInsn;
- case bci_PUSH_APPLY_F:
- Sp--; Sp[0] = (W_)&stg_ap_f_info;
- goto nextInsn;
- case bci_PUSH_APPLY_D:
- Sp--; Sp[0] = (W_)&stg_ap_d_info;
- goto nextInsn;
- case bci_PUSH_APPLY_L:
- Sp--; Sp[0] = (W_)&stg_ap_l_info;
- goto nextInsn;
- case bci_PUSH_APPLY_P:
- Sp--; Sp[0] = (W_)&stg_ap_p_info;
- goto nextInsn;
- case bci_PUSH_APPLY_PP:
- Sp--; Sp[0] = (W_)&stg_ap_pp_info;
- goto nextInsn;
- case bci_PUSH_APPLY_PPP:
- Sp--; Sp[0] = (W_)&stg_ap_ppp_info;
- goto nextInsn;
- case bci_PUSH_APPLY_PPPP:
- Sp--; Sp[0] = (W_)&stg_ap_pppp_info;
- goto nextInsn;
- case bci_PUSH_APPLY_PPPPP:
- Sp--; Sp[0] = (W_)&stg_ap_ppppp_info;
- goto nextInsn;
- case bci_PUSH_APPLY_PPPPPP:
- Sp--; Sp[0] = (W_)&stg_ap_pppppp_info;
- goto nextInsn;
-
- case bci_PUSH_UBX: {
- int i;
- int o_lits = BCO_GET_LARGE_ARG;
- int n_words = BCO_NEXT;
- Sp -= n_words;
- for (i = 0; i < n_words; i++) {
- Sp[i] = (W_)BCO_LIT(o_lits+i);
- }
- goto nextInsn;
- }
-
- case bci_SLIDE: {
- int n = BCO_NEXT;
- int by = BCO_NEXT;
- /* a_1, .. a_n, b_1, .. b_by, s => a_1, .. a_n, s */
- while(--n >= 0) {
- Sp[n+by] = Sp[n];
- }
- Sp += by;
- INTERP_TICK(it_slides);
- goto nextInsn;
- }
-
- case bci_ALLOC_AP: {
- StgAP* ap;
- int n_payload = BCO_NEXT;
- ap = (StgAP*)allocate(cap, AP_sizeW(n_payload));
- Sp[-1] = (W_)ap;
- ap->n_args = n_payload;
- SET_HDR(ap, &stg_AP_info, CCS_SYSTEM/*ToDo*/)
- Sp --;
- goto nextInsn;
- }
-
- case bci_ALLOC_AP_NOUPD: {
- StgAP* ap;
- int n_payload = BCO_NEXT;
- ap = (StgAP*)allocate(cap, AP_sizeW(n_payload));
- Sp[-1] = (W_)ap;
- ap->n_args = n_payload;
- SET_HDR(ap, &stg_AP_NOUPD_info, CCS_SYSTEM/*ToDo*/)
- Sp --;
- goto nextInsn;
- }
-
- case bci_ALLOC_PAP: {
- StgPAP* pap;
- int arity = BCO_NEXT;
- int n_payload = BCO_NEXT;
- pap = (StgPAP*)allocate(cap, PAP_sizeW(n_payload));
- Sp[-1] = (W_)pap;
- pap->n_args = n_payload;
- pap->arity = arity;
- SET_HDR(pap, &stg_PAP_info, CCS_SYSTEM/*ToDo*/)
- Sp --;
- goto nextInsn;
- }
-
- case bci_MKAP: {
- int i;
- int stkoff = BCO_NEXT;
- int n_payload = BCO_NEXT;
- StgAP* ap = (StgAP*)Sp[stkoff];
- ASSERT((int)ap->n_args == n_payload);
- ap->fun = (StgClosure*)Sp[0];
-
- // The function should be a BCO, and its bitmap should
- // cover the payload of the AP correctly.
- ASSERT(get_itbl(ap->fun)->type == BCO
- && BCO_BITMAP_SIZE(ap->fun) == ap->n_args);
-
- for (i = 0; i < n_payload; i++)
- ap->payload[i] = (StgClosure*)Sp[i+1];
- Sp += n_payload+1;
- IF_DEBUG(interpreter,
- debugBelch("\tBuilt ");
- printObj((StgClosure*)ap);
- );
- goto nextInsn;
- }
-
- case bci_MKPAP: {
- int i;
- int stkoff = BCO_NEXT;
- int n_payload = BCO_NEXT;
- StgPAP* pap = (StgPAP*)Sp[stkoff];
- ASSERT((int)pap->n_args == n_payload);
- pap->fun = (StgClosure*)Sp[0];
-
- // The function should be a BCO
- ASSERT(get_itbl(pap->fun)->type == BCO);
-
- for (i = 0; i < n_payload; i++)
- pap->payload[i] = (StgClosure*)Sp[i+1];
- Sp += n_payload+1;
- IF_DEBUG(interpreter,
- debugBelch("\tBuilt ");
- printObj((StgClosure*)pap);
- );
- goto nextInsn;
- }
-
- case bci_UNPACK: {
- /* Unpack N ptr words from t.o.s constructor */
- int i;
- int n_words = BCO_NEXT;
- StgClosure* con = (StgClosure*)Sp[0];
- Sp -= n_words;
- for (i = 0; i < n_words; i++) {
- Sp[i] = (W_)con->payload[i];
- }
- goto nextInsn;
- }
-
- case bci_PACK: {
- int i;
- int o_itbl = BCO_GET_LARGE_ARG;
- int n_words = BCO_NEXT;
- StgInfoTable* itbl = INFO_PTR_TO_STRUCT((StgInfoTable *)BCO_LIT(o_itbl));
- int request = CONSTR_sizeW( itbl->layout.payload.ptrs,
- itbl->layout.payload.nptrs );
- StgClosure* con = (StgClosure*)allocate_NONUPD(cap,request);
- ASSERT( itbl->layout.payload.ptrs + itbl->layout.payload.nptrs > 0);
- SET_HDR(con, (StgInfoTable*)BCO_LIT(o_itbl), CCS_SYSTEM/*ToDo*/);
- for (i = 0; i < n_words; i++) {
- con->payload[i] = (StgClosure*)Sp[i];
- }
- Sp += n_words;
- Sp --;
- Sp[0] = (W_)con;
- IF_DEBUG(interpreter,
- debugBelch("\tBuilt ");
- printObj((StgClosure*)con);
- );
- goto nextInsn;
- }
-
- case bci_TESTLT_P: {
- unsigned int discr = BCO_NEXT;
- int failto = BCO_GET_LARGE_ARG;
- StgClosure* con = (StgClosure*)Sp[0];
- if (GET_TAG(con) >= discr) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTEQ_P: {
- unsigned int discr = BCO_NEXT;
- int failto = BCO_GET_LARGE_ARG;
- StgClosure* con = (StgClosure*)Sp[0];
- if (GET_TAG(con) != discr) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTLT_I: {
- // There should be an Int at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- I_ stackInt = (I_)Sp[1];
- if (stackInt >= (I_)BCO_LIT(discr))
- bciPtr = failto;
- goto nextInsn;
- }
-
- case bci_TESTEQ_I: {
- // There should be an Int at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- I_ stackInt = (I_)Sp[1];
- if (stackInt != (I_)BCO_LIT(discr)) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTLT_W: {
- // There should be an Int at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- W_ stackWord = (W_)Sp[1];
- if (stackWord >= (W_)BCO_LIT(discr))
- bciPtr = failto;
- goto nextInsn;
- }
-
- case bci_TESTEQ_W: {
- // There should be an Int at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- W_ stackWord = (W_)Sp[1];
- if (stackWord != (W_)BCO_LIT(discr)) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTLT_D: {
- // There should be a Double at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- StgDouble stackDbl, discrDbl;
- stackDbl = PK_DBL( & Sp[1] );
- discrDbl = PK_DBL( & BCO_LIT(discr) );
- if (stackDbl >= discrDbl) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTEQ_D: {
- // There should be a Double at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- StgDouble stackDbl, discrDbl;
- stackDbl = PK_DBL( & Sp[1] );
- discrDbl = PK_DBL( & BCO_LIT(discr) );
- if (stackDbl != discrDbl) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTLT_F: {
- // There should be a Float at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- StgFloat stackFlt, discrFlt;
- stackFlt = PK_FLT( & Sp[1] );
- discrFlt = PK_FLT( & BCO_LIT(discr) );
- if (stackFlt >= discrFlt) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- case bci_TESTEQ_F: {
- // There should be a Float at Sp[1], and an info table at Sp[0].
- int discr = BCO_GET_LARGE_ARG;
- int failto = BCO_GET_LARGE_ARG;
- StgFloat stackFlt, discrFlt;
- stackFlt = PK_FLT( & Sp[1] );
- discrFlt = PK_FLT( & BCO_LIT(discr) );
- if (stackFlt != discrFlt) {
- bciPtr = failto;
- }
- goto nextInsn;
- }
-
- // Control-flow ish things
- case bci_ENTER:
- // Context-switch check. We put it here to ensure that
- // the interpreter has done at least *some* work before
- // context switching: sometimes the scheduler can invoke
- // the interpreter with context_switch == 1, particularly
- // if the -C0 flag has been given on the cmd line.
- if (cap->r.rHpLim == NULL) {
- Sp--; Sp[0] = (W_)&stg_enter_info;
- RETURN_TO_SCHEDULER(ThreadInterpret, ThreadYielding);
- }
- goto eval;
-
- case bci_RETURN:
- tagged_obj = (StgClosure *)Sp[0];
- Sp++;
- goto do_return;
-
- case bci_RETURN_P:
- Sp--;
+ case bci_PUSH_ALTS_F: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_F1_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_ALTS_D: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_D1_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_ALTS_L: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_L1_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_ALTS_V: {
+ int o_bco = BCO_GET_LARGE_ARG;
+ Sp[-2] = (W_)&stg_ctoi_V_info;
+ Sp[-1] = BCO_PTR(o_bco);
+ Sp -= 2;
+ goto nextInsn;
+ }
+
+ case bci_PUSH_APPLY_N:
+ Sp--; Sp[0] = (W_)&stg_ap_n_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_V:
+ Sp--; Sp[0] = (W_)&stg_ap_v_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_F:
+ Sp--; Sp[0] = (W_)&stg_ap_f_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_D:
+ Sp--; Sp[0] = (W_)&stg_ap_d_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_L:
+ Sp--; Sp[0] = (W_)&stg_ap_l_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_P:
+ Sp--; Sp[0] = (W_)&stg_ap_p_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_PP:
+ Sp--; Sp[0] = (W_)&stg_ap_pp_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_PPP:
+ Sp--; Sp[0] = (W_)&stg_ap_ppp_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_PPPP:
+ Sp--; Sp[0] = (W_)&stg_ap_pppp_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_PPPPP:
+ Sp--; Sp[0] = (W_)&stg_ap_ppppp_info;
+ goto nextInsn;
+ case bci_PUSH_APPLY_PPPPPP:
+ Sp--; Sp[0] = (W_)&stg_ap_pppppp_info;
+ goto nextInsn;
+
+ case bci_PUSH_UBX: {
+ int i;
+ int o_lits = BCO_GET_LARGE_ARG;
+ int n_words = BCO_NEXT;
+ Sp -= n_words;
+ for (i = 0; i < n_words; i++) {
+ Sp[i] = (W_)BCO_LIT(o_lits+i);
+ }
+ goto nextInsn;
+ }
+
+ case bci_SLIDE: {
+ int n = BCO_NEXT;
+ int by = BCO_NEXT;
+ /* a_1, .. a_n, b_1, .. b_by, s => a_1, .. a_n, s */
+ while(--n >= 0) {
+ Sp[n+by] = Sp[n];
+ }
+ Sp += by;
+ INTERP_TICK(it_slides);
+ goto nextInsn;
+ }
+
+ case bci_ALLOC_AP: {
+ StgAP* ap;
+ int n_payload = BCO_NEXT;
+ ap = (StgAP*)allocate(cap, AP_sizeW(n_payload));
+ Sp[-1] = (W_)ap;
+ ap->n_args = n_payload;
+ SET_HDR(ap, &stg_AP_info, CCS_SYSTEM/*ToDo*/)
+ Sp --;
+ goto nextInsn;
+ }
+
+ case bci_ALLOC_AP_NOUPD: {
+ StgAP* ap;
+ int n_payload = BCO_NEXT;
+ ap = (StgAP*)allocate(cap, AP_sizeW(n_payload));
+ Sp[-1] = (W_)ap;
+ ap->n_args = n_payload;
+ SET_HDR(ap, &stg_AP_NOUPD_info, CCS_SYSTEM/*ToDo*/)
+ Sp --;
+ goto nextInsn;
+ }
+
+ case bci_ALLOC_PAP: {
+ StgPAP* pap;
+ int arity = BCO_NEXT;
+ int n_payload = BCO_NEXT;
+ pap = (StgPAP*)allocate(cap, PAP_sizeW(n_payload));
+ Sp[-1] = (W_)pap;
+ pap->n_args = n_payload;
+ pap->arity = arity;
+ SET_HDR(pap, &stg_PAP_info, CCS_SYSTEM/*ToDo*/)
+ Sp --;
+ goto nextInsn;
+ }
+
+ case bci_MKAP: {
+ int i;
+ int stkoff = BCO_NEXT;
+ int n_payload = BCO_NEXT;
+ StgAP* ap = (StgAP*)Sp[stkoff];
+ ASSERT((int)ap->n_args == n_payload);
+ ap->fun = (StgClosure*)Sp[0];
+
+ // The function should be a BCO, and its bitmap should
+ // cover the payload of the AP correctly.
+ ASSERT(get_itbl(ap->fun)->type == BCO
+ && BCO_BITMAP_SIZE(ap->fun) == ap->n_args);
+
+ for (i = 0; i < n_payload; i++)
+ ap->payload[i] = (StgClosure*)Sp[i+1];
+ Sp += n_payload+1;
+ IF_DEBUG(interpreter,
+ debugBelch("\tBuilt ");
+ printObj((StgClosure*)ap);
+ );
+ goto nextInsn;
+ }
+
+ case bci_MKPAP: {
+ int i;
+ int stkoff = BCO_NEXT;
+ int n_payload = BCO_NEXT;
+ StgPAP* pap = (StgPAP*)Sp[stkoff];
+ ASSERT((int)pap->n_args == n_payload);
+ pap->fun = (StgClosure*)Sp[0];
+
+ // The function should be a BCO
+ ASSERT(get_itbl(pap->fun)->type == BCO);
+
+ for (i = 0; i < n_payload; i++)
+ pap->payload[i] = (StgClosure*)Sp[i+1];
+ Sp += n_payload+1;
+ IF_DEBUG(interpreter,
+ debugBelch("\tBuilt ");
+ printObj((StgClosure*)pap);
+ );
+ goto nextInsn;
+ }
+
+ case bci_UNPACK: {
+ /* Unpack N ptr words from t.o.s constructor */
+ int i;
+ int n_words = BCO_NEXT;
+ StgClosure* con = (StgClosure*)Sp[0];
+ Sp -= n_words;
+ for (i = 0; i < n_words; i++) {
+ Sp[i] = (W_)con->payload[i];
+ }
+ goto nextInsn;
+ }
+
+ case bci_PACK: {
+ int i;
+ int o_itbl = BCO_GET_LARGE_ARG;
+ int n_words = BCO_NEXT;
+ StgInfoTable* itbl = INFO_PTR_TO_STRUCT((StgInfoTable *)BCO_LIT(o_itbl));
+ int request = CONSTR_sizeW( itbl->layout.payload.ptrs,
+ itbl->layout.payload.nptrs );
+ StgClosure* con = (StgClosure*)allocate_NONUPD(cap,request);
+ ASSERT( itbl->layout.payload.ptrs + itbl->layout.payload.nptrs > 0);
+ SET_HDR(con, (StgInfoTable*)BCO_LIT(o_itbl), CCS_SYSTEM/*ToDo*/);
+ for (i = 0; i < n_words; i++) {
+ con->payload[i] = (StgClosure*)Sp[i];
+ }
+ Sp += n_words;
+ Sp --;
+ Sp[0] = (W_)con;
+ IF_DEBUG(interpreter,
+ debugBelch("\tBuilt ");
+ printObj((StgClosure*)con);
+ );
+ goto nextInsn;
+ }
+
+ case bci_TESTLT_P: {
+ unsigned int discr = BCO_NEXT;
+ int failto = BCO_GET_LARGE_ARG;
+ StgClosure* con = (StgClosure*)Sp[0];
+ if (GET_TAG(con) >= discr) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTEQ_P: {
+ unsigned int discr = BCO_NEXT;
+ int failto = BCO_GET_LARGE_ARG;
+ StgClosure* con = (StgClosure*)Sp[0];
+ if (GET_TAG(con) != discr) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTLT_I: {
+ // There should be an Int at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ I_ stackInt = (I_)Sp[1];
+ if (stackInt >= (I_)BCO_LIT(discr))
+ bciPtr = failto;
+ goto nextInsn;
+ }
+
+ case bci_TESTEQ_I: {
+ // There should be an Int at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ I_ stackInt = (I_)Sp[1];
+ if (stackInt != (I_)BCO_LIT(discr)) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTLT_W: {
+ // There should be an Int at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ W_ stackWord = (W_)Sp[1];
+ if (stackWord >= (W_)BCO_LIT(discr))
+ bciPtr = failto;
+ goto nextInsn;
+ }
+
+ case bci_TESTEQ_W: {
+ // There should be an Int at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ W_ stackWord = (W_)Sp[1];
+ if (stackWord != (W_)BCO_LIT(discr)) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTLT_D: {
+ // There should be a Double at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ StgDouble stackDbl, discrDbl;
+ stackDbl = PK_DBL( & Sp[1] );
+ discrDbl = PK_DBL( & BCO_LIT(discr) );
+ if (stackDbl >= discrDbl) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTEQ_D: {
+ // There should be a Double at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ StgDouble stackDbl, discrDbl;
+ stackDbl = PK_DBL( & Sp[1] );
+ discrDbl = PK_DBL( & BCO_LIT(discr) );
+ if (stackDbl != discrDbl) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTLT_F: {
+ // There should be a Float at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ StgFloat stackFlt, discrFlt;
+ stackFlt = PK_FLT( & Sp[1] );
+ discrFlt = PK_FLT( & BCO_LIT(discr) );
+ if (stackFlt >= discrFlt) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ case bci_TESTEQ_F: {
+ // There should be a Float at Sp[1], and an info table at Sp[0].
+ int discr = BCO_GET_LARGE_ARG;
+ int failto = BCO_GET_LARGE_ARG;
+ StgFloat stackFlt, discrFlt;
+ stackFlt = PK_FLT( & Sp[1] );
+ discrFlt = PK_FLT( & BCO_LIT(discr) );
+ if (stackFlt != discrFlt) {
+ bciPtr = failto;
+ }
+ goto nextInsn;
+ }
+
+ // Control-flow ish things
+ case bci_ENTER:
+ // Context-switch check. We put it here to ensure that
+ // the interpreter has done at least *some* work before
+ // context switching: sometimes the scheduler can invoke
+ // the interpreter with context_switch == 1, particularly
+ // if the -C0 flag has been given on the cmd line.
+ if (cap->r.rHpLim == NULL) {
+ Sp--; Sp[0] = (W_)&stg_enter_info;
+ RETURN_TO_SCHEDULER(ThreadInterpret, ThreadYielding);
+ }
+ goto eval;
+
+ case bci_RETURN:
+ tagged_obj = (StgClosure *)Sp[0];
+ Sp++;
+ goto do_return;
+
+ case bci_RETURN_P:
+ Sp--;
Sp[0] = (W_)&stg_ret_p_info;
- goto do_return_unboxed;
- case bci_RETURN_N:
- Sp--;
+ goto do_return_unboxed;
+ case bci_RETURN_N:
+ Sp--;
Sp[0] = (W_)&stg_ret_n_info;
- goto do_return_unboxed;
- case bci_RETURN_F:
- Sp--;
+ goto do_return_unboxed;
+ case bci_RETURN_F:
+ Sp--;
Sp[0] = (W_)&stg_ret_f_info;
- goto do_return_unboxed;
- case bci_RETURN_D:
- Sp--;
+ goto do_return_unboxed;
+ case bci_RETURN_D:
+ Sp--;
Sp[0] = (W_)&stg_ret_d_info;
- goto do_return_unboxed;
- case bci_RETURN_L:
- Sp--;
+ goto do_return_unboxed;
+ case bci_RETURN_L:
+ Sp--;
Sp[0] = (W_)&stg_ret_l_info;
- goto do_return_unboxed;
- case bci_RETURN_V:
- Sp--;
+ goto do_return_unboxed;
+ case bci_RETURN_V:
+ Sp--;
Sp[0] = (W_)&stg_ret_v_info;
- goto do_return_unboxed;
-
- case bci_SWIZZLE: {
- int stkoff = BCO_NEXT;
- signed short n = (signed short)(BCO_NEXT);
- Sp[stkoff] += (W_)n;
- goto nextInsn;
- }
-
- case bci_CCALL: {
- void *tok;
- int stk_offset = BCO_NEXT;
- int o_itbl = BCO_GET_LARGE_ARG;
- int interruptible = BCO_NEXT;
- void(*marshall_fn)(void*) = (void (*)(void*))BCO_LIT(o_itbl);
+ goto do_return_unboxed;
+
+ case bci_SWIZZLE: {
+ int stkoff = BCO_NEXT;
+ signed short n = (signed short)(BCO_NEXT);
+ Sp[stkoff] += (W_)n;
+ goto nextInsn;
+ }
+
+ case bci_CCALL: {
+ void *tok;
+ int stk_offset = BCO_NEXT;
+ int o_itbl = BCO_GET_LARGE_ARG;
+ int interruptible = BCO_NEXT;
+ void(*marshall_fn)(void*) = (void (*)(void*))BCO_LIT(o_itbl);
/* the stack looks like this:
-
+
| | <- Sp + stk_offset
- +-------------+
+ +-------------+
| |
| args |
| | <- Sp + ret_size + 1
@@ -1403,7 +1403,7 @@ run_BCO:
int j;
StgPtr p;
W_ ret[2]; // max needed
- W_ *arguments[stk_offset]; // max needed
+ W_ *arguments[stk_offset]; // max needed
void *argptrs[nargs];
void (*fn)(void);
@@ -1416,9 +1416,9 @@ run_BCO:
ret_size = ROUND_UP_WDS(cif->rtype->size);
}
- memcpy(arguments, Sp+ret_size+1,
+ memcpy(arguments, Sp+ret_size+1,
sizeof(W_) * (stk_offset-1-ret_size));
-
+
// libffi expects the args as an array of pointers to
// values, so we have to construct this array before making
// the call.
@@ -1432,17 +1432,17 @@ run_BCO:
// this is the function we're going to call
fn = (void(*)(void))Sp[ret_size];
- // Restore the Haskell thread's current value of errno
- errno = cap->r.rCurrentTSO->saved_errno;
-
- // There are a bunch of non-ptr words on the stack (the
- // ccall args, the ccall fun address and space for the
- // result), which we need to cover with an info table
- // since we might GC during this call.
- //
- // We know how many (non-ptr) words there are before the
- // next valid stack frame: it is the stk_offset arg to the
- // CCALL instruction. So we overwrite this area of the
+ // Restore the Haskell thread's current value of errno
+ errno = cap->r.rCurrentTSO->saved_errno;
+
+ // There are a bunch of non-ptr words on the stack (the
+ // ccall args, the ccall fun address and space for the
+ // result), which we need to cover with an info table
+ // since we might GC during this call.
+ //
+ // We know how many (non-ptr) words there are before the
+ // next valid stack frame: it is the stk_offset arg to the
+ // CCALL instruction. So we overwrite this area of the
// stack with empty stack frames (stg_ret_v_info);
//
for (j = 0; j < stk_offset; j++) {
@@ -1456,15 +1456,15 @@ run_BCO:
Sp[1] = (W_)obj;
Sp[0] = (W_)&stg_ret_p_info;
- SAVE_STACK_POINTERS;
- tok = suspendThread(&cap->r, interruptible ? rtsTrue : rtsFalse);
+ SAVE_STACK_POINTERS;
+ tok = suspendThread(&cap->r, interruptible ? rtsTrue : rtsFalse);
- // We already made a copy of the arguments above.
+ // We already made a copy of the arguments above.
ffi_call(cif, fn, ret, argptrs);
// And restart the thread again, popping the stg_ret_p frame.
- cap = (Capability *)((void *)((unsigned char*)resumeThread(tok) - STG_FIELD_OFFSET(Capability,r)));
- LOAD_STACK_POINTERS;
+ cap = (Capability *)((void *)((unsigned char*)resumeThread(tok) - STG_FIELD_OFFSET(Capability,r)));
+ LOAD_STACK_POINTERS;
if (Sp[0] != (W_)&stg_ret_p_info) {
// the stack is not how we left it. This probably
@@ -1484,33 +1484,33 @@ run_BCO:
ptrs = (StgPtr*)(&bco->ptrs->payload[0]);
Sp += 2; // pop the stg_ret_p frame
-
- // Save the Haskell thread's current value of errno
- cap->r.rCurrentTSO->saved_errno = errno;
-
- // Copy the return value back to the TSO stack. It is at
+
+ // Save the Haskell thread's current value of errno
+ cap->r.rCurrentTSO->saved_errno = errno;
+
+ // Copy the return value back to the TSO stack. It is at
// most 2 words large, and resides at arguments[0].
memcpy(Sp, ret, sizeof(W_) * stg_min(stk_offset,ret_size));
- goto nextInsn;
- }
-
- case bci_JMP: {
- /* BCO_NEXT modifies bciPtr, so be conservative. */
- int nextpc = BCO_GET_LARGE_ARG;
- bciPtr = nextpc;
- goto nextInsn;
- }
-
- case bci_CASEFAIL:
- barf("interpretBCO: hit a CASEFAIL");
-
- // Errors
- default:
- barf("interpretBCO: unknown or unimplemented opcode %d",
+ goto nextInsn;
+ }
+
+ case bci_JMP: {
+ /* BCO_NEXT modifies bciPtr, so be conservative. */
+ int nextpc = BCO_GET_LARGE_ARG;
+ bciPtr = nextpc;
+ goto nextInsn;
+ }
+
+ case bci_CASEFAIL:
+ barf("interpretBCO: hit a CASEFAIL");
+
+ // Errors
+ default:
+ barf("interpretBCO: unknown or unimplemented opcode %d",
(int)(bci & 0xFF));
- } /* switch on opcode */
+ } /* switch on opcode */
}
}
diff --git a/rts/LdvProfile.h b/rts/LdvProfile.h
index b4418046ba..d58c5fbf57 100644
--- a/rts/LdvProfile.h
+++ b/rts/LdvProfile.h
@@ -18,16 +18,16 @@ RTS_PRIVATE void LdvCensusForDead ( nat );
RTS_PRIVATE void LdvCensusKillAll ( void );
// Creates a 0-filled slop of size 'howManyBackwards' backwards from the
-// address 'from'.
+// address 'from'.
//
-// Invoked when:
+// Invoked when:
// 1) Hp is incremented and exceeds HpLim (in Updates.hc).
// 2) copypart() is called (in GC.c).
-#define LDV_FILL_SLOP(from, howMany) \
- if (era > 0) { \
- int i; \
- for (i = 0;i < (howMany); i++) \
- ((StgWord *)(from))[i] = 0; \
+#define LDV_FILL_SLOP(from, howMany) \
+ if (era > 0) { \
+ int i; \
+ for (i = 0;i < (howMany); i++) \
+ ((StgWord *)(from))[i] = 0; \
}
// Informs the LDV profiler that closure c has just been evacuated.
diff --git a/rts/Linker.c b/rts/Linker.c
index 9a7c300577..7290c966bb 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -217,8 +217,9 @@ static int ocRunInit_PEi386 ( ObjectCode* oc );
static void *lookupSymbolInDLLs ( unsigned char *lbl );
static void zapTrailingAtSign ( unsigned char *sym );
static char *allocateImageAndTrampolines (
+ pathchar* arch_name, char* member_name,
#if defined(x86_64_HOST_ARCH)
- FILE* f, pathchar* arch_name, char* member_name,
+ FILE* f,
#endif
int size );
#if defined(x86_64_HOST_ARCH)
@@ -2725,9 +2726,9 @@ loadArchive( pathchar *path )
#elif defined(mingw32_HOST_OS)
// TODO: We would like to use allocateExec here, but allocateExec
// cannot currently allocate blocks large enough.
- image = allocateImageAndTrampolines(
+ image = allocateImageAndTrampolines(path, fileName,
#if defined(x86_64_HOST_ARCH)
- f, path, fileName,
+ f,
#endif
memberSize);
#elif defined(darwin_HOST_OS)
@@ -2946,9 +2947,9 @@ loadObj( pathchar *path )
# if defined(mingw32_HOST_OS)
// TODO: We would like to use allocateExec here, but allocateExec
// cannot currently allocate blocks large enough.
- image = allocateImageAndTrampolines(
+ image = allocateImageAndTrampolines(path, "itself",
#if defined(x86_64_HOST_ARCH)
- f, path, "itself",
+ f,
#endif
fileSize);
if (image == NULL) {
@@ -3663,8 +3664,9 @@ static int verifyCOFFHeader ( COFF_header *hdr, pathchar *filename);
*/
static char *
allocateImageAndTrampolines (
+ pathchar* arch_name, char* member_name,
#if defined(x86_64_HOST_ARCH)
- FILE* f, pathchar* arch_name, char* member_name,
+ FILE* f,
#endif
int size )
{
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 9079c2be60..06b677c428 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -49,14 +49,14 @@ static nat max_era;
typedef struct _counter {
void *identity;
union {
- nat resid;
- struct {
- long prim; // total size of 'inherently used' closures
- long not_used; // total size of 'never used' closures
- long used; // total size of 'used at least once' closures
- long void_total; // current total size of 'destroyed without being used' closures
- long drag_total; // current total size of 'used at least once and waiting to die'
- } ldv;
+ nat resid;
+ struct {
+ long prim; // total size of 'inherently used' closures
+ long not_used; // total size of 'never used' closures
+ long used; // total size of 'used at least once' closures
+ long void_total; // current total size of 'destroyed without being used' closures
+ long drag_total; // current total size of 'used at least once and waiting to die'
+ } ldv;
} c;
struct _counter *next;
} counter;
@@ -108,20 +108,20 @@ closureIdentity( StgClosure *p )
#ifdef PROFILING
case HEAP_BY_CCS:
- return p->header.prof.ccs;
+ return p->header.prof.ccs;
case HEAP_BY_MOD:
- return p->header.prof.ccs->cc->module;
+ return p->header.prof.ccs->cc->module;
case HEAP_BY_DESCR:
- return GET_PROF_DESC(get_itbl(p));
+ return GET_PROF_DESC(get_itbl(p));
case HEAP_BY_TYPE:
- return GET_PROF_TYPE(get_itbl(p));
+ return GET_PROF_TYPE(get_itbl(p));
case HEAP_BY_RETAINER:
- // AFAIK, the only closures in the heap which might not have a
- // valid retainer set are DEAD_WEAK closures.
- if (isRetainerSetFieldValid(p))
- return retainerSetOf(p);
- else
- return NULL;
+ // AFAIK, the only closures in the heap which might not have a
+ // valid retainer set are DEAD_WEAK closures.
+ if (isRetainerSetFieldValid(p))
+ return retainerSetOf(p);
+ else
+ return NULL;
#else
case HEAP_BY_CLOSURE_TYPE:
@@ -145,7 +145,7 @@ closureIdentity( StgClosure *p )
#endif
default:
- barf("closureIdentity");
+ barf("closureIdentity");
}
}
@@ -156,25 +156,25 @@ closureIdentity( StgClosure *p )
STATIC_INLINE rtsBool
doingLDVProfiling( void )
{
- return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV
- || RtsFlags.ProfFlags.bioSelector != NULL);
+ return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV
+ || RtsFlags.ProfFlags.bioSelector != NULL);
}
STATIC_INLINE rtsBool
doingRetainerProfiling( void )
{
return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_RETAINER
- || RtsFlags.ProfFlags.retainerSelector != NULL);
+ || RtsFlags.ProfFlags.retainerSelector != NULL);
}
#endif /* PROFILING */
// Precesses a closure 'c' being destroyed whose size is 'size'.
// Make sure that LDV_recordDead() is not invoked on 'inherently used' closures
// such as TSO; they should not be involved in computing dragNew or voidNew.
-//
-// Even though era is checked in both LdvCensusForDead() and
-// LdvCensusKillAll(), we still need to make sure that era is > 0 because
-// LDV_recordDead() may be called from elsewhere in the runtime system. E.g.,
+//
+// Even though era is checked in both LdvCensusForDead() and
+// LdvCensusKillAll(), we still need to make sure that era is > 0 because
+// LDV_recordDead() may be called from elsewhere in the runtime system. E.g.,
// when a thunk is replaced by an indirection object.
#ifdef PROFILING
@@ -186,57 +186,57 @@ LDV_recordDead( StgClosure *c, nat size )
counter *ctr;
if (era > 0 && closureSatisfiesConstraints(c)) {
- size -= sizeofW(StgProfHeader);
- ASSERT(LDVW(c) != 0);
- if ((LDVW((c)) & LDV_STATE_MASK) == LDV_STATE_CREATE) {
- t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT;
- if (t < era) {
- if (RtsFlags.ProfFlags.bioSelector == NULL) {
+ size -= sizeofW(StgProfHeader);
+ ASSERT(LDVW(c) != 0);
+ if ((LDVW((c)) & LDV_STATE_MASK) == LDV_STATE_CREATE) {
+ t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT;
+ if (t < era) {
+ if (RtsFlags.ProfFlags.bioSelector == NULL) {
censuses[t].void_total += (long)size;
censuses[era].void_total -= (long)size;
- ASSERT(censuses[t].void_total < censuses[t].not_used);
- } else {
- id = closureIdentity(c);
- ctr = lookupHashTable(censuses[t].hash, (StgWord)id);
- ASSERT( ctr != NULL );
+ ASSERT(censuses[t].void_total < censuses[t].not_used);
+ } else {
+ id = closureIdentity(c);
+ ctr = lookupHashTable(censuses[t].hash, (StgWord)id);
+ ASSERT( ctr != NULL );
ctr->c.ldv.void_total += (long)size;
- ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
- if (ctr == NULL) {
- ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
- initLDVCtr(ctr);
- insertHashTable(censuses[era].hash, (StgWord)id, ctr);
- ctr->identity = id;
- ctr->next = censuses[era].ctrs;
- censuses[era].ctrs = ctr;
- }
+ ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
+ if (ctr == NULL) {
+ ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
+ initLDVCtr(ctr);
+ insertHashTable(censuses[era].hash, (StgWord)id, ctr);
+ ctr->identity = id;
+ ctr->next = censuses[era].ctrs;
+ censuses[era].ctrs = ctr;
+ }
ctr->c.ldv.void_total -= (long)size;
- }
- }
- } else {
- t = LDVW((c)) & LDV_LAST_MASK;
- if (t + 1 < era) {
- if (RtsFlags.ProfFlags.bioSelector == NULL) {
- censuses[t+1].drag_total += size;
- censuses[era].drag_total -= size;
- } else {
- void *id;
- id = closureIdentity(c);
- ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id);
- ASSERT( ctr != NULL );
+ }
+ }
+ } else {
+ t = LDVW((c)) & LDV_LAST_MASK;
+ if (t + 1 < era) {
+ if (RtsFlags.ProfFlags.bioSelector == NULL) {
+ censuses[t+1].drag_total += size;
+ censuses[era].drag_total -= size;
+ } else {
+ void *id;
+ id = closureIdentity(c);
+ ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id);
+ ASSERT( ctr != NULL );
ctr->c.ldv.drag_total += (long)size;
- ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
- if (ctr == NULL) {
- ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
- initLDVCtr(ctr);
- insertHashTable(censuses[era].hash, (StgWord)id, ctr);
- ctr->identity = id;
- ctr->next = censuses[era].ctrs;
- censuses[era].ctrs = ctr;
- }
+ ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
+ if (ctr == NULL) {
+ ctr = arenaAlloc(censuses[era].arena, sizeof(counter));
+ initLDVCtr(ctr);
+ insertHashTable(censuses[era].hash, (StgWord)id, ctr);
+ ctr->identity = id;
+ ctr->next = censuses[era].ctrs;
+ censuses[era].ctrs = ctr;
+ }
ctr->c.ldv.drag_total -= (long)size;
- }
- }
- }
+ }
+ }
+ }
}
}
#endif
@@ -275,19 +275,19 @@ static void
nextEra( void )
{
#ifdef PROFILING
- if (doingLDVProfiling()) {
- era++;
-
- if (era == max_era) {
- errorBelch("maximum number of censuses reached; use +RTS -i to reduce");
- stg_exit(EXIT_FAILURE);
- }
-
- if (era == n_censuses) {
- n_censuses *= 2;
- censuses = stgReallocBytes(censuses, sizeof(Census) * n_censuses,
- "nextEra");
- }
+ if (doingLDVProfiling()) {
+ era++;
+
+ if (era == max_era) {
+ errorBelch("maximum number of censuses reached; use +RTS -i to reduce");
+ stg_exit(EXIT_FAILURE);
+ }
+
+ if (era == n_censuses) {
+ n_censuses *= 2;
+ censuses = stgReallocBytes(censuses, sizeof(Census) * n_censuses,
+ "nextEra");
+ }
}
#endif /* PROFILING */
@@ -335,7 +335,7 @@ void initProfiling2 (void)
/* open the log file */
if ((hp_file = fopen(hp_filename, "w")) == NULL) {
debugBelch("Can't open profiling report file %s\n",
- hp_filename);
+ hp_filename);
RtsFlags.ProfFlags.doHeapProfile = 0;
stgFree(prog);
return;
@@ -378,8 +378,8 @@ initHeapProfiling(void)
#ifdef PROFILING
if (doingLDVProfiling() && doingRetainerProfiling()) {
- errorBelch("cannot mix -hb and -hr");
- stg_exit(EXIT_FAILURE);
+ errorBelch("cannot mix -hb and -hr");
+ stg_exit(EXIT_FAILURE);
}
#endif
@@ -387,15 +387,15 @@ initHeapProfiling(void)
// is fixed at zero.
#ifdef PROFILING
if (doingLDVProfiling()) {
- era = 1;
+ era = 1;
} else
#endif
{
- era = 0;
+ era = 0;
}
// max_era = 2^LDV_SHIFT
- max_era = 1 << LDV_SHIFT;
+ max_era = 1 << LDV_SHIFT;
n_censuses = 32;
censuses = stgMallocBytes(sizeof(Census) * n_censuses, "initHeapProfiling");
@@ -407,12 +407,12 @@ initHeapProfiling(void)
#ifdef PROFILING
{
- int count;
- for(count = 1; count < prog_argc; count++)
- fprintf(hp_file, " %s", prog_argv[count]);
- fprintf(hp_file, " +RTS");
- for(count = 0; count < rts_argc; count++)
- fprintf(hp_file, " %s", rts_argv[count]);
+ int count;
+ for(count = 1; count < prog_argc; count++)
+ fprintf(hp_file, " %s", prog_argv[count]);
+ fprintf(hp_file, " +RTS");
+ for(count = 0; count < rts_argc; count++)
+ fprintf(hp_file, " %s", rts_argv[count]);
}
#endif /* PROFILING */
@@ -428,7 +428,7 @@ initHeapProfiling(void)
#ifdef PROFILING
if (doingRetainerProfiling()) {
- initRetainerProfiling();
+ initRetainerProfiling();
}
#endif
@@ -446,18 +446,18 @@ endHeapProfiling(void)
#ifdef PROFILING
if (doingRetainerProfiling()) {
- endRetainerProfiling();
+ endRetainerProfiling();
}
#endif
#ifdef PROFILING
if (doingLDVProfiling()) {
- nat t;
- LdvCensusKillAll();
- aggregateCensusInfo();
- for (t = 1; t < era; t++) {
- dumpCensus( &censuses[t] );
- }
+ nat t;
+ LdvCensusKillAll();
+ aggregateCensusInfo();
+ for (t = 1; t < era; t++) {
+ dumpCensus( &censuses[t] );
+ }
}
#endif
@@ -495,8 +495,8 @@ buf_append(char *p, const char *q, char *end)
int m;
for (m = 0; p < end; p++, q++, m++) {
- *p = *q;
- if (*q == '\0') { break; }
+ *p = *q;
+ if (*q == '\0') { break; }
}
return m;
}
@@ -508,8 +508,8 @@ fprint_ccs(FILE *fp, CostCentreStack *ccs, nat max_length)
// MAIN on its own gets printed as "MAIN", otherwise we ignore MAIN.
if (ccs == CCS_MAIN) {
- fprintf(fp, "MAIN");
- return;
+ fprintf(fp, "MAIN");
+ return;
}
fprintf(fp, "(%ld)", ccs->ccsID);
@@ -521,22 +521,22 @@ fprint_ccs(FILE *fp, CostCentreStack *ccs, nat max_length)
// in the buffer. If we run out of space, end with "...".
for (; ccs != NULL && ccs != CCS_MAIN; ccs = ccs->prevStack) {
- // CAF cost centres print as M.CAF, but we leave the module
- // name out of all the others to save space.
- if (!strcmp(ccs->cc->label,"CAF")) {
- p += buf_append(p, ccs->cc->module, buf_end);
- p += buf_append(p, ".CAF", buf_end);
- } else {
- p += buf_append(p, ccs->cc->label, buf_end);
- if (ccs->prevStack != NULL && ccs->prevStack != CCS_MAIN) {
- p += buf_append(p, "/", buf_end);
- }
- }
-
- if (p >= buf_end) {
- sprintf(buf+max_length-4, "...");
- break;
- }
+ // CAF cost centres print as M.CAF, but we leave the module
+ // name out of all the others to save space.
+ if (!strcmp(ccs->cc->label,"CAF")) {
+ p += buf_append(p, ccs->cc->module, buf_end);
+ p += buf_append(p, ".CAF", buf_end);
+ } else {
+ p += buf_append(p, ccs->cc->label, buf_end);
+ if (ccs->prevStack != NULL && ccs->prevStack != CCS_MAIN) {
+ p += buf_append(p, "/", buf_end);
+ }
+ }
+
+ if (p >= buf_end) {
+ sprintf(buf+max_length-4, "...");
+ break;
+ }
}
fprintf(fp, "%s", buf);
}
@@ -550,16 +550,16 @@ strMatchesSelector( char* str, char* sel )
// Compare str against wherever we've got to in sel.
p = str;
while (*p != '\0' && *sel != ',' && *sel != '\0' && *p == *sel) {
- p++; sel++;
+ p++; sel++;
}
// Match if all of str used and have reached the end of a sel fragment.
if (*p == '\0' && (*sel == ',' || *sel == '\0'))
- return rtsTrue;
-
+ return rtsTrue;
+
// No match. Advance sel to the start of the next elem.
while (*sel != ',' && *sel != '\0') sel++;
if (*sel == ',') sel++;
-
+
/* Run out of sel ?? */
if (*sel == '\0') return rtsFalse;
}
@@ -589,7 +589,7 @@ closureSatisfiesConstraints( StgClosure* p )
if (RtsFlags.ProfFlags.descrSelector) {
b = strMatchesSelector( (GET_PROF_DESC(get_itbl((StgClosure *)p))),
- RtsFlags.ProfFlags.descrSelector );
+ RtsFlags.ProfFlags.descrSelector );
if (!b) return rtsFalse;
}
if (RtsFlags.ProfFlags.typeSelector) {
@@ -605,14 +605,14 @@ closureSatisfiesConstraints( StgClosure* p )
// a newly deceased weak pointer (i.e. a DEAD_WEAK), since
// these aren't reached by the retainer profiler's traversal.
if (isRetainerSetFieldValid((StgClosure *)p)) {
- rs = retainerSetOf((StgClosure *)p);
- if (rs != NULL) {
- for (i = 0; i < rs->num; i++) {
- b = strMatchesSelector( rs->element[i]->cc->label,
- RtsFlags.ProfFlags.retainerSelector );
- if (b) return rtsTrue;
- }
- }
+ rs = retainerSetOf((StgClosure *)p);
+ if (rs != NULL) {
+ for (i = 0; i < rs->num; i++) {
+ b = strMatchesSelector( rs->element[i]->cc->label,
+ RtsFlags.ProfFlags.retainerSelector );
+ if (b) return rtsTrue;
+ }
+ }
}
return rtsFalse;
}
@@ -638,35 +638,35 @@ aggregateCensusInfo( void )
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
long void_total, drag_total;
- // Now we compute void_total and drag_total for each census
- // After the program has finished, the void_total field of
- // each census contains the count of words that were *created*
- // in this era and were eventually void. Conversely, if a
- // void closure was destroyed in this era, it will be
- // represented by a negative count of words in void_total.
- //
- // To get the count of live words that are void at each
- // census, just propagate the void_total count forwards:
-
- void_total = 0;
- drag_total = 0;
- for (t = 1; t < era; t++) { // note: start at 1, not 0
- void_total += censuses[t].void_total;
- drag_total += censuses[t].drag_total;
- censuses[t].void_total = void_total;
- censuses[t].drag_total = drag_total;
-
- ASSERT( censuses[t].void_total <= censuses[t].not_used );
- // should be true because: void_total is the count of
- // live words that are void at this census, which *must*
- // be less than the number of live words that have not
- // been used yet.
-
- ASSERT( censuses[t].drag_total <= censuses[t].used );
- // similar reasoning as above.
- }
-
- return;
+ // Now we compute void_total and drag_total for each census
+ // After the program has finished, the void_total field of
+ // each census contains the count of words that were *created*
+ // in this era and were eventually void. Conversely, if a
+ // void closure was destroyed in this era, it will be
+ // represented by a negative count of words in void_total.
+ //
+ // To get the count of live words that are void at each
+ // census, just propagate the void_total count forwards:
+
+ void_total = 0;
+ drag_total = 0;
+ for (t = 1; t < era; t++) { // note: start at 1, not 0
+ void_total += censuses[t].void_total;
+ drag_total += censuses[t].drag_total;
+ censuses[t].void_total = void_total;
+ censuses[t].drag_total = drag_total;
+
+ ASSERT( censuses[t].void_total <= censuses[t].not_used );
+ // should be true because: void_total is the count of
+ // live words that are void at this census, which *must*
+ // be less than the number of live words that have not
+ // been used yet.
+
+ ASSERT( censuses[t].drag_total <= censuses[t].used );
+ // similar reasoning as above.
+ }
+
+ return;
}
// otherwise... we're doing a heap profile that is restricted to
@@ -680,48 +680,48 @@ aggregateCensusInfo( void )
for (t = 1; t < era; t++) {
- // first look through all the counters we're aggregating
- for (c = ctrs; c != NULL; c = c->next) {
- // if one of the totals is non-zero, then this closure
- // type must be present in the heap at this census time...
- d = lookupHashTable(censuses[t].hash, (StgWord)c->identity);
-
- if (d == NULL) {
- // if this closure identity isn't present in the
- // census for this time period, then our running
- // totals *must* be zero.
- ASSERT(c->c.ldv.void_total == 0 && c->c.ldv.drag_total == 0);
-
- // debugCCS(c->identity);
- // debugBelch(" census=%d void_total=%d drag_total=%d\n",
- // t, c->c.ldv.void_total, c->c.ldv.drag_total);
- } else {
- d->c.ldv.void_total += c->c.ldv.void_total;
- d->c.ldv.drag_total += c->c.ldv.drag_total;
- c->c.ldv.void_total = d->c.ldv.void_total;
- c->c.ldv.drag_total = d->c.ldv.drag_total;
-
- ASSERT( c->c.ldv.void_total >= 0 );
- ASSERT( c->c.ldv.drag_total >= 0 );
- }
- }
-
- // now look through the counters in this census to find new ones
- for (c = censuses[t].ctrs; c != NULL; c = c->next) {
- d = lookupHashTable(acc, (StgWord)c->identity);
- if (d == NULL) {
- d = arenaAlloc( arena, sizeof(counter) );
- initLDVCtr(d);
- insertHashTable( acc, (StgWord)c->identity, d );
- d->identity = c->identity;
- d->next = ctrs;
- ctrs = d;
- d->c.ldv.void_total = c->c.ldv.void_total;
- d->c.ldv.drag_total = c->c.ldv.drag_total;
- }
- ASSERT( c->c.ldv.void_total >= 0 );
- ASSERT( c->c.ldv.drag_total >= 0 );
- }
+ // first look through all the counters we're aggregating
+ for (c = ctrs; c != NULL; c = c->next) {
+ // if one of the totals is non-zero, then this closure
+ // type must be present in the heap at this census time...
+ d = lookupHashTable(censuses[t].hash, (StgWord)c->identity);
+
+ if (d == NULL) {
+ // if this closure identity isn't present in the
+ // census for this time period, then our running
+ // totals *must* be zero.
+ ASSERT(c->c.ldv.void_total == 0 && c->c.ldv.drag_total == 0);
+
+ // debugCCS(c->identity);
+ // debugBelch(" census=%d void_total=%d drag_total=%d\n",
+ // t, c->c.ldv.void_total, c->c.ldv.drag_total);
+ } else {
+ d->c.ldv.void_total += c->c.ldv.void_total;
+ d->c.ldv.drag_total += c->c.ldv.drag_total;
+ c->c.ldv.void_total = d->c.ldv.void_total;
+ c->c.ldv.drag_total = d->c.ldv.drag_total;
+
+ ASSERT( c->c.ldv.void_total >= 0 );
+ ASSERT( c->c.ldv.drag_total >= 0 );
+ }
+ }
+
+ // now look through the counters in this census to find new ones
+ for (c = censuses[t].ctrs; c != NULL; c = c->next) {
+ d = lookupHashTable(acc, (StgWord)c->identity);
+ if (d == NULL) {
+ d = arenaAlloc( arena, sizeof(counter) );
+ initLDVCtr(d);
+ insertHashTable( acc, (StgWord)c->identity, d );
+ d->identity = c->identity;
+ d->next = ctrs;
+ ctrs = d;
+ d->c.ldv.void_total = c->c.ldv.void_total;
+ d->c.ldv.drag_total = c->c.ldv.drag_total;
+ }
+ ASSERT( c->c.ldv.void_total >= 0 );
+ ASSERT( c->c.ldv.drag_total >= 0 );
+ }
}
freeHashTable(acc, NULL);
@@ -743,89 +743,89 @@ dumpCensus( Census *census )
#ifdef PROFILING
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
fprintf(hp_file, "VOID\t%lu\n", (unsigned long)(census->void_total) * sizeof(W_));
- fprintf(hp_file, "LAG\t%lu\n",
- (unsigned long)(census->not_used - census->void_total) * sizeof(W_));
- fprintf(hp_file, "USE\t%lu\n",
- (unsigned long)(census->used - census->drag_total) * sizeof(W_));
- fprintf(hp_file, "INHERENT_USE\t%lu\n",
- (unsigned long)(census->prim) * sizeof(W_));
- fprintf(hp_file, "DRAG\t%lu\n",
- (unsigned long)(census->drag_total) * sizeof(W_));
- printSample(rtsFalse, census->time);
- return;
+ fprintf(hp_file, "LAG\t%lu\n",
+ (unsigned long)(census->not_used - census->void_total) * sizeof(W_));
+ fprintf(hp_file, "USE\t%lu\n",
+ (unsigned long)(census->used - census->drag_total) * sizeof(W_));
+ fprintf(hp_file, "INHERENT_USE\t%lu\n",
+ (unsigned long)(census->prim) * sizeof(W_));
+ fprintf(hp_file, "DRAG\t%lu\n",
+ (unsigned long)(census->drag_total) * sizeof(W_));
+ printSample(rtsFalse, census->time);
+ return;
}
#endif
for (ctr = census->ctrs; ctr != NULL; ctr = ctr->next) {
#ifdef PROFILING
- if (RtsFlags.ProfFlags.bioSelector != NULL) {
- count = 0;
- if (strMatchesSelector("lag", RtsFlags.ProfFlags.bioSelector))
- count += ctr->c.ldv.not_used - ctr->c.ldv.void_total;
- if (strMatchesSelector("drag", RtsFlags.ProfFlags.bioSelector))
- count += ctr->c.ldv.drag_total;
- if (strMatchesSelector("void", RtsFlags.ProfFlags.bioSelector))
- count += ctr->c.ldv.void_total;
- if (strMatchesSelector("use", RtsFlags.ProfFlags.bioSelector))
- count += ctr->c.ldv.used - ctr->c.ldv.drag_total;
- } else
+ if (RtsFlags.ProfFlags.bioSelector != NULL) {
+ count = 0;
+ if (strMatchesSelector("lag", RtsFlags.ProfFlags.bioSelector))
+ count += ctr->c.ldv.not_used - ctr->c.ldv.void_total;
+ if (strMatchesSelector("drag", RtsFlags.ProfFlags.bioSelector))
+ count += ctr->c.ldv.drag_total;
+ if (strMatchesSelector("void", RtsFlags.ProfFlags.bioSelector))
+ count += ctr->c.ldv.void_total;
+ if (strMatchesSelector("use", RtsFlags.ProfFlags.bioSelector))
+ count += ctr->c.ldv.used - ctr->c.ldv.drag_total;
+ } else
#endif
- {
- count = ctr->c.resid;
- }
+ {
+ count = ctr->c.resid;
+ }
- ASSERT( count >= 0 );
+ ASSERT( count >= 0 );
- if (count == 0) continue;
+ if (count == 0) continue;
#if !defined(PROFILING)
- switch (RtsFlags.ProfFlags.doHeapProfile) {
- case HEAP_BY_CLOSURE_TYPE:
- fprintf(hp_file, "%s", (char *)ctr->identity);
- break;
- }
+ switch (RtsFlags.ProfFlags.doHeapProfile) {
+ case HEAP_BY_CLOSURE_TYPE:
+ fprintf(hp_file, "%s", (char *)ctr->identity);
+ break;
+ }
#endif
-
+
#ifdef PROFILING
- switch (RtsFlags.ProfFlags.doHeapProfile) {
- case HEAP_BY_CCS:
- fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, RtsFlags.ProfFlags.ccsLength);
- break;
- case HEAP_BY_MOD:
- case HEAP_BY_DESCR:
- case HEAP_BY_TYPE:
- fprintf(hp_file, "%s", (char *)ctr->identity);
- break;
- case HEAP_BY_RETAINER:
- {
- RetainerSet *rs = (RetainerSet *)ctr->identity;
-
- // it might be the distinguished retainer set rs_MANY:
- if (rs == &rs_MANY) {
- fprintf(hp_file, "MANY");
- break;
- }
-
- // Mark this retainer set by negating its id, because it
- // has appeared in at least one census. We print the
- // values of all such retainer sets into the log file at
- // the end. A retainer set may exist but not feature in
- // any censuses if it arose as the intermediate retainer
- // set for some closure during retainer set calculation.
- if (rs->id > 0)
- rs->id = -(rs->id);
-
- // report in the unit of bytes: * sizeof(StgWord)
- printRetainerSetShort(hp_file, rs, RtsFlags.ProfFlags.ccsLength);
- break;
- }
- default:
- barf("dumpCensus; doHeapProfile");
- }
+ switch (RtsFlags.ProfFlags.doHeapProfile) {
+ case HEAP_BY_CCS:
+ fprint_ccs(hp_file, (CostCentreStack *)ctr->identity, RtsFlags.ProfFlags.ccsLength);
+ break;
+ case HEAP_BY_MOD:
+ case HEAP_BY_DESCR:
+ case HEAP_BY_TYPE:
+ fprintf(hp_file, "%s", (char *)ctr->identity);
+ break;
+ case HEAP_BY_RETAINER:
+ {
+ RetainerSet *rs = (RetainerSet *)ctr->identity;
+
+ // it might be the distinguished retainer set rs_MANY:
+ if (rs == &rs_MANY) {
+ fprintf(hp_file, "MANY");
+ break;
+ }
+
+ // Mark this retainer set by negating its id, because it
+ // has appeared in at least one census. We print the
+ // values of all such retainer sets into the log file at
+ // the end. A retainer set may exist but not feature in
+ // any censuses if it arose as the intermediate retainer
+ // set for some closure during retainer set calculation.
+ if (rs->id > 0)
+ rs->id = -(rs->id);
+
+ // report in the unit of bytes: * sizeof(StgWord)
+ printRetainerSetShort(hp_file, rs, RtsFlags.ProfFlags.ccsLength);
+ break;
+ }
+ default:
+ barf("dumpCensus; doHeapProfile");
+ }
#endif
- fprintf(hp_file, "\t%" FMT_SizeT "\n", (W_)count * sizeof(W_));
+ fprintf(hp_file, "\t%" FMT_SizeT "\n", (W_)count * sizeof(W_));
}
printSample(rtsFalse, census->time);
@@ -846,67 +846,67 @@ static void heapProfObject(Census *census, StgClosure *p, nat size,
identity = NULL;
#ifdef PROFILING
- // subtract the profiling overhead
- real_size = size - sizeofW(StgProfHeader);
+ // subtract the profiling overhead
+ real_size = size - sizeofW(StgProfHeader);
#else
- real_size = size;
+ real_size = size;
#endif
- if (closureSatisfiesConstraints((StgClosure*)p)) {
+ if (closureSatisfiesConstraints((StgClosure*)p)) {
#ifdef PROFILING
- if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
- if (prim)
- census->prim += real_size;
- else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
- census->not_used += real_size;
- else
- census->used += real_size;
- } else
+ if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
+ if (prim)
+ census->prim += real_size;
+ else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
+ census->not_used += real_size;
+ else
+ census->used += real_size;
+ } else
#endif
- {
- identity = closureIdentity((StgClosure *)p);
+ {
+ identity = closureIdentity((StgClosure *)p);
- if (identity != NULL) {
- ctr = lookupHashTable( census->hash, (StgWord)identity );
- if (ctr != NULL) {
+ if (identity != NULL) {
+ ctr = lookupHashTable( census->hash, (StgWord)identity );
+ if (ctr != NULL) {
#ifdef PROFILING
- if (RtsFlags.ProfFlags.bioSelector != NULL) {
- if (prim)
- ctr->c.ldv.prim += real_size;
- else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
- ctr->c.ldv.not_used += real_size;
- else
- ctr->c.ldv.used += real_size;
- } else
+ if (RtsFlags.ProfFlags.bioSelector != NULL) {
+ if (prim)
+ ctr->c.ldv.prim += real_size;
+ else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
+ ctr->c.ldv.not_used += real_size;
+ else
+ ctr->c.ldv.used += real_size;
+ } else
#endif
- {
- ctr->c.resid += real_size;
- }
- } else {
- ctr = arenaAlloc( census->arena, sizeof(counter) );
- initLDVCtr(ctr);
- insertHashTable( census->hash, (StgWord)identity, ctr );
- ctr->identity = identity;
- ctr->next = census->ctrs;
- census->ctrs = ctr;
+ {
+ ctr->c.resid += real_size;
+ }
+ } else {
+ ctr = arenaAlloc( census->arena, sizeof(counter) );
+ initLDVCtr(ctr);
+ insertHashTable( census->hash, (StgWord)identity, ctr );
+ ctr->identity = identity;
+ ctr->next = census->ctrs;
+ census->ctrs = ctr;
#ifdef PROFILING
- if (RtsFlags.ProfFlags.bioSelector != NULL) {
- if (prim)
- ctr->c.ldv.prim = real_size;
- else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
- ctr->c.ldv.not_used = real_size;
- else
- ctr->c.ldv.used = real_size;
- } else
+ if (RtsFlags.ProfFlags.bioSelector != NULL) {
+ if (prim)
+ ctr->c.ldv.prim = real_size;
+ else if ((LDVW(p) & LDV_STATE_MASK) == LDV_STATE_CREATE)
+ ctr->c.ldv.not_used = real_size;
+ else
+ ctr->c.ldv.used = real_size;
+ } else
#endif
- {
- ctr->c.resid = real_size;
- }
- }
- }
- }
- }
+ {
+ ctr->c.resid = real_size;
+ }
+ }
+ }
+ }
+ }
}
/* -----------------------------------------------------------------------------
@@ -933,153 +933,153 @@ heapCensusChain( Census *census, bdescr *bd )
continue;
}
- p = bd->start;
- while (p < bd->free) {
- info = get_itbl((StgClosure *)p);
+ p = bd->start;
+ while (p < bd->free) {
+ info = get_itbl((StgClosure *)p);
prim = rtsFalse;
-
- switch (info->type) {
-
- case THUNK:
- size = thunk_sizeW_fromITBL(info);
- break;
-
- case THUNK_1_1:
- case THUNK_0_2:
- case THUNK_2_0:
- size = sizeofW(StgThunkHeader) + 2;
- break;
-
- case THUNK_1_0:
- case THUNK_0_1:
- case THUNK_SELECTOR:
- size = sizeofW(StgThunkHeader) + 1;
- break;
-
- case CONSTR:
- case FUN:
- case IND_PERM:
- case BLACKHOLE:
- case BLOCKING_QUEUE:
- case FUN_1_0:
- case FUN_0_1:
- case FUN_1_1:
- case FUN_0_2:
- case FUN_2_0:
- case CONSTR_1_0:
- case CONSTR_0_1:
- case CONSTR_1_1:
- case CONSTR_0_2:
- case CONSTR_2_0:
- size = sizeW_fromITBL(info);
- break;
-
- case IND:
- // Special case/Delicate Hack: INDs don't normally
- // appear, since we're doing this heap census right
- // after GC. However, GarbageCollect() also does
- // resurrectThreads(), which can update some
- // blackholes when it calls raiseAsync() on the
- // resurrected threads. So we know that any IND will
- // be the size of a BLACKHOLE.
- size = BLACKHOLE_sizeW();
- break;
-
- case BCO:
+
+ switch (info->type) {
+
+ case THUNK:
+ size = thunk_sizeW_fromITBL(info);
+ break;
+
+ case THUNK_1_1:
+ case THUNK_0_2:
+ case THUNK_2_0:
+ size = sizeofW(StgThunkHeader) + 2;
+ break;
+
+ case THUNK_1_0:
+ case THUNK_0_1:
+ case THUNK_SELECTOR:
+ size = sizeofW(StgThunkHeader) + 1;
+ break;
+
+ case CONSTR:
+ case FUN:
+ case IND_PERM:
+ case BLACKHOLE:
+ case BLOCKING_QUEUE:
+ case FUN_1_0:
+ case FUN_0_1:
+ case FUN_1_1:
+ case FUN_0_2:
+ case FUN_2_0:
+ case CONSTR_1_0:
+ case CONSTR_0_1:
+ case CONSTR_1_1:
+ case CONSTR_0_2:
+ case CONSTR_2_0:
+ size = sizeW_fromITBL(info);
+ break;
+
+ case IND:
+ // Special case/Delicate Hack: INDs don't normally
+ // appear, since we're doing this heap census right
+ // after GC. However, GarbageCollect() also does
+ // resurrectThreads(), which can update some
+ // blackholes when it calls raiseAsync() on the
+ // resurrected threads. So we know that any IND will
+ // be the size of a BLACKHOLE.
+ size = BLACKHOLE_sizeW();
+ break;
+
+ case BCO:
prim = rtsTrue;
- size = bco_sizeW((StgBCO *)p);
- break;
+ size = bco_sizeW((StgBCO *)p);
+ break;
case MVAR_CLEAN:
case MVAR_DIRTY:
case TVAR:
case WEAK:
- case PRIM:
- case MUT_PRIM:
- case MUT_VAR_CLEAN:
- case MUT_VAR_DIRTY:
- prim = rtsTrue;
- size = sizeW_fromITBL(info);
- break;
-
- case AP:
- size = ap_sizeW((StgAP *)p);
- break;
-
- case PAP:
- size = pap_sizeW((StgPAP *)p);
- break;
-
- case AP_STACK:
- size = ap_stack_sizeW((StgAP_STACK *)p);
- break;
-
- case ARR_WORDS:
- prim = rtsTrue;
- size = arr_words_sizeW((StgArrWords*)p);
- break;
-
- case MUT_ARR_PTRS_CLEAN:
- case MUT_ARR_PTRS_DIRTY:
- case MUT_ARR_PTRS_FROZEN:
- case MUT_ARR_PTRS_FROZEN0:
- prim = rtsTrue;
- size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
- break;
-
- case SMALL_MUT_ARR_PTRS_CLEAN:
- case SMALL_MUT_ARR_PTRS_DIRTY:
- case SMALL_MUT_ARR_PTRS_FROZEN:
- case SMALL_MUT_ARR_PTRS_FROZEN0:
- prim = rtsTrue;
- size = small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs *)p);
- break;
-
- case TSO:
- prim = rtsTrue;
+ case PRIM:
+ case MUT_PRIM:
+ case MUT_VAR_CLEAN:
+ case MUT_VAR_DIRTY:
+ prim = rtsTrue;
+ size = sizeW_fromITBL(info);
+ break;
+
+ case AP:
+ size = ap_sizeW((StgAP *)p);
+ break;
+
+ case PAP:
+ size = pap_sizeW((StgPAP *)p);
+ break;
+
+ case AP_STACK:
+ size = ap_stack_sizeW((StgAP_STACK *)p);
+ break;
+
+ case ARR_WORDS:
+ prim = rtsTrue;
+ size = arr_words_sizeW((StgArrWords*)p);
+ break;
+
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
+ case MUT_ARR_PTRS_FROZEN:
+ case MUT_ARR_PTRS_FROZEN0:
+ prim = rtsTrue;
+ size = mut_arr_ptrs_sizeW((StgMutArrPtrs *)p);
+ break;
+
+ case SMALL_MUT_ARR_PTRS_CLEAN:
+ case SMALL_MUT_ARR_PTRS_DIRTY:
+ case SMALL_MUT_ARR_PTRS_FROZEN:
+ case SMALL_MUT_ARR_PTRS_FROZEN0:
+ prim = rtsTrue;
+ size = small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs *)p);
+ break;
+
+ case TSO:
+ prim = rtsTrue;
#ifdef PROFILING
- if (RtsFlags.ProfFlags.includeTSOs) {
+ if (RtsFlags.ProfFlags.includeTSOs) {
size = sizeofW(StgTSO);
- break;
- } else {
- // Skip this TSO and move on to the next object
+ break;
+ } else {
+ // Skip this TSO and move on to the next object
p += sizeofW(StgTSO);
- continue;
- }
+ continue;
+ }
#else
size = sizeofW(StgTSO);
- break;
+ break;
#endif
case STACK:
- prim = rtsTrue;
+ prim = rtsTrue;
#ifdef PROFILING
- if (RtsFlags.ProfFlags.includeTSOs) {
+ if (RtsFlags.ProfFlags.includeTSOs) {
size = stack_sizeW((StgStack*)p);
break;
- } else {
- // Skip this TSO and move on to the next object
+ } else {
+ // Skip this TSO and move on to the next object
p += stack_sizeW((StgStack*)p);
- continue;
- }
+ continue;
+ }
#else
size = stack_sizeW((StgStack*)p);
- break;
+ break;
#endif
case TREC_CHUNK:
- prim = rtsTrue;
- size = sizeofW(StgTRecChunk);
- break;
-
- default:
- barf("heapCensus, unknown object: %d", info->type);
- }
-
+ prim = rtsTrue;
+ size = sizeofW(StgTRecChunk);
+ break;
+
+ default:
+ barf("heapCensus, unknown object: %d", info->type);
+ }
+
heapProfObject(census,(StgClosure*)p,size,prim);
- p += size;
- }
+ p += size;
+ }
}
}
@@ -1091,7 +1091,7 @@ void heapCensus (Time t)
census = &censuses[era];
census->time = mut_user_time_until(t);
-
+
// calculate retainer sets if necessary
#ifdef PROFILING
if (doingRetainerProfiling()) {
@@ -1123,7 +1123,7 @@ void heapCensus (Time t)
// We can't generate any info for LDV profiling until
// the end of the run...
if (!doingLDVProfiling())
- dumpCensus( census );
+ dumpCensus( census );
#else
dumpCensus( census );
#endif
@@ -1146,5 +1146,4 @@ void heapCensus (Time t)
#ifdef PROFILING
stat_endHeapCensus();
#endif
-}
-
+}
diff --git a/rts/Profiling.c b/rts/Profiling.c
index 53f64a7280..a299189ce0 100644
--- a/rts/Profiling.c
+++ b/rts/Profiling.c
@@ -32,7 +32,7 @@
Arena *prof_arena;
/*
- * Global variables used to assign unique IDs to cc's, ccs's, and
+ * Global variables used to assign unique IDs to cc's, ccs's, and
* closure_cats
*/
@@ -49,7 +49,7 @@ static W_ total_prof_ticks;
static char *prof_filename; /* prof report file name = <program>.prof */
FILE *prof_file;
-static char *hp_filename; /* heap profile (hp2ps style) log file */
+static char *hp_filename; /* heap profile (hp2ps style) log file */
FILE *hp_file;
/* Linked lists to keep track of CCs and CCSs that haven't
@@ -95,8 +95,8 @@ CC_DECLARE(CC_DONT_CARE, "DONT_CARE", "MAIN", "<built-in>", CC_NOT_CAF, )
CC_DECLARE(CC_PINNED, "PINNED", "SYSTEM", "<built-in>", CC_NOT_CAF, );
CC_DECLARE(CC_IDLE, "IDLE", "IDLE", "<built-in>", CC_NOT_CAF, );
-CCS_DECLARE(CCS_MAIN, CC_MAIN, );
-CCS_DECLARE(CCS_SYSTEM, CC_SYSTEM, );
+CCS_DECLARE(CCS_MAIN, CC_MAIN, );
+CCS_DECLARE(CCS_SYSTEM, CC_SYSTEM, );
CCS_DECLARE(CCS_GC, CC_GC, );
CCS_DECLARE(CCS_OVERHEAD, CC_OVERHEAD, );
CCS_DECLARE(CCS_DONT_CARE, CC_DONT_CARE, );
@@ -129,7 +129,7 @@ static CostCentreStack * pruneCCSTree ( CostCentreStack *ccs );
static CostCentreStack * actualPush ( CostCentreStack *, CostCentre * );
static CostCentreStack * isInIndexTable ( IndexTable *, CostCentre * );
static IndexTable * addToIndexTable ( IndexTable *, CostCentreStack *,
- CostCentre *, unsigned int );
+ CostCentre *, unsigned int );
static void ccsSetSelected ( CostCentreStack *ccs );
static void initTimeProfiling ( void );
@@ -239,7 +239,7 @@ initProfilingLogFile(void)
}
#endif
- if (RtsFlags.CcFlags.doCostCentres == 0 &&
+ if (RtsFlags.CcFlags.doCostCentres == 0 &&
RtsFlags.ProfFlags.doHeapProfile != HEAP_BY_RETAINER &&
RtsFlags.ProfFlags.retainerSelector == NULL)
{
@@ -264,19 +264,19 @@ initProfilingLogFile(void)
return;
}
}
-
+
if (RtsFlags.ProfFlags.doHeapProfile) {
- /* Initialise the log file name */
- hp_filename = arenaAlloc(prof_arena, strlen(prog) + 6);
- sprintf(hp_filename, "%s.hp", prog);
-
- /* open the log file */
- if ((hp_file = fopen(hp_filename, "w")) == NULL) {
- debugBelch("Can't open profiling report file %s\n",
- hp_filename);
- RtsFlags.ProfFlags.doHeapProfile = 0;
- return;
- }
+ /* Initialise the log file name */
+ hp_filename = arenaAlloc(prof_arena, strlen(prog) + 6);
+ sprintf(hp_filename, "%s.hp", prog);
+
+ /* open the log file */
+ if ((hp_file = fopen(hp_filename, "w")) == NULL) {
+ debugBelch("Can't open profiling report file %s\n",
+ hp_filename);
+ RtsFlags.ProfFlags.doHeapProfile = 0;
+ return;
+ }
}
}
@@ -287,7 +287,7 @@ initTimeProfiling(void)
startProfTimer();
};
-void
+void
endProfiling ( void )
{
if (RtsFlags.CcFlags.doCostCentres) {
@@ -413,26 +413,26 @@ ccsSetSelected (CostCentreStack *ccs)
if (RtsFlags.ProfFlags.modSelector) {
if (! strMatchesSelector (ccs->cc->module,
RtsFlags.ProfFlags.modSelector) ) {
- ccs->selected = 0;
+ ccs->selected = 0;
return;
}
}
if (RtsFlags.ProfFlags.ccSelector) {
if (! strMatchesSelector (ccs->cc->label,
RtsFlags.ProfFlags.ccSelector) ) {
- ccs->selected = 0;
+ ccs->selected = 0;
return;
}
}
if (RtsFlags.ProfFlags.ccsSelector) {
- CostCentreStack *c;
+ CostCentreStack *c;
for (c = ccs; c != NULL; c = c->prevStack)
{
if ( strMatchesSelector (c->cc->label,
RtsFlags.ProfFlags.ccsSelector) ) {
- break;
- }
- }
+ break;
+ }
+ }
if (c == NULL) {
ccs->selected = 0;
return;
@@ -454,10 +454,10 @@ pushCostCentre ( CostCentreStack *ccs, CostCentre *cc )
#define pushCostCentre _pushCostCentre
{
IF_DEBUG(prof,
- traceBegin("pushing %s on ", cc->label);
- debugCCS(ccs);
- traceEnd(););
-
+ traceBegin("pushing %s on ", cc->label);
+ debugCCS(ccs);
+ traceEnd(););
+
return pushCostCentre(ccs,cc);
}
#endif
@@ -518,7 +518,7 @@ pushCostCentre (CostCentreStack *ccs, CostCentre *cc)
// check if we've already memoized this stack
ixtable = ccs->indexTable;
temp_ccs = isInIndexTable(ixtable,cc);
-
+
if (temp_ccs != EMPTY_STACK) {
return temp_ccs;
} else {
@@ -637,7 +637,7 @@ isInIndexTable(IndexTable *it, CostCentre *cc)
else
it = it->next;
}
-
+
/* otherwise we never found it so return EMPTY_TABLE */
return EMPTY_TABLE;
}
@@ -670,13 +670,13 @@ ignoreCC (CostCentre *cc)
{
if (RtsFlags.CcFlags.doCostCentres < COST_CENTRES_ALL &&
( cc == CC_OVERHEAD
- || cc == CC_DONT_CARE
- || cc == CC_GC
+ || cc == CC_DONT_CARE
+ || cc == CC_GC
|| cc == CC_SYSTEM
|| cc == CC_IDLE)) {
- return rtsTrue;
+ return rtsTrue;
} else {
- return rtsFalse;
+ return rtsFalse;
}
}
@@ -691,7 +691,7 @@ ignoreCCS (CostCentreStack *ccs)
|| ccs == CCS_IDLE)) {
return rtsTrue;
} else {
- return rtsFalse;
+ return rtsFalse;
}
}
@@ -809,7 +809,7 @@ reportPerCCCosts( void )
Generate the cost-centre-stack time/alloc report
-------------------------------------------------------------------------- */
-static void
+static void
fprintHeader( nat max_label_len, nat max_module_len )
{
fprintf(prof_file, "%-*s %-*s%6s %11s %11s %11s\n", max_label_len, "", max_module_len, "", "", "", "individual", "inherited");
@@ -829,38 +829,38 @@ reportCCSProfiling( void )
{
nat count;
char temp[128]; /* sigh: magic constant */
-
+
stopProfTimer();
total_prof_ticks = 0;
total_alloc = 0;
countTickss(CCS_MAIN);
-
+
if (RtsFlags.CcFlags.doCostCentres == 0) return;
- fprintf(prof_file, "\t%s Time and Allocation Profiling Report (%s)\n",
- time_str(), "Final");
+ fprintf(prof_file, "\t%s Time and Allocation Profiling Report (%s)\n",
+ time_str(), "Final");
fprintf(prof_file, "\n\t ");
fprintf(prof_file, " %s", prog_name);
fprintf(prof_file, " +RTS");
for (count = 0; rts_argv[count]; count++)
- fprintf(prof_file, " %s", rts_argv[count]);
+ fprintf(prof_file, " %s", rts_argv[count]);
fprintf(prof_file, " -RTS");
for (count = 1; prog_argv[count]; count++)
- fprintf(prof_file, " %s", prog_argv[count]);
+ fprintf(prof_file, " %s", prog_argv[count]);
fprintf(prof_file, "\n\n");
fprintf(prof_file, "\ttotal time = %11.2f secs (%lu ticks @ %d us, %d processor%s)\n",
((double) total_prof_ticks *
(double) RtsFlags.MiscFlags.tickInterval) / (TIME_RESOLUTION * n_capabilities),
- (unsigned long) total_prof_ticks,
+ (unsigned long) total_prof_ticks,
(int) TimeToUS(RtsFlags.MiscFlags.tickInterval),
n_capabilities, n_capabilities > 1 ? "s" : "");
fprintf(prof_file, "\ttotal alloc = %11s bytes",
- showStgWord64(total_alloc * sizeof(W_),
- temp, rtsTrue/*commas*/));
+ showStgWord64(total_alloc * sizeof(W_),
+ temp, rtsTrue/*commas*/));
fprintf(prof_file, " (excludes profiling overheads)\n\n");
@@ -871,7 +871,7 @@ reportCCSProfiling( void )
reportCCS(pruneCCSTree(CCS_MAIN));
}
-static void
+static void
findCCSMaxLens(CostCentreStack *ccs, nat indent, nat *max_label_len, nat *max_module_len) {
CostCentre *cc;
IndexTable *i;
@@ -888,7 +888,7 @@ findCCSMaxLens(CostCentreStack *ccs, nat indent, nat *max_label_len, nat *max_mo
}
}
-static void
+static void
logCCS(CostCentreStack *ccs, nat indent, nat max_label_len, nat max_module_len)
{
CostCentre *cc;
@@ -915,7 +915,7 @@ logCCS(CostCentreStack *ccs, nat indent, nat max_label_len, nat max_module_len)
total_alloc == 0 ? 0.0 : ((double)ccs->mem_alloc / (double)total_alloc * 100.0),
total_prof_ticks == 0 ? 0.0 : ((double)ccs->inherited_ticks / (double)total_prof_ticks * 100.0),
total_alloc == 0 ? 0.0 : ((double)ccs->inherited_alloc / (double)total_alloc * 100.0)
- );
+ );
if (RtsFlags.CcFlags.doCostCentres >= COST_CENTRES_VERBOSE) {
fprintf(prof_file, " %5" FMT_Word64 " %9" FMT_Word64,
diff --git a/rts/Proftimer.c b/rts/Proftimer.c
index 6458f6e095..d1736f722b 100644
--- a/rts/Proftimer.c
+++ b/rts/Proftimer.c
@@ -50,9 +50,9 @@ stopHeapProfTimer( void )
void
startHeapProfTimer( void )
{
- if (RtsFlags.ProfFlags.doHeapProfile &&
+ if (RtsFlags.ProfFlags.doHeapProfile &&
RtsFlags.ProfFlags.heapProfileIntervalTicks > 0) {
- do_heap_prof_ticks = rtsTrue;
+ do_heap_prof_ticks = rtsTrue;
}
}
@@ -82,10 +82,10 @@ handleProfTick(void)
#endif
if (do_heap_prof_ticks) {
- ticks_to_heap_profile--;
- if (ticks_to_heap_profile <= 0) {
+ ticks_to_heap_profile--;
+ if (ticks_to_heap_profile <= 0) {
ticks_to_heap_profile = RtsFlags.ProfFlags.heapProfileIntervalTicks;
- performHeapProfile = rtsTrue;
- }
+ performHeapProfile = rtsTrue;
+ }
}
}
diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
index a5440e40ad..10585c89fa 100644
--- a/rts/RaiseAsync.c
+++ b/rts/RaiseAsync.c
@@ -34,7 +34,7 @@ static void removeFromQueues(Capability *cap, StgTSO *tso);
static void removeFromMVarBlockedQueue (StgTSO *tso);
static void throwToSendMsg (Capability *cap USED_IF_THREADS,
- Capability *target_cap USED_IF_THREADS,
+ Capability *target_cap USED_IF_THREADS,
MessageThrowTo *msg USED_IF_THREADS);
/* -----------------------------------------------------------------------------
@@ -42,7 +42,7 @@ static void throwToSendMsg (Capability *cap USED_IF_THREADS,
This version of throwTo is safe to use if and only if one of the
following holds:
-
+
- !THREADED_RTS
- all the other threads in the system are stopped (eg. during GC).
@@ -55,7 +55,7 @@ static void throwToSendMsg (Capability *cap USED_IF_THREADS,
-------------------------------------------------------------------------- */
static void
-throwToSingleThreaded__ (Capability *cap, StgTSO *tso, StgClosure *exception,
+throwToSingleThreaded__ (Capability *cap, StgTSO *tso, StgClosure *exception,
rtsBool stop_at_atomically, StgUpdateFrame *stop_here)
{
// Thread already dead?
@@ -128,13 +128,13 @@ suspendComputation (Capability *cap, StgTSO *tso, StgUpdateFrame *stop_here)
its parent container (e.g. the MVar) and then raise the exception.
We might change these cases to be more message-passing-like in the
future.
-
- Returns:
+
+ Returns:
NULL exception was raised, ok to continue
MessageThrowTo * exception was not raised; the source TSO
- should now put itself in the state
+ should now put itself in the state
BlockedOnMsgThrowTo, and when it is ready
it should unlock the mssage using
unlockClosure(msg, &stg_MSG_THROWTO_info);
@@ -145,10 +145,10 @@ suspendComputation (Capability *cap, StgTSO *tso, StgUpdateFrame *stop_here)
-------------------------------------------------------------------------- */
MessageThrowTo *
-throwTo (Capability *cap, // the Capability we hold
- StgTSO *source, // the TSO sending the exception (or NULL)
- StgTSO *target, // the TSO receiving the exception
- StgClosure *exception) // the exception closure
+throwTo (Capability *cap, // the Capability we hold
+ StgTSO *source, // the TSO sending the exception (or NULL)
+ StgTSO *target, // the TSO receiving the exception
+ StgClosure *exception) // the exception closure
{
MessageThrowTo *msg;
@@ -175,7 +175,7 @@ throwTo (Capability *cap, // the Capability we hold
return msg;
}
}
-
+
nat
throwToMsg (Capability *cap, MessageThrowTo *msg)
@@ -194,14 +194,14 @@ check_target:
ASSERT(target != END_TSO_QUEUE);
// Thread already dead?
- if (target->what_next == ThreadComplete
- || target->what_next == ThreadKilled) {
- return THROWTO_SUCCESS;
+ if (target->what_next == ThreadComplete
+ || target->what_next == ThreadKilled) {
+ return THROWTO_SUCCESS;
}
debugTraceCap(DEBUG_sched, cap,
"throwTo: from thread %lu to thread %lu",
- (unsigned long)msg->source->id,
+ (unsigned long)msg->source->id,
(unsigned long)msg->target->id);
#ifdef DEBUG
@@ -215,7 +215,7 @@ check_target:
}
status = target->why_blocked;
-
+
switch (status) {
case NotBlocked:
{
@@ -276,8 +276,8 @@ check_target:
goto retry;
}
- if ((target->flags & TSO_BLOCKEX) &&
- ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
+ if ((target->flags & TSO_BLOCKEX) &&
+ ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
unlockClosure((StgClosure*)m, i);
blockedThrowTo(cap,target,msg);
return THROWTO_BLOCKED;
@@ -293,17 +293,17 @@ check_target:
case BlockedOnMVar:
case BlockedOnMVarRead:
{
- /*
- To establish ownership of this TSO, we need to acquire a
- lock on the MVar that it is blocked on.
- */
- StgMVar *mvar;
- StgInfoTable *info USED_IF_THREADS;
-
- mvar = (StgMVar *)target->block_info.closure;
-
- // ASSUMPTION: tso->block_info must always point to a
- // closure. In the threaded RTS it does.
+ /*
+ To establish ownership of this TSO, we need to acquire a
+ lock on the MVar that it is blocked on.
+ */
+ StgMVar *mvar;
+ StgInfoTable *info USED_IF_THREADS;
+
+ mvar = (StgMVar *)target->block_info.closure;
+
+ // ASSUMPTION: tso->block_info must always point to a
+ // closure. In the threaded RTS it does.
switch (get_itbl((StgClosure *)mvar)->type) {
case MVAR_CLEAN:
case MVAR_DIRTY:
@@ -312,47 +312,47 @@ check_target:
goto retry;
}
- info = lockClosure((StgClosure *)mvar);
+ info = lockClosure((StgClosure *)mvar);
// we have the MVar, let's check whether the thread
- // is still blocked on the same MVar.
- if ((target->why_blocked != BlockedOnMVar && target->why_blocked != BlockedOnMVarRead)
- || (StgMVar *)target->block_info.closure != mvar) {
- unlockClosure((StgClosure *)mvar, info);
- goto retry;
- }
+ // is still blocked on the same MVar.
+ if ((target->why_blocked != BlockedOnMVar && target->why_blocked != BlockedOnMVarRead)
+ || (StgMVar *)target->block_info.closure != mvar) {
+ unlockClosure((StgClosure *)mvar, info);
+ goto retry;
+ }
if (target->_link == END_TSO_QUEUE) {
// the MVar operation has already completed. There is a
// MSG_TRY_WAKEUP on the way, but we can just wake up the
// thread now anyway and ignore the message when it
// arrives.
- unlockClosure((StgClosure *)mvar, info);
+ unlockClosure((StgClosure *)mvar, info);
tryWakeupThread(cap, target);
goto retry;
}
- if ((target->flags & TSO_BLOCKEX) &&
- ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
+ if ((target->flags & TSO_BLOCKEX) &&
+ ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
blockedThrowTo(cap,target,msg);
- unlockClosure((StgClosure *)mvar, info);
- return THROWTO_BLOCKED;
- } else {
+ unlockClosure((StgClosure *)mvar, info);
+ return THROWTO_BLOCKED;
+ } else {
// revoke the MVar operation
removeFromMVarBlockedQueue(target);
- raiseAsync(cap, target, msg->exception, rtsFalse, NULL);
- unlockClosure((StgClosure *)mvar, info);
- return THROWTO_SUCCESS;
- }
+ raiseAsync(cap, target, msg->exception, rtsFalse, NULL);
+ unlockClosure((StgClosure *)mvar, info);
+ return THROWTO_SUCCESS;
+ }
}
case BlockedOnBlackHole:
{
- if (target->flags & TSO_BLOCKEX) {
+ if (target->flags & TSO_BLOCKEX) {
// BlockedOnBlackHole is not interruptible.
blockedThrowTo(cap,target,msg);
- return THROWTO_BLOCKED;
- } else {
+ return THROWTO_BLOCKED;
+ } else {
// Revoke the message by replacing it with IND. We're not
// locking anything here, so we might still get a TRY_WAKEUP
// message from the owner of the blackhole some time in the
@@ -365,23 +365,23 @@ check_target:
}
case BlockedOnSTM:
- lockTSO(target);
- // Unblocking BlockedOnSTM threads requires the TSO to be
- // locked; see STM.c:unpark_tso().
- if (target->why_blocked != BlockedOnSTM) {
- unlockTSO(target);
- goto retry;
- }
- if ((target->flags & TSO_BLOCKEX) &&
- ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
+ lockTSO(target);
+ // Unblocking BlockedOnSTM threads requires the TSO to be
+ // locked; see STM.c:unpark_tso().
+ if (target->why_blocked != BlockedOnSTM) {
+ unlockTSO(target);
+ goto retry;
+ }
+ if ((target->flags & TSO_BLOCKEX) &&
+ ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
blockedThrowTo(cap,target,msg);
- unlockTSO(target);
- return THROWTO_BLOCKED;
- } else {
- raiseAsync(cap, target, msg->exception, rtsFalse, NULL);
- unlockTSO(target);
- return THROWTO_SUCCESS;
- }
+ unlockTSO(target);
+ return THROWTO_BLOCKED;
+ } else {
+ raiseAsync(cap, target, msg->exception, rtsFalse, NULL);
+ unlockTSO(target);
+ return THROWTO_SUCCESS;
+ }
case BlockedOnCCall_Interruptible:
#ifdef THREADED_RTS
@@ -409,8 +409,8 @@ check_target:
}
#endif
case BlockedOnCCall:
- blockedThrowTo(cap,target,msg);
- return THROWTO_BLOCKED;
+ blockedThrowTo(cap,target,msg);
+ return THROWTO_BLOCKED;
#ifndef THREADEDED_RTS
case BlockedOnRead:
@@ -419,15 +419,15 @@ check_target:
#if defined(mingw32_HOST_OS)
case BlockedOnDoProc:
#endif
- if ((target->flags & TSO_BLOCKEX) &&
- ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
- blockedThrowTo(cap,target,msg);
- return THROWTO_BLOCKED;
- } else {
- removeFromQueues(cap,target);
- raiseAsync(cap, target, msg->exception, rtsFalse, NULL);
- return THROWTO_SUCCESS;
- }
+ if ((target->flags & TSO_BLOCKEX) &&
+ ((target->flags & TSO_INTERRUPTIBLE) == 0)) {
+ blockedThrowTo(cap,target,msg);
+ return THROWTO_BLOCKED;
+ } else {
+ removeFromQueues(cap,target);
+ raiseAsync(cap, target, msg->exception, rtsFalse, NULL);
+ return THROWTO_SUCCESS;
+ }
#endif
case ThreadMigrating:
@@ -450,9 +450,9 @@ check_target:
static void
throwToSendMsg (Capability *cap STG_UNUSED,
- Capability *target_cap USED_IF_THREADS,
+ Capability *target_cap USED_IF_THREADS,
MessageThrowTo *msg USED_IF_THREADS)
-
+
{
#ifdef THREADED_RTS
debugTraceCap(DEBUG_sched, cap, "throwTo: sending a throwto message to cap %lu", (unsigned long)target_cap->no);
@@ -510,17 +510,17 @@ maybePerformBlockedException (Capability *cap, StgTSO *tso)
}
}
- if (tso->blocked_exceptions != END_BLOCKED_EXCEPTIONS_QUEUE &&
+ if (tso->blocked_exceptions != END_BLOCKED_EXCEPTIONS_QUEUE &&
(tso->flags & TSO_BLOCKEX) != 0) {
debugTraceCap(DEBUG_sched, cap, "throwTo: thread %lu has blocked exceptions but is inside block", (unsigned long)tso->id);
}
if (tso->blocked_exceptions != END_BLOCKED_EXCEPTIONS_QUEUE
- && ((tso->flags & TSO_BLOCKEX) == 0
- || ((tso->flags & TSO_INTERRUPTIBLE) && interruptible(tso)))) {
+ && ((tso->flags & TSO_BLOCKEX) == 0
+ || ((tso->flags & TSO_INTERRUPTIBLE) && interruptible(tso)))) {
- // We unblock just the first thread on the queue, and perform
- // its throw immediately.
+ // We unblock just the first thread on the queue, and perform
+ // its throw immediately.
loop:
msg = tso->blocked_exceptions;
if (msg == END_BLOCKED_EXCEPTIONS_QUEUE) return 0;
@@ -562,7 +562,7 @@ awakenBlockedExceptionQueue (Capability *cap, StgTSO *tso)
}
}
tso->blocked_exceptions = END_BLOCKED_EXCEPTIONS_QUEUE;
-}
+}
/* -----------------------------------------------------------------------------
Remove a thread from blocking queues.
@@ -673,7 +673,7 @@ removeFromQueues(Capability *cap, StgTSO *tso)
case BlockedOnDelay:
removeThreadFromQueue(cap, &sleeping_queue, tso);
- goto done;
+ goto done;
#endif
default:
@@ -696,11 +696,11 @@ removeFromQueues(Capability *cap, StgTSO *tso)
* TSO blocked_exception queues.
*
* We strip the stack down to the innermost CATCH_FRAME, building
- * thunks in the heap for all the active computations, so they can
+ * thunks in the heap for all the active computations, so they can
* be restarted if necessary. When we reach a CATCH_FRAME, we build
* an application of the handler to the exception, and push it on
* the top of the stack.
- *
+ *
* How exactly do we save all the active computations? We create an
* AP_STACK for every UpdateFrame on the stack. Entering one of these
* AP_STACKs pushes everything from the corresponding update frame
@@ -711,7 +711,7 @@ removeFromQueues(Capability *cap, StgTSO *tso)
* exactly as it did when we killed the TSO and we can continue
* execution by entering the closure on top of the stack.
*
- * We can also kill a thread entirely - this happens if either (a) the
+ * We can also kill a thread entirely - this happens if either (a) the
* exception passed to raiseAsync is NULL, or (b) there's no
* CATCH_FRAME on the stack. In either case, we strip the entire
* stack and replace the thread with a zombie.
@@ -724,8 +724,8 @@ removeFromQueues(Capability *cap, StgTSO *tso)
* -------------------------------------------------------------------------- */
static StgTSO *
-raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
- rtsBool stop_at_atomically, StgUpdateFrame *stop_here)
+raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
+ rtsBool stop_at_atomically, StgUpdateFrame *stop_here)
{
StgRetInfoTable *info;
StgPtr sp, frame;
@@ -735,12 +735,12 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
debugTraceCap(DEBUG_sched, cap,
"raising exception in thread %ld.", (long)tso->id);
-
+
#if defined(PROFILING)
- /*
+ /*
* Debugging tool: on raising an exception, show where we are.
* See also Exception.cmm:stg_raisezh.
- * This wasn't done for asynchronous exceptions originally; see #1450
+ * This wasn't done for asynchronous exceptions originally; see #1450
*/
if (RtsFlags.ProfFlags.showCCSOnException && exception != NULL)
{
@@ -749,10 +749,10 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
#endif
// ASSUMES: the thread is not already complete or dead
// Upper layers should deal with that.
- ASSERT(tso->what_next != ThreadComplete &&
+ ASSERT(tso->what_next != ThreadComplete &&
tso->what_next != ThreadKilled);
- // only if we own this TSO (except that deleteThread() calls this
+ // only if we own this TSO (except that deleteThread() calls this
ASSERT(tso->cap == cap);
stack = tso->stackobj;
@@ -762,7 +762,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
dirty_STACK(cap, stack);
sp = stack->sp;
-
+
if (stop_here != NULL) {
updatee = stop_here->updatee;
} else {
@@ -773,69 +773,69 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
// the top of the stack, so we have to arrange that this is the case...
//
if (sp[0] == (W_)&stg_enter_info) {
- sp++;
+ sp++;
} else {
- sp--;
- sp[0] = (W_)&stg_dummy_ret_closure;
+ sp--;
+ sp[0] = (W_)&stg_dummy_ret_closure;
}
frame = sp + 1;
while (stop_here == NULL || frame < (StgPtr)stop_here) {
- // 1. Let the top of the stack be the "current closure"
- //
- // 2. Walk up the stack until we find either an UPDATE_FRAME or a
- // CATCH_FRAME.
- //
- // 3. If it's an UPDATE_FRAME, then make an AP_STACK containing the
- // current closure applied to the chunk of stack up to (but not
- // including) the update frame. This closure becomes the "current
- // closure". Go back to step 2.
- //
- // 4. If it's a CATCH_FRAME, then leave the exception handler on
- // top of the stack applied to the exception.
- //
- // 5. If it's a STOP_FRAME, then kill the thread.
- //
+ // 1. Let the top of the stack be the "current closure"
+ //
+ // 2. Walk up the stack until we find either an UPDATE_FRAME or a
+ // CATCH_FRAME.
+ //
+ // 3. If it's an UPDATE_FRAME, then make an AP_STACK containing the
+ // current closure applied to the chunk of stack up to (but not
+ // including) the update frame. This closure becomes the "current
+ // closure". Go back to step 2.
+ //
+ // 4. If it's a CATCH_FRAME, then leave the exception handler on
+ // top of the stack applied to the exception.
+ //
+ // 5. If it's a STOP_FRAME, then kill the thread.
+ //
// 6. If it's an UNDERFLOW_FRAME, then continue with the next
// stack chunk.
//
// NB: if we pass an ATOMICALLY_FRAME then abort the associated
// transaction
-
+
info = get_ret_itbl((StgClosure *)frame);
- switch (info->i.type) {
-
- case UPDATE_FRAME:
- {
- StgAP_STACK * ap;
- nat words;
-
- // First build an AP_STACK consisting of the stack chunk above the
- // current update frame, with the top word on the stack as the
- // fun field.
- //
- words = frame - sp - 1;
- ap = (StgAP_STACK *)allocate(cap,AP_STACK_sizeW(words));
-
- ap->size = words;
- ap->fun = (StgClosure *)sp[0];
- sp++;
- for(i=0; i < (nat)words; ++i) {
- ap->payload[i] = (StgClosure *)*sp++;
- }
-
- SET_HDR(ap,&stg_AP_STACK_info,
- ((StgClosure *)frame)->header.prof.ccs /* ToDo */);
- TICK_ALLOC_UP_THK(WDS(words+1),0);
-
- //IF_DEBUG(scheduler,
- // debugBelch("sched: Updating ");
- // printPtr((P_)((StgUpdateFrame *)frame)->updatee);
- // debugBelch(" with ");
- // printObj((StgClosure *)ap);
- // );
+ switch (info->i.type) {
+
+ case UPDATE_FRAME:
+ {
+ StgAP_STACK * ap;
+ nat words;
+
+ // First build an AP_STACK consisting of the stack chunk above the
+ // current update frame, with the top word on the stack as the
+ // fun field.
+ //
+ words = frame - sp - 1;
+ ap = (StgAP_STACK *)allocate(cap,AP_STACK_sizeW(words));
+
+ ap->size = words;
+ ap->fun = (StgClosure *)sp[0];
+ sp++;
+ for(i=0; i < (nat)words; ++i) {
+ ap->payload[i] = (StgClosure *)*sp++;
+ }
+
+ SET_HDR(ap,&stg_AP_STACK_info,
+ ((StgClosure *)frame)->header.prof.ccs /* ToDo */);
+ TICK_ALLOC_UP_THK(WDS(words+1),0);
+
+ //IF_DEBUG(scheduler,
+ // debugBelch("sched: Updating ");
+ // printPtr((P_)((StgUpdateFrame *)frame)->updatee);
+ // debugBelch(" with ");
+ // printObj((StgClosure *)ap);
+ // );
if (((StgUpdateFrame *)frame)->updatee == updatee) {
// If this update frame points to the same closure as
@@ -848,37 +848,37 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
// Perform the update
// TODO: this may waste some work, if the thunk has
// already been updated by another thread.
- updateThunk(cap, tso,
+ updateThunk(cap, tso,
((StgUpdateFrame *)frame)->updatee, (StgClosure *)ap);
}
- sp += sizeofW(StgUpdateFrame) - 1;
- sp[0] = (W_)ap; // push onto stack
- frame = sp + 1;
- continue; //no need to bump frame
- }
+ sp += sizeofW(StgUpdateFrame) - 1;
+ sp[0] = (W_)ap; // push onto stack
+ frame = sp + 1;
+ continue; //no need to bump frame
+ }
case UNDERFLOW_FRAME:
{
- StgAP_STACK * ap;
- nat words;
-
- // First build an AP_STACK consisting of the stack chunk above the
- // current update frame, with the top word on the stack as the
- // fun field.
- //
- words = frame - sp - 1;
- ap = (StgAP_STACK *)allocate(cap,AP_STACK_sizeW(words));
-
- ap->size = words;
- ap->fun = (StgClosure *)sp[0];
- sp++;
- for(i=0; i < (nat)words; ++i) {
- ap->payload[i] = (StgClosure *)*sp++;
- }
-
+ StgAP_STACK * ap;
+ nat words;
+
+ // First build an AP_STACK consisting of the stack chunk above the
+ // current update frame, with the top word on the stack as the
+ // fun field.
+ //
+ words = frame - sp - 1;
+ ap = (StgAP_STACK *)allocate(cap,AP_STACK_sizeW(words));
+
+ ap->size = words;
+ ap->fun = (StgClosure *)sp[0];
+ sp++;
+ for(i=0; i < (nat)words; ++i) {
+ ap->payload[i] = (StgClosure *)*sp++;
+ }
+
SET_HDR(ap,&stg_AP_STACK_NOUPD_info,
- ((StgClosure *)frame)->header.prof.ccs /* ToDo */);
+ ((StgClosure *)frame)->header.prof.ccs /* ToDo */);
TICK_ALLOC_SE_THK(WDS(words+1),0);
stack->sp = sp;
@@ -893,40 +893,40 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
}
case STOP_FRAME:
- {
- // We've stripped the entire stack, the thread is now dead.
- tso->what_next = ThreadKilled;
+ {
+ // We've stripped the entire stack, the thread is now dead.
+ tso->what_next = ThreadKilled;
stack->sp = frame + sizeofW(StgStopFrame);
goto done;
- }
-
- case CATCH_FRAME:
- // If we find a CATCH_FRAME, and we've got an exception to raise,
- // then build the THUNK raise(exception), and leave it on
- // top of the CATCH_FRAME ready to enter.
- //
- {
- StgCatchFrame *cf = (StgCatchFrame *)frame;
- StgThunk *raise;
-
- if (exception == NULL) break;
-
- // we've got an exception to raise, so let's pass it to the
- // handler in this frame.
- //
- raise = (StgThunk *)allocate(cap,sizeofW(StgThunk)+1);
- TICK_ALLOC_SE_THK(WDS(1),0);
- SET_HDR(raise,&stg_raise_info,cf->header.prof.ccs);
- raise->payload[0] = exception;
-
- // throw away the stack from Sp up to the CATCH_FRAME.
- //
- sp = frame - 1;
-
- /* Ensure that async exceptions are blocked now, so we don't get
- * a surprise exception before we get around to executing the
- * handler.
- */
+ }
+
+ case CATCH_FRAME:
+ // If we find a CATCH_FRAME, and we've got an exception to raise,
+ // then build the THUNK raise(exception), and leave it on
+ // top of the CATCH_FRAME ready to enter.
+ //
+ {
+ StgCatchFrame *cf = (StgCatchFrame *)frame;
+ StgThunk *raise;
+
+ if (exception == NULL) break;
+
+ // we've got an exception to raise, so let's pass it to the
+ // handler in this frame.
+ //
+ raise = (StgThunk *)allocate(cap,sizeofW(StgThunk)+1);
+ TICK_ALLOC_SE_THK(WDS(1),0);
+ SET_HDR(raise,&stg_raise_info,cf->header.prof.ccs);
+ raise->payload[0] = exception;
+
+ // throw away the stack from Sp up to the CATCH_FRAME.
+ //
+ sp = frame - 1;
+
+ /* Ensure that async exceptions are blocked now, so we don't get
+ * a surprise exception before we get around to executing the
+ * handler.
+ */
tso->flags |= TSO_BLOCKEX;
if ((cf->exceptions_blocked & TSO_INTERRUPTIBLE) == 0) {
tso->flags &= ~TSO_INTERRUPTIBLE;
@@ -934,20 +934,20 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
tso->flags |= TSO_INTERRUPTIBLE;
}
- /* Put the newly-built THUNK on top of the stack, ready to execute
- * when the thread restarts.
- */
- sp[0] = (W_)raise;
- sp[-1] = (W_)&stg_enter_info;
+ /* Put the newly-built THUNK on top of the stack, ready to execute
+ * when the thread restarts.
+ */
+ sp[0] = (W_)raise;
+ sp[-1] = (W_)&stg_enter_info;
stack->sp = sp-1;
- tso->what_next = ThreadRunGHC;
+ tso->what_next = ThreadRunGHC;
goto done;
- }
-
- case ATOMICALLY_FRAME:
- if (stop_at_atomically) {
- ASSERT(tso->trec->enclosing_trec == NO_TREC);
- stmCondemnTransaction(cap, tso -> trec);
+ }
+
+ case ATOMICALLY_FRAME:
+ if (stop_at_atomically) {
+ ASSERT(tso->trec->enclosing_trec == NO_TREC);
+ stmCondemnTransaction(cap, tso -> trec);
stack->sp = frame - 2;
// The ATOMICALLY_FRAME expects to be returned a
// result from the transaction, which it stores in the
@@ -961,7 +961,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
stack->sp[0] = (W_)&stg_ret_p_info;
tso->what_next = ThreadRunGHC;
goto done;
- }
+ }
else
{
// Freezing an STM transaction. Just aborting the
@@ -1009,33 +1009,33 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception,
}
case CATCH_STM_FRAME:
- case CATCH_RETRY_FRAME:
+ case CATCH_RETRY_FRAME:
// CATCH frames within an atomically block: abort the
// inner transaction and continue. Eventually we will
// hit the outer transaction that will get frozen (see
// above).
//
// In this case (unlike ordinary exceptions) we do not care
- // whether the transaction is valid or not because its
- // possible validity cannot have caused the exception
- // and will not be visible after the abort.
+ // whether the transaction is valid or not because its
+ // possible validity cannot have caused the exception
+ // and will not be visible after the abort.
{
StgTRecHeader *trec = tso -> trec;
StgTRecHeader *outer = trec -> enclosing_trec;
- debugTraceCap(DEBUG_stm, cap,
+ debugTraceCap(DEBUG_stm, cap,
"found atomically block delivering async exception");
stmAbortTransaction(cap, trec);
- stmFreeAbortedTRec(cap, trec);
+ stmFreeAbortedTRec(cap, trec);
tso -> trec = outer;
break;
};
- default:
- break;
- }
+ default:
+ break;
+ }
- // move on to the next stack frame
- frame += stack_frame_sizeW((StgClosure *)frame);
+ // move on to the next stack frame
+ frame += stack_frame_sizeW((StgClosure *)frame);
}
done:
@@ -1045,9 +1045,7 @@ done:
if (tso->why_blocked != NotBlocked) {
tso->why_blocked = NotBlocked;
appendToRunQueue(cap,tso);
- }
+ }
return tso;
}
-
-
diff --git a/rts/RaiseAsync.h b/rts/RaiseAsync.h
index 3da9e7bc09..e2763d0cb8 100644
--- a/rts/RaiseAsync.h
+++ b/rts/RaiseAsync.h
@@ -16,23 +16,23 @@
#include "BeginPrivate.h"
-void blockedThrowTo (Capability *cap,
+void blockedThrowTo (Capability *cap,
StgTSO *target, MessageThrowTo *msg);
void throwToSingleThreaded (Capability *cap,
- StgTSO *tso,
- StgClosure *exception);
+ StgTSO *tso,
+ StgClosure *exception);
-void throwToSingleThreaded_ (Capability *cap,
- StgTSO *tso,
- StgClosure *exception,
- rtsBool stop_at_atomically);
+void throwToSingleThreaded_ (Capability *cap,
+ StgTSO *tso,
+ StgClosure *exception,
+ rtsBool stop_at_atomically);
-void suspendComputation (Capability *cap,
- StgTSO *tso,
- StgUpdateFrame *stop_here);
+void suspendComputation (Capability *cap,
+ StgTSO *tso,
+ StgUpdateFrame *stop_here);
-MessageThrowTo *throwTo (Capability *cap, // the Capability we hold
+MessageThrowTo *throwTo (Capability *cap, // the Capability we hold
StgTSO *source,
StgTSO *target,
StgClosure *exception); // the exception closure
@@ -74,4 +74,3 @@ interruptible(StgTSO *t)
#endif /* CMINUSMINUS */
#endif /* RAISEASYNC_H */
-
diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c
index bfc96247aa..f3e8c72eb8 100644
--- a/rts/RetainerProfile.c
+++ b/rts/RetainerProfile.c
@@ -46,9 +46,9 @@
* Declarations...
* -------------------------------------------------------------------------- */
-static nat retainerGeneration; // generation
+static nat retainerGeneration; // generation
-static nat numObjectVisited; // total number of objects visited
+static nat numObjectVisited; // total number of objects visited
static nat timesAnyObjectVisited; // number of times any objects are visited
/*
@@ -81,15 +81,15 @@ static void belongToHeap(StgPtr p);
*/
static nat cStackSize, maxCStackSize;
-static nat sumOfNewCost; // sum of the cost of each object, computed
- // when the object is first visited
+static nat sumOfNewCost; // sum of the cost of each object, computed
+ // when the object is first visited
static nat sumOfNewCostExtra; // for those objects not visited during
// retainer profiling, e.g., MUT_VAR
static nat costArray[N_CLOSURE_TYPES];
-nat sumOfCostLinear; // sum of the costs of all object, computed
- // when linearly traversing the heap after
- // retainer profiling
+nat sumOfCostLinear; // sum of the costs of all object, computed
+ // when linearly traversing the heap after
+ // retainer profiling
nat costArrayLinear[N_CLOSURE_TYPES];
#endif
@@ -118,27 +118,27 @@ typedef union {
struct {
// See StgClosureInfo in InfoTables.h
#if SIZEOF_VOID_P == 8
- StgWord32 pos;
- StgWord32 ptrs;
+ StgWord32 pos;
+ StgWord32 ptrs;
#else
- StgWord16 pos;
- StgWord16 ptrs;
+ StgWord16 pos;
+ StgWord16 ptrs;
#endif
- StgPtr payload;
+ StgPtr payload;
} ptrs;
// SRT
struct {
- StgClosure **srt;
- StgWord srt_bitmap;
+ StgClosure **srt;
+ StgWord srt_bitmap;
} srt;
// Large SRT
struct {
- StgLargeSRT *srt;
- StgWord offset;
+ StgLargeSRT *srt;
+ StgWord offset;
} large_srt;
-
+
} nextPos;
typedef struct {
@@ -237,7 +237,7 @@ static void
initializeTraverseStack( void )
{
if (firstStack != NULL) {
- freeChain(firstStack);
+ freeChain(firstStack);
}
firstStack = allocGroup(BLOCKS_IN_STACK);
@@ -278,7 +278,7 @@ retainerStackBlocks( void )
bdescr* bd;
W_ res = 0;
- for (bd = firstStack; bd != NULL; bd = bd->link)
+ for (bd = firstStack; bd != NULL; bd = bd->link)
res += bd->blocks;
return res;
@@ -316,9 +316,9 @@ static INLINE StgClosure *
find_ptrs( stackPos *info )
{
if (info->next.ptrs.pos < info->next.ptrs.ptrs) {
- return (StgClosure *)info->next.ptrs.payload[info->next.ptrs.pos++];
+ return (StgClosure *)info->next.ptrs.payload[info->next.ptrs.pos++];
} else {
- return NULL;
+ return NULL;
}
}
@@ -329,13 +329,13 @@ static INLINE void
init_srt_fun( stackPos *info, StgFunInfoTable *infoTable )
{
if (infoTable->i.srt_bitmap == (StgHalfWord)(-1)) {
- info->type = posTypeLargeSRT;
- info->next.large_srt.srt = (StgLargeSRT *)GET_FUN_SRT(infoTable);
- info->next.large_srt.offset = 0;
+ info->type = posTypeLargeSRT;
+ info->next.large_srt.srt = (StgLargeSRT *)GET_FUN_SRT(infoTable);
+ info->next.large_srt.offset = 0;
} else {
- info->type = posTypeSRT;
- info->next.srt.srt = (StgClosure **)GET_FUN_SRT(infoTable);
- info->next.srt.srt_bitmap = infoTable->i.srt_bitmap;
+ info->type = posTypeSRT;
+ info->next.srt.srt = (StgClosure **)GET_FUN_SRT(infoTable);
+ info->next.srt.srt_bitmap = infoTable->i.srt_bitmap;
}
}
@@ -343,13 +343,13 @@ static INLINE void
init_srt_thunk( stackPos *info, StgThunkInfoTable *infoTable )
{
if (infoTable->i.srt_bitmap == (StgHalfWord)(-1)) {
- info->type = posTypeLargeSRT;
- info->next.large_srt.srt = (StgLargeSRT *)GET_SRT(infoTable);
- info->next.large_srt.offset = 0;
+ info->type = posTypeLargeSRT;
+ info->next.large_srt.srt = (StgLargeSRT *)GET_SRT(infoTable);
+ info->next.large_srt.offset = 0;
} else {
- info->type = posTypeSRT;
- info->next.srt.srt = (StgClosure **)GET_SRT(infoTable);
- info->next.srt.srt_bitmap = infoTable->i.srt_bitmap;
+ info->type = posTypeSRT;
+ info->next.srt.srt = (StgClosure **)GET_SRT(infoTable);
+ info->next.srt.srt_bitmap = infoTable->i.srt_bitmap;
}
}
@@ -363,54 +363,54 @@ find_srt( stackPos *info )
StgWord bitmap;
if (info->type == posTypeSRT) {
- // Small SRT bitmap
- bitmap = info->next.srt.srt_bitmap;
- while (bitmap != 0) {
- if ((bitmap & 1) != 0) {
+ // Small SRT bitmap
+ bitmap = info->next.srt.srt_bitmap;
+ while (bitmap != 0) {
+ if ((bitmap & 1) != 0) {
#if defined(COMPILING_WINDOWS_DLL)
- if ((unsigned long)(*(info->next.srt.srt)) & 0x1)
- c = (* (StgClosure **)((unsigned long)*(info->next.srt.srt)) & ~0x1);
- else
- c = *(info->next.srt.srt);
+ if ((unsigned long)(*(info->next.srt.srt)) & 0x1)
+ c = (* (StgClosure **)((unsigned long)*(info->next.srt.srt)) & ~0x1);
+ else
+ c = *(info->next.srt.srt);
#else
- c = *(info->next.srt.srt);
+ c = *(info->next.srt.srt);
#endif
- bitmap = bitmap >> 1;
- info->next.srt.srt++;
- info->next.srt.srt_bitmap = bitmap;
- return c;
- }
- bitmap = bitmap >> 1;
- info->next.srt.srt++;
- }
- // bitmap is now zero...
- return NULL;
+ bitmap = bitmap >> 1;
+ info->next.srt.srt++;
+ info->next.srt.srt_bitmap = bitmap;
+ return c;
+ }
+ bitmap = bitmap >> 1;
+ info->next.srt.srt++;
+ }
+ // bitmap is now zero...
+ return NULL;
}
else {
- // Large SRT bitmap
- nat i = info->next.large_srt.offset;
- StgWord bitmap;
-
- // Follow the pattern from GC.c:scavenge_large_srt_bitmap().
- bitmap = info->next.large_srt.srt->l.bitmap[i / BITS_IN(W_)];
- bitmap = bitmap >> (i % BITS_IN(StgWord));
- while (i < info->next.large_srt.srt->l.size) {
- if ((bitmap & 1) != 0) {
- c = ((StgClosure **)info->next.large_srt.srt->srt)[i];
- i++;
- info->next.large_srt.offset = i;
- return c;
- }
- i++;
- if (i % BITS_IN(W_) == 0) {
- bitmap = info->next.large_srt.srt->l.bitmap[i / BITS_IN(W_)];
- } else {
- bitmap = bitmap >> 1;
- }
- }
- // reached the end of this bitmap.
- info->next.large_srt.offset = i;
- return NULL;
+ // Large SRT bitmap
+ nat i = info->next.large_srt.offset;
+ StgWord bitmap;
+
+ // Follow the pattern from GC.c:scavenge_large_srt_bitmap().
+ bitmap = info->next.large_srt.srt->l.bitmap[i / BITS_IN(W_)];
+ bitmap = bitmap >> (i % BITS_IN(StgWord));
+ while (i < info->next.large_srt.srt->l.size) {
+ if ((bitmap & 1) != 0) {
+ c = ((StgClosure **)info->next.large_srt.srt->srt)[i];
+ i++;
+ info->next.large_srt.offset = i;
+ return c;
+ }
+ i++;
+ if (i % BITS_IN(W_) == 0) {
+ bitmap = info->next.large_srt.srt->l.bitmap[i / BITS_IN(W_)];
+ } else {
+ bitmap = bitmap >> 1;
+ }
+ }
+ // reached the end of this bitmap.
+ info->next.large_srt.offset = i;
+ return NULL;
}
}
@@ -451,162 +451,162 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
// fill in se.info
switch (get_itbl(c)->type) {
- // no child, no SRT
+ // no child, no SRT
case CONSTR_0_1:
case CONSTR_0_2:
case ARR_WORDS:
- *first_child = NULL;
- return;
+ *first_child = NULL;
+ return;
- // one child (fixed), no SRT
+ // one child (fixed), no SRT
case MUT_VAR_CLEAN:
case MUT_VAR_DIRTY:
- *first_child = ((StgMutVar *)c)->var;
- return;
+ *first_child = ((StgMutVar *)c)->var;
+ return;
case THUNK_SELECTOR:
- *first_child = ((StgSelector *)c)->selectee;
- return;
+ *first_child = ((StgSelector *)c)->selectee;
+ return;
case IND_PERM:
case BLACKHOLE:
- *first_child = ((StgInd *)c)->indirectee;
- return;
+ *first_child = ((StgInd *)c)->indirectee;
+ return;
case CONSTR_1_0:
case CONSTR_1_1:
- *first_child = c->payload[0];
- return;
+ *first_child = c->payload[0];
+ return;
- // For CONSTR_2_0 and MVAR, we use se.info.step to record the position
- // of the next child. We do not write a separate initialization code.
- // Also we do not have to initialize info.type;
+ // For CONSTR_2_0 and MVAR, we use se.info.step to record the position
+ // of the next child. We do not write a separate initialization code.
+ // Also we do not have to initialize info.type;
- // two children (fixed), no SRT
- // need to push a stackElement, but nothing to store in se.info
+ // two children (fixed), no SRT
+ // need to push a stackElement, but nothing to store in se.info
case CONSTR_2_0:
- *first_child = c->payload[0]; // return the first pointer
- // se.info.type = posTypeStep;
- // se.info.next.step = 2; // 2 = second
- break;
+ *first_child = c->payload[0]; // return the first pointer
+ // se.info.type = posTypeStep;
+ // se.info.next.step = 2; // 2 = second
+ break;
- // three children (fixed), no SRT
- // need to push a stackElement
+ // three children (fixed), no SRT
+ // need to push a stackElement
case MVAR_CLEAN:
case MVAR_DIRTY:
- // head must be TSO and the head of a linked list of TSOs.
- // Shoule it be a child? Seems to be yes.
- *first_child = (StgClosure *)((StgMVar *)c)->head;
- // se.info.type = posTypeStep;
- se.info.next.step = 2; // 2 = second
- break;
-
- // three children (fixed), no SRT
+ // head must be TSO and the head of a linked list of TSOs.
+ // Shoule it be a child? Seems to be yes.
+ *first_child = (StgClosure *)((StgMVar *)c)->head;
+ // se.info.type = posTypeStep;
+ se.info.next.step = 2; // 2 = second
+ break;
+
+ // three children (fixed), no SRT
case WEAK:
- *first_child = ((StgWeak *)c)->key;
- // se.info.type = posTypeStep;
- se.info.next.step = 2;
- break;
+ *first_child = ((StgWeak *)c)->key;
+ // se.info.type = posTypeStep;
+ se.info.next.step = 2;
+ break;
- // layout.payload.ptrs, no SRT
+ // layout.payload.ptrs, no SRT
case TVAR:
case CONSTR:
case PRIM:
case MUT_PRIM:
case BCO:
case CONSTR_STATIC:
- init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs,
- (StgPtr)c->payload);
- *first_child = find_ptrs(&se.info);
- if (*first_child == NULL)
- return; // no child
- break;
-
- // StgMutArrPtr.ptrs, no SRT
+ init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs,
+ (StgPtr)c->payload);
+ *first_child = find_ptrs(&se.info);
+ if (*first_child == NULL)
+ return; // no child
+ break;
+
+ // StgMutArrPtr.ptrs, no SRT
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- init_ptrs(&se.info, ((StgMutArrPtrs *)c)->ptrs,
- (StgPtr)(((StgMutArrPtrs *)c)->payload));
- *first_child = find_ptrs(&se.info);
- if (*first_child == NULL)
- return;
- break;
-
- // StgMutArrPtr.ptrs, no SRT
+ init_ptrs(&se.info, ((StgMutArrPtrs *)c)->ptrs,
+ (StgPtr)(((StgMutArrPtrs *)c)->payload));
+ *first_child = find_ptrs(&se.info);
+ if (*first_child == NULL)
+ return;
+ break;
+
+ // StgMutArrPtr.ptrs, no SRT
case SMALL_MUT_ARR_PTRS_CLEAN:
case SMALL_MUT_ARR_PTRS_DIRTY:
case SMALL_MUT_ARR_PTRS_FROZEN:
case SMALL_MUT_ARR_PTRS_FROZEN0:
- init_ptrs(&se.info, ((StgSmallMutArrPtrs *)c)->ptrs,
- (StgPtr)(((StgSmallMutArrPtrs *)c)->payload));
- *first_child = find_ptrs(&se.info);
- if (*first_child == NULL)
- return;
- break;
+ init_ptrs(&se.info, ((StgSmallMutArrPtrs *)c)->ptrs,
+ (StgPtr)(((StgSmallMutArrPtrs *)c)->payload));
+ *first_child = find_ptrs(&se.info);
+ if (*first_child == NULL)
+ return;
+ break;
// layout.payload.ptrs, SRT
case FUN: // *c is a heap object.
case FUN_2_0:
- init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs, (StgPtr)c->payload);
- *first_child = find_ptrs(&se.info);
- if (*first_child == NULL)
- // no child from ptrs, so check SRT
- goto fun_srt_only;
- break;
+ init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs, (StgPtr)c->payload);
+ *first_child = find_ptrs(&se.info);
+ if (*first_child == NULL)
+ // no child from ptrs, so check SRT
+ goto fun_srt_only;
+ break;
case THUNK:
case THUNK_2_0:
- init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs,
- (StgPtr)((StgThunk *)c)->payload);
- *first_child = find_ptrs(&se.info);
- if (*first_child == NULL)
- // no child from ptrs, so check SRT
- goto thunk_srt_only;
- break;
-
- // 1 fixed child, SRT
+ init_ptrs(&se.info, get_itbl(c)->layout.payload.ptrs,
+ (StgPtr)((StgThunk *)c)->payload);
+ *first_child = find_ptrs(&se.info);
+ if (*first_child == NULL)
+ // no child from ptrs, so check SRT
+ goto thunk_srt_only;
+ break;
+
+ // 1 fixed child, SRT
case FUN_1_0:
case FUN_1_1:
- *first_child = c->payload[0];
- ASSERT(*first_child != NULL);
- init_srt_fun(&se.info, get_fun_itbl(c));
- break;
+ *first_child = c->payload[0];
+ ASSERT(*first_child != NULL);
+ init_srt_fun(&se.info, get_fun_itbl(c));
+ break;
case THUNK_1_0:
case THUNK_1_1:
- *first_child = ((StgThunk *)c)->payload[0];
- ASSERT(*first_child != NULL);
- init_srt_thunk(&se.info, get_thunk_itbl(c));
- break;
+ *first_child = ((StgThunk *)c)->payload[0];
+ ASSERT(*first_child != NULL);
+ init_srt_thunk(&se.info, get_thunk_itbl(c));
+ break;
case FUN_STATIC: // *c is a heap object.
- ASSERT(get_itbl(c)->srt_bitmap != 0);
+ ASSERT(get_itbl(c)->srt_bitmap != 0);
case FUN_0_1:
case FUN_0_2:
fun_srt_only:
init_srt_fun(&se.info, get_fun_itbl(c));
- *first_child = find_srt(&se.info);
- if (*first_child == NULL)
- return; // no child
- break;
+ *first_child = find_srt(&se.info);
+ if (*first_child == NULL)
+ return; // no child
+ break;
// SRT only
case THUNK_STATIC:
- ASSERT(get_itbl(c)->srt_bitmap != 0);
+ ASSERT(get_itbl(c)->srt_bitmap != 0);
case THUNK_0_1:
case THUNK_0_2:
thunk_srt_only:
init_srt_thunk(&se.info, get_thunk_itbl(c));
- *first_child = find_srt(&se.info);
- if (*first_child == NULL)
- return; // no child
- break;
-
+ *first_child = find_srt(&se.info);
+ if (*first_child == NULL)
+ return; // no child
+ break;
+
case TREC_CHUNK:
- *first_child = (StgClosure *)((StgTRecChunk *)c)->prev_chunk;
- se.info.next.step = 0; // entry no.
- break;
+ *first_child = (StgClosure *)((StgTRecChunk *)c)->prev_chunk;
+ se.info.next.step = 0; // entry no.
+ break;
- // cannot appear
+ // cannot appear
case PAP:
case AP:
case AP_STACK:
@@ -614,7 +614,7 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
case STACK:
case IND_STATIC:
case CONSTR_NOCAF_STATIC:
- // stack objects
+ // stack objects
case UPDATE_FRAME:
case CATCH_FRAME:
case UNDERFLOW_FRAME:
@@ -622,31 +622,31 @@ push( StgClosure *c, retainer c_child_r, StgClosure **first_child )
case RET_BCO:
case RET_SMALL:
case RET_BIG:
- // invalid objects
+ // invalid objects
case IND:
case INVALID_OBJECT:
default:
- barf("Invalid object *c in push()");
- return;
+ barf("Invalid object *c in push()");
+ return;
}
if (stackTop - 1 < stackBottom) {
#ifdef DEBUG_RETAINER
- // debugBelch("push() to the next stack.\n");
+ // debugBelch("push() to the next stack.\n");
#endif
- // currentStack->free is updated when the active stack is switched
- // to the next stack.
- currentStack->free = (StgPtr)stackTop;
-
- if (currentStack->link == NULL) {
- nbd = allocGroup(BLOCKS_IN_STACK);
- nbd->link = NULL;
- nbd->u.back = currentStack;
- currentStack->link = nbd;
- } else
- nbd = currentStack->link;
-
- newStackBlock(nbd);
+ // currentStack->free is updated when the active stack is switched
+ // to the next stack.
+ currentStack->free = (StgPtr)stackTop;
+
+ if (currentStack->link == NULL) {
+ nbd = allocGroup(BLOCKS_IN_STACK);
+ nbd->link = NULL;
+ nbd->u.back = currentStack;
+ currentStack->link = nbd;
+ } else
+ nbd = currentStack->link;
+
+ newStackBlock(nbd);
}
// adjust stackTop (acutal push)
@@ -697,18 +697,18 @@ popOffReal(void)
ASSERT(stackBottom == (stackElement *)currentStack->start);
if (firstStack == currentStack) {
- // The stack is completely empty.
- stackTop++;
- ASSERT(stackTop == stackLimit);
+ // The stack is completely empty.
+ stackTop++;
+ ASSERT(stackTop == stackLimit);
#ifdef DEBUG_RETAINER
- stackSize--;
- if (stackSize > maxStackSize) maxStackSize = stackSize;
- /*
- ASSERT(stackSize >= 0);
- debugBelch("stackSize = %d\n", stackSize);
- */
+ stackSize--;
+ if (stackSize > maxStackSize) maxStackSize = stackSize;
+ /*
+ ASSERT(stackSize >= 0);
+ debugBelch("stackSize = %d\n", stackSize);
+ */
#endif
- return;
+ return;
}
// currentStack->free is updated when the active stack is switched back
@@ -742,16 +742,16 @@ popOff(void) {
// <= (instead of <) is wrong!
if (stackTop + 1 < stackLimit) {
- stackTop++;
+ stackTop++;
#ifdef DEBUG_RETAINER
- stackSize--;
- if (stackSize > maxStackSize) maxStackSize = stackSize;
- /*
- ASSERT(stackSize >= 0);
- debugBelch("stackSize = %d\n", stackSize);
- */
+ stackSize--;
+ if (stackSize > maxStackSize) maxStackSize = stackSize;
+ /*
+ ASSERT(stackSize >= 0);
+ debugBelch("stackSize = %d\n", stackSize);
+ */
#endif
- return;
+ return;
}
popOffReal();
@@ -783,182 +783,182 @@ pop( StgClosure **c, StgClosure **cp, retainer *r )
#endif
do {
- if (isOnBoundary()) { // if the current stack chunk is depleted
- *c = NULL;
- return;
- }
-
- se = stackTop;
-
- switch (get_itbl(se->c)->type) {
- // two children (fixed), no SRT
- // nothing in se.info
- case CONSTR_2_0:
- *c = se->c->payload[1];
- *cp = se->c;
- *r = se->c_child_r;
- popOff();
- return;
-
- // three children (fixed), no SRT
- // need to push a stackElement
+ if (isOnBoundary()) { // if the current stack chunk is depleted
+ *c = NULL;
+ return;
+ }
+
+ se = stackTop;
+
+ switch (get_itbl(se->c)->type) {
+ // two children (fixed), no SRT
+ // nothing in se.info
+ case CONSTR_2_0:
+ *c = se->c->payload[1];
+ *cp = se->c;
+ *r = se->c_child_r;
+ popOff();
+ return;
+
+ // three children (fixed), no SRT
+ // need to push a stackElement
case MVAR_CLEAN:
case MVAR_DIRTY:
- if (se->info.next.step == 2) {
- *c = (StgClosure *)((StgMVar *)se->c)->tail;
- se->info.next.step++; // move to the next step
- // no popOff
- } else {
- *c = ((StgMVar *)se->c)->value;
- popOff();
- }
- *cp = se->c;
- *r = se->c_child_r;
- return;
-
- // three children (fixed), no SRT
- case WEAK:
- if (se->info.next.step == 2) {
- *c = ((StgWeak *)se->c)->value;
- se->info.next.step++;
- // no popOff
- } else {
- *c = ((StgWeak *)se->c)->finalizer;
- popOff();
- }
- *cp = se->c;
- *r = se->c_child_r;
- return;
-
- case TREC_CHUNK: {
- // These are pretty complicated: we have N entries, each
- // of which contains 3 fields that we want to follow. So
- // we divide the step counter: the 2 low bits indicate
- // which field, and the rest of the bits indicate the
- // entry number (starting from zero).
- TRecEntry *entry;
- nat entry_no = se->info.next.step >> 2;
- nat field_no = se->info.next.step & 3;
- if (entry_no == ((StgTRecChunk *)se->c)->next_entry_idx) {
- *c = NULL;
- popOff();
- return;
- }
- entry = &((StgTRecChunk *)se->c)->entries[entry_no];
- if (field_no == 0) {
- *c = (StgClosure *)entry->tvar;
- } else if (field_no == 1) {
- *c = entry->expected_value;
- } else {
- *c = entry->new_value;
- }
- *cp = se->c;
- *r = se->c_child_r;
- se->info.next.step++;
- return;
- }
+ if (se->info.next.step == 2) {
+ *c = (StgClosure *)((StgMVar *)se->c)->tail;
+ se->info.next.step++; // move to the next step
+ // no popOff
+ } else {
+ *c = ((StgMVar *)se->c)->value;
+ popOff();
+ }
+ *cp = se->c;
+ *r = se->c_child_r;
+ return;
+
+ // three children (fixed), no SRT
+ case WEAK:
+ if (se->info.next.step == 2) {
+ *c = ((StgWeak *)se->c)->value;
+ se->info.next.step++;
+ // no popOff
+ } else {
+ *c = ((StgWeak *)se->c)->finalizer;
+ popOff();
+ }
+ *cp = se->c;
+ *r = se->c_child_r;
+ return;
+
+ case TREC_CHUNK: {
+ // These are pretty complicated: we have N entries, each
+ // of which contains 3 fields that we want to follow. So
+ // we divide the step counter: the 2 low bits indicate
+ // which field, and the rest of the bits indicate the
+ // entry number (starting from zero).
+ TRecEntry *entry;
+ nat entry_no = se->info.next.step >> 2;
+ nat field_no = se->info.next.step & 3;
+ if (entry_no == ((StgTRecChunk *)se->c)->next_entry_idx) {
+ *c = NULL;
+ popOff();
+ return;
+ }
+ entry = &((StgTRecChunk *)se->c)->entries[entry_no];
+ if (field_no == 0) {
+ *c = (StgClosure *)entry->tvar;
+ } else if (field_no == 1) {
+ *c = entry->expected_value;
+ } else {
+ *c = entry->new_value;
+ }
+ *cp = se->c;
+ *r = se->c_child_r;
+ se->info.next.step++;
+ return;
+ }
case TVAR:
case CONSTR:
- case PRIM:
- case MUT_PRIM:
- case BCO:
- case CONSTR_STATIC:
- // StgMutArrPtr.ptrs, no SRT
- case MUT_ARR_PTRS_CLEAN:
- case MUT_ARR_PTRS_DIRTY:
- case MUT_ARR_PTRS_FROZEN:
- case MUT_ARR_PTRS_FROZEN0:
- *c = find_ptrs(&se->info);
- if (*c == NULL) {
- popOff();
- break;
- }
- *cp = se->c;
- *r = se->c_child_r;
- return;
-
- // layout.payload.ptrs, SRT
- case FUN: // always a heap object
- case FUN_2_0:
- if (se->info.type == posTypePtrs) {
- *c = find_ptrs(&se->info);
- if (*c != NULL) {
- *cp = se->c;
- *r = se->c_child_r;
- return;
- }
- init_srt_fun(&se->info, get_fun_itbl(se->c));
- }
- goto do_srt;
-
- case THUNK:
- case THUNK_2_0:
- if (se->info.type == posTypePtrs) {
- *c = find_ptrs(&se->info);
- if (*c != NULL) {
- *cp = se->c;
- *r = se->c_child_r;
- return;
- }
- init_srt_thunk(&se->info, get_thunk_itbl(se->c));
- }
- goto do_srt;
-
- // SRT
- do_srt:
- case THUNK_STATIC:
- case FUN_STATIC:
- case FUN_0_1:
- case FUN_0_2:
- case THUNK_0_1:
- case THUNK_0_2:
- case FUN_1_0:
- case FUN_1_1:
- case THUNK_1_0:
- case THUNK_1_1:
- *c = find_srt(&se->info);
- if (*c != NULL) {
- *cp = se->c;
- *r = se->c_child_r;
- return;
- }
- popOff();
- break;
-
- // no child (fixed), no SRT
- case CONSTR_0_1:
- case CONSTR_0_2:
- case ARR_WORDS:
- // one child (fixed), no SRT
- case MUT_VAR_CLEAN:
- case MUT_VAR_DIRTY:
- case THUNK_SELECTOR:
- case IND_PERM:
- case CONSTR_1_1:
- // cannot appear
- case PAP:
- case AP:
- case AP_STACK:
- case TSO:
+ case PRIM:
+ case MUT_PRIM:
+ case BCO:
+ case CONSTR_STATIC:
+ // StgMutArrPtr.ptrs, no SRT
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
+ case MUT_ARR_PTRS_FROZEN:
+ case MUT_ARR_PTRS_FROZEN0:
+ *c = find_ptrs(&se->info);
+ if (*c == NULL) {
+ popOff();
+ break;
+ }
+ *cp = se->c;
+ *r = se->c_child_r;
+ return;
+
+ // layout.payload.ptrs, SRT
+ case FUN: // always a heap object
+ case FUN_2_0:
+ if (se->info.type == posTypePtrs) {
+ *c = find_ptrs(&se->info);
+ if (*c != NULL) {
+ *cp = se->c;
+ *r = se->c_child_r;
+ return;
+ }
+ init_srt_fun(&se->info, get_fun_itbl(se->c));
+ }
+ goto do_srt;
+
+ case THUNK:
+ case THUNK_2_0:
+ if (se->info.type == posTypePtrs) {
+ *c = find_ptrs(&se->info);
+ if (*c != NULL) {
+ *cp = se->c;
+ *r = se->c_child_r;
+ return;
+ }
+ init_srt_thunk(&se->info, get_thunk_itbl(se->c));
+ }
+ goto do_srt;
+
+ // SRT
+ do_srt:
+ case THUNK_STATIC:
+ case FUN_STATIC:
+ case FUN_0_1:
+ case FUN_0_2:
+ case THUNK_0_1:
+ case THUNK_0_2:
+ case FUN_1_0:
+ case FUN_1_1:
+ case THUNK_1_0:
+ case THUNK_1_1:
+ *c = find_srt(&se->info);
+ if (*c != NULL) {
+ *cp = se->c;
+ *r = se->c_child_r;
+ return;
+ }
+ popOff();
+ break;
+
+ // no child (fixed), no SRT
+ case CONSTR_0_1:
+ case CONSTR_0_2:
+ case ARR_WORDS:
+ // one child (fixed), no SRT
+ case MUT_VAR_CLEAN:
+ case MUT_VAR_DIRTY:
+ case THUNK_SELECTOR:
+ case IND_PERM:
+ case CONSTR_1_1:
+ // cannot appear
+ case PAP:
+ case AP:
+ case AP_STACK:
+ case TSO:
case STACK:
case IND_STATIC:
- case CONSTR_NOCAF_STATIC:
- // stack objects
+ case CONSTR_NOCAF_STATIC:
+ // stack objects
case UPDATE_FRAME:
- case CATCH_FRAME:
+ case CATCH_FRAME:
case UNDERFLOW_FRAME:
case STOP_FRAME:
- case RET_BCO:
- case RET_SMALL:
- case RET_BIG:
- // invalid objects
- case IND:
- case INVALID_OBJECT:
- default:
- barf("Invalid object *c in pop()");
- return;
- }
+ case RET_BCO:
+ case RET_SMALL:
+ case RET_BIG:
+ // invalid objects
+ case IND:
+ case INVALID_OBJECT:
+ default:
+ barf("Invalid object *c in pop()");
+ return;
+ }
} while (rtsTrue);
}
@@ -1002,7 +1002,7 @@ static INLINE void
maybeInitRetainerSet( StgClosure *c )
{
if (!isRetainerSetFieldValid(c)) {
- setRetainerSetToNull(c);
+ setRetainerSetToNull(c);
}
}
@@ -1013,14 +1013,14 @@ static INLINE rtsBool
isRetainer( StgClosure *c )
{
switch (get_itbl(c)->type) {
- //
- // True case
- //
- // TSOs MUST be retainers: they constitute the set of roots.
+ //
+ // True case
+ //
+ // TSOs MUST be retainers: they constitute the set of roots.
case TSO:
case STACK:
- // mutable objects
+ // mutable objects
case MUT_PRIM:
case MVAR_CLEAN:
case MVAR_DIRTY:
@@ -1030,7 +1030,7 @@ isRetainer( StgClosure *c )
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
- // thunks are retainers.
+ // thunks are retainers.
case THUNK:
case THUNK_1_0:
case THUNK_0_1:
@@ -1041,63 +1041,63 @@ isRetainer( StgClosure *c )
case AP:
case AP_STACK:
- // Static thunks, or CAFS, are obviously retainers.
+ // Static thunks, or CAFS, are obviously retainers.
case THUNK_STATIC:
- // WEAK objects are roots; there is separate code in which traversing
- // begins from WEAK objects.
+ // WEAK objects are roots; there is separate code in which traversing
+ // begins from WEAK objects.
case WEAK:
- return rtsTrue;
+ return rtsTrue;
- //
- // False case
- //
+ //
+ // False case
+ //
- // constructors
+ // constructors
case CONSTR:
case CONSTR_1_0:
case CONSTR_0_1:
case CONSTR_2_0:
case CONSTR_1_1:
case CONSTR_0_2:
- // functions
+ // functions
case FUN:
case FUN_1_0:
case FUN_0_1:
case FUN_2_0:
case FUN_1_1:
case FUN_0_2:
- // partial applications
+ // partial applications
case PAP:
- // indirection
+ // indirection
case IND_PERM:
// IND_STATIC used to be an error, but at the moment it can happen
// as isAlive doesn't look through IND_STATIC as it ignores static
// closures. See trac #3956 for a program that hit this error.
case IND_STATIC:
case BLACKHOLE:
- // static objects
+ // static objects
case CONSTR_STATIC:
case FUN_STATIC:
- // misc
+ // misc
case PRIM:
case BCO:
case ARR_WORDS:
- // STM
+ // STM
case TREC_CHUNK:
// immutable arrays
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- return rtsFalse;
+ return rtsFalse;
- //
- // Error case
- //
- // CONSTR_NOCAF_STATIC
- // cannot be *c, *cp, *r in the retainer profiling loop.
+ //
+ // Error case
+ //
+ // CONSTR_NOCAF_STATIC
+ // cannot be *c, *cp, *r in the retainer profiling loop.
case CONSTR_NOCAF_STATIC:
- // Stack objects are invalid because they are never treated as
- // legal objects during retainer profiling.
+ // Stack objects are invalid because they are never treated as
+ // legal objects during retainer profiling.
case UPDATE_FRAME:
case CATCH_FRAME:
case UNDERFLOW_FRAME:
@@ -1105,12 +1105,12 @@ isRetainer( StgClosure *c )
case RET_BCO:
case RET_SMALL:
case RET_BIG:
- // other cases
+ // other cases
case IND:
case INVALID_OBJECT:
default:
- barf("Invalid object in isRetainer(): %d", get_itbl(c)->type);
- return rtsFalse;
+ barf("Invalid object in isRetainer(): %d", get_itbl(c)->type);
+ return rtsFalse;
}
}
@@ -1166,39 +1166,39 @@ associate( StgClosure *c, RetainerSet *s )
static void
retain_large_bitmap (StgPtr p, StgLargeBitmap *large_bitmap, nat size,
- StgClosure *c, retainer c_child_r)
+ StgClosure *c, retainer c_child_r)
{
nat i, b;
StgWord bitmap;
-
+
b = 0;
bitmap = large_bitmap->bitmap[b];
for (i = 0; i < size; ) {
- if ((bitmap & 1) == 0) {
- retainClosure((StgClosure *)*p, c, c_child_r);
- }
- i++;
- p++;
- if (i % BITS_IN(W_) == 0) {
- b++;
- bitmap = large_bitmap->bitmap[b];
- } else {
- bitmap = bitmap >> 1;
- }
+ if ((bitmap & 1) == 0) {
+ retainClosure((StgClosure *)*p, c, c_child_r);
+ }
+ i++;
+ p++;
+ if (i % BITS_IN(W_) == 0) {
+ b++;
+ bitmap = large_bitmap->bitmap[b];
+ } else {
+ bitmap = bitmap >> 1;
+ }
}
}
static INLINE StgPtr
retain_small_bitmap (StgPtr p, nat size, StgWord bitmap,
- StgClosure *c, retainer c_child_r)
+ StgClosure *c, retainer c_child_r)
{
while (size > 0) {
- if ((bitmap & 1) == 0) {
- retainClosure((StgClosure *)*p, c, c_child_r);
- }
- p++;
- bitmap = bitmap >> 1;
- size--;
+ if ((bitmap & 1) == 0) {
+ retainClosure((StgClosure *)*p, c, c_child_r);
+ }
+ p++;
+ bitmap = bitmap >> 1;
+ size--;
}
return p;
}
@@ -1213,23 +1213,23 @@ retain_large_srt_bitmap (StgLargeSRT *srt, StgClosure *c, retainer c_child_r)
nat i, b, size;
StgWord bitmap;
StgClosure **p;
-
+
b = 0;
p = (StgClosure **)srt->srt;
size = srt->l.size;
bitmap = srt->l.bitmap[b];
for (i = 0; i < size; ) {
- if ((bitmap & 1) != 0) {
- retainClosure((StgClosure *)*p, c, c_child_r);
- }
- i++;
- p++;
- if (i % BITS_IN(W_) == 0) {
- b++;
- bitmap = srt->l.bitmap[b];
- } else {
- bitmap = bitmap >> 1;
- }
+ if ((bitmap & 1) != 0) {
+ retainClosure((StgClosure *)*p, c, c_child_r);
+ }
+ i++;
+ p++;
+ if (i % BITS_IN(W_) == 0) {
+ b++;
+ bitmap = srt->l.bitmap[b];
+ } else {
+ bitmap = bitmap >> 1;
+ }
}
}
@@ -1242,7 +1242,7 @@ retainSRT (StgClosure **srt, nat srt_bitmap, StgClosure *c, retainer c_child_r)
bitmap = srt_bitmap;
p = srt;
- if (bitmap == (StgHalfWord)(-1)) {
+ if (bitmap == (StgHalfWord)(-1)) {
retain_large_srt_bitmap( (StgLargeSRT *)srt, c, c_child_r );
return;
}
@@ -1250,14 +1250,14 @@ retainSRT (StgClosure **srt, nat srt_bitmap, StgClosure *c, retainer c_child_r)
while (bitmap != 0) {
if ((bitmap & 1) != 0) {
#if defined(COMPILING_WINDOWS_DLL)
- if ( (unsigned long)(*srt) & 0x1 ) {
- retainClosure(* (StgClosure**) ((unsigned long) (*srt) & ~0x1),
- c, c_child_r);
- } else {
- retainClosure(*srt,c,c_child_r);
- }
+ if ( (unsigned long)(*srt) & 0x1 ) {
+ retainClosure(* (StgClosure**) ((unsigned long) (*srt) & ~0x1),
+ c, c_child_r);
+ } else {
+ retainClosure(*srt,c,c_child_r);
+ }
#else
- retainClosure(*srt,c,c_child_r);
+ retainClosure(*srt,c,c_child_r);
#endif
}
p++;
@@ -1277,7 +1277,7 @@ retainSRT (StgClosure **srt, nat srt_bitmap, StgClosure *c, retainer c_child_r)
* RSET(c) and RSET(c_child_r) are valid, i.e., their
* interpretation conforms to the current value of flip (even when they
* are interpreted to be NULL).
- * If *c is TSO, its state is not ThreadComplete,or ThreadKilled,
+ * If *c is TSO, its state is not ThreadComplete,or ThreadKilled,
* which means that its stack is ready to process.
* Note:
* This code was almost plagiarzied from GC.c! For each pointer,
@@ -1285,7 +1285,7 @@ retainSRT (StgClosure **srt, nat srt_bitmap, StgClosure *c, retainer c_child_r)
* -------------------------------------------------------------------------- */
static void
retainStack( StgClosure *c, retainer c_child_r,
- StgPtr stackStart, StgPtr stackEnd )
+ StgPtr stackStart, StgPtr stackEnd )
{
stackElement *oldStackBoundary;
StgPtr p;
@@ -1315,87 +1315,87 @@ retainStack( StgClosure *c, retainer c_child_r,
p = stackStart;
while (p < stackEnd) {
- info = get_ret_itbl((StgClosure *)p);
+ info = get_ret_itbl((StgClosure *)p);
- switch(info->i.type) {
+ switch(info->i.type) {
- case UPDATE_FRAME:
- retainClosure(((StgUpdateFrame *)p)->updatee, c, c_child_r);
- p += sizeofW(StgUpdateFrame);
- continue;
+ case UPDATE_FRAME:
+ retainClosure(((StgUpdateFrame *)p)->updatee, c, c_child_r);
+ p += sizeofW(StgUpdateFrame);
+ continue;
case UNDERFLOW_FRAME:
case STOP_FRAME:
- case CATCH_FRAME:
- case CATCH_STM_FRAME:
- case CATCH_RETRY_FRAME:
- case ATOMICALLY_FRAME:
- case RET_SMALL:
- bitmap = BITMAP_BITS(info->i.layout.bitmap);
- size = BITMAP_SIZE(info->i.layout.bitmap);
- p++;
- p = retain_small_bitmap(p, size, bitmap, c, c_child_r);
-
- follow_srt:
- retainSRT((StgClosure **)GET_SRT(info), info->i.srt_bitmap, c, c_child_r);
- continue;
-
- case RET_BCO: {
- StgBCO *bco;
-
- p++;
- retainClosure((StgClosure *)*p, c, c_child_r);
- bco = (StgBCO *)*p;
- p++;
- size = BCO_BITMAP_SIZE(bco);
- retain_large_bitmap(p, BCO_BITMAP(bco), size, c, c_child_r);
- p += size;
- continue;
- }
-
- // large bitmap (> 32 entries, or > 64 on a 64-bit machine)
- case RET_BIG:
- size = GET_LARGE_BITMAP(&info->i)->size;
- p++;
- retain_large_bitmap(p, GET_LARGE_BITMAP(&info->i),
- size, c, c_child_r);
- p += size;
- // and don't forget to follow the SRT
- goto follow_srt;
+ case CATCH_FRAME:
+ case CATCH_STM_FRAME:
+ case CATCH_RETRY_FRAME:
+ case ATOMICALLY_FRAME:
+ case RET_SMALL:
+ bitmap = BITMAP_BITS(info->i.layout.bitmap);
+ size = BITMAP_SIZE(info->i.layout.bitmap);
+ p++;
+ p = retain_small_bitmap(p, size, bitmap, c, c_child_r);
+
+ follow_srt:
+ retainSRT((StgClosure **)GET_SRT(info), info->i.srt_bitmap, c, c_child_r);
+ continue;
+
+ case RET_BCO: {
+ StgBCO *bco;
+
+ p++;
+ retainClosure((StgClosure *)*p, c, c_child_r);
+ bco = (StgBCO *)*p;
+ p++;
+ size = BCO_BITMAP_SIZE(bco);
+ retain_large_bitmap(p, BCO_BITMAP(bco), size, c, c_child_r);
+ p += size;
+ continue;
+ }
+
+ // large bitmap (> 32 entries, or > 64 on a 64-bit machine)
+ case RET_BIG:
+ size = GET_LARGE_BITMAP(&info->i)->size;
+ p++;
+ retain_large_bitmap(p, GET_LARGE_BITMAP(&info->i),
+ size, c, c_child_r);
+ p += size;
+ // and don't forget to follow the SRT
+ goto follow_srt;
case RET_FUN: {
- StgRetFun *ret_fun = (StgRetFun *)p;
- StgFunInfoTable *fun_info;
-
- retainClosure(ret_fun->fun, c, c_child_r);
- fun_info = get_fun_itbl(UNTAG_CLOSURE(ret_fun->fun));
-
- p = (P_)&ret_fun->payload;
- switch (fun_info->f.fun_type) {
- case ARG_GEN:
- bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
- size = BITMAP_SIZE(fun_info->f.b.bitmap);
- p = retain_small_bitmap(p, size, bitmap, c, c_child_r);
- break;
- case ARG_GEN_BIG:
- size = GET_FUN_LARGE_BITMAP(fun_info)->size;
- retain_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info),
- size, c, c_child_r);
- p += size;
- break;
- default:
- bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
- size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]);
- p = retain_small_bitmap(p, size, bitmap, c, c_child_r);
- break;
- }
- goto follow_srt;
- }
-
- default:
- barf("Invalid object found in retainStack(): %d",
- (int)(info->i.type));
- }
+ StgRetFun *ret_fun = (StgRetFun *)p;
+ StgFunInfoTable *fun_info;
+
+ retainClosure(ret_fun->fun, c, c_child_r);
+ fun_info = get_fun_itbl(UNTAG_CLOSURE(ret_fun->fun));
+
+ p = (P_)&ret_fun->payload;
+ switch (fun_info->f.fun_type) {
+ case ARG_GEN:
+ bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
+ size = BITMAP_SIZE(fun_info->f.b.bitmap);
+ p = retain_small_bitmap(p, size, bitmap, c, c_child_r);
+ break;
+ case ARG_GEN_BIG:
+ size = GET_FUN_LARGE_BITMAP(fun_info)->size;
+ retain_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info),
+ size, c, c_child_r);
+ p += size;
+ break;
+ default:
+ bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
+ size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]);
+ p = retain_small_bitmap(p, size, bitmap, c, c_child_r);
+ break;
+ }
+ goto follow_srt;
+ }
+
+ default:
+ barf("Invalid object found in retainStack(): %d",
+ (int)(info->i.type));
+ }
}
// restore currentStackBoundary
@@ -1415,9 +1415,9 @@ retainStack( StgClosure *c, retainer c_child_r,
static INLINE StgPtr
retain_PAP_payload (StgClosure *pap, /* NOT tagged */
- retainer c_child_r, /* NOT tagged */
+ retainer c_child_r, /* NOT tagged */
StgClosure *fun, /* tagged */
- StgClosure** payload, StgWord n_args)
+ StgClosure** payload, StgWord n_args)
{
StgPtr p;
StgWord bitmap;
@@ -1432,24 +1432,24 @@ retain_PAP_payload (StgClosure *pap, /* NOT tagged */
switch (fun_info->f.fun_type) {
case ARG_GEN:
- bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
- p = retain_small_bitmap(p, n_args, bitmap,
- pap, c_child_r);
- break;
+ bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
+ p = retain_small_bitmap(p, n_args, bitmap,
+ pap, c_child_r);
+ break;
case ARG_GEN_BIG:
- retain_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info),
- n_args, pap, c_child_r);
- p += n_args;
- break;
+ retain_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info),
+ n_args, pap, c_child_r);
+ p += n_args;
+ break;
case ARG_BCO:
- retain_large_bitmap((StgPtr)payload, BCO_BITMAP(fun),
- n_args, pap, c_child_r);
- p += n_args;
- break;
+ retain_large_bitmap((StgPtr)payload, BCO_BITMAP(fun),
+ n_args, pap, c_child_r);
+ p += n_args;
+ break;
default:
- bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
- p = retain_small_bitmap(p, n_args, bitmap, pap, c_child_r);
- break;
+ bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
+ p = retain_small_bitmap(p, n_args, bitmap, pap, c_child_r);
+ break;
}
return p;
}
@@ -1505,9 +1505,9 @@ loop:
if (c == NULL) {
#ifdef DEBUG_RETAINER
- // debugBelch("retainClosure() ends: oldStackTop = 0x%x, stackTop = 0x%x\n", oldStackTop, stackTop);
+ // debugBelch("retainClosure() ends: oldStackTop = 0x%x, stackTop = 0x%x\n", oldStackTop, stackTop);
#endif
- return;
+ return;
}
//debugBelch("inner_loop");
@@ -1536,70 +1536,70 @@ inner_loop:
case CONSTR_STATIC:
case THUNK_STATIC:
case FUN_STATIC:
- break;
+ break;
default:
- if (retainerSetOf(c) == NULL) { // first visit?
- costArray[typeOfc] += cost(c);
- sumOfNewCost += cost(c);
- }
- break;
+ if (retainerSetOf(c) == NULL) { // first visit?
+ costArray[typeOfc] += cost(c);
+ sumOfNewCost += cost(c);
+ }
+ break;
}
#endif
// special cases
switch (typeOfc) {
case TSO:
- if (((StgTSO *)c)->what_next == ThreadComplete ||
- ((StgTSO *)c)->what_next == ThreadKilled) {
+ if (((StgTSO *)c)->what_next == ThreadComplete ||
+ ((StgTSO *)c)->what_next == ThreadKilled) {
#ifdef DEBUG_RETAINER
- debugBelch("ThreadComplete or ThreadKilled encountered in retainClosure()\n");
+ debugBelch("ThreadComplete or ThreadKilled encountered in retainClosure()\n");
#endif
- goto loop;
- }
+ goto loop;
+ }
break;
case IND_STATIC:
- // We just skip IND_STATIC, so its retainer set is never computed.
- c = ((StgIndStatic *)c)->indirectee;
- goto inner_loop;
- // static objects with no pointers out, so goto loop.
+ // We just skip IND_STATIC, so its retainer set is never computed.
+ c = ((StgIndStatic *)c)->indirectee;
+ goto inner_loop;
+ // static objects with no pointers out, so goto loop.
case CONSTR_NOCAF_STATIC:
- // It is not just enough not to compute the retainer set for *c; it is
- // mandatory because CONSTR_NOCAF_STATIC are not reachable from
- // scavenged_static_objects, the list from which is assumed to traverse
- // all static objects after major garbage collections.
- goto loop;
+ // It is not just enough not to compute the retainer set for *c; it is
+ // mandatory because CONSTR_NOCAF_STATIC are not reachable from
+ // scavenged_static_objects, the list from which is assumed to traverse
+ // all static objects after major garbage collections.
+ goto loop;
case THUNK_STATIC:
case FUN_STATIC:
- if (get_itbl(c)->srt_bitmap == 0) {
- // No need to compute the retainer set; no dynamic objects
- // are reachable from *c.
- //
- // Static objects: if we traverse all the live closures,
- // including static closures, during each heap census then
- // we will observe that some static closures appear and
- // disappear. eg. a closure may contain a pointer to a
- // static function 'f' which is not otherwise reachable
- // (it doesn't indirectly point to any CAFs, so it doesn't
- // appear in any SRTs), so we would find 'f' during
- // traversal. However on the next sweep there may be no
- // closures pointing to 'f'.
- //
- // We must therefore ignore static closures whose SRT is
- // empty, because these are exactly the closures that may
- // "appear". A closure with a non-empty SRT, and which is
- // still required, will always be reachable.
- //
- // But what about CONSTR_STATIC? Surely these may be able
- // to appear, and they don't have SRTs, so we can't
- // check. So for now, we're calling
- // resetStaticObjectForRetainerProfiling() from the
- // garbage collector to reset the retainer sets in all the
- // reachable static objects.
- goto loop;
- }
+ if (get_itbl(c)->srt_bitmap == 0) {
+ // No need to compute the retainer set; no dynamic objects
+ // are reachable from *c.
+ //
+ // Static objects: if we traverse all the live closures,
+ // including static closures, during each heap census then
+ // we will observe that some static closures appear and
+ // disappear. eg. a closure may contain a pointer to a
+ // static function 'f' which is not otherwise reachable
+ // (it doesn't indirectly point to any CAFs, so it doesn't
+ // appear in any SRTs), so we would find 'f' during
+ // traversal. However on the next sweep there may be no
+ // closures pointing to 'f'.
+ //
+ // We must therefore ignore static closures whose SRT is
+ // empty, because these are exactly the closures that may
+ // "appear". A closure with a non-empty SRT, and which is
+ // still required, will always be reachable.
+ //
+ // But what about CONSTR_STATIC? Surely these may be able
+ // to appear, and they don't have SRTs, so we can't
+ // check. So for now, we're calling
+ // resetStaticObjectForRetainerProfiling() from the
+ // garbage collector to reset the retainer sets in all the
+ // reachable static objects.
+ goto loop;
+ }
default:
- break;
+ break;
}
// The above objects are ignored in computing the average number of times
@@ -1614,51 +1614,51 @@ inner_loop:
// isRetainer(cp) == rtsTrue => s == NULL
// isRetainer(cp) == rtsFalse => s == cp.retainer
if (isRetainer(cp))
- s = NULL;
+ s = NULL;
else
- s = retainerSetOf(cp);
+ s = retainerSetOf(cp);
// (c, cp, r, s) is available.
// (c, cp, r, s, R_r) is available, so compute the retainer set for *c.
if (retainerSetOfc == NULL) {
- // This is the first visit to *c.
- numObjectVisited++;
+ // This is the first visit to *c.
+ numObjectVisited++;
- if (s == NULL)
- associate(c, singleton(r));
- else
- // s is actually the retainer set of *c!
- associate(c, s);
+ if (s == NULL)
+ associate(c, singleton(r));
+ else
+ // s is actually the retainer set of *c!
+ associate(c, s);
- // compute c_child_r
- c_child_r = isRetainer(c) ? getRetainerFrom(c) : r;
+ // compute c_child_r
+ c_child_r = isRetainer(c) ? getRetainerFrom(c) : r;
} else {
- // This is not the first visit to *c.
- if (isMember(r, retainerSetOfc))
- goto loop; // no need to process child
-
- if (s == NULL)
- associate(c, addElement(r, retainerSetOfc));
- else {
- // s is not NULL and cp is not a retainer. This means that
- // each time *cp is visited, so is *c. Thus, if s has
- // exactly one more element in its retainer set than c, s
- // is also the new retainer set for *c.
- if (s->num == retainerSetOfc->num + 1) {
- associate(c, s);
- }
- // Otherwise, just add R_r to the current retainer set of *c.
- else {
- associate(c, addElement(r, retainerSetOfc));
- }
- }
-
- if (isRetainer(c))
- goto loop; // no need to process child
-
- // compute c_child_r
- c_child_r = r;
+ // This is not the first visit to *c.
+ if (isMember(r, retainerSetOfc))
+ goto loop; // no need to process child
+
+ if (s == NULL)
+ associate(c, addElement(r, retainerSetOfc));
+ else {
+ // s is not NULL and cp is not a retainer. This means that
+ // each time *cp is visited, so is *c. Thus, if s has
+ // exactly one more element in its retainer set than c, s
+ // is also the new retainer set for *c.
+ if (s->num == retainerSetOfc->num + 1) {
+ associate(c, s);
+ }
+ // Otherwise, just add R_r to the current retainer set of *c.
+ else {
+ associate(c, addElement(r, retainerSetOfc));
+ }
+ }
+
+ if (isRetainer(c))
+ goto loop; // no need to process child
+
+ // compute c_child_r
+ c_child_r = r;
}
// now, RSET() of all of *c, *cp, and *r is valid.
@@ -1671,10 +1671,10 @@ inner_loop:
// would be hard.
switch (typeOfc) {
case STACK:
- retainStack(c, c_child_r,
+ retainStack(c, c_child_r,
((StgStack *)c)->sp,
((StgStack *)c)->stack + ((StgStack *)c)->stack_size);
- goto loop;
+ goto loop;
case TSO:
{
@@ -1696,25 +1696,25 @@ inner_loop:
case PAP:
{
- StgPAP *pap = (StgPAP *)c;
- retain_PAP_payload(c, c_child_r, pap->fun, pap->payload, pap->n_args);
- goto loop;
+ StgPAP *pap = (StgPAP *)c;
+ retain_PAP_payload(c, c_child_r, pap->fun, pap->payload, pap->n_args);
+ goto loop;
}
case AP:
{
- StgAP *ap = (StgAP *)c;
- retain_PAP_payload(c, c_child_r, ap->fun, ap->payload, ap->n_args);
- goto loop;
+ StgAP *ap = (StgAP *)c;
+ retain_PAP_payload(c, c_child_r, ap->fun, ap->payload, ap->n_args);
+ goto loop;
}
case AP_STACK:
- retainClosure(((StgAP_STACK *)c)->fun, c, c_child_r);
- retainStack(c, c_child_r,
- (StgPtr)((StgAP_STACK *)c)->payload,
- (StgPtr)((StgAP_STACK *)c)->payload +
- ((StgAP_STACK *)c)->size);
- goto loop;
+ retainClosure(((StgAP_STACK *)c)->fun, c, c_child_r);
+ retainStack(c, c_child_r,
+ (StgPtr)((StgAP_STACK *)c)->payload,
+ (StgPtr)((StgAP_STACK *)c)->payload +
+ ((StgAP_STACK *)c)->size);
+ goto loop;
}
push(c, c_child_r, &first_child);
@@ -1723,7 +1723,7 @@ inner_loop:
// If first_child is not null, the top stack element points to the next
// object. push() may or may not push a stackElement on the stack.
if (first_child == NULL)
- goto loop;
+ goto loop;
// (c, cp, r) = (first_child, c, c_child_r)
r = c_child_r;
@@ -1749,9 +1749,9 @@ retainRoot(void *user STG_UNUSED, StgClosure **tl)
c = UNTAG_CLOSURE(*tl);
maybeInitRetainerSet(c);
if (c != &stg_END_TSO_QUEUE_closure && isRetainer(c)) {
- retainClosure(c, c, getRetainerFrom(c));
+ retainClosure(c, c, getRetainerFrom(c));
} else {
- retainClosure(c, c, CCS_SYSTEM);
+ retainClosure(c, c, CCS_SYSTEM);
}
// NOT TRUE: ASSERT(isMember(getRetainerFrom(*tl), retainerSetOf(*tl)));
@@ -1774,7 +1774,7 @@ computeRetainerSet( void )
RetainerSet tmpRetainerSet;
#endif
- markCapabilities(retainRoot, NULL); // for scheduler roots
+ markCapabilities(retainRoot, NULL); // for scheduler roots
// This function is called after a major GC, when key, value, and finalizer
// all are guaranteed to be valid, or reachable.
@@ -1801,44 +1801,44 @@ computeRetainerSet( void )
// object (computing sumOfNewCostExtra and updating costArray[] when
// debugging retainer profiler).
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- // NOT TRUE: even G0 has a block on its mutable list
+ // NOT TRUE: even G0 has a block on its mutable list
// ASSERT(g != 0 || (generations[g].mut_list == NULL));
- // Traversing through mut_list is necessary
- // because we can find MUT_VAR objects which have not been
- // visited during retainer profiling.
+ // Traversing through mut_list is necessary
+ // because we can find MUT_VAR objects which have not been
+ // visited during retainer profiling.
for (n = 0; n < n_capabilities; n++) {
for (bd = capabilities[n]->mut_lists[g]; bd != NULL; bd = bd->link) {
- for (ml = bd->start; ml < bd->free; ml++) {
+ for (ml = bd->start; ml < bd->free; ml++) {
- maybeInitRetainerSet((StgClosure *)*ml);
- rtl = retainerSetOf((StgClosure *)*ml);
+ maybeInitRetainerSet((StgClosure *)*ml);
+ rtl = retainerSetOf((StgClosure *)*ml);
#ifdef DEBUG_RETAINER
- if (rtl == NULL) {
- // first visit to *ml
- // This is a violation of the interface rule!
- RSET(ml) = (RetainerSet *)((StgWord)(&tmpRetainerSet) | flip);
-
- switch (get_itbl((StgClosure *)ml)->type) {
- case IND_STATIC:
- // no cost involved
- break;
- case CONSTR_NOCAF_STATIC:
- case CONSTR_STATIC:
- case THUNK_STATIC:
- case FUN_STATIC:
- barf("Invalid object in computeRetainerSet(): %d", get_itbl((StgClosure*)ml)->type);
- break;
- default:
- // dynamic objects
- costArray[get_itbl((StgClosure *)ml)->type] += cost((StgClosure *)ml);
- sumOfNewCostExtra += cost((StgClosure *)ml);
- break;
- }
- }
+ if (rtl == NULL) {
+ // first visit to *ml
+ // This is a violation of the interface rule!
+ RSET(ml) = (RetainerSet *)((StgWord)(&tmpRetainerSet) | flip);
+
+ switch (get_itbl((StgClosure *)ml)->type) {
+ case IND_STATIC:
+ // no cost involved
+ break;
+ case CONSTR_NOCAF_STATIC:
+ case CONSTR_STATIC:
+ case THUNK_STATIC:
+ case FUN_STATIC:
+ barf("Invalid object in computeRetainerSet(): %d", get_itbl((StgClosure*)ml)->type);
+ break;
+ default:
+ // dynamic objects
+ costArray[get_itbl((StgClosure *)ml)->type] += cost((StgClosure *)ml);
+ sumOfNewCostExtra += cost((StgClosure *)ml);
+ break;
+ }
+ }
#endif
- }
+ }
}
}
}
@@ -1883,32 +1883,32 @@ resetStaticObjectForRetainerProfiling( StgClosure *static_objects )
p = static_objects;
while (p != END_OF_STATIC_LIST) {
#ifdef DEBUG_RETAINER
- count++;
+ count++;
#endif
- switch (get_itbl(p)->type) {
- case IND_STATIC:
- // Since we do not compute the retainer set of any
- // IND_STATIC object, we don't have to reset its retainer
- // field.
- p = (StgClosure*)*IND_STATIC_LINK(p);
- break;
- case THUNK_STATIC:
- maybeInitRetainerSet(p);
- p = (StgClosure*)*THUNK_STATIC_LINK(p);
- break;
- case FUN_STATIC:
- maybeInitRetainerSet(p);
- p = (StgClosure*)*FUN_STATIC_LINK(p);
- break;
- case CONSTR_STATIC:
- maybeInitRetainerSet(p);
- p = (StgClosure*)*STATIC_LINK(get_itbl(p), p);
- break;
- default:
- barf("resetStaticObjectForRetainerProfiling: %p (%s)",
- p, get_itbl(p)->type);
- break;
- }
+ switch (get_itbl(p)->type) {
+ case IND_STATIC:
+ // Since we do not compute the retainer set of any
+ // IND_STATIC object, we don't have to reset its retainer
+ // field.
+ p = (StgClosure*)*IND_STATIC_LINK(p);
+ break;
+ case THUNK_STATIC:
+ maybeInitRetainerSet(p);
+ p = (StgClosure*)*THUNK_STATIC_LINK(p);
+ break;
+ case FUN_STATIC:
+ maybeInitRetainerSet(p);
+ p = (StgClosure*)*FUN_STATIC_LINK(p);
+ break;
+ case CONSTR_STATIC:
+ maybeInitRetainerSet(p);
+ p = (StgClosure*)*STATIC_LINK(get_itbl(p), p);
+ break;
+ default:
+ barf("resetStaticObjectForRetainerProfiling: %p (%s)",
+ p, get_itbl(p)->type);
+ break;
+ }
}
#ifdef DEBUG_RETAINER
// debugBelch("count in scavenged_static_objects = %d\n", count);
@@ -2077,20 +2077,20 @@ sanityCheckHeapClosure( StgClosure *c )
ASSERT(LOOKS_LIKE_PTR(c));
if ((((StgWord)RSET(c) & 1) ^ flip) != 0) {
- if (get_itbl(c)->type == CONSTR &&
- !strcmp(GET_PROF_TYPE(get_itbl(c)), "DEAD_WEAK") &&
- !strcmp(GET_PROF_DESC(get_itbl(c)), "DEAD_WEAK")) {
- debugBelch("\tUnvisited dead weak pointer object found: c = %p\n", c);
- costArray[get_itbl(c)->type] += cost(c);
- sumOfNewCost += cost(c);
- } else
- debugBelch(
- "Unvisited object: flip = %d, c = %p(%d, %s, %s), rs = %p\n",
- flip, c, get_itbl(c)->type,
- get_itbl(c)->prof.closure_type, GET_PROF_DESC(get_itbl(c)),
- RSET(c));
+ if (get_itbl(c)->type == CONSTR &&
+ !strcmp(GET_PROF_TYPE(get_itbl(c)), "DEAD_WEAK") &&
+ !strcmp(GET_PROF_DESC(get_itbl(c)), "DEAD_WEAK")) {
+ debugBelch("\tUnvisited dead weak pointer object found: c = %p\n", c);
+ costArray[get_itbl(c)->type] += cost(c);
+ sumOfNewCost += cost(c);
+ } else
+ debugBelch(
+ "Unvisited object: flip = %d, c = %p(%d, %s, %s), rs = %p\n",
+ flip, c, get_itbl(c)->type,
+ get_itbl(c)->prof.closure_type, GET_PROF_DESC(get_itbl(c)),
+ RSET(c));
} else {
- // debugBelch("sanityCheckHeapClosure) S: flip = %d, c = %p(%d), rs = %p\n", flip, c, get_itbl(c)->type, RSET(c));
+ // debugBelch("sanityCheckHeapClosure) S: flip = %d, c = %p(%d), rs = %p\n", flip, c, get_itbl(c)->type, RSET(c));
}
return closure_sizeW(c);
@@ -2104,17 +2104,17 @@ heapCheck( bdescr *bd )
costSum = 0;
while (bd != NULL) {
- p = bd->start;
- while (p < bd->free) {
- size = sanityCheckHeapClosure((StgClosure *)p);
- sumOfCostLinear += size;
- costArrayLinear[get_itbl((StgClosure *)p)->type] += size;
- p += size;
- // no need for slop check; I think slops are not used currently.
- }
- ASSERT(p == bd->free);
- costSum += bd->free - bd->start;
- bd = bd->link;
+ p = bd->start;
+ while (p < bd->free) {
+ size = sanityCheckHeapClosure((StgClosure *)p);
+ sumOfCostLinear += size;
+ costArrayLinear[get_itbl((StgClosure *)p)->type] += size;
+ p += size;
+ // no need for slop check; I think slops are not used currently.
+ }
+ ASSERT(p == bd->free);
+ costSum += bd->free - bd->start;
+ bd = bd->link;
}
return costSum;
@@ -2132,30 +2132,30 @@ smallObjectPoolCheck(void)
// first block
if (bd == NULL)
- return costSum;
+ return costSum;
p = bd->start;
while (p < alloc_Hp) {
- size = sanityCheckHeapClosure((StgClosure *)p);
- sumOfCostLinear += size;
- costArrayLinear[get_itbl((StgClosure *)p)->type] += size;
- p += size;
+ size = sanityCheckHeapClosure((StgClosure *)p);
+ sumOfCostLinear += size;
+ costArrayLinear[get_itbl((StgClosure *)p)->type] += size;
+ p += size;
}
ASSERT(p == alloc_Hp);
costSum += alloc_Hp - bd->start;
bd = bd->link;
while (bd != NULL) {
- p = bd->start;
- while (p < bd->free) {
- size = sanityCheckHeapClosure((StgClosure *)p);
- sumOfCostLinear += size;
- costArrayLinear[get_itbl((StgClosure *)p)->type] += size;
- p += size;
- }
- ASSERT(p == bd->free);
- costSum += bd->free - bd->start;
- bd = bd->link;
+ p = bd->start;
+ while (p < bd->free) {
+ size = sanityCheckHeapClosure((StgClosure *)p);
+ sumOfCostLinear += size;
+ costArrayLinear[get_itbl((StgClosure *)p)->type] += size;
+ p += size;
+ }
+ ASSERT(p == bd->free);
+ costSum += bd->free - bd->start;
+ bd = bd->link;
}
return costSum;
@@ -2168,14 +2168,14 @@ chainCheck(bdescr *bd)
costSum = 0;
while (bd != NULL) {
- // bd->free - bd->start is not an accurate measurement of the
- // object size. Actually it is always zero, so we compute its
- // size explicitly.
- size = sanityCheckHeapClosure((StgClosure *)bd->start);
- sumOfCostLinear += size;
- costArrayLinear[get_itbl((StgClosure *)bd->start)->type] += size;
- costSum += size;
- bd = bd->link;
+ // bd->free - bd->start is not an accurate measurement of the
+ // object size. Actually it is always zero, so we compute its
+ // size explicitly.
+ size = sanityCheckHeapClosure((StgClosure *)bd->start);
+ sumOfCostLinear += size;
+ costArrayLinear[get_itbl((StgClosure *)bd->start)->type] += size;
+ costSum += size;
+ bd = bd->link;
}
return costSum;
@@ -2189,32 +2189,32 @@ checkHeapSanityForRetainerProfiling( void )
costSum = 0;
debugBelch("START: sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
if (RtsFlags.GcFlags.generations == 1) {
- costSum += heapCheck(g0s0->to_blocks);
- debugBelch("heapCheck: sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
- costSum += chainCheck(g0s0->large_objects);
- debugBelch("chainCheck: sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
+ costSum += heapCheck(g0s0->to_blocks);
+ debugBelch("heapCheck: sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
+ costSum += chainCheck(g0s0->large_objects);
+ debugBelch("chainCheck: sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
} else {
- for (g = 0; g < RtsFlags.GcFlags.generations; g++)
- for (s = 0; s < generations[g].n_steps; s++) {
- /*
- After all live objects have been scavenged, the garbage
- collector may create some objects in
- scheduleFinalizers(). These objects are created throught
- allocate(), so the small object pool or the large object
- pool of the g0s0 may not be empty.
- */
- if (g == 0 && s == 0) {
- costSum += smallObjectPoolCheck();
- debugBelch("smallObjectPoolCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
- costSum += chainCheck(generations[g].steps[s].large_objects);
- debugBelch("chainCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
- } else {
- costSum += heapCheck(generations[g].steps[s].blocks);
- debugBelch("heapCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
- costSum += chainCheck(generations[g].steps[s].large_objects);
- debugBelch("chainCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
- }
- }
+ for (g = 0; g < RtsFlags.GcFlags.generations; g++)
+ for (s = 0; s < generations[g].n_steps; s++) {
+ /*
+ After all live objects have been scavenged, the garbage
+ collector may create some objects in
+ scheduleFinalizers(). These objects are created throught
+ allocate(), so the small object pool or the large object
+ pool of the g0s0 may not be empty.
+ */
+ if (g == 0 && s == 0) {
+ costSum += smallObjectPoolCheck();
+ debugBelch("smallObjectPoolCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
+ costSum += chainCheck(generations[g].steps[s].large_objects);
+ debugBelch("chainCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
+ } else {
+ costSum += heapCheck(generations[g].steps[s].blocks);
+ debugBelch("heapCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
+ costSum += chainCheck(generations[g].steps[s].large_objects);
+ debugBelch("chainCheck(): sumOfCostLinear = %d, costSum = %d\n", sumOfCostLinear, costSum);
+ }
+ }
}
return costSum;
@@ -2228,32 +2228,32 @@ findPointer(StgPtr p)
nat g, s;
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- for (s = 0; s < generations[g].n_steps; s++) {
- // if (g == 0 && s == 0) continue;
- bd = generations[g].steps[s].blocks;
- for (; bd; bd = bd->link) {
- for (q = bd->start; q < bd->free; q++) {
- if (*q == (StgWord)p) {
- r = q;
- while (!LOOKS_LIKE_GHC_INFO(*r)) r--;
- debugBelch("Found in gen[%d], step[%d]: q = %p, r = %p\n", g, s, q, r);
- // return;
- }
- }
- }
- bd = generations[g].steps[s].large_objects;
- for (; bd; bd = bd->link) {
- e = bd->start + cost((StgClosure *)bd->start);
- for (q = bd->start; q < e; q++) {
- if (*q == (StgWord)p) {
- r = q;
- while (*r == 0 || !LOOKS_LIKE_GHC_INFO(*r)) r--;
- debugBelch("Found in gen[%d], large_objects: %p\n", g, r);
- // return;
- }
- }
- }
- }
+ for (s = 0; s < generations[g].n_steps; s++) {
+ // if (g == 0 && s == 0) continue;
+ bd = generations[g].steps[s].blocks;
+ for (; bd; bd = bd->link) {
+ for (q = bd->start; q < bd->free; q++) {
+ if (*q == (StgWord)p) {
+ r = q;
+ while (!LOOKS_LIKE_GHC_INFO(*r)) r--;
+ debugBelch("Found in gen[%d], step[%d]: q = %p, r = %p\n", g, s, q, r);
+ // return;
+ }
+ }
+ }
+ bd = generations[g].steps[s].large_objects;
+ for (; bd; bd = bd->link) {
+ e = bd->start + cost((StgClosure *)bd->start);
+ for (q = bd->start; q < e; q++) {
+ if (*q == (StgWord)p) {
+ r = q;
+ while (*r == 0 || !LOOKS_LIKE_GHC_INFO(*r)) r--;
+ debugBelch("Found in gen[%d], large_objects: %p\n", g, r);
+ // return;
+ }
+ }
+ }
+ }
}
}
@@ -2264,23 +2264,23 @@ belongToHeap(StgPtr p)
nat g, s;
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- for (s = 0; s < generations[g].n_steps; s++) {
- // if (g == 0 && s == 0) continue;
- bd = generations[g].steps[s].blocks;
- for (; bd; bd = bd->link) {
- if (bd->start <= p && p < bd->free) {
- debugBelch("Belongs to gen[%d], step[%d]", g, s);
- return;
- }
- }
- bd = generations[g].steps[s].large_objects;
- for (; bd; bd = bd->link) {
- if (bd->start <= p && p < bd->start + getHeapClosureSize((StgClosure *)bd->start)) {
- debugBelch("Found in gen[%d], large_objects: %p\n", g, bd->start);
- return;
- }
- }
- }
+ for (s = 0; s < generations[g].n_steps; s++) {
+ // if (g == 0 && s == 0) continue;
+ bd = generations[g].steps[s].blocks;
+ for (; bd; bd = bd->link) {
+ if (bd->start <= p && p < bd->free) {
+ debugBelch("Belongs to gen[%d], step[%d]", g, s);
+ return;
+ }
+ }
+ bd = generations[g].steps[s].large_objects;
+ for (; bd; bd = bd->link) {
+ if (bd->start <= p && p < bd->start + getHeapClosureSize((StgClosure *)bd->start)) {
+ debugBelch("Found in gen[%d], large_objects: %p\n", g, bd->start);
+ return;
+ }
+ }
+ }
}
}
#endif /* DEBUG_RETAINER */
diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c
index 6e75abc8a5..b3d8f94b48 100644
--- a/rts/RtsMessages.c
+++ b/rts/RtsMessages.c
@@ -51,7 +51,7 @@ vbarf(const char*s, va_list ap)
stg_exit(EXIT_INTERNAL_ERROR); // just in case fatalInternalErrorFn() returns
}
-void
+void
_assertFail(const char*filename, unsigned int linenum)
{
barf("ASSERTION FAILED: file %s, line %u\n", filename, linenum);
@@ -142,10 +142,10 @@ rtsFatalInternalErrorFn(const char *s, va_list ap)
vsnprintf(message, BUFSIZE, s, ap);
MessageBox(NULL /* hWnd */,
- message,
- title,
- MB_OK | MB_ICONERROR | MB_TASKMODAL
- );
+ message,
+ title,
+ MB_OK | MB_ICONERROR | MB_TASKMODAL
+ );
}
else
#endif
@@ -180,9 +180,9 @@ rtsErrorMsgFn(const char *s, va_list ap)
char buf[BUFSIZE];
int r;
- r = vsnprintf(buf, BUFSIZE, s, ap);
- if (r > 0 && r < BUFSIZE) {
- MessageBox(NULL /* hWnd */,
+ r = vsnprintf(buf, BUFSIZE, s, ap);
+ if (r > 0 && r < BUFSIZE) {
+ MessageBox(NULL /* hWnd */,
buf,
prog_name,
MB_OK | MB_ICONERROR | MB_TASKMODAL
@@ -207,31 +207,31 @@ rtsSysErrorMsgFn(const char *s, va_list ap)
char *syserr;
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
- FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) &syserr,
- 0,
- NULL );
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &syserr,
+ 0,
+ NULL );
if (isGUIApp())
{
- char buf[BUFSIZE];
- int r;
-
- r = vsnprintf(buf, BUFSIZE, s, ap);
- if (r > 0 && r < BUFSIZE) {
- r = vsnprintf(buf+r, BUFSIZE-r, ": %s", syserr);
- MessageBox(NULL /* hWnd */,
- buf,
- prog_name,
- MB_OK | MB_ICONERROR | MB_TASKMODAL
- );
- }
+ char buf[BUFSIZE];
+ int r;
+
+ r = vsnprintf(buf, BUFSIZE, s, ap);
+ if (r > 0 && r < BUFSIZE) {
+ r = vsnprintf(buf+r, BUFSIZE-r, ": %s", syserr);
+ MessageBox(NULL /* hWnd */,
+ buf,
+ prog_name,
+ MB_OK | MB_ICONERROR | MB_TASKMODAL
+ );
+ }
}
else
#else
@@ -239,21 +239,21 @@ rtsSysErrorMsgFn(const char *s, va_list ap)
// ToDo: use strerror_r() if available
#endif
{
- /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- if (prog_argv != NULL && prog_name != NULL) {
- fprintf(stderr, "%s: ", prog_name);
- }
- vfprintf(stderr, s, ap);
- if (syserr) {
+ /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
+ if (prog_argv != NULL && prog_name != NULL) {
+ fprintf(stderr, "%s: ", prog_name);
+ }
+ vfprintf(stderr, s, ap);
+ if (syserr) {
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
// Win32 error messages have a terminating \n
- fprintf(stderr, ": %s", syserr);
+ fprintf(stderr, ": %s", syserr);
#else
- fprintf(stderr, ": %s\n", syserr);
+ fprintf(stderr, ": %s\n", syserr);
#endif
- } else {
- fprintf(stderr, "\n");
- }
+ } else {
+ fprintf(stderr, "\n");
+ }
}
#if defined(cygwin32_HOST_OS) || defined (mingw32_HOST_OS)
@@ -268,10 +268,10 @@ rtsDebugMsgFn(const char *s, va_list ap)
if (isGUIApp())
{
char buf[BUFSIZE];
- int r;
+ int r;
- r = vsnprintf(buf, BUFSIZE, s, ap);
- if (r > 0 && r < BUFSIZE) {
+ r = vsnprintf(buf, BUFSIZE, s, ap);
+ if (r > 0 && r < BUFSIZE) {
OutputDebugString(buf);
}
}
diff --git a/rts/Schedule.c b/rts/Schedule.c
index b4881bb86e..b11270832d 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -91,7 +91,7 @@ volatile StgWord recent_activity = ACTIVITY_YES;
*/
volatile StgWord sched_state = SCHED_RUNNING;
-/* This is used in `TSO.h' and gcc 2.96 insists that this variable actually
+/* This is used in `TSO.h' and gcc 2.96 insists that this variable actually
* exists - earlier gccs apparently didn't.
* -= chak
*/
@@ -147,10 +147,10 @@ static void scheduleActivateSpark(Capability *cap);
static void schedulePostRunThread(Capability *cap, StgTSO *t);
static rtsBool scheduleHandleHeapOverflow( Capability *cap, StgTSO *t );
static rtsBool scheduleHandleYield( Capability *cap, StgTSO *t,
- nat prev_what_next );
+ nat prev_what_next );
static void scheduleHandleThreadBlocked( StgTSO *t );
static rtsBool scheduleHandleThreadFinished( Capability *cap, Task *task,
- StgTSO *t );
+ StgTSO *t );
static rtsBool scheduleNeedHeapProfile(rtsBool ready_to_gc);
static void scheduleDoGC(Capability **pcap, Task *task, rtsBool force_major);
@@ -186,7 +186,7 @@ schedule (Capability *initialCapability, Task *task)
#if defined(THREADED_RTS)
rtsBool first = rtsTrue;
#endif
-
+
cap = initialCapability;
// Pre-condition: this task owns initialCapability.
@@ -206,13 +206,13 @@ schedule (Capability *initialCapability, Task *task)
// going via suspendThread()/resumeThread (i.e. a 'safe' foreign
// call).
if (cap->in_haskell) {
- errorBelch("schedule: re-entered unsafely.\n"
- " Perhaps a 'foreign import unsafe' should be 'safe'?");
- stg_exit(EXIT_FAILURE);
+ errorBelch("schedule: re-entered unsafely.\n"
+ " Perhaps a 'foreign import unsafe' should be 'safe'?");
+ stg_exit(EXIT_FAILURE);
}
// The interruption / shutdown sequence.
- //
+ //
// In order to cleanly shut down the runtime, we want to:
// * make sure that all main threads return to their callers
// with the state 'Interrupted'.
@@ -230,7 +230,7 @@ schedule (Capability *initialCapability, Task *task)
// done by scheduleDoGC() for convenience (because GC already
// needs to acquire all the capabilities). We can't kill
// threads involved in foreign calls.
- //
+ //
// * somebody calls shutdownHaskell(), which calls exitScheduler()
//
// * sched_state := SCHED_SHUTTING_DOWN
@@ -242,14 +242,14 @@ schedule (Capability *initialCapability, Task *task)
// * eventually all Capabilities will shut down, and the RTS can
// exit.
//
- // * We might be left with threads blocked in foreign calls,
+ // * We might be left with threads blocked in foreign calls,
// we should really attempt to kill these somehow (TODO);
-
+
switch (sched_state) {
case SCHED_RUNNING:
- break;
+ break;
case SCHED_INTERRUPTING:
- debugTrace(DEBUG_sched, "SCHED_INTERRUPTING");
+ debugTrace(DEBUG_sched, "SCHED_INTERRUPTING");
/* scheduleDoGC() deletes all the threads */
scheduleDoGC(&cap,task,rtsFalse);
@@ -261,16 +261,16 @@ schedule (Capability *initialCapability, Task *task)
// fall through
case SCHED_SHUTTING_DOWN:
- debugTrace(DEBUG_sched, "SCHED_SHUTTING_DOWN");
- // If we are a worker, just exit. If we're a bound thread
- // then we will exit below when we've removed our TSO from
- // the run queue.
- if (!isBoundTask(task) && emptyRunQueue(cap)) {
- return cap;
- }
- break;
+ debugTrace(DEBUG_sched, "SCHED_SHUTTING_DOWN");
+ // If we are a worker, just exit. If we're a bound thread
+ // then we will exit below when we've removed our TSO from
+ // the run queue.
+ if (!isBoundTask(task) && emptyRunQueue(cap)) {
+ return cap;
+ }
+ break;
default:
- barf("sched_state: %d", sched_state);
+ barf("sched_state: %d", sched_state);
}
scheduleFindWork(&cap);
@@ -282,16 +282,16 @@ schedule (Capability *initialCapability, Task *task)
scheduleDetectDeadlock(&cap,task);
// Normally, the only way we can get here with no threads to
- // run is if a keyboard interrupt received during
+ // run is if a keyboard interrupt received during
// scheduleCheckBlockedThreads() or scheduleDetectDeadlock().
// Additionally, it is not fatal for the
// threaded RTS to reach here with no threads to run.
//
// win32: might be here due to awaitEvent() being abandoned
// as a result of a console event having been delivered.
-
+
#if defined(THREADED_RTS)
- if (first)
+ if (first)
{
// XXX: ToDo
// // don't yield the first time, we want a chance to run this
@@ -308,11 +308,11 @@ schedule (Capability *initialCapability, Task *task)
#if !defined(THREADED_RTS) && !defined(mingw32_HOST_OS)
if ( emptyRunQueue(cap) ) {
- ASSERT(sched_state >= SCHED_INTERRUPTING);
+ ASSERT(sched_state >= SCHED_INTERRUPTING);
}
#endif
- //
+ //
// Get a thread to run
//
t = popRunQueue(cap);
@@ -326,30 +326,30 @@ schedule (Capability *initialCapability, Task *task)
// If not, we have to pass our capability to the right task.
{
InCall *bound = t->bound;
-
- if (bound) {
- if (bound->task == task) {
- // yes, the Haskell thread is bound to the current native thread
- } else {
- debugTrace(DEBUG_sched,
- "thread %lu bound to another OS thread",
+
+ if (bound) {
+ if (bound->task == task) {
+ // yes, the Haskell thread is bound to the current native thread
+ } else {
+ debugTrace(DEBUG_sched,
+ "thread %lu bound to another OS thread",
(unsigned long)t->id);
- // no, bound to a different Haskell thread: pass to that thread
- pushOnRunQueue(cap,t);
- continue;
- }
- } else {
- // The thread we want to run is unbound.
- if (task->incall->tso) {
- debugTrace(DEBUG_sched,
- "this OS thread cannot run thread %lu",
+ // no, bound to a different Haskell thread: pass to that thread
+ pushOnRunQueue(cap,t);
+ continue;
+ }
+ } else {
+ // The thread we want to run is unbound.
+ if (task->incall->tso) {
+ debugTrace(DEBUG_sched,
+ "this OS thread cannot run thread %lu",
(unsigned long)t->id);
- // no, the current native thread is bound to a different
- // Haskell thread, so pass it to any worker thread
- pushOnRunQueue(cap,t);
- continue;
- }
- }
+ // no, the current native thread is bound to a different
+ // Haskell thread, so pass it to any worker thread
+ pushOnRunQueue(cap,t);
+ continue;
+ }
+ }
}
#endif
@@ -387,10 +387,10 @@ schedule (Capability *initialCapability, Task *task)
* +RTS -C0
*/
if (RtsFlags.ConcFlags.ctxtSwitchTicks == 0
- && !emptyThreadQueues(cap)) {
- cap->context_switch = 1;
+ && !emptyThreadQueues(cap)) {
+ cap->context_switch = 1;
}
-
+
run_thread:
// CurrentTSO is the thread to run. It might be different if we
@@ -401,7 +401,7 @@ run_thread:
startHeapProfTimer();
// ----------------------------------------------------------------------
- // Run the current thread
+ // Run the current thread
ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
ASSERT(t->cap == cap);
@@ -450,29 +450,29 @@ run_thread:
traceEventRunThread(cap, t);
switch (prev_what_next) {
-
+
case ThreadKilled:
case ThreadComplete:
- /* Thread already finished, return to scheduler. */
- ret = ThreadFinished;
- break;
-
+ /* Thread already finished, return to scheduler. */
+ ret = ThreadFinished;
+ break;
+
case ThreadRunGHC:
{
- StgRegTable *r;
- r = StgRun((StgFunPtr) stg_returnToStackTop, &cap->r);
- cap = regTableToCapability(r);
- ret = r->rRet;
- break;
+ StgRegTable *r;
+ r = StgRun((StgFunPtr) stg_returnToStackTop, &cap->r);
+ cap = regTableToCapability(r);
+ ret = r->rRet;
+ break;
}
-
+
case ThreadInterpret:
- cap = interpretBCO(cap);
- ret = cap->r.rRet;
- break;
-
+ cap = interpretBCO(cap);
+ ret = cap->r.rRet;
+ break;
+
default:
- barf("schedule: invalid what_next field");
+ barf("schedule: invalid what_next field");
}
cap->in_haskell = rtsFalse;
@@ -506,21 +506,21 @@ run_thread:
ASSERT(t->cap == cap);
// ----------------------------------------------------------------------
-
+
// Costs for the scheduler are assigned to CCS_SYSTEM
stopHeapProfTimer();
#if defined(PROFILING)
cap->r.rCCCS = CCS_SYSTEM;
#endif
-
+
schedulePostRunThread(cap,t);
ready_to_gc = rtsFalse;
switch (ret) {
case HeapOverflow:
- ready_to_gc = scheduleHandleHeapOverflow(cap,t);
- break;
+ ready_to_gc = scheduleHandleHeapOverflow(cap,t);
+ break;
case StackOverflow:
// just adjust the stack for this thread, then pop it back
@@ -532,18 +532,18 @@ run_thread:
case ThreadYielding:
if (scheduleHandleYield(cap, t, prev_what_next)) {
// shortcut for switching between compiler/interpreter:
- goto run_thread;
- }
- break;
+ goto run_thread;
+ }
+ break;
case ThreadBlocked:
- scheduleHandleThreadBlocked(t);
- break;
+ scheduleHandleThreadBlocked(t);
+ break;
case ThreadFinished:
- if (scheduleHandleThreadFinished(cap, task, t)) return cap;
- ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
- break;
+ if (scheduleHandleThreadFinished(cap, task, t)) return cap;
+ ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
+ break;
default:
barf("schedule: invalid thread return code %d", (int)ret);
@@ -593,7 +593,7 @@ promoteInRunQueue (Capability *cap, StgTSO *tso)
static void
schedulePreLoop(void)
{
- // initialisation for scheduler - what cannot go into initScheduler()
+ // initialisation for scheduler - what cannot go into initScheduler()
#if defined(mingw32_HOST_OS) && !defined(USE_MINIINTERPRETER)
win32AllocStack();
@@ -649,7 +649,7 @@ shouldYieldCapability (Capability *cap, Task *task, rtsBool didGcLast)
// This is the single place where a Task goes to sleep. There are
// two reasons it might need to sleep:
// - there are no threads to run
-// - we need to yield this Capability to someone else
+// - we need to yield this Capability to someone else
// (see shouldYieldCapability())
//
// Careful: the scheduler loop is quite delicate. Make sure you run
@@ -664,7 +664,7 @@ scheduleYield (Capability **pcap, Task *task)
// if we have work, and we don't need to give up the Capability, continue.
//
- if (!shouldYieldCapability(cap,task,rtsFalse) &&
+ if (!shouldYieldCapability(cap,task,rtsFalse) &&
(!emptyRunQueue(cap) ||
!emptyInbox(cap) ||
sched_state >= SCHED_INTERRUPTING)) {
@@ -674,7 +674,7 @@ scheduleYield (Capability **pcap, Task *task)
// otherwise yield (sleep), and keep yielding if necessary.
do {
didGcLast = yieldCapability(&cap,task, !didGcLast);
- }
+ }
while (shouldYieldCapability(cap,task,didGcLast));
// note there may still be no threads on the run queue at this
@@ -684,7 +684,7 @@ scheduleYield (Capability **pcap, Task *task)
return;
}
#endif
-
+
/* -----------------------------------------------------------------------------
* schedulePushWork()
*
@@ -692,8 +692,8 @@ scheduleYield (Capability **pcap, Task *task)
* -------------------------------------------------------------------------- */
static void
-schedulePushWork(Capability *cap USED_IF_THREADS,
- Task *task USED_IF_THREADS)
+schedulePushWork(Capability *cap USED_IF_THREADS,
+ Task *task USED_IF_THREADS)
{
/* following code not for PARALLEL_HASKELL. I kept the call general,
future GUM versions might use pushing in a distributed setup */
@@ -718,16 +718,16 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
for (i=0, n_free_caps=0; i < n_capabilities; i++) {
cap0 = capabilities[i];
if (cap != cap0 && !cap0->disabled && tryGrabCapability(cap0,task)) {
- if (!emptyRunQueue(cap0)
+ if (!emptyRunQueue(cap0)
|| cap0->returning_tasks_hd != NULL
|| cap0->inbox != (Message*)END_TSO_QUEUE) {
- // it already has some work, we just grabbed it at
- // the wrong moment. Or maybe it's deadlocked!
- releaseCapability(cap0);
- } else {
- free_caps[n_free_caps++] = cap0;
- }
- }
+ // it already has some work, we just grabbed it at
+ // the wrong moment. Or maybe it's deadlocked!
+ releaseCapability(cap0);
+ } else {
+ free_caps[n_free_caps++] = cap0;
+ }
+ }
}
// we now have n_free_caps free capabilities stashed in
@@ -735,98 +735,98 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
// probably the simplest thing we could do; improvements we might
// want to do include:
//
- // - giving high priority to moving relatively new threads, on
+ // - giving high priority to moving relatively new threads, on
// the gournds that they haven't had time to build up a
// working set in the cache on this CPU/Capability.
//
// - giving low priority to moving long-lived threads
if (n_free_caps > 0) {
- StgTSO *prev, *t, *next;
+ StgTSO *prev, *t, *next;
#ifdef SPARK_PUSHING
- rtsBool pushed_to_all;
+ rtsBool pushed_to_all;
#endif
- debugTrace(DEBUG_sched,
- "cap %d: %s and %d free capabilities, sharing...",
- cap->no,
- (!emptyRunQueue(cap) && !singletonRunQueue(cap))?
- "excess threads on run queue":"sparks to share (>=2)",
- n_free_caps);
+ debugTrace(DEBUG_sched,
+ "cap %d: %s and %d free capabilities, sharing...",
+ cap->no,
+ (!emptyRunQueue(cap) && !singletonRunQueue(cap))?
+ "excess threads on run queue":"sparks to share (>=2)",
+ n_free_caps);
- i = 0;
+ i = 0;
#ifdef SPARK_PUSHING
- pushed_to_all = rtsFalse;
+ pushed_to_all = rtsFalse;
#endif
- if (cap->run_queue_hd != END_TSO_QUEUE) {
- prev = cap->run_queue_hd;
- t = prev->_link;
- prev->_link = END_TSO_QUEUE;
- for (; t != END_TSO_QUEUE; t = next) {
- next = t->_link;
- t->_link = END_TSO_QUEUE;
+ if (cap->run_queue_hd != END_TSO_QUEUE) {
+ prev = cap->run_queue_hd;
+ t = prev->_link;
+ prev->_link = END_TSO_QUEUE;
+ for (; t != END_TSO_QUEUE; t = next) {
+ next = t->_link;
+ t->_link = END_TSO_QUEUE;
if (t->bound == task->incall // don't move my bound thread
- || tsoLocked(t)) { // don't move a locked thread
- setTSOLink(cap, prev, t);
+ || tsoLocked(t)) { // don't move a locked thread
+ setTSOLink(cap, prev, t);
setTSOPrev(cap, t, prev);
- prev = t;
- } else if (i == n_free_caps) {
+ prev = t;
+ } else if (i == n_free_caps) {
#ifdef SPARK_PUSHING
- pushed_to_all = rtsTrue;
+ pushed_to_all = rtsTrue;
#endif
- i = 0;
- // keep one for us
- setTSOLink(cap, prev, t);
+ i = 0;
+ // keep one for us
+ setTSOLink(cap, prev, t);
setTSOPrev(cap, t, prev);
- prev = t;
- } else {
- appendToRunQueue(free_caps[i],t);
+ prev = t;
+ } else {
+ appendToRunQueue(free_caps[i],t);
traceEventMigrateThread (cap, t, free_caps[i]->no);
- if (t->bound) { t->bound->task->cap = free_caps[i]; }
- t->cap = free_caps[i];
- i++;
- }
- }
- cap->run_queue_tl = prev;
+ if (t->bound) { t->bound->task->cap = free_caps[i]; }
+ t->cap = free_caps[i];
+ i++;
+ }
+ }
+ cap->run_queue_tl = prev;
IF_DEBUG(sanity, checkRunQueue(cap));
- }
+ }
#ifdef SPARK_PUSHING
- /* JB I left this code in place, it would work but is not necessary */
-
- // If there are some free capabilities that we didn't push any
- // threads to, then try to push a spark to each one.
- if (!pushed_to_all) {
- StgClosure *spark;
- // i is the next free capability to push to
- for (; i < n_free_caps; i++) {
- if (emptySparkPoolCap(free_caps[i])) {
- spark = tryStealSpark(cap->sparks);
- if (spark != NULL) {
+ /* JB I left this code in place, it would work but is not necessary */
+
+ // If there are some free capabilities that we didn't push any
+ // threads to, then try to push a spark to each one.
+ if (!pushed_to_all) {
+ StgClosure *spark;
+ // i is the next free capability to push to
+ for (; i < n_free_caps; i++) {
+ if (emptySparkPoolCap(free_caps[i])) {
+ spark = tryStealSpark(cap->sparks);
+ if (spark != NULL) {
/* TODO: if anyone wants to re-enable this code then
* they must consider the fizzledSpark(spark) case
* and update the per-cap spark statistics.
*/
- debugTrace(DEBUG_sched, "pushing spark %p to capability %d", spark, free_caps[i]->no);
+ debugTrace(DEBUG_sched, "pushing spark %p to capability %d", spark, free_caps[i]->no);
traceEventStealSpark(free_caps[i], t, cap->no);
- newSpark(&(free_caps[i]->r), spark);
- }
- }
- }
- }
+ newSpark(&(free_caps[i]->r), spark);
+ }
+ }
+ }
+ }
#endif /* SPARK_PUSHING */
- // release the capabilities
- for (i = 0; i < n_free_caps; i++) {
- task->cap = free_caps[i];
- releaseAndWakeupCapability(free_caps[i]);
- }
+ // release the capabilities
+ for (i = 0; i < n_free_caps; i++) {
+ task->cap = free_caps[i];
+ releaseAndWakeupCapability(free_caps[i]);
+ }
}
task->cap = cap; // reset to point to our Capability.
@@ -844,7 +844,7 @@ scheduleStartSignalHandlers(Capability *cap)
{
if (RtsFlags.MiscFlags.install_signal_handlers && signals_pending()) {
// safe outside the lock
- startSignalHandlers(cap);
+ startSignalHandlers(cap);
}
}
#else
@@ -869,7 +869,7 @@ scheduleCheckBlockedThreads(Capability *cap USED_IF_NOT_THREADS)
//
if ( !emptyQueue(blocked_queue_hd) || !emptyQueue(sleeping_queue) )
{
- awaitEvent (emptyRunQueue(cap));
+ awaitEvent (emptyRunQueue(cap));
}
#endif
}
@@ -891,71 +891,71 @@ scheduleDetectDeadlock (Capability **pcap, Task *task)
if ( emptyThreadQueues(cap) )
{
#if defined(THREADED_RTS)
- /*
- * In the threaded RTS, we only check for deadlock if there
- * has been no activity in a complete timeslice. This means
- * we won't eagerly start a full GC just because we don't have
- * any threads to run currently.
- */
- if (recent_activity != ACTIVITY_INACTIVE) return;
-#endif
-
- debugTrace(DEBUG_sched, "deadlocked, forcing major GC...");
-
- // Garbage collection can release some new threads due to
- // either (a) finalizers or (b) threads resurrected because
- // they are unreachable and will therefore be sent an
- // exception. Any threads thus released will be immediately
- // runnable.
+ /*
+ * In the threaded RTS, we only check for deadlock if there
+ * has been no activity in a complete timeslice. This means
+ * we won't eagerly start a full GC just because we don't have
+ * any threads to run currently.
+ */
+ if (recent_activity != ACTIVITY_INACTIVE) return;
+#endif
+
+ debugTrace(DEBUG_sched, "deadlocked, forcing major GC...");
+
+ // Garbage collection can release some new threads due to
+ // either (a) finalizers or (b) threads resurrected because
+ // they are unreachable and will therefore be sent an
+ // exception. Any threads thus released will be immediately
+ // runnable.
scheduleDoGC (pcap, task, rtsTrue/*force major GC*/);
cap = *pcap;
// when force_major == rtsTrue. scheduleDoGC sets
// recent_activity to ACTIVITY_DONE_GC and turns off the timer
// signal.
- if ( !emptyRunQueue(cap) ) return;
+ if ( !emptyRunQueue(cap) ) return;
#if defined(RTS_USER_SIGNALS) && !defined(THREADED_RTS)
- /* If we have user-installed signal handlers, then wait
- * for signals to arrive rather then bombing out with a
- * deadlock.
- */
- if ( RtsFlags.MiscFlags.install_signal_handlers && anyUserHandlers() ) {
- debugTrace(DEBUG_sched,
- "still deadlocked, waiting for signals...");
-
- awaitUserSignals();
-
- if (signals_pending()) {
- startSignalHandlers(cap);
- }
+ /* If we have user-installed signal handlers, then wait
+ * for signals to arrive rather then bombing out with a
+ * deadlock.
+ */
+ if ( RtsFlags.MiscFlags.install_signal_handlers && anyUserHandlers() ) {
+ debugTrace(DEBUG_sched,
+ "still deadlocked, waiting for signals...");
+
+ awaitUserSignals();
+
+ if (signals_pending()) {
+ startSignalHandlers(cap);
+ }
- // either we have threads to run, or we were interrupted:
- ASSERT(!emptyRunQueue(cap) || sched_state >= SCHED_INTERRUPTING);
+ // either we have threads to run, or we were interrupted:
+ ASSERT(!emptyRunQueue(cap) || sched_state >= SCHED_INTERRUPTING);
return;
- }
+ }
#endif
#if !defined(THREADED_RTS)
- /* Probably a real deadlock. Send the current main thread the
- * Deadlock exception.
- */
- if (task->incall->tso) {
- switch (task->incall->tso->why_blocked) {
- case BlockedOnSTM:
- case BlockedOnBlackHole:
- case BlockedOnMsgThrowTo:
- case BlockedOnMVar:
- case BlockedOnMVarRead:
- throwToSingleThreaded(cap, task->incall->tso,
- (StgClosure *)nonTermination_closure);
- return;
- default:
- barf("deadlock: main thread blocked in a strange way");
- }
- }
- return;
+ /* Probably a real deadlock. Send the current main thread the
+ * Deadlock exception.
+ */
+ if (task->incall->tso) {
+ switch (task->incall->tso->why_blocked) {
+ case BlockedOnSTM:
+ case BlockedOnBlackHole:
+ case BlockedOnMsgThrowTo:
+ case BlockedOnMVar:
+ case BlockedOnMVarRead:
+ throwToSingleThreaded(cap, task->incall->tso,
+ (StgClosure *)nonTermination_closure);
+ return;
+ default:
+ barf("deadlock: main thread blocked in a strange way");
+ }
+ }
+ return;
#endif
}
}
@@ -975,11 +975,11 @@ scheduleSendPendingMessages(void)
processFetches();
}
# endif
-
+
if (RtsFlags.ParFlags.BufferTime) {
- // if we use message buffering, we must send away all message
- // packets which have become too old...
- sendOldBuffers();
+ // if we use message buffering, we must send away all message
+ // packets which have become too old...
+ sendOldBuffers();
}
}
#endif
@@ -1055,7 +1055,7 @@ schedulePostRunThread (Capability *cap, StgTSO *t)
{
// We have to be able to catch transactions that are in an
// infinite loop as a result of seeing an inconsistent view of
- // memory, e.g.
+ // memory, e.g.
//
// atomically $ do
// [a,b] <- mapM readTVar [ta,tb]
@@ -1067,13 +1067,13 @@ schedulePostRunThread (Capability *cap, StgTSO *t)
if (!stmValidateNestOfTransactions(cap, t -> trec)) {
debugTrace(DEBUG_sched | DEBUG_stm,
"trec %p found wasting its time", t);
-
+
// strip the stack back to the
// ATOMICALLY_FRAME, aborting the (nested)
// transaction, and saving the stack of any
// partially-evaluated thunks on the heap.
throwToSingleThreaded_(cap, t, NULL, rtsTrue);
-
+
// ASSERT(get_itbl((StgClosure *)t->sp)->type == ATOMICALLY_FRAME);
}
}
@@ -1090,70 +1090,70 @@ scheduleHandleHeapOverflow( Capability *cap, StgTSO *t )
{
// did the task ask for a large block?
if (cap->r.rHpAlloc > BLOCK_SIZE) {
- // if so, get one and push it on the front of the nursery.
- bdescr *bd;
- W_ blocks;
-
- blocks = (W_)BLOCK_ROUND_UP(cap->r.rHpAlloc) / BLOCK_SIZE;
-
+ // if so, get one and push it on the front of the nursery.
+ bdescr *bd;
+ W_ blocks;
+
+ blocks = (W_)BLOCK_ROUND_UP(cap->r.rHpAlloc) / BLOCK_SIZE;
+
if (blocks > BLOCKS_PER_MBLOCK) {
barf("allocation of %ld bytes too large (GHC should have complained at compile-time)", (long)cap->r.rHpAlloc);
}
- debugTrace(DEBUG_sched,
- "--<< thread %ld (%s) stopped: requesting a large block (size %ld)\n",
- (long)t->id, what_next_strs[t->what_next], blocks);
-
- // don't do this if the nursery is (nearly) full, we'll GC first.
- if (cap->r.rCurrentNursery->link != NULL ||
- cap->r.rNursery->n_blocks == 1) { // paranoia to prevent infinite loop
- // if the nursery has only one block.
-
+ debugTrace(DEBUG_sched,
+ "--<< thread %ld (%s) stopped: requesting a large block (size %ld)\n",
+ (long)t->id, what_next_strs[t->what_next], blocks);
+
+ // don't do this if the nursery is (nearly) full, we'll GC first.
+ if (cap->r.rCurrentNursery->link != NULL ||
+ cap->r.rNursery->n_blocks == 1) { // paranoia to prevent infinite loop
+ // if the nursery has only one block.
+
bd = allocGroup_lock(blocks);
cap->r.rNursery->n_blocks += blocks;
-
- // link the new group into the list
- bd->link = cap->r.rCurrentNursery;
- bd->u.back = cap->r.rCurrentNursery->u.back;
- if (cap->r.rCurrentNursery->u.back != NULL) {
- cap->r.rCurrentNursery->u.back->link = bd;
- } else {
- cap->r.rNursery->blocks = bd;
- }
- cap->r.rCurrentNursery->u.back = bd;
-
- // initialise it as a nursery block. We initialise the
- // step, gen_no, and flags field of *every* sub-block in
- // this large block, because this is easier than making
- // sure that we always find the block head of a large
- // block whenever we call Bdescr() (eg. evacuate() and
- // isAlive() in the GC would both have to do this, at
- // least).
- {
- bdescr *x;
- for (x = bd; x < bd + blocks; x++) {
+
+ // link the new group into the list
+ bd->link = cap->r.rCurrentNursery;
+ bd->u.back = cap->r.rCurrentNursery->u.back;
+ if (cap->r.rCurrentNursery->u.back != NULL) {
+ cap->r.rCurrentNursery->u.back->link = bd;
+ } else {
+ cap->r.rNursery->blocks = bd;
+ }
+ cap->r.rCurrentNursery->u.back = bd;
+
+ // initialise it as a nursery block. We initialise the
+ // step, gen_no, and flags field of *every* sub-block in
+ // this large block, because this is easier than making
+ // sure that we always find the block head of a large
+ // block whenever we call Bdescr() (eg. evacuate() and
+ // isAlive() in the GC would both have to do this, at
+ // least).
+ {
+ bdescr *x;
+ for (x = bd; x < bd + blocks; x++) {
initBdescr(x,g0,g0);
x->free = x->start;
- x->flags = 0;
- }
- }
-
- // This assert can be a killer if the app is doing lots
- // of large block allocations.
- IF_DEBUG(sanity, checkNurserySanity(cap->r.rNursery));
-
- // now update the nursery to point to the new block
- cap->r.rCurrentNursery = bd;
-
- // we might be unlucky and have another thread get on the
- // run queue before us and steal the large block, but in that
- // case the thread will just end up requesting another large
- // block.
- pushOnRunQueue(cap,t);
- return rtsFalse; /* not actually GC'ing */
- }
- }
-
+ x->flags = 0;
+ }
+ }
+
+ // This assert can be a killer if the app is doing lots
+ // of large block allocations.
+ IF_DEBUG(sanity, checkNurserySanity(cap->r.rNursery));
+
+ // now update the nursery to point to the new block
+ cap->r.rCurrentNursery = bd;
+
+ // we might be unlucky and have another thread get on the
+ // run queue before us and steal the large block, but in that
+ // case the thread will just end up requesting another large
+ // block.
+ pushOnRunQueue(cap,t);
+ return rtsFalse; /* not actually GC'ing */
+ }
+ }
+
if (cap->r.rHpLim == NULL || cap->context_switch) {
// Sometimes we miss a context switch, e.g. when calling
// primitives in a tight loop, MAYBE_GC() doesn't check the
@@ -1182,15 +1182,15 @@ scheduleHandleYield( Capability *cap, StgTSO *t, nat prev_what_next )
*/
ASSERT(t->_link == END_TSO_QUEUE);
-
+
// Shortcut if we're just switching evaluators: don't bother
// doing stack squeezing (which can be expensive), just run the
// thread.
if (cap->context_switch == 0 && t->what_next != prev_what_next) {
- debugTrace(DEBUG_sched,
- "--<< thread %ld (%s) stopped to switch evaluators",
- (long)t->id, what_next_strs[t->what_next]);
- return rtsTrue;
+ debugTrace(DEBUG_sched,
+ "--<< thread %ld (%s) stopped to switch evaluators",
+ (long)t->id, what_next_strs[t->what_next]);
+ return rtsTrue;
}
// Reset the context switch flag. We don't do this just before
@@ -1207,8 +1207,8 @@ scheduleHandleYield( Capability *cap, StgTSO *t, nat prev_what_next )
}
IF_DEBUG(sanity,
- //debugBelch("&& Doing sanity check on yielding TSO %ld.", t->id);
- checkTSO(t));
+ //debugBelch("&& Doing sanity check on yielding TSO %ld.", t->id);
+ checkTSO(t));
return rtsFalse;
}
@@ -1260,7 +1260,7 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t)
//
// Check whether the thread that just completed was a bound
- // thread, and if so return with the result.
+ // thread, and if so return with the result.
//
// There is an assumption here that all thread completion goes
// through this point; we need to make sure that if a thread
@@ -1270,47 +1270,47 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t)
if (t->bound) {
- if (t->bound != task->incall) {
+ if (t->bound != task->incall) {
#if !defined(THREADED_RTS)
- // Must be a bound thread that is not the topmost one. Leave
- // it on the run queue until the stack has unwound to the
- // point where we can deal with this. Leaving it on the run
- // queue also ensures that the garbage collector knows about
- // this thread and its return value (it gets dropped from the
- // step->threads list so there's no other way to find it).
- appendToRunQueue(cap,t);
- return rtsFalse;
+ // Must be a bound thread that is not the topmost one. Leave
+ // it on the run queue until the stack has unwound to the
+ // point where we can deal with this. Leaving it on the run
+ // queue also ensures that the garbage collector knows about
+ // this thread and its return value (it gets dropped from the
+ // step->threads list so there's no other way to find it).
+ appendToRunQueue(cap,t);
+ return rtsFalse;
#else
- // this cannot happen in the threaded RTS, because a
- // bound thread can only be run by the appropriate Task.
- barf("finished bound thread that isn't mine");
+ // this cannot happen in the threaded RTS, because a
+ // bound thread can only be run by the appropriate Task.
+ barf("finished bound thread that isn't mine");
#endif
- }
+ }
- ASSERT(task->incall->tso == t);
+ ASSERT(task->incall->tso == t);
- if (t->what_next == ThreadComplete) {
- if (task->incall->ret) {
+ if (t->what_next == ThreadComplete) {
+ if (task->incall->ret) {
// NOTE: return val is stack->sp[1] (see StgStartup.hc)
*(task->incall->ret) = (StgClosure *)task->incall->tso->stackobj->sp[1];
- }
- task->incall->stat = Success;
- } else {
- if (task->incall->ret) {
- *(task->incall->ret) = NULL;
- }
- if (sched_state >= SCHED_INTERRUPTING) {
+ }
+ task->incall->stat = Success;
+ } else {
+ if (task->incall->ret) {
+ *(task->incall->ret) = NULL;
+ }
+ if (sched_state >= SCHED_INTERRUPTING) {
if (heap_overflow) {
task->incall->stat = HeapExhausted;
} else {
task->incall->stat = Interrupted;
}
- } else {
- task->incall->stat = Killed;
- }
- }
+ } else {
+ task->incall->stat = Killed;
+ }
+ }
#ifdef DEBUG
- removeThreadLabel((StgWord)task->incall->tso->id);
+ removeThreadLabel((StgWord)task->incall->tso->id);
#endif
// We no longer consider this thread and task to be bound to
@@ -1323,7 +1323,7 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t)
t->bound = NULL;
task->incall->tso = NULL;
- return rtsTrue; // tells schedule() to return
+ return rtsTrue; // tells schedule() to return
}
return rtsFalse;
@@ -1340,7 +1340,7 @@ scheduleNeedHeapProfile( rtsBool ready_to_gc STG_UNUSED )
// every GC. This lets us get repeatable runs for debugging.
if (performHeapProfile ||
(RtsFlags.ProfFlags.heapProfileInterval==0 &&
- RtsFlags.ProfFlags.doHeapProfile && ready_to_gc)) {
+ RtsFlags.ProfFlags.doHeapProfile && ready_to_gc)) {
return rtsTrue;
} else {
return rtsFalse;
@@ -1366,7 +1366,7 @@ static nat requestSync (Capability **pcap, Task *task, nat sync_type)
if (prev_pending_sync)
{
- do {
+ do {
debugTrace(DEBUG_sched, "someone else is trying to sync (%d)...",
prev_pending_sync);
ASSERT(*pcap);
@@ -1469,7 +1469,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
// In order to GC, there must be no threads running Haskell code.
// Therefore, the GC thread needs to hold *all* the capabilities,
- // and release them after the GC has completed.
+ // and release them after the GC has completed.
//
// This seems to be the simplest way: previous attempts involved
// making all the threads with capabilities give up their
@@ -1480,7 +1480,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
/* Other capabilities are prevented from running yet more Haskell
threads if pending_sync is set. Tested inside
- yieldCapability() and releaseCapability() in Capability.c */
+ yieldCapability() and releaseCapability() in Capability.c */
do {
sync = requestSync(pcap, task, gc_type);
@@ -1510,7 +1510,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
// The final shutdown GC is always single-threaded, because it's
// possible that some of the Capabilities have no worker threads.
-
+
if (gc_type == SYNC_GC_SEQ)
{
traceEventRequestSeqGc(cap);
@@ -1581,7 +1581,7 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS,
// For all capabilities participating in this GC, wait until
// they have stopped mutating and are standing by for GC.
waitForGcThreads(cap);
-
+
#if defined(THREADED_RTS)
// Stable point where we can do a global check on our spark counters
ASSERT(checkSparkCountInvariant());
@@ -1599,7 +1599,7 @@ delete_threads_and_gc:
* threads in the system.
*/
if (sched_state == SCHED_INTERRUPTING) {
- deleteAllThreads(cap);
+ deleteAllThreads(cap);
#if defined(THREADED_RTS)
// Discard all the sparks from every Capability. Why?
// They'll probably be GC'd anyway since we've killed all the
@@ -1614,7 +1614,7 @@ delete_threads_and_gc:
#endif
sched_state = SCHED_SHUTTING_DOWN;
}
-
+
/*
* When there are disabled capabilities, we want to migrate any
* threads away from them. Normally this happens in the
@@ -1728,12 +1728,12 @@ delete_threads_and_gc:
// main thread? It should presumably be the same one that
// gets ^C exceptions, but that's all done on the Haskell side
// (GHC.TopHandler).
- sched_state = SCHED_INTERRUPTING;
+ sched_state = SCHED_INTERRUPTING;
goto delete_threads_and_gc;
}
#ifdef SPARKBALANCE
- /* JB
+ /* JB
Once we are all together... this would be the place to balance all
spark pools. No concurrent stealing or adding of new sparks can
occur. Should be defined in Sparks.c. */
@@ -1757,7 +1757,7 @@ delete_threads_and_gc:
pid_t
forkProcess(HsStablePtr *entry
#ifndef FORKPROCESS_PRIMOP_SUPPORTED
- STG_UNUSED
+ STG_UNUSED
#endif
)
{
@@ -1773,7 +1773,7 @@ forkProcess(HsStablePtr *entry
#endif
debugTrace(DEBUG_sched, "forking!");
-
+
task = newBoundTask();
cap = NULL;
@@ -1813,9 +1813,9 @@ forkProcess(HsStablePtr *entry
#endif
pid = fork();
-
+
if (pid) { // parent
-
+
startTimer(); // #4074
RELEASE_LOCK(&sched_mutex);
@@ -1834,9 +1834,9 @@ forkProcess(HsStablePtr *entry
boundTaskExiting(task);
- // just return the pid
+ // just return the pid
return pid;
-
+
} else { // child
#if defined(THREADED_RTS)
@@ -1857,17 +1857,17 @@ forkProcess(HsStablePtr *entry
#endif
// Now, all OS threads except the thread that forked are
- // stopped. We need to stop all Haskell threads, including
- // those involved in foreign calls. Also we need to delete
- // all Tasks, because they correspond to OS threads that are
- // now gone.
+ // stopped. We need to stop all Haskell threads, including
+ // those involved in foreign calls. Also we need to delete
+ // all Tasks, because they correspond to OS threads that are
+ // now gone.
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
for (t = generations[g].threads; t != END_TSO_QUEUE; t = next) {
next = t->global_link;
- // don't allow threads to catch the ThreadKilled
- // exception, but we do want to raiseAsync() because these
- // threads may be evaluating thunks that we need later.
+ // don't allow threads to catch the ThreadKilled
+ // exception, but we do want to raiseAsync() because these
+ // threads may be evaluating thunks that we need later.
deleteThread_(t->cap,t);
// stop the GC from updating the InCall to point to
@@ -1877,8 +1877,8 @@ forkProcess(HsStablePtr *entry
// also scheduleHandleThreadFinished).
t->bound = NULL;
}
- }
-
+ }
+
discardTasksExcept(task);
for (i=0; i < n_capabilities; i++) {
@@ -1915,7 +1915,7 @@ forkProcess(HsStablePtr *entry
task->cap = cap;
// Empty the threads lists. Otherwise, the garbage
- // collector may attempt to resurrect some of these threads.
+ // collector may attempt to resurrect some of these threads.
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
generations[g].threads = END_TSO_QUEUE;
}
@@ -1934,9 +1934,9 @@ forkProcess(HsStablePtr *entry
#endif
rts_evalStableIO(&cap, entry, NULL); // run the action
- rts_checkSchedStatus("forkProcess",cap);
-
- rts_unlock(cap);
+ rts_checkSchedStatus("forkProcess",cap);
+
+ rts_unlock(cap);
shutdownHaskellAndExit(EXIT_SUCCESS, 0 /* !fastExit */);
}
#else /* !FORKPROCESS_PRIMOP_SUPPORTED */
@@ -1957,7 +1957,7 @@ forkProcess(HsStablePtr *entry
* worker Tasks on the new Capabilities we created.
*
* ------------------------------------------------------------------------- */
-
+
void
setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
{
@@ -1983,7 +1983,7 @@ setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
debugTrace(DEBUG_sched, "changing the number of Capabilities from %d to %d",
enabled_capabilities, new_n_capabilities);
-
+
cap = rts_lock();
task = cap->running_task;
@@ -2088,7 +2088,7 @@ setNumCapabilities (nat new_n_capabilities USED_IF_THREADS)
/* ---------------------------------------------------------------------------
* Delete all the threads in the system
* ------------------------------------------------------------------------- */
-
+
static void
deleteAllThreads ( Capability *cap )
{
@@ -2126,13 +2126,13 @@ STATIC_INLINE void
suspendTask (Capability *cap, Task *task)
{
InCall *incall;
-
+
incall = task->incall;
ASSERT(incall->next == NULL && incall->prev == NULL);
incall->next = cap->suspended_ccalls;
incall->prev = NULL;
if (cap->suspended_ccalls) {
- cap->suspended_ccalls->prev = incall;
+ cap->suspended_ccalls->prev = incall;
}
cap->suspended_ccalls = incall;
}
@@ -2144,20 +2144,20 @@ recoverSuspendedTask (Capability *cap, Task *task)
incall = task->incall;
if (incall->prev) {
- incall->prev->next = incall->next;
+ incall->prev->next = incall->next;
} else {
- ASSERT(cap->suspended_ccalls == incall);
- cap->suspended_ccalls = incall->next;
+ ASSERT(cap->suspended_ccalls == incall);
+ cap->suspended_ccalls = incall->next;
}
if (incall->next) {
- incall->next->prev = incall->prev;
+ incall->next->prev = incall->prev;
}
incall->next = incall->prev = NULL;
}
/* ---------------------------------------------------------------------------
* Suspending & resuming Haskell threads.
- *
+ *
* When making a "safe" call to C (aka _ccall_GC), the task gives back
* its capability before calling the C function. This allows another
* task to pick up the capability and carry on running Haskell
@@ -2173,7 +2173,7 @@ recoverSuspendedTask (Capability *cap, Task *task)
* unceremoniously terminated and should be scheduled on an
* unbound worker thread.
* ------------------------------------------------------------------------- */
-
+
void *
suspendThread (StgRegTable *reg, rtsBool interruptible)
{
@@ -2219,7 +2219,7 @@ suspendThread (StgRegTable *reg, rtsBool interruptible)
suspendTask(cap,task);
cap->in_haskell = rtsFalse;
releaseCapability_(cap,rtsFalse);
-
+
RELEASE_LOCK(&cap->lock);
errno = saved_errno;
@@ -2265,7 +2265,7 @@ resumeThread (void *task_)
tso->_link = END_TSO_QUEUE; // no write barrier reqd
traceEventRunThread(cap, tso);
-
+
/* Reset blocking status */
tso->why_blocked = NotBlocked;
@@ -2275,7 +2275,7 @@ resumeThread (void *task_)
maybePerformBlockedException(cap,tso);
}
}
-
+
cap->r.rCurrentTSO = tso;
cap->in_haskell = rtsTrue;
errno = saved_errno;
@@ -2314,11 +2314,11 @@ void
scheduleThreadOn(Capability *cap, StgWord cpu USED_IF_THREADS, StgTSO *tso)
{
tso->flags |= TSO_LOCKED; // we requested explicit affinity; don't
- // move this thread from now on.
+ // move this thread from now on.
#if defined(THREADED_RTS)
cpu %= enabled_capabilities;
if (cpu == cap->no) {
- appendToRunQueue(cap,tso);
+ appendToRunQueue(cap,tso);
} else {
migrateThread(cap, tso, capabilities[cpu]);
}
@@ -2420,7 +2420,7 @@ startWorkerTasks (nat from USED_IF_THREADS, nat to USED_IF_THREADS)
*
* ------------------------------------------------------------------------ */
-void
+void
initScheduler(void)
{
#if !defined(THREADED_RTS)
@@ -2437,7 +2437,7 @@ initScheduler(void)
* the scheduler. */
initMutex(&sched_mutex);
#endif
-
+
ACQUIRE_LOCK(&sched_mutex);
/* A capability holds the state a native thread needs in
@@ -2470,7 +2470,7 @@ exitScheduler (rtsBool wait_foreign USED_IF_THREADS)
// If we haven't killed all the threads yet, do it now.
if (sched_state < SCHED_SHUTTING_DOWN) {
- sched_state = SCHED_INTERRUPTING;
+ sched_state = SCHED_INTERRUPTING;
Capability *cap = task->cap;
waitForReturnCapability(&cap,task);
scheduleDoGC(&cap,task,rtsTrue);
@@ -2509,14 +2509,14 @@ freeScheduler( void )
#endif
}
-void markScheduler (evac_fn evac USED_IF_NOT_THREADS,
+void markScheduler (evac_fn evac USED_IF_NOT_THREADS,
void *user USED_IF_NOT_THREADS)
{
#if !defined(THREADED_RTS)
evac(user, (StgClosure **)(void *)&blocked_queue_hd);
evac(user, (StgClosure **)(void *)&blocked_queue_tl);
evac(user, (StgClosure **)(void *)&sleeping_queue);
-#endif
+#endif
}
/* -----------------------------------------------------------------------------
@@ -2534,10 +2534,10 @@ performGC_(rtsBool force_major)
Capability *cap = NULL;
// We must grab a new Task here, because the existing Task may be
- // associated with a particular Capability, and chained onto the
+ // associated with a particular Capability, and chained onto the
// suspended_ccalls queue.
task = newBoundTask();
-
+
// TODO: do we need to traceTask*() here?
waitForReturnCapability(&cap,task);
@@ -2560,7 +2560,7 @@ performMajorGC(void)
/* ---------------------------------------------------------------------------
Interrupt execution
- - usually called inside a signal handler so it mustn't do anything fancy.
+ - usually called inside a signal handler so it mustn't do anything fancy.
------------------------------------------------------------------------ */
void
@@ -2575,7 +2575,7 @@ interruptStgRts(void)
/* -----------------------------------------------------------------------------
Wake up the RTS
-
+
This function causes at least one OS thread to wake up and run the
scheduler loop. It is invoked when the RTS might be deadlocked, or
an external event has arrived that may need servicing (eg. a
@@ -2609,11 +2609,11 @@ deleteThread (Capability *cap STG_UNUSED, StgTSO *tso)
{
// NOTE: must only be called on a TSO that we have exclusive
// access to, because we will call throwToSingleThreaded() below.
- // The TSO must be on the run queue of the Capability we own, or
+ // The TSO must be on the run queue of the Capability we own, or
// we must own all Capabilities.
if (tso->why_blocked != BlockedOnCCall &&
- tso->why_blocked != BlockedOnCCall_Interruptible) {
+ tso->why_blocked != BlockedOnCCall_Interruptible) {
throwToSingleThreaded(tso->cap,tso,NULL);
}
}
@@ -2625,18 +2625,18 @@ deleteThread_(Capability *cap, StgTSO *tso)
// like deleteThread(), but we delete threads in foreign calls, too.
if (tso->why_blocked == BlockedOnCCall ||
- tso->why_blocked == BlockedOnCCall_Interruptible) {
- tso->what_next = ThreadKilled;
- appendToRunQueue(tso->cap, tso);
+ tso->why_blocked == BlockedOnCCall_Interruptible) {
+ tso->what_next = ThreadKilled;
+ appendToRunQueue(tso->cap, tso);
} else {
- deleteThread(cap,tso);
+ deleteThread(cap,tso);
}
}
#endif
/* -----------------------------------------------------------------------------
raiseExceptionHelper
-
+
This function is called by the raise# primitve, just so that we can
move some of the tricky bits of raising an exception from C-- into
C. Who knows, it might be a useful re-useable thing here too.
@@ -2665,7 +2665,7 @@ raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception)
// use MIN_UPD_SIZE.
//
// raise_closure = (StgClosure *)RET_STGCALL1(P_,allocate,
- // sizeofW(StgClosure)+1);
+ // sizeofW(StgClosure)+1);
//
//
@@ -2675,37 +2675,37 @@ raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception)
//
p = tso->stackobj->sp;
while(1) {
- info = get_ret_itbl((StgClosure *)p);
- next = p + stack_frame_sizeW((StgClosure *)p);
- switch (info->i.type) {
-
- case UPDATE_FRAME:
- // Only create raise_closure if we need to.
- if (raise_closure == NULL) {
- raise_closure =
- (StgThunk *)allocate(cap,sizeofW(StgThunk)+1);
+ info = get_ret_itbl((StgClosure *)p);
+ next = p + stack_frame_sizeW((StgClosure *)p);
+ switch (info->i.type) {
+
+ case UPDATE_FRAME:
+ // Only create raise_closure if we need to.
+ if (raise_closure == NULL) {
+ raise_closure =
+ (StgThunk *)allocate(cap,sizeofW(StgThunk)+1);
SET_HDR(raise_closure, &stg_raise_info, cap->r.rCCCS);
- raise_closure->payload[0] = exception;
- }
+ raise_closure->payload[0] = exception;
+ }
updateThunk(cap, tso, ((StgUpdateFrame *)p)->updatee,
(StgClosure *)raise_closure);
- p = next;
- continue;
+ p = next;
+ continue;
case ATOMICALLY_FRAME:
- debugTrace(DEBUG_stm, "found ATOMICALLY_FRAME at %p", p);
+ debugTrace(DEBUG_stm, "found ATOMICALLY_FRAME at %p", p);
tso->stackobj->sp = p;
return ATOMICALLY_FRAME;
-
- case CATCH_FRAME:
+
+ case CATCH_FRAME:
tso->stackobj->sp = p;
- return CATCH_FRAME;
+ return CATCH_FRAME;
case CATCH_STM_FRAME:
- debugTrace(DEBUG_stm, "found CATCH_STM_FRAME at %p", p);
+ debugTrace(DEBUG_stm, "found CATCH_STM_FRAME at %p", p);
tso->stackobj->sp = p;
return CATCH_STM_FRAME;
-
+
case UNDERFLOW_FRAME:
tso->stackobj->sp = p;
threadStackUnderflow(cap,tso);
@@ -2714,7 +2714,7 @@ raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception)
case STOP_FRAME:
tso->stackobj->sp = p;
- return STOP_FRAME;
+ return STOP_FRAME;
case CATCH_RETRY_FRAME: {
StgTRecHeader *trec = tso -> trec;
@@ -2729,10 +2729,10 @@ raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception)
continue;
}
- default:
- p = next;
- continue;
- }
+ default:
+ p = next;
+ continue;
+ }
}
}
@@ -2741,10 +2741,10 @@ raiseExceptionHelper (StgRegTable *reg, StgTSO *tso, StgClosure *exception)
findRetryFrameHelper
This function is called by the retry# primitive. It traverses the stack
- leaving tso->sp referring to the frame which should handle the retry.
+ leaving tso->sp referring to the frame which should handle the retry.
- This should either be a CATCH_RETRY_FRAME (if the retry# is within an orElse#)
- or should be a ATOMICALLY_FRAME (if the retry# reaches the top level).
+ This should either be a CATCH_RETRY_FRAME (if the retry# is within an orElse#)
+ or should be a ATOMICALLY_FRAME (if the retry# reaches the top level).
We skip CATCH_STM_FRAMEs (aborting and rolling back the nested tx that they
create) because retries are not considered to be exceptions, despite the
@@ -2765,32 +2765,32 @@ findRetryFrameHelper (Capability *cap, StgTSO *tso)
info = get_ret_itbl((StgClosure *)p);
next = p + stack_frame_sizeW((StgClosure *)p);
switch (info->i.type) {
-
+
case ATOMICALLY_FRAME:
- debugTrace(DEBUG_stm,
- "found ATOMICALLY_FRAME at %p during retry", p);
+ debugTrace(DEBUG_stm,
+ "found ATOMICALLY_FRAME at %p during retry", p);
tso->stackobj->sp = p;
- return ATOMICALLY_FRAME;
-
+ return ATOMICALLY_FRAME;
+
case CATCH_RETRY_FRAME:
- debugTrace(DEBUG_stm,
+ debugTrace(DEBUG_stm,
"found CATCH_RETRY_FRAME at %p during retry", p);
tso->stackobj->sp = p;
- return CATCH_RETRY_FRAME;
-
+ return CATCH_RETRY_FRAME;
+
case CATCH_STM_FRAME: {
StgTRecHeader *trec = tso -> trec;
- StgTRecHeader *outer = trec -> enclosing_trec;
+ StgTRecHeader *outer = trec -> enclosing_trec;
debugTrace(DEBUG_stm,
- "found CATCH_STM_FRAME at %p during retry", p);
+ "found CATCH_STM_FRAME at %p during retry", p);
debugTrace(DEBUG_stm, "trec=%p outer=%p", trec, outer);
stmAbortTransaction(cap, trec);
stmFreeAbortedTRec(cap, trec);
- tso -> trec = outer;
- p = next;
+ tso -> trec = outer;
+ p = next;
continue;
}
-
+
case UNDERFLOW_FRAME:
tso->stackobj->sp = p;
threadStackUnderflow(cap,tso);
@@ -2800,7 +2800,7 @@ findRetryFrameHelper (Capability *cap, StgTSO *tso)
default:
ASSERT(info->i.type != CATCH_FRAME);
ASSERT(info->i.type != STOP_FRAME);
- p = next;
+ p = next;
continue;
}
}
@@ -2824,47 +2824,47 @@ resurrectThreads (StgTSO *threads)
generation *gen;
for (tso = threads; tso != END_TSO_QUEUE; tso = next) {
- next = tso->global_link;
+ next = tso->global_link;
gen = Bdescr((P_)tso)->gen;
- tso->global_link = gen->threads;
- gen->threads = tso;
-
- debugTrace(DEBUG_sched, "resurrecting thread %lu", (unsigned long)tso->id);
-
- // Wake up the thread on the Capability it was last on
- cap = tso->cap;
-
- switch (tso->why_blocked) {
- case BlockedOnMVar:
- case BlockedOnMVarRead:
- /* Called by GC - sched_mutex lock is currently held. */
- throwToSingleThreaded(cap, tso,
- (StgClosure *)blockedIndefinitelyOnMVar_closure);
- break;
- case BlockedOnBlackHole:
- throwToSingleThreaded(cap, tso,
- (StgClosure *)nonTermination_closure);
- break;
- case BlockedOnSTM:
- throwToSingleThreaded(cap, tso,
- (StgClosure *)blockedIndefinitelyOnSTM_closure);
- break;
- case NotBlocked:
- /* This might happen if the thread was blocked on a black hole
- * belonging to a thread that we've just woken up (raiseAsync
- * can wake up threads, remember...).
- */
- continue;
+ tso->global_link = gen->threads;
+ gen->threads = tso;
+
+ debugTrace(DEBUG_sched, "resurrecting thread %lu", (unsigned long)tso->id);
+
+ // Wake up the thread on the Capability it was last on
+ cap = tso->cap;
+
+ switch (tso->why_blocked) {
+ case BlockedOnMVar:
+ case BlockedOnMVarRead:
+ /* Called by GC - sched_mutex lock is currently held. */
+ throwToSingleThreaded(cap, tso,
+ (StgClosure *)blockedIndefinitelyOnMVar_closure);
+ break;
+ case BlockedOnBlackHole:
+ throwToSingleThreaded(cap, tso,
+ (StgClosure *)nonTermination_closure);
+ break;
+ case BlockedOnSTM:
+ throwToSingleThreaded(cap, tso,
+ (StgClosure *)blockedIndefinitelyOnSTM_closure);
+ break;
+ case NotBlocked:
+ /* This might happen if the thread was blocked on a black hole
+ * belonging to a thread that we've just woken up (raiseAsync
+ * can wake up threads, remember...).
+ */
+ continue;
case BlockedOnMsgThrowTo:
// This can happen if the target is masking, blocks on a
// black hole, and then is found to be unreachable. In
// this case, we want to let the target wake up and carry
// on, and do nothing to this thread.
continue;
- default:
- barf("resurrectThreads: thread blocked in a strange way: %d",
+ default:
+ barf("resurrectThreads: thread blocked in a strange way: %d",
tso->why_blocked);
- }
+ }
}
}
diff --git a/rts/Schedule.h b/rts/Schedule.h
index 015cc1cefc..d61be04bb7 100644
--- a/rts/Schedule.h
+++ b/rts/Schedule.h
@@ -2,7 +2,7 @@
*
* (c) The GHC Team 1998-2005
*
- * Prototypes for functions in Schedule.c
+ * Prototypes for functions in Schedule.c
* (RTS internal scheduler interface)
*
* -------------------------------------------------------------------------*/
@@ -34,7 +34,7 @@ void scheduleThread (Capability *cap, StgTSO *tso);
void scheduleThreadOn(Capability *cap, StgWord cpu, StgTSO *tso);
/* wakeUpRts()
- *
+ *
* Causes an OS thread to wake up and run the scheduler, if necessary.
*/
#if defined(THREADED_RTS)
@@ -60,7 +60,7 @@ void scheduleWorker (Capability *cap, Task *task);
extern volatile StgWord sched_state;
-/*
+/*
* flag that tracks whether we have done any execution in this time
* slice, and controls the disabling of the interval timer.
*
@@ -136,10 +136,10 @@ appendToRunQueue (Capability *cap, StgTSO *tso)
{
ASSERT(tso->_link == END_TSO_QUEUE);
if (cap->run_queue_hd == END_TSO_QUEUE) {
- cap->run_queue_hd = tso;
+ cap->run_queue_hd = tso;
tso->block_info.prev = END_TSO_QUEUE;
} else {
- setTSOLink(cap, cap->run_queue_tl, tso);
+ setTSOLink(cap, cap->run_queue_tl, tso);
setTSOPrev(cap, tso, cap->run_queue_tl);
}
cap->run_queue_tl = tso;
@@ -161,7 +161,7 @@ pushOnRunQueue (Capability *cap, StgTSO *tso)
}
cap->run_queue_hd = tso;
if (cap->run_queue_tl == END_TSO_QUEUE) {
- cap->run_queue_tl = tso;
+ cap->run_queue_tl = tso;
}
}
@@ -169,7 +169,7 @@ pushOnRunQueue (Capability *cap, StgTSO *tso)
*/
INLINE_HEADER StgTSO *
popRunQueue (Capability *cap)
-{
+{
StgTSO *t = cap->run_queue_hd;
ASSERT(t != END_TSO_QUEUE);
cap->run_queue_hd = t->_link;
@@ -178,7 +178,7 @@ popRunQueue (Capability *cap)
}
t->_link = END_TSO_QUEUE; // no write barrier req'd
if (cap->run_queue_hd == END_TSO_QUEUE) {
- cap->run_queue_tl = END_TSO_QUEUE;
+ cap->run_queue_tl = END_TSO_QUEUE;
}
return t;
}
@@ -200,9 +200,9 @@ appendToBlockedQueue(StgTSO *tso)
{
ASSERT(tso->_link == END_TSO_QUEUE);
if (blocked_queue_hd == END_TSO_QUEUE) {
- blocked_queue_hd = tso;
+ blocked_queue_hd = tso;
} else {
- setTSOLink(&MainCapability, blocked_queue_tl, tso);
+ setTSOLink(&MainCapability, blocked_queue_tl, tso);
}
blocked_queue_tl = tso;
}
@@ -248,7 +248,7 @@ emptyThreadQueues(Capability *cap)
{
return emptyRunQueue(cap)
#if !defined(THREADED_RTS)
- && EMPTY_BLOCKED_QUEUE() && EMPTY_SLEEPING_QUEUE()
+ && EMPTY_BLOCKED_QUEUE() && EMPTY_SLEEPING_QUEUE()
#endif
;
}
@@ -258,4 +258,3 @@ emptyThreadQueues(Capability *cap)
#include "EndPrivate.h"
#endif /* SCHEDULE_H */
-
diff --git a/rts/Stats.c b/rts/Stats.c
index 894e9d2c79..ed345c2894 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -161,7 +161,7 @@ initStats0(void)
max_slop = 0;
GC_end_faults = 0;
-}
+}
/* ---------------------------------------------------------------------------
initStats1() can be called after setupRtsFlags()
@@ -171,25 +171,25 @@ void
initStats1 (void)
{
nat i;
-
+
if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) {
statsPrintf(" Alloc Copied Live GC GC TOT TOT Page Flts\n");
statsPrintf(" bytes bytes bytes user elap user elap\n");
}
- GC_coll_cpu =
- (Time *)stgMallocBytes(
+ GC_coll_cpu =
+ (Time *)stgMallocBytes(
sizeof(Time)*RtsFlags.GcFlags.generations,
- "initStats");
- GC_coll_elapsed =
- (Time *)stgMallocBytes(
- sizeof(Time)*RtsFlags.GcFlags.generations,
- "initStats");
+ "initStats");
+ GC_coll_elapsed =
+ (Time *)stgMallocBytes(
+ sizeof(Time)*RtsFlags.GcFlags.generations,
+ "initStats");
GC_coll_max_pause =
- (Time *)stgMallocBytes(
- sizeof(Time)*RtsFlags.GcFlags.generations,
- "initStats");
+ (Time *)stgMallocBytes(
+ sizeof(Time)*RtsFlags.GcFlags.generations,
+ "initStats");
for (i = 0; i < RtsFlags.GcFlags.generations; i++) {
- GC_coll_cpu[i] = 0;
+ GC_coll_cpu[i] = 0;
GC_coll_elapsed[i] = 0;
GC_coll_max_pause[i] = 0;
}
@@ -205,7 +205,7 @@ stat_startInit(void)
getProcessTimes(&start_init_cpu, &start_init_elapsed);
}
-void
+void
stat_endInit(void)
{
getProcessTimes(&end_init_cpu, &end_init_elapsed);
@@ -224,7 +224,7 @@ stat_endInit(void)
/* -----------------------------------------------------------------------------
stat_startExit and stat_endExit
-
+
These two measure the time taken in shutdownHaskell().
-------------------------------------------------------------------------- */
@@ -261,12 +261,12 @@ stat_startGC (Capability *cap, gc_thread *gct)
nat bell = RtsFlags.GcFlags.ringBell;
if (bell) {
- if (bell > 1) {
- debugBelch(" GC ");
- rub_bell = 1;
- } else {
- debugBelch("\007");
- }
+ if (bell > 1) {
+ debugBelch(" GC ");
+ rub_bell = 1;
+ } else {
+ debugBelch("\007");
+ }
}
#if USE_PAPI
@@ -337,7 +337,7 @@ stat_endGC (Capability *cap, gc_thread *gct,
// for a detailed design rationale of the current setup
// of GC eventlog events.
traceEventGcGlobalSync(cap);
-
+
// Emitted before GC_END on all caps, which simplifies tools code.
traceEventGcStats(cap,
CAPSET_HEAP_DEFAULT,
@@ -364,9 +364,9 @@ stat_endGC (Capability *cap, gc_thread *gct,
gc_cpu = cpu - gct->gc_start_cpu;
/* For the moment we calculate both per-HEC and total allocation.
- * There is thus redundancy here, but for the moment we will calculate
- * it both the old and new way and assert they're the same.
- * When we're sure it's working OK then we can simplify things.
+ * There is thus redundancy here, but for the moment we will calculate
+ * it both the old and new way and assert they're the same.
+ * When we're sure it's working OK then we can simplify things.
*/
tot_alloc = calcTotalAllocated();
@@ -375,23 +375,23 @@ stat_endGC (Capability *cap, gc_thread *gct,
GC_tot_alloc = tot_alloc;
if (RtsFlags.GcFlags.giveStats == VERBOSE_GC_STATS) {
- W_ faults = getPageFaults();
-
- statsPrintf("%9" FMT_SizeT " %9" FMT_SizeT " %9" FMT_SizeT,
- alloc*sizeof(W_), copied*sizeof(W_),
- live*sizeof(W_));
+ W_ faults = getPageFaults();
+
+ statsPrintf("%9" FMT_SizeT " %9" FMT_SizeT " %9" FMT_SizeT,
+ alloc*sizeof(W_), copied*sizeof(W_),
+ live*sizeof(W_));
statsPrintf(" %6.3f %6.3f %8.3f %8.3f %4" FMT_Word " %4" FMT_Word " (Gen: %2d)\n",
TimeToSecondsDbl(gc_cpu),
- TimeToSecondsDbl(gc_elapsed),
- TimeToSecondsDbl(cpu),
- TimeToSecondsDbl(elapsed - start_init_elapsed),
- faults - gct->gc_start_faults,
+ TimeToSecondsDbl(gc_elapsed),
+ TimeToSecondsDbl(cpu),
+ TimeToSecondsDbl(elapsed - start_init_elapsed),
+ faults - gct->gc_start_faults,
gct->gc_start_faults - GC_end_faults,
gen);
GC_end_faults = faults;
- statsFlush();
- }
+ statsFlush();
+ }
GC_coll_cpu[gen] += gc_cpu;
GC_coll_elapsed[gen] += gc_elapsed;
@@ -399,33 +399,33 @@ stat_endGC (Capability *cap, gc_thread *gct,
GC_coll_max_pause[gen] = gc_elapsed;
}
- GC_tot_copied += (StgWord64) copied;
+ GC_tot_copied += (StgWord64) copied;
GC_par_max_copied += (StgWord64) par_max_copied;
GC_par_tot_copied += (StgWord64) par_tot_copied;
- GC_tot_cpu += gc_cpu;
-
+ GC_tot_cpu += gc_cpu;
+
traceEventHeapSize(cap,
- CAPSET_HEAP_DEFAULT,
- mblocks_allocated * MBLOCK_SIZE_W * sizeof(W_));
+ CAPSET_HEAP_DEFAULT,
+ mblocks_allocated * MBLOCK_SIZE_W * sizeof(W_));
- if (gen == RtsFlags.GcFlags.generations-1) { /* major GC? */
- if (live > max_residency) {
- max_residency = live;
- }
+ if (gen == RtsFlags.GcFlags.generations-1) { /* major GC? */
+ if (live > max_residency) {
+ max_residency = live;
+ }
current_residency = live;
- residency_samples++;
- cumulative_residency += live;
- traceEventHeapLive(cap,
- CAPSET_HEAP_DEFAULT,
- live * sizeof(W_));
- }
+ residency_samples++;
+ cumulative_residency += live;
+ traceEventHeapLive(cap,
+ CAPSET_HEAP_DEFAULT,
+ live * sizeof(W_));
+ }
if (slop > max_slop) max_slop = slop;
}
if (rub_bell) {
- debugBelch("\b\b\b \b\b\b");
- rub_bell = 0;
+ debugBelch("\b\b\b \b\b\b");
+ rub_bell = 0;
}
#if USE_PAPI
@@ -476,7 +476,7 @@ stat_endRP(
RP_tot_time += user - RP_start_time;
RPe_tot_time += elapsed - RPe_start_time;
- fprintf(prof_file, "Retainer Profiling: %d, at %f seconds\n",
+ fprintf(prof_file, "Retainer Profiling: %d, at %f seconds\n",
retainerGeneration, mut_user_time_during_RP());
#ifdef DEBUG_RETAINER
fprintf(prof_file, "\tMax C stack size = %u\n", maxCStackSize);
@@ -506,7 +506,7 @@ stat_startHeapCensus(void)
-------------------------------------------------------------------------- */
#ifdef PROFILING
void
-stat_endHeapCensus(void)
+stat_endHeapCensus(void)
{
Time user, elapsed;
getProcessTimes( &user, &elapsed );
@@ -540,13 +540,13 @@ StgInt TOTAL_CALLS=1;
#define REPORT(counter) \
{ \
showStgWord64(counter,temp,rtsTrue/*commas*/); \
- statsPrintf(" (" #counter ") : %s\n",temp); \
+ statsPrintf(" (" #counter ") : %s\n",temp); \
}
/* Report the value of a counter as a percentage of another counter */
#define REPORT_PCT(counter,countertot) \
statsPrintf(" (" #counter ") %% of (" #countertot ") : %.1f%%\n", \
- counter*100.0/countertot)
+ counter*100.0/countertot)
#define TICK_PRINT(arity) \
REPORT(SLOW_CALLS_##arity); \
@@ -557,7 +557,7 @@ StgInt TOTAL_CALLS=1;
#define TICK_PRINT_TOT(arity) \
statsPrintf(" (SLOW_CALLS_" #arity ") %% of (TOTAL_CALLS) : %.1f%%\n", \
- SLOW_CALLS_##arity * 100.0/TOTAL_CALLS)
+ SLOW_CALLS_##arity * 100.0/TOTAL_CALLS)
static inline Time get_init_cpu(void) { return end_init_cpu - start_init_cpu; }
static inline Time get_init_elapsed(void) { return end_init_elapsed - start_init_elapsed; }
@@ -580,13 +580,13 @@ stat_exit (void)
if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) {
- char temp[BIG_STRING_LEN];
- Time tot_cpu;
- Time tot_elapsed;
- nat i, g, total_collections = 0;
+ char temp[BIG_STRING_LEN];
+ Time tot_cpu;
+ Time tot_elapsed;
+ nat i, g, total_collections = 0;
- getProcessTimes( &tot_cpu, &tot_elapsed );
- tot_elapsed -= start_init_elapsed;
+ getProcessTimes( &tot_cpu, &tot_elapsed );
+ tot_elapsed -= start_init_elapsed;
tot_alloc = calcTotalAllocated();
@@ -594,18 +594,18 @@ stat_exit (void)
alloc = tot_alloc - GC_tot_alloc;
GC_tot_alloc = tot_alloc;
- /* Count total garbage collections */
- for (g = 0; g < RtsFlags.GcFlags.generations; g++)
- total_collections += generations[g].collections;
+ /* Count total garbage collections */
+ for (g = 0; g < RtsFlags.GcFlags.generations; g++)
+ total_collections += generations[g].collections;
- /* avoid divide by zero if tot_cpu is measured as 0.00 seconds -- SDM */
- if (tot_cpu == 0.0) tot_cpu = 1;
- if (tot_elapsed == 0.0) tot_elapsed = 1;
-
- if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) {
- statsPrintf("%9" FMT_SizeT " %9.9s %9.9s", (W_)alloc*sizeof(W_), "", "");
- statsPrintf(" %6.3f %6.3f\n\n", 0.0, 0.0);
- }
+ /* avoid divide by zero if tot_cpu is measured as 0.00 seconds -- SDM */
+ if (tot_cpu == 0.0) tot_cpu = 1;
+ if (tot_elapsed == 0.0) tot_elapsed = 1;
+
+ if (RtsFlags.GcFlags.giveStats >= VERBOSE_GC_STATS) {
+ statsPrintf("%9" FMT_SizeT " %9.9s %9.9s", (W_)alloc*sizeof(W_), "", "");
+ statsPrintf(" %6.3f %6.3f\n\n", 0.0, 0.0);
+ }
for (i = 0; i < RtsFlags.GcFlags.generations; i++) {
gc_cpu += GC_coll_cpu[i];
@@ -630,30 +630,30 @@ stat_exit (void)
- PROF_VAL(RP_tot_time + HC_tot_time);
if (mut_cpu < 0) { mut_cpu = 0; }
- if (RtsFlags.GcFlags.giveStats >= SUMMARY_GC_STATS) {
- showStgWord64(GC_tot_alloc*sizeof(W_),
- temp, rtsTrue/*commas*/);
- statsPrintf("%16s bytes allocated in the heap\n", temp);
+ if (RtsFlags.GcFlags.giveStats >= SUMMARY_GC_STATS) {
+ showStgWord64(GC_tot_alloc*sizeof(W_),
+ temp, rtsTrue/*commas*/);
+ statsPrintf("%16s bytes allocated in the heap\n", temp);
- showStgWord64(GC_tot_copied*sizeof(W_),
- temp, rtsTrue/*commas*/);
- statsPrintf("%16s bytes copied during GC\n", temp);
+ showStgWord64(GC_tot_copied*sizeof(W_),
+ temp, rtsTrue/*commas*/);
+ statsPrintf("%16s bytes copied during GC\n", temp);
if ( residency_samples > 0 ) {
- showStgWord64(max_residency*sizeof(W_),
- temp, rtsTrue/*commas*/);
- statsPrintf("%16s bytes maximum residency (%" FMT_Word " sample(s))\n",
- temp, residency_samples);
- }
+ showStgWord64(max_residency*sizeof(W_),
+ temp, rtsTrue/*commas*/);
+ statsPrintf("%16s bytes maximum residency (%" FMT_Word " sample(s))\n",
+ temp, residency_samples);
+ }
- showStgWord64(max_slop*sizeof(W_), temp, rtsTrue/*commas*/);
- statsPrintf("%16s bytes maximum slop\n", temp);
+ showStgWord64(max_slop*sizeof(W_), temp, rtsTrue/*commas*/);
+ statsPrintf("%16s bytes maximum slop\n", temp);
- statsPrintf("%16" FMT_SizeT " MB total memory in use (%" FMT_SizeT " MB lost due to fragmentation)\n\n",
+ statsPrintf("%16" FMT_SizeT " MB total memory in use (%" FMT_SizeT " MB lost due to fragmentation)\n\n",
(size_t)(peak_mblocks_allocated * MBLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_)),
(size_t)(peak_mblocks_allocated * BLOCKS_PER_MBLOCK * BLOCK_SIZE_W - hw_alloc_blocks * BLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_)));
- /* Print garbage collections in each gen */
+ /* Print garbage collections in each gen */
statsPrintf(" Tot time (elapsed) Avg pause Max pause\n");
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
gen = &generations[g];
@@ -669,7 +669,7 @@ stat_exit (void)
#if defined(THREADED_RTS)
if (RtsFlags.ParFlags.parGcEnabled && n_capabilities > 1) {
- statsPrintf("\n Parallel GC work balance: %.2f%% (serial 0%%, perfect 100%%)\n",
+ statsPrintf("\n Parallel GC work balance: %.2f%% (serial 0%%, perfect 100%%)\n",
100 * (((double)GC_par_tot_copied / (double)GC_par_max_copied) - 1)
/ (n_capabilities - 1)
);
@@ -683,7 +683,7 @@ stat_exit (void)
peakWorkerCount, workerCount,
n_capabilities);
- statsPrintf("\n");
+ statsPrintf("\n");
{
nat i;
@@ -704,7 +704,7 @@ stat_exit (void)
}
#endif
- statsPrintf(" INIT time %7.3fs (%7.3fs elapsed)\n",
+ statsPrintf(" INIT time %7.3fs (%7.3fs elapsed)\n",
TimeToSecondsDbl(init_cpu), TimeToSecondsDbl(init_elapsed));
statsPrintf(" MUT time %7.3fs (%7.3fs elapsed)\n",
@@ -713,35 +713,35 @@ stat_exit (void)
TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed));
#ifdef PROFILING
- statsPrintf(" RP time %7.3fs (%7.3fs elapsed)\n",
- TimeToSecondsDbl(RP_tot_time), TimeToSecondsDbl(RPe_tot_time));
- statsPrintf(" PROF time %7.3fs (%7.3fs elapsed)\n",
- TimeToSecondsDbl(HC_tot_time), TimeToSecondsDbl(HCe_tot_time));
-#endif
- statsPrintf(" EXIT time %7.3fs (%7.3fs elapsed)\n",
- TimeToSecondsDbl(exit_cpu), TimeToSecondsDbl(exit_elapsed));
- statsPrintf(" Total time %7.3fs (%7.3fs elapsed)\n\n",
- TimeToSecondsDbl(tot_cpu), TimeToSecondsDbl(tot_elapsed));
+ statsPrintf(" RP time %7.3fs (%7.3fs elapsed)\n",
+ TimeToSecondsDbl(RP_tot_time), TimeToSecondsDbl(RPe_tot_time));
+ statsPrintf(" PROF time %7.3fs (%7.3fs elapsed)\n",
+ TimeToSecondsDbl(HC_tot_time), TimeToSecondsDbl(HCe_tot_time));
+#endif
+ statsPrintf(" EXIT time %7.3fs (%7.3fs elapsed)\n",
+ TimeToSecondsDbl(exit_cpu), TimeToSecondsDbl(exit_elapsed));
+ statsPrintf(" Total time %7.3fs (%7.3fs elapsed)\n\n",
+ TimeToSecondsDbl(tot_cpu), TimeToSecondsDbl(tot_elapsed));
#ifndef THREADED_RTS
- statsPrintf(" %%GC time %5.1f%% (%.1f%% elapsed)\n\n",
- TimeToSecondsDbl(gc_cpu)*100/TimeToSecondsDbl(tot_cpu),
- TimeToSecondsDbl(gc_elapsed)*100/TimeToSecondsDbl(tot_elapsed));
+ statsPrintf(" %%GC time %5.1f%% (%.1f%% elapsed)\n\n",
+ TimeToSecondsDbl(gc_cpu)*100/TimeToSecondsDbl(tot_cpu),
+ TimeToSecondsDbl(gc_elapsed)*100/TimeToSecondsDbl(tot_elapsed));
#endif
if (mut_cpu == 0) {
- showStgWord64(0, temp, rtsTrue/*commas*/);
+ showStgWord64(0, temp, rtsTrue/*commas*/);
} else {
- showStgWord64(
+ showStgWord64(
(StgWord64)((GC_tot_alloc*sizeof(W_)) / TimeToSecondsDbl(mut_cpu)),
temp, rtsTrue/*commas*/);
}
- statsPrintf(" Alloc rate %s bytes per MUT second\n\n", temp);
-
- statsPrintf(" Productivity %5.1f%% of total user, %.1f%% of total elapsed\n\n",
+ statsPrintf(" Alloc rate %s bytes per MUT second\n\n", temp);
+
+ statsPrintf(" Productivity %5.1f%% of total user, %.1f%% of total elapsed\n\n",
TimeToSecondsDbl(tot_cpu - gc_cpu -
- PROF_VAL(RP_tot_time + HC_tot_time) - init_cpu) * 100
- / TimeToSecondsDbl(tot_cpu),
+ PROF_VAL(RP_tot_time + HC_tot_time) - init_cpu) * 100
+ / TimeToSecondsDbl(tot_cpu),
TimeToSecondsDbl(tot_cpu - gc_cpu -
PROF_VAL(RP_tot_time + HC_tot_time) - init_cpu) * 100
/ TimeToSecondsDbl(tot_elapsed));
@@ -749,7 +749,7 @@ stat_exit (void)
/*
TICK_PRINT(1);
TICK_PRINT(2);
- REPORT(TOTAL_CALLS);
+ REPORT(TOTAL_CALLS);
TICK_PRINT_TOT(1);
TICK_PRINT_TOT(2);
*/
@@ -760,7 +760,7 @@ stat_exit (void)
#if defined(THREADED_RTS) && defined(PROF_SPIN)
{
nat g;
-
+
statsPrintf("gc_alloc_block_sync: %"FMT_Word64"\n", gc_alloc_block_sync.spin);
statsPrintf("whitehole_spin: %"FMT_Word64"\n", whitehole_spin);
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
@@ -768,9 +768,9 @@ stat_exit (void)
}
}
#endif
- }
+ }
- if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS) {
+ if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS) {
char *fmt1, *fmt2;
if (RtsFlags.MiscFlags.machineReadable) {
fmt1 = " [(\"bytes allocated\", \"%llu\")\n";
@@ -791,22 +791,22 @@ stat_exit (void)
fmt1 = "<<ghc: %llu bytes, ";
fmt2 = "%d GCs, %ld/%ld avg/max bytes residency (%ld samples), %luM in use, %.3f INIT (%.3f elapsed), %.3f MUT (%.3f elapsed), %.3f GC (%.3f elapsed) :ghc>>\n";
}
- /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */
- statsPrintf(fmt1, GC_tot_alloc*(StgWord64)sizeof(W_));
- statsPrintf(fmt2,
- total_collections,
- residency_samples == 0 ? 0 :
- cumulative_residency*sizeof(W_)/residency_samples,
- max_residency*sizeof(W_),
- residency_samples,
- (unsigned long)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)),
- TimeToSecondsDbl(init_cpu), TimeToSecondsDbl(init_elapsed),
- TimeToSecondsDbl(mut_cpu), TimeToSecondsDbl(mut_elapsed),
- TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed));
- }
-
- statsFlush();
- statsClose();
+ /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */
+ statsPrintf(fmt1, GC_tot_alloc*(StgWord64)sizeof(W_));
+ statsPrintf(fmt2,
+ total_collections,
+ residency_samples == 0 ? 0 :
+ cumulative_residency*sizeof(W_)/residency_samples,
+ max_residency*sizeof(W_),
+ residency_samples,
+ (unsigned long)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)),
+ TimeToSecondsDbl(init_cpu), TimeToSecondsDbl(init_elapsed),
+ TimeToSecondsDbl(mut_cpu), TimeToSecondsDbl(mut_elapsed),
+ TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed));
+ }
+
+ statsFlush();
+ statsClose();
}
if (GC_coll_cpu) {
@@ -837,7 +837,7 @@ statDescribeGens(void)
W_ gen_live, gen_blocks;
bdescr *bd;
generation *gen;
-
+
debugBelch(
"----------------------------------------------------------\n"
" Gen Max Mut-list Blocks Large Live Slop\n"
@@ -893,7 +893,7 @@ statDescribeGens(void)
each compilation and expression evaluation.
-------------------------------------------------------------------------- */
-extern HsInt64 getAllocations( void )
+extern HsInt64 getAllocations( void )
{ return (HsInt64)GC_tot_alloc * sizeof(W_); }
/* EZY: I'm not convinced I got all the casting right. */
@@ -977,12 +977,12 @@ statsPrintf( char *s, ... )
{
FILE *sf = RtsFlags.GcFlags.statsFile;
va_list ap;
-
+
va_start(ap,s);
if (sf == NULL) {
- vdebugBelch(s,ap);
+ vdebugBelch(s,ap);
} else {
- vfprintf(sf, s, ap);
+ vfprintf(sf, s, ap);
}
va_end(ap);
}
@@ -992,7 +992,7 @@ statsFlush( void )
{
FILE *sf = RtsFlags.GcFlags.statsFile;
if (sf != NULL) {
- fflush(sf);
+ fflush(sf);
}
}
@@ -1001,6 +1001,6 @@ statsClose( void )
{
FILE *sf = RtsFlags.GcFlags.statsFile;
if (sf != NULL) {
- fclose(sf);
+ fclose(sf);
}
}
diff --git a/rts/Threads.c b/rts/Threads.c
index 0d0a3fc106..76e844a3f6 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -35,11 +35,11 @@ static StgThreadID next_thread_id = 1;
* RESERVED_STACK_WORDS (so we can get back from the stack overflow)
* + sizeofW(StgStopFrame) (the stg_stop_thread_info frame)
* + 1 (the closure to enter)
- * + 1 (stg_ap_v_ret)
- * + 1 (spare slot req'd by stg_ap_v_ret)
+ * + 1 (stg_ap_v_ret)
+ * + 1 (spare slot req'd by stg_ap_v_ret)
*
* A thread with this stack will bomb immediately with a stack
- * overflow, which will increase its stack size.
+ * overflow, which will increase its stack size.
*/
#define MIN_STACK_WORDS (RESERVED_STACK_WORDS + sizeofW(StgStopFrame) + 3)
@@ -106,7 +106,7 @@ createThread(Capability *cap, W_ size)
tso->saved_errno = 0;
tso->bound = NULL;
tso->cap = cap;
-
+
tso->stackobj = stack;
tso->tot_stack_size = stack->stack_size;
@@ -115,7 +115,7 @@ createThread(Capability *cap, W_ size)
#ifdef PROFILING
tso->prof.cccs = CCS_MAIN;
#endif
-
+
// put a stop frame on the stack
stack->sp -= sizeofW(StgStopFrame);
SET_HDR((StgClosure*)stack->sp,
@@ -128,7 +128,7 @@ createThread(Capability *cap, W_ size)
tso->global_link = g0->threads;
g0->threads = tso;
RELEASE_LOCK(&sched_mutex);
-
+
// ToDo: report the stack size in the event?
traceEventCreateThread(cap, tso);
@@ -143,11 +143,11 @@ createThread(Capability *cap, W_ size)
* ------------------------------------------------------------------------ */
int
-cmp_thread(StgPtr tso1, StgPtr tso2)
-{
- StgThreadID id1 = ((StgTSO *)tso1)->id;
+cmp_thread(StgPtr tso1, StgPtr tso2)
+{
+ StgThreadID id1 = ((StgTSO *)tso1)->id;
StgThreadID id2 = ((StgTSO *)tso2)->id;
-
+
if (id1 < id2) return (-1);
if (id1 > id2) return 1;
return 0;
@@ -159,7 +159,7 @@ cmp_thread(StgPtr tso1, StgPtr tso2)
* This is used in the implementation of Show for ThreadIds.
* ------------------------------------------------------------------------ */
int
-rts_getThreadId(StgPtr tso)
+rts_getThreadId(StgPtr tso)
{
return ((StgTSO *)tso)->id;
}
@@ -176,23 +176,23 @@ removeThreadFromQueue (Capability *cap, StgTSO **queue, StgTSO *tso)
prev = NULL;
for (t = *queue; t != END_TSO_QUEUE; prev = t, t = t->_link) {
- if (t == tso) {
- if (prev) {
- setTSOLink(cap,prev,t->_link);
+ if (t == tso) {
+ if (prev) {
+ setTSOLink(cap,prev,t->_link);
t->_link = END_TSO_QUEUE;
return rtsFalse;
- } else {
- *queue = t->_link;
+ } else {
+ *queue = t->_link;
t->_link = END_TSO_QUEUE;
return rtsTrue;
- }
- }
+ }
+ }
}
barf("removeThreadFromQueue: not found");
}
rtsBool // returns True if we modified head or tail
-removeThreadFromDeQueue (Capability *cap,
+removeThreadFromDeQueue (Capability *cap,
StgTSO **head, StgTSO **tail, StgTSO *tso)
{
StgTSO *t, *prev;
@@ -200,26 +200,26 @@ removeThreadFromDeQueue (Capability *cap,
prev = NULL;
for (t = *head; t != END_TSO_QUEUE; prev = t, t = t->_link) {
- if (t == tso) {
- if (prev) {
- setTSOLink(cap,prev,t->_link);
+ if (t == tso) {
+ if (prev) {
+ setTSOLink(cap,prev,t->_link);
flag = rtsFalse;
- } else {
- *head = t->_link;
+ } else {
+ *head = t->_link;
flag = rtsTrue;
- }
+ }
t->_link = END_TSO_QUEUE;
if (*tail == tso) {
- if (prev) {
- *tail = prev;
- } else {
- *tail = END_TSO_QUEUE;
- }
+ if (prev) {
+ *tail = prev;
+ } else {
+ *tail = END_TSO_QUEUE;
+ }
return rtsTrue;
- } else {
+ } else {
return flag;
}
- }
+ }
}
barf("removeThreadFromDeQueue: not found");
}
@@ -268,7 +268,7 @@ tryWakeupThread (Capability *cap, StgTSO *tso)
case BlockedOnMsgThrowTo:
{
const StgInfoTable *i;
-
+
i = lockClosure(tso->block_info.closure);
unlockClosure(tso->block_info.closure, i);
if (i != &stg_MSG_NULL_info) {
@@ -343,7 +343,7 @@ wakeBlockingQueue(Capability *cap, StgBlockingQueue *bq)
ASSERT(bq->header.info == &stg_BLOCKING_QUEUE_DIRTY_info ||
bq->header.info == &stg_BLOCKING_QUEUE_CLEAN_info );
- for (msg = bq->queue; msg != (MessageBlackHole*)END_TSO_QUEUE;
+ for (msg = bq->queue; msg != (MessageBlackHole*)END_TSO_QUEUE;
msg = msg->link) {
i = msg->header.info;
if (i != &stg_IND_info) {
@@ -377,7 +377,7 @@ checkBlockingQueues (Capability *cap, StgTSO *tso)
debugTraceCap(DEBUG_sched, cap,
"collision occurred; checking blocking queues for thread %ld",
(W_)tso->id);
-
+
for (bq = tso->bq; bq != (StgBlockingQueue*)END_TSO_QUEUE; bq = next) {
next = bq->link;
@@ -386,14 +386,14 @@ checkBlockingQueues (Capability *cap, StgTSO *tso)
// traversing this IND multiple times.
continue;
}
-
+
p = bq->bh;
if (p->header.info != &stg_BLACKHOLE_info ||
((StgInd *)p)->indirectee != (StgClosure*)bq)
{
wakeBlockingQueue(cap,bq);
- }
+ }
}
}
@@ -420,7 +420,7 @@ updateThunk (Capability *cap, StgTSO *tso, StgClosure *thunk, StgClosure *val)
updateWithIndirection(cap, thunk, val);
return;
}
-
+
v = ((StgInd*)thunk)->indirectee;
updateWithIndirection(cap, thunk, val);
@@ -457,7 +457,7 @@ updateThunk (Capability *cap, StgTSO *tso, StgClosure *thunk, StgClosure *val)
* rtsSupportsBoundThreads(): is the RTS built to support bound threads?
* used by Control.Concurrent for error checking.
* ------------------------------------------------------------------------- */
-
+
HsBool
rtsSupportsBoundThreads(void)
{
@@ -471,7 +471,7 @@ rtsSupportsBoundThreads(void)
/* ---------------------------------------------------------------------------
* isThreadBound(tso): check whether tso is bound to an OS thread.
* ------------------------------------------------------------------------- */
-
+
StgBool
isThreadBound(StgTSO* tso USED_IF_THREADS)
{
@@ -558,7 +558,7 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
// we squeezed is not enough to run the thread, we'll come back
// here (no squeezing will have occurred and thus we'll enlarge the
// stack.)
- if ((tso->flags & TSO_SQUEEZED) &&
+ if ((tso->flags & TSO_SQUEEZED) &&
((W_)(tso->stackobj->sp - tso->stackobj->stack) >= BLOCK_SIZE_W)) {
return;
}
@@ -787,7 +787,7 @@ printThreadBlockage(StgTSO *tso)
debugBelch("is blocked on atomic MVar read @ %p", tso->block_info.closure);
break;
case BlockedOnBlackHole:
- debugBelch("is blocked on a black hole %p",
+ debugBelch("is blocked on a black hole %p",
((StgBlockingQueue*)tso->block_info.bh->bh));
break;
case BlockedOnMsgThrowTo:
@@ -810,7 +810,7 @@ printThreadBlockage(StgTSO *tso)
break;
default:
barf("printThreadBlockage: strange tso->why_blocked: %d for TSO %d (%d)",
- tso->why_blocked, tso->id, tso);
+ tso->why_blocked, tso->id, tso);
}
}
@@ -824,19 +824,19 @@ printThreadStatus(StgTSO *t)
if (label) debugBelch("[\"%s\"] ",(char *)label);
}
switch (t->what_next) {
- case ThreadKilled:
- debugBelch("has been killed");
- break;
- case ThreadComplete:
- debugBelch("has completed");
- break;
- default:
- printThreadBlockage(t);
- }
+ case ThreadKilled:
+ debugBelch("has been killed");
+ break;
+ case ThreadComplete:
+ debugBelch("has completed");
+ break;
+ default:
+ printThreadBlockage(t);
+ }
if (t->dirty) {
debugBelch(" (TSO_DIRTY)");
}
- debugBelch("\n");
+ debugBelch("\n");
}
void
@@ -852,7 +852,7 @@ printAllThreads(void)
cap = capabilities[i];
debugBelch("threads on capability %d:\n", cap->no);
for (t = cap->run_queue_hd; t != END_TSO_QUEUE; t = t->_link) {
- printThreadStatus(t);
+ printThreadStatus(t);
}
}
@@ -860,7 +860,7 @@ printAllThreads(void)
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
for (t = generations[g].threads; t != END_TSO_QUEUE; t = next) {
if (t->why_blocked != NotBlocked) {
- printThreadStatus(t);
+ printThreadStatus(t);
}
next = t->global_link;
}
@@ -868,13 +868,13 @@ printAllThreads(void)
}
// useful from gdb
-void
+void
printThreadQueue(StgTSO *t)
{
nat i = 0;
for (; t != END_TSO_QUEUE; t = t->_link) {
- printThreadStatus(t);
- i++;
+ printThreadStatus(t);
+ i++;
}
debugBelch("%d threads on queue\n", i);
}
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c
index b07a886eab..a053dc3b4e 100644
--- a/rts/sm/Compact.c
+++ b/rts/sm/Compact.c
@@ -6,7 +6,7 @@
*
* Documentation on the architecture of the Garbage Collector can be
* found in the online commentary:
- *
+ *
* http://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
*
* ---------------------------------------------------------------------------*/
@@ -56,7 +56,7 @@
pointer-tagging tag bits on each pointer during the
threading/unthreading process.
- Our solution is as follows:
+ Our solution is as follows:
- an info pointer (chain length zero) is identified by having tag 0
- in a threaded chain of length > 0:
- the pointer-tagging tag bits are attached to the info pointer
@@ -83,16 +83,16 @@ thread (StgClosure **p)
// It doesn't look like a closure at the moment, because the info
// ptr is possibly threaded:
// ASSERT(LOOKS_LIKE_CLOSURE_PTR(q));
-
+
if (HEAP_ALLOCED(q)) {
- bd = Bdescr(q);
+ bd = Bdescr(q);
- if (bd->flags & BF_MARKED)
+ if (bd->flags & BF_MARKED)
{
iptr = *q;
switch (GET_CLOSURE_TAG((StgClosure *)iptr))
{
- case 0:
+ case 0:
// this is the info pointer; we are creating a new chain.
// save the original tag at the end of the chain.
*p = (StgClosure *)((StgWord)iptr + GET_CLOSURE_TAG(q0));
@@ -157,11 +157,11 @@ STATIC_INLINE StgWord
get_threaded_info( StgPtr p )
{
StgWord q;
-
+
q = (W_)GET_INFO(UNTAG_CLOSURE((StgClosure *)p));
loop:
- switch (GET_CLOSURE_TAG((StgClosure *)q))
+ switch (GET_CLOSURE_TAG((StgClosure *)q))
{
case 0:
ASSERT(LOOKS_LIKE_INFO_PTR(q));
@@ -186,7 +186,7 @@ STATIC_INLINE void
move(StgPtr to, StgPtr from, StgWord size)
{
for(; size > 0; --size) {
- *to++ = *from++;
+ *to++ = *from++;
}
}
@@ -196,29 +196,29 @@ thread_static( StgClosure* p )
const StgInfoTable *info;
// keep going until we've threaded all the objects on the linked
- // list...
+ // list...
while (p != END_OF_STATIC_LIST) {
info = get_itbl(p);
switch (info->type) {
-
+
case IND_STATIC:
- thread(&((StgInd *)p)->indirectee);
- p = *IND_STATIC_LINK(p);
- continue;
-
+ thread(&((StgInd *)p)->indirectee);
+ p = *IND_STATIC_LINK(p);
+ continue;
+
case THUNK_STATIC:
- p = *THUNK_STATIC_LINK(p);
- continue;
+ p = *THUNK_STATIC_LINK(p);
+ continue;
case FUN_STATIC:
- p = *FUN_STATIC_LINK(p);
- continue;
+ p = *FUN_STATIC_LINK(p);
+ continue;
case CONSTR_STATIC:
- p = *STATIC_LINK(info,p);
- continue;
-
+ p = *STATIC_LINK(info,p);
+ continue;
+
default:
- barf("thread_static: strange closure %d", (int)(info->type));
+ barf("thread_static: strange closure %d", (int)(info->type));
}
}
@@ -233,17 +233,17 @@ thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, StgWord size )
b = 0;
bitmap = large_bitmap->bitmap[b];
for (i = 0; i < size; ) {
- if ((bitmap & 1) == 0) {
- thread((StgClosure **)p);
- }
- i++;
- p++;
- if (i % BITS_IN(W_) == 0) {
- b++;
- bitmap = large_bitmap->bitmap[b];
- } else {
- bitmap = bitmap >> 1;
- }
+ if ((bitmap & 1) == 0) {
+ thread((StgClosure **)p);
+ }
+ i++;
+ p++;
+ if (i % BITS_IN(W_) == 0) {
+ b++;
+ bitmap = large_bitmap->bitmap[b];
+ } else {
+ bitmap = bitmap >> 1;
+ }
}
}
@@ -271,20 +271,20 @@ thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args)
p = (StgPtr)args;
switch (fun_info->f.fun_type) {
case ARG_GEN:
- bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
- size = BITMAP_SIZE(fun_info->f.b.bitmap);
- goto small_bitmap;
+ bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
+ size = BITMAP_SIZE(fun_info->f.b.bitmap);
+ goto small_bitmap;
case ARG_GEN_BIG:
- size = GET_FUN_LARGE_BITMAP(fun_info)->size;
- thread_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
- p += size;
- break;
+ size = GET_FUN_LARGE_BITMAP(fun_info)->size;
+ thread_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
+ p += size;
+ break;
default:
- bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
- size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]);
+ bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
+ size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]);
small_bitmap:
p = thread_small_bitmap(p, size, bitmap);
- break;
+ break;
}
return p;
}
@@ -295,74 +295,74 @@ thread_stack(StgPtr p, StgPtr stack_end)
const StgRetInfoTable* info;
StgWord bitmap;
StgWord size;
-
+
// highly similar to scavenge_stack, but we do pointer threading here.
-
+
while (p < stack_end) {
- // *p must be the info pointer of an activation
- // record. All activation records have 'bitmap' style layout
- // info.
- //
- info = get_ret_itbl((StgClosure *)p);
-
- switch (info->i.type) {
-
+ // *p must be the info pointer of an activation
+ // record. All activation records have 'bitmap' style layout
+ // info.
+ //
+ info = get_ret_itbl((StgClosure *)p);
+
+ switch (info->i.type) {
+
// small bitmap (<= 32 entries, or 64 on a 64-bit machine)
case CATCH_RETRY_FRAME:
case CATCH_STM_FRAME:
case ATOMICALLY_FRAME:
- case UPDATE_FRAME:
+ case UPDATE_FRAME:
case UNDERFLOW_FRAME:
case STOP_FRAME:
case CATCH_FRAME:
- case RET_SMALL:
- bitmap = BITMAP_BITS(info->i.layout.bitmap);
- size = BITMAP_SIZE(info->i.layout.bitmap);
- p++;
- // NOTE: the payload starts immediately after the info-ptr, we
- // don't have an StgHeader in the same sense as a heap closure.
+ case RET_SMALL:
+ bitmap = BITMAP_BITS(info->i.layout.bitmap);
+ size = BITMAP_SIZE(info->i.layout.bitmap);
+ p++;
+ // NOTE: the payload starts immediately after the info-ptr, we
+ // don't have an StgHeader in the same sense as a heap closure.
p = thread_small_bitmap(p, size, bitmap);
- continue;
-
- case RET_BCO: {
- StgBCO *bco;
-
- p++;
- bco = (StgBCO *)*p;
- thread((StgClosure **)p);
- p++;
- size = BCO_BITMAP_SIZE(bco);
- thread_large_bitmap(p, BCO_BITMAP(bco), size);
- p += size;
- continue;
- }
-
- // large bitmap (> 32 entries, or 64 on a 64-bit machine)
- case RET_BIG:
- p++;
- size = GET_LARGE_BITMAP(&info->i)->size;
- thread_large_bitmap(p, GET_LARGE_BITMAP(&info->i), size);
- p += size;
- continue;
-
- case RET_FUN:
- {
- StgRetFun *ret_fun = (StgRetFun *)p;
- StgFunInfoTable *fun_info;
-
- fun_info = FUN_INFO_PTR_TO_STRUCT((StgInfoTable *)UNTAG_CLOSURE((StgClosure *)
+ continue;
+
+ case RET_BCO: {
+ StgBCO *bco;
+
+ p++;
+ bco = (StgBCO *)*p;
+ thread((StgClosure **)p);
+ p++;
+ size = BCO_BITMAP_SIZE(bco);
+ thread_large_bitmap(p, BCO_BITMAP(bco), size);
+ p += size;
+ continue;
+ }
+
+ // large bitmap (> 32 entries, or 64 on a 64-bit machine)
+ case RET_BIG:
+ p++;
+ size = GET_LARGE_BITMAP(&info->i)->size;
+ thread_large_bitmap(p, GET_LARGE_BITMAP(&info->i), size);
+ p += size;
+ continue;
+
+ case RET_FUN:
+ {
+ StgRetFun *ret_fun = (StgRetFun *)p;
+ StgFunInfoTable *fun_info;
+
+ fun_info = FUN_INFO_PTR_TO_STRUCT((StgInfoTable *)UNTAG_CLOSURE((StgClosure *)
get_threaded_info((StgPtr)ret_fun->fun)));
- // *before* threading it!
- thread(&ret_fun->fun);
- p = thread_arg_block(fun_info, ret_fun->payload);
- continue;
- }
-
- default:
- barf("thread_stack: weird activation record found on stack: %d",
- (int)(info->i.type));
- }
+ // *before* threading it!
+ thread(&ret_fun->fun);
+ p = thread_arg_block(fun_info, ret_fun->payload);
+ continue;
+ }
+
+ default:
+ barf("thread_stack: weird activation record found on stack: %d",
+ (int)(info->i.type));
+ }
}
}
@@ -381,21 +381,21 @@ thread_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size)
switch (fun_info->f.fun_type) {
case ARG_GEN:
- bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
- goto small_bitmap;
+ bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
+ goto small_bitmap;
case ARG_GEN_BIG:
- thread_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
- p += size;
- break;
+ thread_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
+ p += size;
+ break;
case ARG_BCO:
- thread_large_bitmap((StgPtr)payload, BCO_BITMAP(fun), size);
- p += size;
- break;
+ thread_large_bitmap((StgPtr)payload, BCO_BITMAP(fun), size);
+ p += size;
+ break;
default:
- bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
+ bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
small_bitmap:
p = thread_small_bitmap(p, size, bitmap);
- break;
+ break;
}
return p;
@@ -409,7 +409,7 @@ thread_PAP (StgPAP *pap)
thread(&pap->fun);
return p;
}
-
+
STATIC_INLINE StgPtr
thread_AP (StgAP *ap)
{
@@ -417,7 +417,7 @@ thread_AP (StgAP *ap)
p = thread_PAP_payload(ap->fun, ap->payload, ap->n_args);
thread(&ap->fun);
return p;
-}
+}
STATIC_INLINE StgPtr
thread_AP_STACK (StgAP_STACK *ap)
@@ -435,15 +435,15 @@ thread_TSO (StgTSO *tso)
if ( tso->why_blocked == BlockedOnMVar
|| tso->why_blocked == BlockedOnMVarRead
- || tso->why_blocked == BlockedOnBlackHole
- || tso->why_blocked == BlockedOnMsgThrowTo
+ || tso->why_blocked == BlockedOnBlackHole
+ || tso->why_blocked == BlockedOnMsgThrowTo
|| tso->why_blocked == NotBlocked
) {
- thread_(&tso->block_info.closure);
+ thread_(&tso->block_info.closure);
}
thread_(&tso->blocked_exceptions);
thread_(&tso->bq);
-
+
thread_(&tso->trec);
thread_(&tso->stackobj);
@@ -469,14 +469,14 @@ update_fwd_large( bdescr *bd )
switch (info->type) {
case ARR_WORDS:
- // nothing to follow
+ // nothing to follow
continue;
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- // follow everything
+ // follow everything
{
StgMutArrPtrs *a;
@@ -491,7 +491,7 @@ update_fwd_large( bdescr *bd )
case SMALL_MUT_ARR_PTRS_DIRTY:
case SMALL_MUT_ARR_PTRS_FROZEN:
case SMALL_MUT_ARR_PTRS_FROZEN0:
- // follow everything
+ // follow everything
{
StgSmallMutArrPtrs *a;
@@ -510,25 +510,25 @@ update_fwd_large( bdescr *bd )
}
case AP_STACK:
- thread_AP_STACK((StgAP_STACK *)p);
- continue;
+ thread_AP_STACK((StgAP_STACK *)p);
+ continue;
case PAP:
- thread_PAP((StgPAP *)p);
- continue;
+ thread_PAP((StgPAP *)p);
+ continue;
case TREC_CHUNK:
{
StgWord i;
StgTRecChunk *tc = (StgTRecChunk *)p;
- TRecEntry *e = &(tc -> entries[0]);
- thread_(&tc->prev_chunk);
- for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
- thread_(&e->tvar);
- thread(&e->expected_value);
- thread(&e->new_value);
- }
- continue;
+ TRecEntry *e = &(tc -> entries[0]);
+ thread_(&tc->prev_chunk);
+ for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
+ thread_(&e->tvar);
+ thread(&e->expected_value);
+ thread(&e->new_value);
+ }
+ continue;
}
default:
@@ -543,66 +543,66 @@ thread_obj (StgInfoTable *info, StgPtr p)
{
switch (info->type) {
case THUNK_0_1:
- return p + sizeofW(StgThunk) + 1;
+ return p + sizeofW(StgThunk) + 1;
case FUN_0_1:
case CONSTR_0_1:
- return p + sizeofW(StgHeader) + 1;
-
+ return p + sizeofW(StgHeader) + 1;
+
case FUN_1_0:
case CONSTR_1_0:
- thread(&((StgClosure *)p)->payload[0]);
- return p + sizeofW(StgHeader) + 1;
-
+ thread(&((StgClosure *)p)->payload[0]);
+ return p + sizeofW(StgHeader) + 1;
+
case THUNK_1_0:
- thread(&((StgThunk *)p)->payload[0]);
- return p + sizeofW(StgThunk) + 1;
-
+ thread(&((StgThunk *)p)->payload[0]);
+ return p + sizeofW(StgThunk) + 1;
+
case THUNK_0_2:
- return p + sizeofW(StgThunk) + 2;
+ return p + sizeofW(StgThunk) + 2;
case FUN_0_2:
case CONSTR_0_2:
- return p + sizeofW(StgHeader) + 2;
-
+ return p + sizeofW(StgHeader) + 2;
+
case THUNK_1_1:
- thread(&((StgThunk *)p)->payload[0]);
- return p + sizeofW(StgThunk) + 2;
+ thread(&((StgThunk *)p)->payload[0]);
+ return p + sizeofW(StgThunk) + 2;
case FUN_1_1:
case CONSTR_1_1:
- thread(&((StgClosure *)p)->payload[0]);
- return p + sizeofW(StgHeader) + 2;
-
+ thread(&((StgClosure *)p)->payload[0]);
+ return p + sizeofW(StgHeader) + 2;
+
case THUNK_2_0:
- thread(&((StgThunk *)p)->payload[0]);
- thread(&((StgThunk *)p)->payload[1]);
- return p + sizeofW(StgThunk) + 2;
+ thread(&((StgThunk *)p)->payload[0]);
+ thread(&((StgThunk *)p)->payload[1]);
+ return p + sizeofW(StgThunk) + 2;
case FUN_2_0:
case CONSTR_2_0:
- thread(&((StgClosure *)p)->payload[0]);
- thread(&((StgClosure *)p)->payload[1]);
- return p + sizeofW(StgHeader) + 2;
-
+ thread(&((StgClosure *)p)->payload[0]);
+ thread(&((StgClosure *)p)->payload[1]);
+ return p + sizeofW(StgHeader) + 2;
+
case BCO: {
- StgBCO *bco = (StgBCO *)p;
- thread_(&bco->instrs);
- thread_(&bco->literals);
- thread_(&bco->ptrs);
- return p + bco_sizeW(bco);
+ StgBCO *bco = (StgBCO *)p;
+ thread_(&bco->instrs);
+ thread_(&bco->literals);
+ thread_(&bco->ptrs);
+ return p + bco_sizeW(bco);
}
case THUNK:
{
- StgPtr end;
-
- end = (P_)((StgThunk *)p)->payload +
- info->layout.payload.ptrs;
- for (p = (P_)((StgThunk *)p)->payload; p < end; p++) {
- thread((StgClosure **)p);
- }
- return p + info->layout.payload.nptrs;
+ StgPtr end;
+
+ end = (P_)((StgThunk *)p)->payload +
+ info->layout.payload.ptrs;
+ for (p = (P_)((StgThunk *)p)->payload; p < end; p++) {
+ thread((StgClosure **)p);
+ }
+ return p + info->layout.payload.nptrs;
}
case FUN:
@@ -615,98 +615,98 @@ thread_obj (StgInfoTable *info, StgPtr p)
case BLACKHOLE:
case BLOCKING_QUEUE:
{
- StgPtr end;
-
- end = (P_)((StgClosure *)p)->payload +
- info->layout.payload.ptrs;
- for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
- thread((StgClosure **)p);
- }
- return p + info->layout.payload.nptrs;
+ StgPtr end;
+
+ end = (P_)((StgClosure *)p)->payload +
+ info->layout.payload.ptrs;
+ for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
+ thread((StgClosure **)p);
+ }
+ return p + info->layout.payload.nptrs;
}
-
+
case WEAK:
{
- StgWeak *w = (StgWeak *)p;
- thread(&w->cfinalizers);
- thread(&w->key);
- thread(&w->value);
- thread(&w->finalizer);
- if (w->link != NULL) {
- thread_(&w->link);
- }
- return p + sizeofW(StgWeak);
+ StgWeak *w = (StgWeak *)p;
+ thread(&w->cfinalizers);
+ thread(&w->key);
+ thread(&w->value);
+ thread(&w->finalizer);
+ if (w->link != NULL) {
+ thread_(&w->link);
+ }
+ return p + sizeofW(StgWeak);
}
-
+
case MVAR_CLEAN:
case MVAR_DIRTY:
- {
- StgMVar *mvar = (StgMVar *)p;
- thread_(&mvar->head);
- thread_(&mvar->tail);
- thread(&mvar->value);
- return p + sizeofW(StgMVar);
+ {
+ StgMVar *mvar = (StgMVar *)p;
+ thread_(&mvar->head);
+ thread_(&mvar->tail);
+ thread(&mvar->value);
+ return p + sizeofW(StgMVar);
}
-
+
case IND:
case IND_PERM:
- thread(&((StgInd *)p)->indirectee);
- return p + sizeofW(StgInd);
+ thread(&((StgInd *)p)->indirectee);
+ return p + sizeofW(StgInd);
case THUNK_SELECTOR:
- {
- StgSelector *s = (StgSelector *)p;
- thread(&s->selectee);
- return p + THUNK_SELECTOR_sizeW();
+ {
+ StgSelector *s = (StgSelector *)p;
+ thread(&s->selectee);
+ return p + THUNK_SELECTOR_sizeW();
}
-
+
case AP_STACK:
- return thread_AP_STACK((StgAP_STACK *)p);
-
+ return thread_AP_STACK((StgAP_STACK *)p);
+
case PAP:
- return thread_PAP((StgPAP *)p);
+ return thread_PAP((StgPAP *)p);
case AP:
- return thread_AP((StgAP *)p);
-
+ return thread_AP((StgAP *)p);
+
case ARR_WORDS:
- return p + arr_words_sizeW((StgArrWords *)p);
-
+ return p + arr_words_sizeW((StgArrWords *)p);
+
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- // follow everything
+ // follow everything
{
StgMutArrPtrs *a;
a = (StgMutArrPtrs *)p;
- for (p = (P_)a->payload; p < (P_)&a->payload[a->ptrs]; p++) {
- thread((StgClosure **)p);
- }
+ for (p = (P_)a->payload; p < (P_)&a->payload[a->ptrs]; p++) {
+ thread((StgClosure **)p);
+ }
- return (StgPtr)a + mut_arr_ptrs_sizeW(a);
+ return (StgPtr)a + mut_arr_ptrs_sizeW(a);
}
case SMALL_MUT_ARR_PTRS_CLEAN:
case SMALL_MUT_ARR_PTRS_DIRTY:
case SMALL_MUT_ARR_PTRS_FROZEN:
case SMALL_MUT_ARR_PTRS_FROZEN0:
- // follow everything
+ // follow everything
{
StgSmallMutArrPtrs *a;
a = (StgSmallMutArrPtrs *)p;
- for (p = (P_)a->payload; p < (P_)&a->payload[a->ptrs]; p++) {
- thread((StgClosure **)p);
- }
+ for (p = (P_)a->payload; p < (P_)&a->payload[a->ptrs]; p++) {
+ thread((StgClosure **)p);
+ }
- return (StgPtr)a + small_mut_arr_ptrs_sizeW(a);
+ return (StgPtr)a + small_mut_arr_ptrs_sizeW(a);
}
-
+
case TSO:
- return thread_TSO((StgTSO *)p);
-
+ return thread_TSO((StgTSO *)p);
+
case STACK:
{
StgStack *stack = (StgStack*)p;
@@ -718,19 +718,19 @@ thread_obj (StgInfoTable *info, StgPtr p)
{
StgWord i;
StgTRecChunk *tc = (StgTRecChunk *)p;
- TRecEntry *e = &(tc -> entries[0]);
- thread_(&tc->prev_chunk);
- for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
- thread_(&e->tvar);
- thread(&e->expected_value);
- thread(&e->new_value);
- }
- return p + sizeofW(StgTRecChunk);
+ TRecEntry *e = &(tc -> entries[0]);
+ thread_(&tc->prev_chunk);
+ for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
+ thread_(&e->tvar);
+ thread(&e->expected_value);
+ thread(&e->new_value);
+ }
+ return p + sizeofW(StgTRecChunk);
}
default:
- barf("update_fwd: unknown/strange object %d", (int)(info->type));
- return NULL;
+ barf("update_fwd: unknown/strange object %d", (int)(info->type));
+ return NULL;
}
}
@@ -745,16 +745,16 @@ update_fwd( bdescr *blocks )
// cycle through all the blocks in the step
for (; bd != NULL; bd = bd->link) {
- p = bd->start;
-
- // linearly scan the objects in this block
- while (p < bd->free) {
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
- info = get_itbl((StgClosure *)p);
- p = thread_obj(info, p);
- }
+ p = bd->start;
+
+ // linearly scan the objects in this block
+ while (p < bd->free) {
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
+ info = get_itbl((StgClosure *)p);
+ p = thread_obj(info, p);
+ }
}
-}
+}
static void
update_fwd_compact( bdescr *blocks )
@@ -774,70 +774,70 @@ update_fwd_compact( bdescr *blocks )
// cycle through all the blocks in the step
for (; bd != NULL; bd = bd->link) {
- p = bd->start;
+ p = bd->start;
- while (p < bd->free ) {
+ while (p < bd->free ) {
- while ( p < bd->free && !is_marked(p,bd) ) {
- p++;
- }
- if (p >= bd->free) {
- break;
- }
+ while ( p < bd->free && !is_marked(p,bd) ) {
+ p++;
+ }
+ if (p >= bd->free) {
+ break;
+ }
#if 0
next:
- m = * ((StgPtr)bd->u.bitmap + ((p - bd->start) / (BITS_IN(StgWord))));
- m >>= ((p - bd->start) & (BITS_IN(StgWord) - 1));
-
- while ( p < bd->free ) {
-
- if ((m & 1) == 0) {
- m >>= 1;
- p++;
- if (((StgWord)p & (sizeof(W_) * BITS_IN(StgWord))) == 0) {
- goto next;
- } else {
- continue;
- }
- }
+ m = * ((StgPtr)bd->u.bitmap + ((p - bd->start) / (BITS_IN(StgWord))));
+ m >>= ((p - bd->start) & (BITS_IN(StgWord) - 1));
+
+ while ( p < bd->free ) {
+
+ if ((m & 1) == 0) {
+ m >>= 1;
+ p++;
+ if (((StgWord)p & (sizeof(W_) * BITS_IN(StgWord))) == 0) {
+ goto next;
+ } else {
+ continue;
+ }
+ }
#endif
- // Problem: we need to know the destination for this cell
- // in order to unthread its info pointer. But we can't
- // know the destination without the size, because we may
- // spill into the next block. So we have to run down the
- // threaded list and get the info ptr first.
+ // Problem: we need to know the destination for this cell
+ // in order to unthread its info pointer. But we can't
+ // know the destination without the size, because we may
+ // spill into the next block. So we have to run down the
+ // threaded list and get the info ptr first.
//
// ToDo: one possible avenue of attack is to use the fact
// that if (p&BLOCK_MASK) >= (free&BLOCK_MASK), then we
// definitely have enough room. Also see bug #1147.
iptr = get_threaded_info(p);
- info = INFO_PTR_TO_STRUCT((StgInfoTable *)UNTAG_CLOSURE((StgClosure *)iptr));
-
- q = p;
-
- p = thread_obj(info, p);
-
- size = p - q;
- if (free + size > free_bd->start + BLOCK_SIZE_W) {
- // set the next bit in the bitmap to indicate that
- // this object needs to be pushed into the next
- // block. This saves us having to run down the
- // threaded info pointer list twice during the next pass.
- mark(q+1,bd);
- free_bd = free_bd->link;
- free = free_bd->start;
- } else {
- ASSERT(!is_marked(q+1,bd));
- }
-
- unthread(q,(StgWord)free + GET_CLOSURE_TAG((StgClosure *)iptr));
- free += size;
+ info = INFO_PTR_TO_STRUCT((StgInfoTable *)UNTAG_CLOSURE((StgClosure *)iptr));
+
+ q = p;
+
+ p = thread_obj(info, p);
+
+ size = p - q;
+ if (free + size > free_bd->start + BLOCK_SIZE_W) {
+ // set the next bit in the bitmap to indicate that
+ // this object needs to be pushed into the next
+ // block. This saves us having to run down the
+ // threaded info pointer list twice during the next pass.
+ mark(q+1,bd);
+ free_bd = free_bd->link;
+ free = free_bd->start;
+ } else {
+ ASSERT(!is_marked(q+1,bd));
+ }
+
+ unthread(q,(StgWord)free + GET_CLOSURE_TAG((StgClosure *)iptr));
+ free += size;
#if 0
- goto next;
+ goto next;
#endif
- }
+ }
}
}
@@ -860,71 +860,71 @@ update_bkwd_compact( generation *gen )
// cycle through all the blocks in the step
for (; bd != NULL; bd = bd->link) {
- p = bd->start;
+ p = bd->start;
- while (p < bd->free ) {
+ while (p < bd->free ) {
- while ( p < bd->free && !is_marked(p,bd) ) {
- p++;
- }
- if (p >= bd->free) {
- break;
- }
+ while ( p < bd->free && !is_marked(p,bd) ) {
+ p++;
+ }
+ if (p >= bd->free) {
+ break;
+ }
#if 0
next:
- m = * ((StgPtr)bd->u.bitmap + ((p - bd->start) / (BITS_IN(StgWord))));
- m >>= ((p - bd->start) & (BITS_IN(StgWord) - 1));
-
- while ( p < bd->free ) {
-
- if ((m & 1) == 0) {
- m >>= 1;
- p++;
- if (((StgWord)p & (sizeof(W_) * BITS_IN(StgWord))) == 0) {
- goto next;
- } else {
- continue;
- }
- }
+ m = * ((StgPtr)bd->u.bitmap + ((p - bd->start) / (BITS_IN(StgWord))));
+ m >>= ((p - bd->start) & (BITS_IN(StgWord) - 1));
+
+ while ( p < bd->free ) {
+
+ if ((m & 1) == 0) {
+ m >>= 1;
+ p++;
+ if (((StgWord)p & (sizeof(W_) * BITS_IN(StgWord))) == 0) {
+ goto next;
+ } else {
+ continue;
+ }
+ }
#endif
- if (is_marked(p+1,bd)) {
- // don't forget to update the free ptr in the block desc.
- free_bd->free = free;
- free_bd = free_bd->link;
- free = free_bd->start;
- free_blocks++;
- }
+ if (is_marked(p+1,bd)) {
+ // don't forget to update the free ptr in the block desc.
+ free_bd->free = free;
+ free_bd = free_bd->link;
+ free = free_bd->start;
+ free_blocks++;
+ }
iptr = get_threaded_info(p);
- unthread(p, (StgWord)free + GET_CLOSURE_TAG((StgClosure *)iptr));
- ASSERT(LOOKS_LIKE_INFO_PTR((StgWord)((StgClosure *)p)->header.info));
- info = get_itbl((StgClosure *)p);
- size = closure_sizeW_((StgClosure *)p,info);
+ unthread(p, (StgWord)free + GET_CLOSURE_TAG((StgClosure *)iptr));
+ ASSERT(LOOKS_LIKE_INFO_PTR((StgWord)((StgClosure *)p)->header.info));
+ info = get_itbl((StgClosure *)p);
+ size = closure_sizeW_((StgClosure *)p,info);
- if (free != p) {
- move(free,p,size);
- }
+ if (free != p) {
+ move(free,p,size);
+ }
- // relocate TSOs
+ // relocate TSOs
if (info->type == STACK) {
move_STACK((StgStack *)p, (StgStack *)free);
- }
+ }
- free += size;
- p += size;
+ free += size;
+ p += size;
#if 0
- goto next;
+ goto next;
#endif
- }
+ }
}
// free the remaining blocks and count what's left.
free_bd->free = free;
if (free_bd->link != NULL) {
- freeChain(free_bd->link);
- free_bd->link = NULL;
+ freeChain(free_bd->link);
+ free_bd->link = NULL;
}
return free_blocks;
@@ -976,16 +976,16 @@ compact(StgClosure *static_objects)
// the task list
{
- Task *task;
+ Task *task;
InCall *incall;
for (task = all_tasks; task != NULL; task = task->all_next) {
- for (incall = task->incall; incall != NULL;
+ for (incall = task->incall; incall != NULL;
incall = incall->prev_stack) {
if (incall->tso) {
thread_(&incall->tso);
}
}
- }
+ }
}
// the static objects
@@ -1011,16 +1011,16 @@ compact(StgClosure *static_objects)
if (g == RtsFlags.GcFlags.generations-1 && gen->old_blocks != NULL) {
debugTrace(DEBUG_gc, "update_fwd: %d (compact)", g);
update_fwd_compact(gen->old_blocks);
- }
+ }
}
// 3. update backward ptrs
gen = oldest_gen;
if (gen->old_blocks != NULL) {
- blocks = update_bkwd_compact(gen);
- debugTrace(DEBUG_gc,
- "update_bkwd: %d (compact, old: %d blocks, now %d blocks)",
- gen->no, gen->n_old_blocks, blocks);
- gen->n_old_blocks = blocks;
+ blocks = update_bkwd_compact(gen);
+ debugTrace(DEBUG_gc,
+ "update_bkwd: %d (compact, old: %d blocks, now %d blocks)",
+ gen->no, gen->n_old_blocks, blocks);
+ gen->n_old_blocks = blocks;
}
}
diff --git a/rts/sm/Compact.h b/rts/sm/Compact.h
index 1ec915f49a..db7a9694d2 100644
--- a/rts/sm/Compact.h
+++ b/rts/sm/Compact.h
@@ -6,7 +6,7 @@
*
* Documentation on the architecture of the Garbage Collector can be
* found in the online commentary:
- *
+ *
* http://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
*
* ---------------------------------------------------------------------------*/
@@ -16,22 +16,22 @@
#include "BeginPrivate.h"
-INLINE_HEADER void
+INLINE_HEADER void
mark(StgPtr p, bdescr *bd)
{
nat offset_within_block = p - bd->start; // in words
- StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
- (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
+ StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
+ (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
*bitmap_word |= bit_mask;
}
-INLINE_HEADER void
+INLINE_HEADER void
unmark(StgPtr p, bdescr *bd)
{
nat offset_within_block = p - bd->start; // in words
- StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
- (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
+ StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
+ (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
*bitmap_word &= ~bit_mask;
}
@@ -40,8 +40,8 @@ INLINE_HEADER StgWord
is_marked(StgPtr p, bdescr *bd)
{
nat offset_within_block = p - bd->start; // in words
- StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
- (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
+ StgPtr bitmap_word = (StgPtr)bd->u.bitmap +
+ (offset_within_block / (sizeof(W_)*BITS_PER_BYTE));
StgWord bit_mask = (StgWord)1 << (offset_within_block & (sizeof(W_)*BITS_PER_BYTE - 1));
return (*bitmap_word & bit_mask);
}
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index 4a550cdde5..b0ef807768 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -6,7 +6,7 @@
*
* Documentation on the architecture of the Garbage Collector can be
* found in the online commentary:
- *
+ *
* http://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
*
* ---------------------------------------------------------------------------*/
@@ -57,19 +57,19 @@ alloc_for_copy (nat size, nat gen_no)
StgPtr to;
gen_workspace *ws;
- /* Find out where we're going, using the handy "to" pointer in
+ /* Find out where we're going, using the handy "to" pointer in
* the gen of the source object. If it turns out we need to
* evacuate to an older generation, adjust it here (see comment
* by evacuate()).
*/
if (gen_no < gct->evac_gen_no) {
- if (gct->eager_promotion) {
+ if (gct->eager_promotion) {
gen_no = gct->evac_gen_no;
- } else {
- gct->failed_to_evac = rtsTrue;
- }
+ } else {
+ gct->failed_to_evac = rtsTrue;
+ }
}
-
+
ws = &gct->gens[gen_no]; // zero memory references here
/* chain a new block onto the to-space for the destination gen if
@@ -78,7 +78,7 @@ alloc_for_copy (nat size, nat gen_no)
to = ws->todo_free;
ws->todo_free += size;
if (ws->todo_free > ws->todo_lim) {
- to = todo_block_full(size, ws);
+ to = todo_block_full(size, ws);
}
ASSERT(ws->todo_free >= ws->todo_bd->free && ws->todo_free <= ws->todo_lim);
@@ -90,18 +90,18 @@ alloc_for_copy (nat size, nat gen_no)
-------------------------------------------------------------------------- */
STATIC_INLINE GNUC_ATTR_HOT void
-copy_tag(StgClosure **p, const StgInfoTable *info,
+copy_tag(StgClosure **p, const StgInfoTable *info,
StgClosure *src, nat size, nat gen_no, StgWord tag)
{
StgPtr to, from;
nat i;
to = alloc_for_copy(size,gen_no);
-
+
from = (StgPtr)src;
to[0] = (W_)info;
for (i = 1; i < size; i++) { // unroll for small i
- to[i] = from[i];
+ to[i] = from[i];
}
// if (to+size+2 < bd->start + BLOCK_SIZE_W) {
@@ -145,7 +145,7 @@ copy_tag(StgClosure **p, const StgInfoTable *info,
#if defined(PARALLEL_GC) && !defined(PROFILING)
STATIC_INLINE void
-copy_tag_nolock(StgClosure **p, const StgInfoTable *info,
+copy_tag_nolock(StgClosure **p, const StgInfoTable *info,
StgClosure *src, nat size, nat gen_no, StgWord tag)
{
StgPtr to, from;
@@ -156,7 +156,7 @@ copy_tag_nolock(StgClosure **p, const StgInfoTable *info,
from = (StgPtr)src;
to[0] = (W_)info;
for (i = 1; i < size; i++) { // unroll for small i
- to[i] = from[i];
+ to[i] = from[i];
}
// if somebody else reads the forwarding pointer, we better make
@@ -182,26 +182,26 @@ copy_tag_nolock(StgClosure **p, const StgInfoTable *info,
* used to optimise evacuation of TSOs.
*/
static rtsBool
-copyPart(StgClosure **p, StgClosure *src, nat size_to_reserve,
+copyPart(StgClosure **p, StgClosure *src, nat size_to_reserve,
nat size_to_copy, nat gen_no)
{
StgPtr to, from;
nat i;
StgWord info;
-
+
#if defined(PARALLEL_GC)
spin:
- info = xchg((StgPtr)&src->header.info, (W_)&stg_WHITEHOLE_info);
- if (info == (W_)&stg_WHITEHOLE_info) {
+ info = xchg((StgPtr)&src->header.info, (W_)&stg_WHITEHOLE_info);
+ if (info == (W_)&stg_WHITEHOLE_info) {
#ifdef PROF_SPIN
- whitehole_spin++;
+ whitehole_spin++;
#endif
- goto spin;
- }
+ goto spin;
+ }
if (IS_FORWARDING_PTR(info)) {
- src->header.info = (const StgInfoTable *)info;
- evacuate(p); // does the failed_to_evac stuff
- return rtsFalse;
+ src->header.info = (const StgInfoTable *)info;
+ evacuate(p); // does the failed_to_evac stuff
+ return rtsFalse;
}
#else
info = (W_)src->header.info;
@@ -212,20 +212,20 @@ spin:
from = (StgPtr)src;
to[0] = info;
for (i = 1; i < size_to_copy; i++) { // unroll for small i
- to[i] = from[i];
+ to[i] = from[i];
}
-
+
write_barrier();
src->header.info = (const StgInfoTable*)MK_FORWARDING_PTR(to);
*p = (StgClosure *)to;
-
+
#ifdef PROFILING
// We store the size of the just evacuated object in the LDV word so that
// the profiler can guess the position of the next object later.
SET_EVACUAEE_FOR_LDV(from, size_to_reserve);
// fill the slop
if (size_to_reserve - size_to_copy > 0)
- LDV_FILL_SLOP(to + size_to_copy, (int)(size_to_reserve - size_to_copy));
+ LDV_FILL_SLOP(to + size_to_copy, (int)(size_to_reserve - size_to_copy));
#endif
return rtsTrue;
@@ -234,7 +234,7 @@ spin:
/* Copy wrappers that don't tag the closure after copying */
STATIC_INLINE GNUC_ATTR_HOT void
-copy(StgClosure **p, const StgInfoTable *info,
+copy(StgClosure **p, const StgInfoTable *info,
StgClosure *src, nat size, nat gen_no)
{
copy_tag(p,info,src,size,gen_no,0);
@@ -258,35 +258,35 @@ evacuate_large(StgPtr p)
generation *gen, *new_gen;
nat gen_no, new_gen_no;
gen_workspace *ws;
-
+
bd = Bdescr(p);
gen = bd->gen;
gen_no = bd->gen_no;
ACQUIRE_SPIN_LOCK(&gen->sync);
- // already evacuated?
- if (bd->flags & BF_EVACUATED) {
+ // already evacuated?
+ if (bd->flags & BF_EVACUATED) {
/* Don't forget to set the gct->failed_to_evac flag if we didn't get
* the desired destination (see comments in evacuate()).
*/
if (gen_no < gct->evac_gen_no) {
- gct->failed_to_evac = rtsTrue;
- TICK_GC_FAILED_PROMOTION();
+ gct->failed_to_evac = rtsTrue;
+ TICK_GC_FAILED_PROMOTION();
}
RELEASE_SPIN_LOCK(&gen->sync);
return;
}
- // remove from large_object list
+ // remove from large_object list
if (bd->u.back) {
bd->u.back->link = bd->link;
- } else { // first object in the list
+ } else { // first object in the list
gen->large_objects = bd->link;
}
if (bd->link) {
bd->link->u.back = bd->u.back;
}
-
+
/* link it on to the evacuated large object list of the destination gen
*/
new_gen_no = bd->dest_no;
@@ -295,7 +295,7 @@ evacuate_large(StgPtr p)
if (gct->eager_promotion) {
new_gen_no = gct->evac_gen_no;
} else {
- gct->failed_to_evac = rtsTrue;
+ gct->failed_to_evac = rtsTrue;
}
}
@@ -333,9 +333,9 @@ evacuate_large(StgPtr p)
evacuating an object which resides in generation M when we're
collecting up to generation N
- if M >= gct->evac_gen
+ if M >= gct->evac_gen
if M > N do nothing
- else evac to gen->to
+ else evac to gen->to
if M < gct->evac_gen evac to gct->evac_gen, step 0
@@ -365,7 +365,7 @@ evacuate_large(StgPtr p)
extra reads/writes than we save.
------------------------------------------------------------------------- */
-REGPARM1 GNUC_ATTR_HOT void
+REGPARM1 GNUC_ATTR_HOT void
evacuate(StgClosure **p)
{
bdescr *bd = NULL;
@@ -391,11 +391,11 @@ loop:
switch (info->type) {
case THUNK_STATIC:
- if (info->srt_bitmap != 0) {
- if (*THUNK_STATIC_LINK((StgClosure *)q) == NULL) {
+ if (info->srt_bitmap != 0) {
+ if (*THUNK_STATIC_LINK((StgClosure *)q) == NULL) {
#ifndef THREADED_RTS
- *THUNK_STATIC_LINK((StgClosure *)q) = gct->static_objects;
- gct->static_objects = (StgClosure *)q;
+ *THUNK_STATIC_LINK((StgClosure *)q) = gct->static_objects;
+ gct->static_objects = (StgClosure *)q;
#else
StgPtr link;
link = (StgPtr)cas((StgPtr)THUNK_STATIC_LINK((StgClosure *)q),
@@ -405,13 +405,13 @@ loop:
gct->static_objects = (StgClosure *)q;
}
#endif
- }
- }
- return;
+ }
+ }
+ return;
case FUN_STATIC:
- if (info->srt_bitmap != 0 &&
- *FUN_STATIC_LINK((StgClosure *)q) == NULL) {
+ if (info->srt_bitmap != 0 &&
+ *FUN_STATIC_LINK((StgClosure *)q) == NULL) {
#ifndef THREADED_RTS
*FUN_STATIC_LINK((StgClosure *)q) = gct->static_objects;
gct->static_objects = (StgClosure *)q;
@@ -424,18 +424,18 @@ loop:
gct->static_objects = (StgClosure *)q;
}
#endif
- }
- return;
-
+ }
+ return;
+
case IND_STATIC:
- /* If q->saved_info != NULL, then it's a revertible CAF - it'll be
- * on the CAF list, so don't do anything with it here (we'll
- * scavenge it later).
- */
+ /* If q->saved_info != NULL, then it's a revertible CAF - it'll be
+ * on the CAF list, so don't do anything with it here (we'll
+ * scavenge it later).
+ */
if (*IND_STATIC_LINK((StgClosure *)q) == NULL) {
#ifndef THREADED_RTS
- *IND_STATIC_LINK((StgClosure *)q) = gct->static_objects;
- gct->static_objects = (StgClosure *)q;
+ *IND_STATIC_LINK((StgClosure *)q) = gct->static_objects;
+ gct->static_objects = (StgClosure *)q;
#else
StgPtr link;
link = (StgPtr)cas((StgPtr)IND_STATIC_LINK((StgClosure *)q),
@@ -445,11 +445,11 @@ loop:
gct->static_objects = (StgClosure *)q;
}
#endif
- }
- return;
-
+ }
+ return;
+
case CONSTR_STATIC:
- if (*STATIC_LINK(info,(StgClosure *)q) == NULL) {
+ if (*STATIC_LINK(info,(StgClosure *)q) == NULL) {
#ifndef THREADED_RTS
*STATIC_LINK(info,(StgClosure *)q) = gct->static_objects;
gct->static_objects = (StgClosure *)q;
@@ -466,15 +466,15 @@ loop:
/* I am assuming that static_objects pointers are not
* written to other objects, and thus, no need to retag. */
return;
-
+
case CONSTR_NOCAF_STATIC:
- /* no need to put these on the static linked list, they don't need
- * to be scavenged.
- */
- return;
-
+ /* no need to put these on the static linked list, they don't need
+ * to be scavenged.
+ */
+ return;
+
default:
- barf("evacuate(static): strange closure type %d", (int)(info->type));
+ barf("evacuate(static): strange closure type %d", (int)(info->type));
}
}
@@ -493,19 +493,19 @@ loop:
// whether it is already in the target generation. (this is
// the write barrier).
if (bd->gen_no < gct->evac_gen_no) {
- gct->failed_to_evac = rtsTrue;
- TICK_GC_FAILED_PROMOTION();
- }
- return;
+ gct->failed_to_evac = rtsTrue;
+ TICK_GC_FAILED_PROMOTION();
+ }
+ return;
}
/* evacuate large objects by re-linking them onto a different list.
*/
if (bd->flags & BF_LARGE) {
evacuate_large((P_)q);
- return;
+ return;
}
-
+
/* If the object is in a gen that we're compacting, then we
* need to use an alternative evacuate procedure.
*/
@@ -515,7 +515,7 @@ loop:
}
return;
}
-
+
gen_no = bd->dest_no;
info = q->header.info;
@@ -525,10 +525,10 @@ loop:
* HOWEVER: if the requested destination generation (gct->evac_gen) is
* older than the actual generation (because the object was
* already evacuated to a younger generation) then we have to
- * set the gct->failed_to_evac flag to indicate that we couldn't
+ * set the gct->failed_to_evac flag to indicate that we couldn't
* manage to promote the object to the desired generation.
*/
- /*
+ /*
* Optimisation: the check is fairly expensive, but we can often
* shortcut it if either the required generation is 0, or the
* current object (the EVACUATED) is in a high enough generation.
@@ -541,9 +541,9 @@ loop:
*p = TAG_CLOSURE(tag,e);
if (gen_no < gct->evac_gen_no) { // optimisation
if (Bdescr((P_)e)->gen_no < gct->evac_gen_no) {
- gct->failed_to_evac = rtsTrue;
- TICK_GC_FAILED_PROMOTION();
- }
+ gct->failed_to_evac = rtsTrue;
+ TICK_GC_FAILED_PROMOTION();
+ }
}
return;
}
@@ -554,29 +554,29 @@ loop:
goto loop;
// For ints and chars of low value, save space by replacing references to
- // these with closures with references to common, shared ones in the RTS.
+ // these with closures with references to common, shared ones in the RTS.
//
// * Except when compiling into Windows DLLs which don't support cross-package
- // data references very well.
+ // data references very well.
//
case CONSTR_0_1:
- {
+ {
#if defined(COMPILING_WINDOWS_DLL)
copy_tag_nolock(p,info,q,sizeofW(StgHeader)+1,gen_no,tag);
#else
StgWord w = (StgWord)q->payload[0];
if (info == Czh_con_info &&
- // unsigned, so always true: (StgChar)w >= MIN_CHARLIKE &&
- (StgChar)w <= MAX_CHARLIKE) {
- *p = TAG_CLOSURE(tag,
+ // unsigned, so always true: (StgChar)w >= MIN_CHARLIKE &&
+ (StgChar)w <= MAX_CHARLIKE) {
+ *p = TAG_CLOSURE(tag,
(StgClosure *)CHARLIKE_CLOSURE((StgChar)w)
- );
+ );
}
else if (info == Izh_con_info &&
- (StgInt)w >= MIN_INTLIKE && (StgInt)w <= MAX_INTLIKE) {
- *p = TAG_CLOSURE(tag,
- (StgClosure *)INTLIKE_CLOSURE((StgInt)w)
- );
+ (StgInt)w >= MIN_INTLIKE && (StgInt)w <= MAX_INTLIKE) {
+ *p = TAG_CLOSURE(tag,
+ (StgClosure *)INTLIKE_CLOSURE((StgInt)w)
+ );
}
else {
copy_tag_nolock(p,info,q,sizeofW(StgHeader)+1,gen_no,tag);
@@ -639,7 +639,7 @@ loop:
i = r->header.info;
}
if (i == &stg_TSO_info
- || i == &stg_WHITEHOLE_info
+ || i == &stg_WHITEHOLE_info
|| i == &stg_BLOCKING_QUEUE_CLEAN_info
|| i == &stg_BLOCKING_QUEUE_DIRTY_info) {
copy(p,info,q,sizeofW(StgInd),gen_no);
@@ -673,7 +673,7 @@ loop:
return;
case IND:
- // follow chains of indirections, don't evacuate them
+ // follow chains of indirections, don't evacuate them
q = ((StgInd*)q)->indirectee;
*p = q;
goto loop;
@@ -688,7 +688,7 @@ loop:
case CATCH_STM_FRAME:
case CATCH_RETRY_FRAME:
case ATOMICALLY_FRAME:
- // shouldn't see these
+ // shouldn't see these
barf("evacuate: stack frame at %p\n", q);
case PAP:
@@ -704,7 +704,7 @@ loop:
return;
case ARR_WORDS:
- // just copy the block
+ // just copy the block
copy(p,info,q,arr_words_sizeW((StgArrWords *)q),gen_no);
return;
@@ -712,7 +712,7 @@ loop:
case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- // just copy the block
+ // just copy the block
copy(p,info,q,mut_arr_ptrs_sizeW((StgMutArrPtrs *)q),gen_no);
return;
@@ -720,7 +720,7 @@ loop:
case SMALL_MUT_ARR_PTRS_DIRTY:
case SMALL_MUT_ARR_PTRS_FROZEN:
case SMALL_MUT_ARR_PTRS_FROZEN0:
- // just copy the block
+ // just copy the block
copy(p,info,q,small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs *)q),gen_no);
return;
@@ -736,7 +736,7 @@ loop:
*/
{
StgStack *new_stack;
- StgPtr r, s;
+ StgPtr r, s;
rtsBool mine;
mine = copyPart(p,(StgClosure *)stack, stack_sizeW(stack),
@@ -749,7 +749,7 @@ loop:
*s++ = *r++;
}
}
- return;
+ return;
}
}
@@ -785,7 +785,7 @@ unchain_thunk_selectors(StgSelector *p, StgClosure *val)
{
ASSERT(p->header.info == &stg_WHITEHOLE_info);
// val must be in to-space. Not always: when we recursively
- // invoke eval_thunk_selector(), the recursive calls will not
+ // invoke eval_thunk_selector(), the recursive calls will not
// evacuate the value (because we want to select on the value,
// not evacuate it), so in this case val is in from-space.
// ASSERT(!HEAP_ALLOCED_GC(val) || Bdescr((P_)val)->gen_no > N || (Bdescr((P_)val)->flags & BF_EVACUATED));
@@ -838,7 +838,7 @@ eval_thunk_selector (StgClosure **q, StgSelector * p, rtsBool evac)
StgSelector *prev_thunk_selector;
bdescr *bd;
StgClosure *val;
-
+
prev_thunk_selector = NULL;
// this is a chain of THUNK_SELECTORs that we are going to update
// to point to the value of the current THUNK_SELECTOR. Each
@@ -892,7 +892,7 @@ selector_chain:
} while (info_ptr == (W_)&stg_WHITEHOLE_info);
// make sure someone else didn't get here first...
- if (IS_FORWARDING_PTR(info_ptr) ||
+ if (IS_FORWARDING_PTR(info_ptr) ||
INFO_PTR_TO_STRUCT((StgInfoTable *)info_ptr)->type != THUNK_SELECTOR) {
// v. tricky now. The THUNK_SELECTOR has been evacuated
// by another thread, and is now either a forwarding ptr or IND.
@@ -942,8 +942,8 @@ selector_loop:
info = INFO_PTR_TO_STRUCT(info);
switch (info->type) {
case WHITEHOLE:
- goto bale_out; // about to be evacuated by another thread (or a loop).
-
+ goto bale_out; // about to be evacuated by another thread (or a loop).
+
case CONSTR:
case CONSTR_1_0:
case CONSTR_0_1:
@@ -953,13 +953,13 @@ selector_loop:
case CONSTR_STATIC:
case CONSTR_NOCAF_STATIC:
{
- // check that the size is in range
- ASSERT(field < (StgWord32)(info->layout.payload.ptrs +
+ // check that the size is in range
+ ASSERT(field < (StgWord32)(info->layout.payload.ptrs +
info->layout.payload.nptrs));
-
+
// Select the right field from the constructor
val = selectee->payload[field];
-
+
#ifdef PROFILING
// For the purposes of LDV profiling, we have destroyed
// the original selector thunk, p.
@@ -1023,7 +1023,7 @@ selector_loop:
case IND_STATIC:
// Again, we might need to untag a constructor.
selectee = UNTAG_CLOSURE( ((StgInd *)selectee)->indirectee );
- goto selector_loop;
+ goto selector_loop;
case BLACKHOLE:
{
@@ -1040,7 +1040,7 @@ selector_loop:
i = r->header.info;
}
if (i == &stg_TSO_info
- || i == &stg_WHITEHOLE_info
+ || i == &stg_WHITEHOLE_info
|| i == &stg_BLOCKING_QUEUE_CLEAN_info
|| i == &stg_BLOCKING_QUEUE_DIRTY_info) {
goto bale_out;
@@ -1054,20 +1054,20 @@ selector_loop:
case THUNK_SELECTOR:
{
- StgClosure *val;
+ StgClosure *val;
// recursively evaluate this selector. We don't want to
// recurse indefinitely, so we impose a depth bound.
- if (gct->thunk_selector_depth >= MAX_THUNK_SELECTOR_DEPTH) {
- goto bale_out;
- }
+ if (gct->thunk_selector_depth >= MAX_THUNK_SELECTOR_DEPTH) {
+ goto bale_out;
+ }
- gct->thunk_selector_depth++;
+ gct->thunk_selector_depth++;
// rtsFalse says "don't evacuate the result". It will,
// however, update any THUNK_SELECTORs that are evaluated
// along the way.
- eval_thunk_selector(&val, (StgSelector*)selectee, rtsFalse);
- gct->thunk_selector_depth--;
+ eval_thunk_selector(&val, (StgSelector*)selectee, rtsFalse);
+ gct->thunk_selector_depth--;
// did we actually manage to evaluate it?
if (val == selectee) goto bale_out;
@@ -1086,12 +1086,12 @@ selector_loop:
case THUNK_1_1:
case THUNK_0_2:
case THUNK_STATIC:
- // not evaluated yet
- goto bale_out;
-
+ // not evaluated yet
+ goto bale_out;
+
default:
- barf("eval_thunk_selector: strange selectee %d",
- (int)(info->type));
+ barf("eval_thunk_selector: strange selectee %d",
+ (int)(info->type));
}
bale_out:
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 19d9ab23bc..748dc0d6de 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -400,8 +400,8 @@ GarbageCollect (nat collect_gen,
// must be last... invariant is that everything is fully
// scavenged at this point.
if (traverseWeakPtrList()) { // returns rtsTrue if evaced something
- inc_running();
- continue;
+ inc_running();
+ continue;
}
// If we get to here, there's really nothing left to do.
@@ -500,11 +500,11 @@ GarbageCollect (nat collect_gen,
for (n = 0; n < n_capabilities; n++) {
mut_list_size += countOccupied(capabilities[n]->mut_lists[g]);
}
- copied += mut_list_size;
+ copied += mut_list_size;
- debugTrace(DEBUG_gc,
- "mut_list_size: %lu (%d vars, %d arrays, %d MVARs, %d TVARs, %d TVAR_WATCH_QUEUEs, %d TREC_CHUNKs, %d TREC_HEADERs, %d ATOMIC_INVARIANTs, %d INVARIANT_CHECK_QUEUEs, %d others)",
- (unsigned long)(mut_list_size * sizeof(W_)),
+ debugTrace(DEBUG_gc,
+ "mut_list_size: %lu (%d vars, %d arrays, %d MVARs, %d TVARs, %d TVAR_WATCH_QUEUEs, %d TREC_CHUNKs, %d TREC_HEADERs, %d ATOMIC_INVARIANTs, %d INVARIANT_CHECK_QUEUEs, %d others)",
+ (unsigned long)(mut_list_size * sizeof(W_)),
mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS,
mutlist_TVAR, mutlist_TVAR_WATCH_QUEUE,
mutlist_TREC_CHUNK, mutlist_TREC_HEADER,
@@ -519,10 +519,10 @@ GarbageCollect (nat collect_gen,
// for generations we collected...
if (g <= N) {
- /* free old memory and shift to-space into from-space for all
- * the collected steps (except the allocation area). These
- * freed blocks will probaby be quickly recycled.
- */
+ /* free old memory and shift to-space into from-space for all
+ * the collected steps (except the allocation area). These
+ * freed blocks will probaby be quickly recycled.
+ */
if (gen->mark)
{
// tack the new blocks on the end of the existing blocks
@@ -592,18 +592,18 @@ GarbageCollect (nat collect_gen,
}
else // for generations > N
{
- /* For older generations, we need to append the
- * scavenged_large_object list (i.e. large objects that have been
- * promoted during this GC) to the large_object list for that step.
- */
- for (bd = gen->scavenged_large_objects; bd; bd = next) {
+ /* For older generations, we need to append the
+ * scavenged_large_object list (i.e. large objects that have been
+ * promoted during this GC) to the large_object list for that step.
+ */
+ for (bd = gen->scavenged_large_objects; bd; bd = next) {
next = bd->link;
dbl_link_onto(bd, &gen->large_objects);
gen->n_large_words += bd->free - bd->start;
}
- // add the new blocks we promoted during this GC
- gen->n_large_blocks += gen->n_scavenged_large_blocks;
+ // add the new blocks we promoted during this GC
+ gen->n_large_blocks += gen->n_scavenged_large_blocks;
}
ASSERT(countBlocks(gen->large_objects) == gen->n_large_blocks);
@@ -894,13 +894,13 @@ freeGcThreads (void)
if (gc_threads != NULL) {
#if defined(THREADED_RTS)
nat i;
- for (i = 0; i < n_capabilities; i++) {
+ for (i = 0; i < n_capabilities; i++) {
for (g = 0; g < RtsFlags.GcFlags.generations; g++)
{
freeWSDeque(gc_threads[i]->gens[g].todo_q);
}
stgFree (gc_threads[i]);
- }
+ }
stgFree (gc_threads);
#else
for (g = 0; g < RtsFlags.GcFlags.generations; g++)
@@ -947,7 +947,7 @@ any_work (void)
// scavenge objects in compacted generation
if (mark_stack_bd != NULL && !mark_stack_empty()) {
- return rtsTrue;
+ return rtsTrue;
}
// Check for global work in any step. We don't need to check for
@@ -1161,7 +1161,7 @@ wakeup_gc_threads (nat me USED_IF_THREADS)
debugTrace(DEBUG_gc, "waking up gc thread %d", i);
if (gc_threads[i]->wakeup != GC_THREAD_STANDING_BY) barf("wakeup_gc_threads");
- gc_threads[i]->wakeup = GC_THREAD_RUNNING;
+ gc_threads[i]->wakeup = GC_THREAD_RUNNING;
ACQUIRE_SPIN_LOCK(&gc_threads[i]->mut_spin);
RELEASE_SPIN_LOCK(&gc_threads[i]->gc_spin);
}
@@ -1227,7 +1227,7 @@ prepare_collected_gen (generation *gen)
for (i = 0; i < n_capabilities; i++) {
freeChain(capabilities[i]->mut_lists[g]);
capabilities[i]->mut_lists[g] = allocBlock();
- }
+ }
}
gen = &generations[g];
@@ -1522,7 +1522,7 @@ resize_generations (void)
const W_ max = RtsFlags.GcFlags.maxHeapSize;
const W_ gens = RtsFlags.GcFlags.generations;
- // live in the oldest generations
+ // live in the oldest generations
if (oldest_gen->live_estimate != 0) {
words = oldest_gen->live_estimate;
} else {
@@ -1531,9 +1531,9 @@ resize_generations (void)
live = (words + BLOCK_SIZE_W - 1) / BLOCK_SIZE_W +
oldest_gen->n_large_blocks;
- // default max size for all generations except zero
- size = stg_max(live * RtsFlags.GcFlags.oldGenFactor,
- RtsFlags.GcFlags.minOldGenSize);
+ // default max size for all generations except zero
+ size = stg_max(live * RtsFlags.GcFlags.oldGenFactor,
+ RtsFlags.GcFlags.minOldGenSize);
if (RtsFlags.GcFlags.heapSizeSuggestionAuto) {
if (max > 0) {
@@ -1543,65 +1543,65 @@ resize_generations (void)
}
}
- // minimum size for generation zero
- min_alloc = stg_max((RtsFlags.GcFlags.pcFreeHeap * max) / 200,
- RtsFlags.GcFlags.minAllocAreaSize);
+ // minimum size for generation zero
+ min_alloc = stg_max((RtsFlags.GcFlags.pcFreeHeap * max) / 200,
+ RtsFlags.GcFlags.minAllocAreaSize);
- // Auto-enable compaction when the residency reaches a
- // certain percentage of the maximum heap size (default: 30%).
- if (RtsFlags.GcFlags.compact ||
+ // Auto-enable compaction when the residency reaches a
+ // certain percentage of the maximum heap size (default: 30%).
+ if (RtsFlags.GcFlags.compact ||
(max > 0 &&
oldest_gen->n_blocks >
(RtsFlags.GcFlags.compactThreshold * max) / 100)) {
- oldest_gen->mark = 1;
- oldest_gen->compact = 1;
-// debugBelch("compaction: on\n", live);
- } else {
- oldest_gen->mark = 0;
- oldest_gen->compact = 0;
-// debugBelch("compaction: off\n", live);
- }
+ oldest_gen->mark = 1;
+ oldest_gen->compact = 1;
+// debugBelch("compaction: on\n", live);
+ } else {
+ oldest_gen->mark = 0;
+ oldest_gen->compact = 0;
+// debugBelch("compaction: off\n", live);
+ }
if (RtsFlags.GcFlags.sweep) {
- oldest_gen->mark = 1;
+ oldest_gen->mark = 1;
}
- // if we're going to go over the maximum heap size, reduce the
- // size of the generations accordingly. The calculation is
- // different if compaction is turned on, because we don't need
- // to double the space required to collect the old generation.
- if (max != 0) {
-
- // this test is necessary to ensure that the calculations
- // below don't have any negative results - we're working
- // with unsigned values here.
- if (max < min_alloc) {
- heapOverflow();
- }
-
- if (oldest_gen->compact) {
- if ( (size + (size - 1) * (gens - 2) * 2) + min_alloc > max ) {
- size = (max - min_alloc) / ((gens - 1) * 2 - 1);
- }
- } else {
- if ( (size * (gens - 1) * 2) + min_alloc > max ) {
- size = (max - min_alloc) / ((gens - 1) * 2);
- }
- }
-
- if (size < live) {
- heapOverflow();
- }
- }
+ // if we're going to go over the maximum heap size, reduce the
+ // size of the generations accordingly. The calculation is
+ // different if compaction is turned on, because we don't need
+ // to double the space required to collect the old generation.
+ if (max != 0) {
+
+ // this test is necessary to ensure that the calculations
+ // below don't have any negative results - we're working
+ // with unsigned values here.
+ if (max < min_alloc) {
+ heapOverflow();
+ }
+
+ if (oldest_gen->compact) {
+ if ( (size + (size - 1) * (gens - 2) * 2) + min_alloc > max ) {
+ size = (max - min_alloc) / ((gens - 1) * 2 - 1);
+ }
+ } else {
+ if ( (size * (gens - 1) * 2) + min_alloc > max ) {
+ size = (max - min_alloc) / ((gens - 1) * 2);
+ }
+ }
+
+ if (size < live) {
+ heapOverflow();
+ }
+ }
#if 0
- debugBelch("live: %d, min_alloc: %d, size : %d, max = %d\n", live,
- min_alloc, size, max);
+ debugBelch("live: %d, min_alloc: %d, size : %d, max = %d\n", live,
+ min_alloc, size, max);
#endif
- for (g = 0; g < gens; g++) {
- generations[g].max_blocks = size;
- }
+ for (g = 0; g < gens; g++) {
+ generations[g].max_blocks = size;
+ }
}
}
@@ -1619,107 +1619,107 @@ resize_nursery (void)
{ // Two-space collector:
W_ blocks;
- /* set up a new nursery. Allocate a nursery size based on a
- * function of the amount of live data (by default a factor of 2)
- * Use the blocks from the old nursery if possible, freeing up any
- * left over blocks.
- *
- * If we get near the maximum heap size, then adjust our nursery
- * size accordingly. If the nursery is the same size as the live
- * data (L), then we need 3L bytes. We can reduce the size of the
- * nursery to bring the required memory down near 2L bytes.
- *
- * A normal 2-space collector would need 4L bytes to give the same
- * performance we get from 3L bytes, reducing to the same
- * performance at 2L bytes.
- */
- blocks = generations[0].n_blocks;
-
- if ( RtsFlags.GcFlags.maxHeapSize != 0 &&
- blocks * RtsFlags.GcFlags.oldGenFactor * 2 >
- RtsFlags.GcFlags.maxHeapSize )
- {
- long adjusted_blocks; // signed on purpose
- int pc_free;
-
- adjusted_blocks = (RtsFlags.GcFlags.maxHeapSize - 2 * blocks);
-
- debugTrace(DEBUG_gc, "near maximum heap size of 0x%x blocks, blocks = %d, adjusted to %ld",
- RtsFlags.GcFlags.maxHeapSize, blocks, adjusted_blocks);
-
- pc_free = adjusted_blocks * 100 / RtsFlags.GcFlags.maxHeapSize;
- if (pc_free < RtsFlags.GcFlags.pcFreeHeap) /* might even * be < 0 */
- {
- heapOverflow();
- }
- blocks = adjusted_blocks;
- }
- else
- {
- blocks *= RtsFlags.GcFlags.oldGenFactor;
- if (blocks < min_nursery)
- {
- blocks = min_nursery;
- }
- }
- resizeNurseries(blocks);
+ /* set up a new nursery. Allocate a nursery size based on a
+ * function of the amount of live data (by default a factor of 2)
+ * Use the blocks from the old nursery if possible, freeing up any
+ * left over blocks.
+ *
+ * If we get near the maximum heap size, then adjust our nursery
+ * size accordingly. If the nursery is the same size as the live
+ * data (L), then we need 3L bytes. We can reduce the size of the
+ * nursery to bring the required memory down near 2L bytes.
+ *
+ * A normal 2-space collector would need 4L bytes to give the same
+ * performance we get from 3L bytes, reducing to the same
+ * performance at 2L bytes.
+ */
+ blocks = generations[0].n_blocks;
+
+ if ( RtsFlags.GcFlags.maxHeapSize != 0 &&
+ blocks * RtsFlags.GcFlags.oldGenFactor * 2 >
+ RtsFlags.GcFlags.maxHeapSize )
+ {
+ long adjusted_blocks; // signed on purpose
+ int pc_free;
+
+ adjusted_blocks = (RtsFlags.GcFlags.maxHeapSize - 2 * blocks);
+
+ debugTrace(DEBUG_gc, "near maximum heap size of 0x%x blocks, blocks = %d, adjusted to %ld",
+ RtsFlags.GcFlags.maxHeapSize, blocks, adjusted_blocks);
+
+ pc_free = adjusted_blocks * 100 / RtsFlags.GcFlags.maxHeapSize;
+ if (pc_free < RtsFlags.GcFlags.pcFreeHeap) /* might even * be < 0 */
+ {
+ heapOverflow();
+ }
+ blocks = adjusted_blocks;
+ }
+ else
+ {
+ blocks *= RtsFlags.GcFlags.oldGenFactor;
+ if (blocks < min_nursery)
+ {
+ blocks = min_nursery;
+ }
+ }
+ resizeNurseries(blocks);
}
else // Generational collector
{
- /*
- * If the user has given us a suggested heap size, adjust our
- * allocation area to make best use of the memory available.
- */
- if (RtsFlags.GcFlags.heapSizeSuggestion)
- {
- long blocks;
+ /*
+ * If the user has given us a suggested heap size, adjust our
+ * allocation area to make best use of the memory available.
+ */
+ if (RtsFlags.GcFlags.heapSizeSuggestion)
+ {
+ long blocks;
StgWord needed;
calcNeeded(rtsFalse, &needed); // approx blocks needed at next GC
- /* Guess how much will be live in generation 0 step 0 next time.
- * A good approximation is obtained by finding the
- * percentage of g0 that was live at the last minor GC.
- *
- * We have an accurate figure for the amount of copied data in
- * 'copied', but we must convert this to a number of blocks, with
- * a small adjustment for estimated slop at the end of a block
- * (- 10 words).
- */
- if (N == 0)
- {
- g0_pcnt_kept = ((copied / (BLOCK_SIZE_W - 10)) * 100)
- / countNurseryBlocks();
- }
-
- /* Estimate a size for the allocation area based on the
- * information available. We might end up going slightly under
- * or over the suggested heap size, but we should be pretty
- * close on average.
- *
- * Formula: suggested - needed
+ /* Guess how much will be live in generation 0 step 0 next time.
+ * A good approximation is obtained by finding the
+ * percentage of g0 that was live at the last minor GC.
+ *
+ * We have an accurate figure for the amount of copied data in
+ * 'copied', but we must convert this to a number of blocks, with
+ * a small adjustment for estimated slop at the end of a block
+ * (- 10 words).
+ */
+ if (N == 0)
+ {
+ g0_pcnt_kept = ((copied / (BLOCK_SIZE_W - 10)) * 100)
+ / countNurseryBlocks();
+ }
+
+ /* Estimate a size for the allocation area based on the
+ * information available. We might end up going slightly under
+ * or over the suggested heap size, but we should be pretty
+ * close on average.
+ *
+ * Formula: suggested - needed
* ----------------------------
- * 1 + g0_pcnt_kept/100
- *
- * where 'needed' is the amount of memory needed at the next
- * collection for collecting all gens except g0.
- */
- blocks =
- (((long)RtsFlags.GcFlags.heapSizeSuggestion - (long)needed) * 100) /
- (100 + (long)g0_pcnt_kept);
-
- if (blocks < (long)min_nursery) {
- blocks = min_nursery;
- }
+ * 1 + g0_pcnt_kept/100
+ *
+ * where 'needed' is the amount of memory needed at the next
+ * collection for collecting all gens except g0.
+ */
+ blocks =
+ (((long)RtsFlags.GcFlags.heapSizeSuggestion - (long)needed) * 100) /
+ (100 + (long)g0_pcnt_kept);
+
+ if (blocks < (long)min_nursery) {
+ blocks = min_nursery;
+ }
resizeNurseries((W_)blocks);
- }
- else
- {
- // we might have added extra large blocks to the nursery, so
- // resize back to minAllocAreaSize again.
- resizeNurseriesFixed(RtsFlags.GcFlags.minAllocAreaSize);
- }
+ }
+ else
+ {
+ // we might have added extra large blocks to the nursery, so
+ // resize back to minAllocAreaSize again.
+ resizeNurseriesFixed(RtsFlags.GcFlags.minAllocAreaSize);
+ }
}
}
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index c653331164..dd50ded063 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -9,7 +9,7 @@
* - All things that are supposed to be pointers look like pointers.
*
* - Objects in text space are marked as static closures, those
- * in the heap are dynamic.
+ * in the heap are dynamic.
*
* ---------------------------------------------------------------------------*/
@@ -48,9 +48,9 @@ checkSmallBitmap( StgPtr payload, StgWord bitmap, nat size )
nat i;
for(i = 0; i < size; i++, bitmap >>= 1 ) {
- if ((bitmap & 1) == 0) {
- checkClosureShallow((StgClosure *)payload[i]);
- }
+ if ((bitmap & 1) == 0) {
+ checkClosureShallow((StgClosure *)payload[i]);
+ }
}
}
@@ -62,13 +62,13 @@ checkLargeBitmap( StgPtr payload, StgLargeBitmap* large_bitmap, nat size )
i = 0;
for (bmp=0; i < size; bmp++) {
- StgWord bitmap = large_bitmap->bitmap[bmp];
- j = 0;
- for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) {
- if ((bitmap & 1) == 0) {
- checkClosureShallow((StgClosure *)payload[i]);
- }
- }
+ StgWord bitmap = large_bitmap->bitmap[bmp];
+ j = 0;
+ for(; i < size && j < BITS_IN(W_); j++, i++, bitmap >>= 1 ) {
+ if ((bitmap & 1) == 0) {
+ checkClosureShallow((StgClosure *)payload[i]);
+ }
+ }
}
}
@@ -77,8 +77,8 @@ checkLargeBitmap( StgPtr payload, StgLargeBitmap* large_bitmap, nat size )
* used to avoid recursion between checking PAPs and checking stack
* chunks.
*/
-
-static void
+
+static void
checkClosureShallow( StgClosure* p )
{
StgClosure *q;
@@ -88,14 +88,14 @@ checkClosureShallow( StgClosure* p )
/* Is it a static closure? */
if (!HEAP_ALLOCED(q)) {
- ASSERT(closure_STATIC(q));
+ ASSERT(closure_STATIC(q));
} else {
- ASSERT(!closure_STATIC(q));
+ ASSERT(!closure_STATIC(q));
}
}
// check an individual stack object
-StgOffset
+StgOffset
checkStackFrame( StgPtr c )
{
nat size;
@@ -116,99 +116,99 @@ checkStackFrame( StgPtr c )
case UNDERFLOW_FRAME:
case STOP_FRAME:
case RET_SMALL:
- size = BITMAP_SIZE(info->i.layout.bitmap);
- checkSmallBitmap((StgPtr)c + 1,
- BITMAP_BITS(info->i.layout.bitmap), size);
- return 1 + size;
+ size = BITMAP_SIZE(info->i.layout.bitmap);
+ checkSmallBitmap((StgPtr)c + 1,
+ BITMAP_BITS(info->i.layout.bitmap), size);
+ return 1 + size;
case RET_BCO: {
- StgBCO *bco;
- nat size;
- bco = (StgBCO *)*(c+1);
- size = BCO_BITMAP_SIZE(bco);
- checkLargeBitmap((StgPtr)c + 2, BCO_BITMAP(bco), size);
- return 2 + size;
+ StgBCO *bco;
+ nat size;
+ bco = (StgBCO *)*(c+1);
+ size = BCO_BITMAP_SIZE(bco);
+ checkLargeBitmap((StgPtr)c + 2, BCO_BITMAP(bco), size);
+ return 2 + size;
}
case RET_BIG: // large bitmap (> 32 entries)
- size = GET_LARGE_BITMAP(&info->i)->size;
- checkLargeBitmap((StgPtr)c + 1, GET_LARGE_BITMAP(&info->i), size);
- return 1 + size;
+ size = GET_LARGE_BITMAP(&info->i)->size;
+ checkLargeBitmap((StgPtr)c + 1, GET_LARGE_BITMAP(&info->i), size);
+ return 1 + size;
case RET_FUN:
{
- StgFunInfoTable *fun_info;
- StgRetFun *ret_fun;
-
- ret_fun = (StgRetFun *)c;
- fun_info = get_fun_itbl(UNTAG_CLOSURE(ret_fun->fun));
- size = ret_fun->size;
- switch (fun_info->f.fun_type) {
- case ARG_GEN:
- checkSmallBitmap((StgPtr)ret_fun->payload,
- BITMAP_BITS(fun_info->f.b.bitmap), size);
- break;
- case ARG_GEN_BIG:
- checkLargeBitmap((StgPtr)ret_fun->payload,
- GET_FUN_LARGE_BITMAP(fun_info), size);
- break;
- default:
- checkSmallBitmap((StgPtr)ret_fun->payload,
- BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
- size);
- break;
- }
- return sizeofW(StgRetFun) + size;
+ StgFunInfoTable *fun_info;
+ StgRetFun *ret_fun;
+
+ ret_fun = (StgRetFun *)c;
+ fun_info = get_fun_itbl(UNTAG_CLOSURE(ret_fun->fun));
+ size = ret_fun->size;
+ switch (fun_info->f.fun_type) {
+ case ARG_GEN:
+ checkSmallBitmap((StgPtr)ret_fun->payload,
+ BITMAP_BITS(fun_info->f.b.bitmap), size);
+ break;
+ case ARG_GEN_BIG:
+ checkLargeBitmap((StgPtr)ret_fun->payload,
+ GET_FUN_LARGE_BITMAP(fun_info), size);
+ break;
+ default:
+ checkSmallBitmap((StgPtr)ret_fun->payload,
+ BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
+ size);
+ break;
+ }
+ return sizeofW(StgRetFun) + size;
}
default:
- barf("checkStackFrame: weird activation record found on stack (%p %d).",c,info->i.type);
+ barf("checkStackFrame: weird activation record found on stack (%p %d).",c,info->i.type);
}
}
// check sections of stack between update frames
-void
+void
checkStackChunk( StgPtr sp, StgPtr stack_end )
{
StgPtr p;
p = sp;
while (p < stack_end) {
- p += checkStackFrame( p );
+ p += checkStackFrame( p );
}
// ASSERT( p == stack_end ); -- HWL
}
static void
checkPAP (StgClosure *tagged_fun, StgClosure** payload, StgWord n_args)
-{
+{
StgClosure *fun;
StgFunInfoTable *fun_info;
-
+
fun = UNTAG_CLOSURE(tagged_fun);
ASSERT(LOOKS_LIKE_CLOSURE_PTR(fun));
fun_info = get_fun_itbl(fun);
-
+
switch (fun_info->f.fun_type) {
case ARG_GEN:
- checkSmallBitmap( (StgPtr)payload,
- BITMAP_BITS(fun_info->f.b.bitmap), n_args );
- break;
+ checkSmallBitmap( (StgPtr)payload,
+ BITMAP_BITS(fun_info->f.b.bitmap), n_args );
+ break;
case ARG_GEN_BIG:
- checkLargeBitmap( (StgPtr)payload,
- GET_FUN_LARGE_BITMAP(fun_info),
- n_args );
- break;
+ checkLargeBitmap( (StgPtr)payload,
+ GET_FUN_LARGE_BITMAP(fun_info),
+ n_args );
+ break;
case ARG_BCO:
- checkLargeBitmap( (StgPtr)payload,
- BCO_BITMAP(fun),
- n_args );
- break;
+ checkLargeBitmap( (StgPtr)payload,
+ BCO_BITMAP(fun),
+ n_args );
+ break;
default:
- checkSmallBitmap( (StgPtr)payload,
- BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
- n_args );
- break;
+ checkSmallBitmap( (StgPtr)payload,
+ BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]),
+ n_args );
+ break;
}
ASSERT(fun_info->f.arity > TAG_MASK ? GET_CLOSURE_TAG(tagged_fun) == 0
@@ -216,7 +216,7 @@ checkPAP (StgClosure *tagged_fun, StgClosure** payload, StgWord n_args)
}
-StgOffset
+StgOffset
checkClosure( StgClosure* p )
{
const StgInfoTable *info;
@@ -226,9 +226,9 @@ checkClosure( StgClosure* p )
p = UNTAG_CLOSURE(p);
/* Is it a static closure (i.e. in the data segment)? */
if (!HEAP_ALLOCED(p)) {
- ASSERT(closure_STATIC(p));
+ ASSERT(closure_STATIC(p));
} else {
- ASSERT(!closure_STATIC(p));
+ ASSERT(!closure_STATIC(p));
}
info = p->header.info;
@@ -242,12 +242,12 @@ checkClosure( StgClosure* p )
case MVAR_CLEAN:
case MVAR_DIRTY:
- {
- StgMVar *mvar = (StgMVar *)p;
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(mvar->head));
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(mvar->tail));
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(mvar->value));
- return sizeofW(StgMVar);
+ {
+ StgMVar *mvar = (StgMVar *)p;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(mvar->head));
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(mvar->tail));
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(mvar->value));
+ return sizeofW(StgMVar);
}
case THUNK:
@@ -257,11 +257,11 @@ checkClosure( StgClosure* p )
case THUNK_0_2:
case THUNK_2_0:
{
- nat i;
- for (i = 0; i < info->layout.payload.ptrs; i++) {
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(((StgThunk *)p)->payload[i]));
- }
- return thunk_sizeW_fromITBL(info);
+ nat i;
+ for (i = 0; i < info->layout.payload.ptrs; i++) {
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(((StgThunk *)p)->payload[i]));
+ }
+ return thunk_sizeW_fromITBL(info);
}
case FUN:
@@ -287,13 +287,13 @@ checkClosure( StgClosure* p )
case CONSTR_NOCAF_STATIC:
case THUNK_STATIC:
case FUN_STATIC:
- {
- nat i;
- for (i = 0; i < info->layout.payload.ptrs; i++) {
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(p->payload[i]));
- }
- return sizeW_fromITBL(info);
- }
+ {
+ nat i;
+ for (i = 0; i < info->layout.payload.ptrs; i++) {
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(p->payload[i]));
+ }
+ return sizeW_fromITBL(info);
+ }
case BLOCKING_QUEUE:
{
@@ -304,9 +304,9 @@ checkClosure( StgClosure* p )
ASSERT(LOOKS_LIKE_CLOSURE_PTR(bq->bh));
ASSERT(get_itbl((StgClosure *)(bq->owner))->type == TSO);
- ASSERT(bq->queue == (MessageBlackHole*)END_TSO_QUEUE
+ ASSERT(bq->queue == (MessageBlackHole*)END_TSO_QUEUE
|| bq->queue->header.info == &stg_MSG_BLACKHOLE_info);
- ASSERT(bq->link == (StgBlockingQueue*)END_TSO_QUEUE ||
+ ASSERT(bq->link == (StgBlockingQueue*)END_TSO_QUEUE ||
get_itbl((StgClosure *)(bq->link))->type == IND ||
get_itbl((StgClosure *)(bq->link))->type == BLOCKING_QUEUE);
@@ -314,11 +314,11 @@ checkClosure( StgClosure* p )
}
case BCO: {
- StgBCO *bco = (StgBCO *)p;
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(bco->instrs));
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(bco->literals));
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(bco->ptrs));
- return bco_sizeW(bco);
+ StgBCO *bco = (StgBCO *)p;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(bco->instrs));
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(bco->literals));
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(bco->ptrs));
+ return bco_sizeW(bco);
}
case IND_STATIC: /* (1, 0) closure */
@@ -330,28 +330,28 @@ checkClosure( StgClosure* p )
* representative of the actual layout.
*/
{ StgWeak *w = (StgWeak *)p;
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->key));
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->value));
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->finalizer));
- if (w->link) {
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->link));
- }
- return sizeW_fromITBL(info);
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->key));
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->value));
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->finalizer));
+ if (w->link) {
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(w->link));
+ }
+ return sizeW_fromITBL(info);
}
case THUNK_SELECTOR:
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(((StgSelector *)p)->selectee));
- return THUNK_SELECTOR_sizeW();
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(((StgSelector *)p)->selectee));
+ return THUNK_SELECTOR_sizeW();
case IND:
- {
- /* we don't expect to see any of these after GC
- * but they might appear during execution
- */
- StgInd *ind = (StgInd *)p;
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(ind->indirectee));
- return sizeofW(StgInd);
- }
+ {
+ /* we don't expect to see any of these after GC
+ * but they might appear during execution
+ */
+ StgInd *ind = (StgInd *)p;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(ind->indirectee));
+ return sizeofW(StgInd);
+ }
case RET_BCO:
case RET_SMALL:
@@ -363,45 +363,45 @@ checkClosure( StgClosure* p )
case ATOMICALLY_FRAME:
case CATCH_RETRY_FRAME:
case CATCH_STM_FRAME:
- barf("checkClosure: stack frame");
+ barf("checkClosure: stack frame");
case AP:
{
- StgAP* ap = (StgAP *)p;
- checkPAP (ap->fun, ap->payload, ap->n_args);
- return ap_sizeW(ap);
+ StgAP* ap = (StgAP *)p;
+ checkPAP (ap->fun, ap->payload, ap->n_args);
+ return ap_sizeW(ap);
}
case PAP:
{
- StgPAP* pap = (StgPAP *)p;
- checkPAP (pap->fun, pap->payload, pap->n_args);
- return pap_sizeW(pap);
+ StgPAP* pap = (StgPAP *)p;
+ checkPAP (pap->fun, pap->payload, pap->n_args);
+ return pap_sizeW(pap);
}
case AP_STACK:
- {
- StgAP_STACK *ap = (StgAP_STACK *)p;
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(ap->fun));
- checkStackChunk((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
- return ap_stack_sizeW(ap);
+ {
+ StgAP_STACK *ap = (StgAP_STACK *)p;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(ap->fun));
+ checkStackChunk((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
+ return ap_stack_sizeW(ap);
}
case ARR_WORDS:
- return arr_words_sizeW((StgArrWords *)p);
+ return arr_words_sizeW((StgArrWords *)p);
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- {
- StgMutArrPtrs* a = (StgMutArrPtrs *)p;
- nat i;
- for (i = 0; i < a->ptrs; i++) {
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(a->payload[i]));
- }
- return mut_arr_ptrs_sizeW(a);
- }
+ {
+ StgMutArrPtrs* a = (StgMutArrPtrs *)p;
+ nat i;
+ for (i = 0; i < a->ptrs; i++) {
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(a->payload[i]));
+ }
+ return mut_arr_ptrs_sizeW(a);
+ }
case TSO:
checkTSO((StgTSO *)p);
@@ -423,9 +423,9 @@ checkClosure( StgClosure* p )
}
return sizeofW(StgTRecChunk);
}
-
+
default:
- barf("checkClosure (closure type %d)", info->type);
+ barf("checkClosure (closure type %d)", info->type);
}
}
@@ -451,12 +451,12 @@ void checkHeapChain (bdescr *bd)
/* This is the smallest size of closure that can live in the heap */
ASSERT( size >= MIN_PAYLOAD_SIZE + sizeofW(StgHeader) );
p += size;
-
+
/* skip over slop */
while (p < bd->free &&
(*p < 0x1000 || !LOOKS_LIKE_INFO_PTR(*p))) { p++; }
}
- }
+ }
}
}
@@ -505,7 +505,7 @@ checkTSO(StgTSO *tso)
if (tso->what_next == ThreadKilled) {
/* The garbage collector doesn't bother following any pointers
- * from dead threads, so don't check sanity here.
+ * from dead threads, so don't check sanity here.
*/
return;
}
@@ -520,10 +520,10 @@ checkTSO(StgTSO *tso)
if ( tso->why_blocked == BlockedOnMVar
|| tso->why_blocked == BlockedOnMVarRead
- || tso->why_blocked == BlockedOnBlackHole
- || tso->why_blocked == BlockedOnMsgThrowTo
+ || tso->why_blocked == BlockedOnBlackHole
+ || tso->why_blocked == BlockedOnMsgThrowTo
|| tso->why_blocked == NotBlocked
- ) {
+ ) {
ASSERT(LOOKS_LIKE_CLOSURE_PTR(tso->block_info.closure));
}
@@ -546,7 +546,7 @@ checkGlobalTSOList (rtsBool checkTSOs)
nat g;
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
- for (tso=generations[g].threads; tso != END_TSO_QUEUE;
+ for (tso=generations[g].threads; tso != END_TSO_QUEUE;
tso = tso->global_link) {
ASSERT(LOOKS_LIKE_CLOSURE_PTR(tso));
ASSERT(get_itbl((StgClosure *)tso)->type == TSO);
@@ -593,8 +593,8 @@ checkMutableList( bdescr *mut_bd, nat gen )
StgClosure *p;
for (bd = mut_bd; bd != NULL; bd = bd->link) {
- for (q = bd->start; q < bd->free; q++) {
- p = (StgClosure *)*q;
+ for (q = bd->start; q < bd->free; q++) {
+ p = (StgClosure *)*q;
ASSERT(!HEAP_ALLOCED(p) || Bdescr((P_)p)->gen_no == gen);
checkClosure(p);
@@ -642,13 +642,13 @@ checkStaticObjects ( StgClosure* static_objects )
info = get_itbl(p);
switch (info->type) {
case IND_STATIC:
- {
+ {
StgClosure *indirectee = UNTAG_CLOSURE(((StgIndStatic *)p)->indirectee);
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(indirectee));
- ASSERT(LOOKS_LIKE_INFO_PTR((StgWord)indirectee->header.info));
- p = *IND_STATIC_LINK((StgClosure *)p);
- break;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(indirectee));
+ ASSERT(LOOKS_LIKE_INFO_PTR((StgWord)indirectee->header.info));
+ p = *IND_STATIC_LINK((StgClosure *)p);
+ break;
}
case THUNK_STATIC:
@@ -664,8 +664,8 @@ checkStaticObjects ( StgClosure* static_objects )
break;
default:
- barf("checkStaticObjetcs: strange closure %p (%s)",
- p, info_type(p));
+ barf("checkStaticObjetcs: strange closure %p (%s)",
+ p, info_type(p));
}
}
}
@@ -681,14 +681,14 @@ checkNurserySanity (nursery *nursery)
for (bd = nursery->blocks; bd != NULL; bd = bd->link) {
ASSERT(bd->gen == g0);
ASSERT(bd->u.back == prev);
- prev = bd;
- blocks += bd->blocks;
+ prev = bd;
+ blocks += bd->blocks;
}
ASSERT(blocks == nursery->n_blocks);
}
-static void checkGeneration (generation *gen,
+static void checkGeneration (generation *gen,
rtsBool after_major_gc USED_IF_THREADS)
{
nat n;
@@ -792,7 +792,7 @@ checkRunQueue(Capability *cap)
{
StgTSO *prev, *tso;
prev = END_TSO_QUEUE;
- for (tso = cap->run_queue_hd; tso != END_TSO_QUEUE;
+ for (tso = cap->run_queue_hd; tso != END_TSO_QUEUE;
prev = tso, tso = tso->_link) {
ASSERT(prev == END_TSO_QUEUE || prev->_link == tso);
ASSERT(tso->block_info.prev == prev);
@@ -828,8 +828,8 @@ genBlocks (generation *gen)
{
ASSERT(countBlocks(gen->blocks) == gen->n_blocks);
ASSERT(countBlocks(gen->large_objects) == gen->n_large_blocks);
- return gen->n_blocks + gen->n_old_blocks +
- countAllocdBlocks(gen->large_objects);
+ return gen->n_blocks + gen->n_old_blocks +
+ countAllocdBlocks(gen->large_objects);
}
void
@@ -885,7 +885,7 @@ memInventory (rtsBool show)
for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
live_blocks += gen_blocks[g];
}
- live_blocks += nursery_blocks +
+ live_blocks += nursery_blocks +
+ retainer_blocks + arena_blocks + exec_blocks;
#define MB(n) (((double)(n) * BLOCK_SIZE_W) / ((1024*1024)/sizeof(W_)))
@@ -894,7 +894,7 @@ memInventory (rtsBool show)
if (show || leak)
{
- if (leak) {
+ if (leak) {
debugBelch("Memory leak detected:\n");
} else {
debugBelch("Memory inventory:\n");
@@ -916,7 +916,7 @@ memInventory (rtsBool show)
debugBelch(" total : %5" FMT_Word " blocks (%6.1lf MB)\n",
live_blocks + free_blocks, MB(live_blocks+free_blocks));
if (leak) {
- debugBelch("\n in system : %5" FMT_Word " blocks (%" FMT_Word " MB)\n",
+ debugBelch("\n in system : %5" FMT_Word " blocks (%" FMT_Word " MB)\n",
(W_)(mblocks_allocated * BLOCKS_PER_MBLOCK), mblocks_allocated);
}
}
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index b9f8f1259b..97c65897f5 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -6,7 +6,7 @@
*
* Documentation on the architecture of the Garbage Collector can be
* found in the online commentary:
- *
+ *
* http://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC
*
* ---------------------------------------------------------------------------*/
@@ -30,9 +30,9 @@
static void scavenge_stack (StgPtr p, StgPtr stack_end);
-static void scavenge_large_bitmap (StgPtr p,
- StgLargeBitmap *large_bitmap,
- StgWord size );
+static void scavenge_large_bitmap (StgPtr p,
+ StgLargeBitmap *large_bitmap,
+ StgWord size );
#if defined(THREADED_RTS) && !defined(PARALLEL_GC)
# define evacuate(a) evacuate1(a)
@@ -55,7 +55,12 @@ scavengeTSO (StgTSO *tso)
// update the pointer from the InCall.
if (tso->bound != NULL) {
- tso->bound->tso = tso;
+ // NB. We can't just set tso->bound->tso = tso, because this
+ // might be an invalid copy the TSO resulting from multiple
+ // threads evacuating the TSO simultaneously (see
+ // Evac.c:copy_tag()). Calling evacuate() on this pointer
+ // will ensure that we update it to point to the correct copy.
+ evacuate((StgClosure **)&tso->bound->tso);
}
saved_eager = gct->eager_promotion;
@@ -63,7 +68,7 @@ scavengeTSO (StgTSO *tso)
evacuate((StgClosure **)&tso->blocked_exceptions);
evacuate((StgClosure **)&tso->bq);
-
+
// scavange current transaction record
evacuate((StgClosure **)&tso->trec);
@@ -72,11 +77,11 @@ scavengeTSO (StgTSO *tso)
evacuate((StgClosure **)&tso->_link);
if ( tso->why_blocked == BlockedOnMVar
|| tso->why_blocked == BlockedOnMVarRead
- || tso->why_blocked == BlockedOnBlackHole
- || tso->why_blocked == BlockedOnMsgThrowTo
+ || tso->why_blocked == BlockedOnBlackHole
+ || tso->why_blocked == BlockedOnMsgThrowTo
|| tso->why_blocked == NotBlocked
- ) {
- evacuate(&tso->block_info.closure);
+ ) {
+ evacuate(&tso->block_info.closure);
}
#ifdef THREADED_RTS
// in the THREADED_RTS, block_info.closure must always point to a
@@ -137,7 +142,7 @@ static StgPtr scavenge_mut_arr_ptrs (StgMutArrPtrs *a)
gct->failed_to_evac = any_failed;
return (StgPtr)a + mut_arr_ptrs_sizeW(a);
}
-
+
// scavenge only the marked areas of a MUT_ARR_PTRS
static StgPtr scavenge_mut_arr_ptrs_marked (StgMutArrPtrs *a)
{
@@ -197,20 +202,20 @@ scavenge_arg_block (StgFunInfoTable *fun_info, StgClosure **args)
p = (StgPtr)args;
switch (fun_info->f.fun_type) {
case ARG_GEN:
- bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
- size = BITMAP_SIZE(fun_info->f.b.bitmap);
- goto small_bitmap;
+ bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
+ size = BITMAP_SIZE(fun_info->f.b.bitmap);
+ goto small_bitmap;
case ARG_GEN_BIG:
- size = GET_FUN_LARGE_BITMAP(fun_info)->size;
- scavenge_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
- p += size;
- break;
+ size = GET_FUN_LARGE_BITMAP(fun_info)->size;
+ scavenge_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
+ p += size;
+ break;
default:
- bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
- size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]);
+ bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
+ size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]);
small_bitmap:
p = scavenge_small_bitmap(p, size, bitmap);
- break;
+ break;
}
return p;
}
@@ -221,28 +226,28 @@ scavenge_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size)
StgPtr p;
StgWord bitmap;
StgFunInfoTable *fun_info;
-
+
fun_info = get_fun_itbl(UNTAG_CLOSURE(fun));
ASSERT(fun_info->i.type != PAP);
p = (StgPtr)payload;
switch (fun_info->f.fun_type) {
case ARG_GEN:
- bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
- goto small_bitmap;
+ bitmap = BITMAP_BITS(fun_info->f.b.bitmap);
+ goto small_bitmap;
case ARG_GEN_BIG:
- scavenge_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
- p += size;
- break;
+ scavenge_large_bitmap(p, GET_FUN_LARGE_BITMAP(fun_info), size);
+ p += size;
+ break;
case ARG_BCO:
- scavenge_large_bitmap((StgPtr)payload, BCO_BITMAP(fun), size);
- p += size;
- break;
+ scavenge_large_bitmap((StgPtr)payload, BCO_BITMAP(fun), size);
+ p += size;
+ break;
default:
- bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
+ bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
small_bitmap:
p = scavenge_small_bitmap(p, size, bitmap);
- break;
+ break;
}
return p;
}
@@ -274,23 +279,23 @@ scavenge_large_srt_bitmap( StgLargeSRT *large_srt )
nat i, b, size;
StgWord bitmap;
StgClosure **p;
-
+
b = 0;
bitmap = large_srt->l.bitmap[b];
size = (nat)large_srt->l.size;
p = (StgClosure **)large_srt->srt;
for (i = 0; i < size; ) {
- if ((bitmap & 1) != 0) {
- evacuate(p);
- }
- i++;
- p++;
- if (i % BITS_IN(W_) == 0) {
- b++;
- bitmap = large_srt->l.bitmap[b];
- } else {
- bitmap = bitmap >> 1;
- }
+ if ((bitmap & 1) != 0) {
+ evacuate(p);
+ }
+ i++;
+ p++;
+ if (i % BITS_IN(W_) == 0) {
+ b++;
+ bitmap = large_srt->l.bitmap[b];
+ } else {
+ bitmap = bitmap >> 1;
+ }
}
}
@@ -307,7 +312,7 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap)
bitmap = srt_bitmap;
p = srt;
- if (bitmap == (StgHalfWord)(-1)) {
+ if (bitmap == (StgHalfWord)(-1)) {
scavenge_large_srt_bitmap( (StgLargeSRT *)srt );
return;
}
@@ -315,21 +320,21 @@ scavenge_srt (StgClosure **srt, nat srt_bitmap)
while (bitmap != 0) {
if ((bitmap & 1) != 0) {
#if defined(COMPILING_WINDOWS_DLL)
- // Special-case to handle references to closures hiding out in DLLs, since
- // double indirections required to get at those. The code generator knows
- // which is which when generating the SRT, so it stores the (indirect)
- // reference to the DLL closure in the table by first adding one to it.
- // We check for this here, and undo the addition before evacuating it.
- //
- // If the SRT entry hasn't got bit 0 set, the SRT entry points to a
- // closure that's fixed at link-time, and no extra magic is required.
- if ( (W_)(*srt) & 0x1 ) {
- evacuate( (StgClosure**) ((W_) (*srt) & ~0x1));
- } else {
- evacuate(p);
- }
+ // Special-case to handle references to closures hiding out in DLLs, since
+ // double indirections required to get at those. The code generator knows
+ // which is which when generating the SRT, so it stores the (indirect)
+ // reference to the DLL closure in the table by first adding one to it.
+ // We check for this here, and undo the addition before evacuating it.
+ //
+ // If the SRT entry hasn't got bit 0 set, the SRT entry points to a
+ // closure that's fixed at link-time, and no extra magic is required.
+ if ( (W_)(*srt) & 0x1 ) {
+ evacuate( (StgClosure**) ((W_) (*srt) & ~0x1));
+ } else {
+ evacuate(p);
+ }
#else
- evacuate(p);
+ evacuate(p);
#endif
}
p++;
@@ -355,7 +360,7 @@ scavenge_fun_srt(const StgInfoTable *info)
StgFunInfoTable *fun_info;
if (!major_gc) return;
-
+
fun_info = itbl_to_fun_itbl(info);
scavenge_srt((StgClosure **)GET_FUN_SRT(fun_info), fun_info->i.srt_bitmap);
}
@@ -365,11 +370,11 @@ scavenge_fun_srt(const StgInfoTable *info)
evac_gen_no is set by the caller to be either zero (for a step in a
generation < N) or G where G is the generation of the step being
- scavenged.
+ scavenged.
We sometimes temporarily change evac_gen_no back to zero if we're
scavenging a mutable object where eager promotion isn't such a good
- idea.
+ idea.
-------------------------------------------------------------------------- */
static GNUC_ATTR_HOT void
@@ -381,7 +386,7 @@ scavenge_block (bdescr *bd)
gen_workspace *ws;
debugTrace(DEBUG_gc, "scavenging block %p (gen %d) @ %p",
- bd->start, bd->gen_no, bd->u.scan);
+ bd->start, bd->gen_no, bd->u.scan);
gct->scan_bd = bd;
gct->evac_gen_no = bd->gen_no;
@@ -391,7 +396,7 @@ scavenge_block (bdescr *bd)
ws = &gct->gens[bd->gen->no];
p = bd->u.scan;
-
+
// we might be evacuating into the very object that we're
// scavenging, so we have to check the real bd->free pointer each
// time around the loop.
@@ -400,7 +405,7 @@ scavenge_block (bdescr *bd)
ASSERT(bd->link == NULL);
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
info = get_itbl((StgClosure *)p);
-
+
ASSERT(gct->thunk_selector_depth == 0);
q = p;
@@ -408,220 +413,220 @@ scavenge_block (bdescr *bd)
case MVAR_CLEAN:
case MVAR_DIRTY:
- {
- StgMVar *mvar = ((StgMVar *)p);
- gct->eager_promotion = rtsFalse;
- evacuate((StgClosure **)&mvar->head);
- evacuate((StgClosure **)&mvar->tail);
- evacuate((StgClosure **)&mvar->value);
- gct->eager_promotion = saved_eager_promotion;
-
- if (gct->failed_to_evac) {
- mvar->header.info = &stg_MVAR_DIRTY_info;
- } else {
- mvar->header.info = &stg_MVAR_CLEAN_info;
- }
- p += sizeofW(StgMVar);
- break;
+ {
+ StgMVar *mvar = ((StgMVar *)p);
+ gct->eager_promotion = rtsFalse;
+ evacuate((StgClosure **)&mvar->head);
+ evacuate((StgClosure **)&mvar->tail);
+ evacuate((StgClosure **)&mvar->value);
+ gct->eager_promotion = saved_eager_promotion;
+
+ if (gct->failed_to_evac) {
+ mvar->header.info = &stg_MVAR_DIRTY_info;
+ } else {
+ mvar->header.info = &stg_MVAR_CLEAN_info;
+ }
+ p += sizeofW(StgMVar);
+ break;
}
case TVAR:
{
- StgTVar *tvar = ((StgTVar *)p);
- gct->eager_promotion = rtsFalse;
+ StgTVar *tvar = ((StgTVar *)p);
+ gct->eager_promotion = rtsFalse;
evacuate((StgClosure **)&tvar->current_value);
evacuate((StgClosure **)&tvar->first_watch_queue_entry);
- gct->eager_promotion = saved_eager_promotion;
-
- if (gct->failed_to_evac) {
- tvar->header.info = &stg_TVAR_DIRTY_info;
- } else {
- tvar->header.info = &stg_TVAR_CLEAN_info;
- }
- p += sizeofW(StgTVar);
- break;
+ gct->eager_promotion = saved_eager_promotion;
+
+ if (gct->failed_to_evac) {
+ tvar->header.info = &stg_TVAR_DIRTY_info;
+ } else {
+ tvar->header.info = &stg_TVAR_CLEAN_info;
+ }
+ p += sizeofW(StgTVar);
+ break;
}
case FUN_2_0:
- scavenge_fun_srt(info);
- evacuate(&((StgClosure *)p)->payload[1]);
- evacuate(&((StgClosure *)p)->payload[0]);
- p += sizeofW(StgHeader) + 2;
- break;
+ scavenge_fun_srt(info);
+ evacuate(&((StgClosure *)p)->payload[1]);
+ evacuate(&((StgClosure *)p)->payload[0]);
+ p += sizeofW(StgHeader) + 2;
+ break;
case THUNK_2_0:
- scavenge_thunk_srt(info);
- evacuate(&((StgThunk *)p)->payload[1]);
- evacuate(&((StgThunk *)p)->payload[0]);
- p += sizeofW(StgThunk) + 2;
- break;
+ scavenge_thunk_srt(info);
+ evacuate(&((StgThunk *)p)->payload[1]);
+ evacuate(&((StgThunk *)p)->payload[0]);
+ p += sizeofW(StgThunk) + 2;
+ break;
case CONSTR_2_0:
- evacuate(&((StgClosure *)p)->payload[1]);
- evacuate(&((StgClosure *)p)->payload[0]);
- p += sizeofW(StgHeader) + 2;
- break;
-
+ evacuate(&((StgClosure *)p)->payload[1]);
+ evacuate(&((StgClosure *)p)->payload[0]);
+ p += sizeofW(StgHeader) + 2;
+ break;
+
case THUNK_1_0:
- scavenge_thunk_srt(info);
- evacuate(&((StgThunk *)p)->payload[0]);
- p += sizeofW(StgThunk) + 1;
- break;
-
+ scavenge_thunk_srt(info);
+ evacuate(&((StgThunk *)p)->payload[0]);
+ p += sizeofW(StgThunk) + 1;
+ break;
+
case FUN_1_0:
- scavenge_fun_srt(info);
+ scavenge_fun_srt(info);
case CONSTR_1_0:
- evacuate(&((StgClosure *)p)->payload[0]);
- p += sizeofW(StgHeader) + 1;
- break;
-
+ evacuate(&((StgClosure *)p)->payload[0]);
+ p += sizeofW(StgHeader) + 1;
+ break;
+
case THUNK_0_1:
- scavenge_thunk_srt(info);
- p += sizeofW(StgThunk) + 1;
- break;
-
+ scavenge_thunk_srt(info);
+ p += sizeofW(StgThunk) + 1;
+ break;
+
case FUN_0_1:
- scavenge_fun_srt(info);
+ scavenge_fun_srt(info);
case CONSTR_0_1:
- p += sizeofW(StgHeader) + 1;
- break;
-
+ p += sizeofW(StgHeader) + 1;
+ break;
+
case THUNK_0_2:
- scavenge_thunk_srt(info);
- p += sizeofW(StgThunk) + 2;
- break;
-
+ scavenge_thunk_srt(info);
+ p += sizeofW(StgThunk) + 2;
+ break;
+
case FUN_0_2:
- scavenge_fun_srt(info);
+ scavenge_fun_srt(info);
case CONSTR_0_2:
- p += sizeofW(StgHeader) + 2;
- break;
-
+ p += sizeofW(StgHeader) + 2;
+ break;
+
case THUNK_1_1:
- scavenge_thunk_srt(info);
- evacuate(&((StgThunk *)p)->payload[0]);
- p += sizeofW(StgThunk) + 2;
- break;
+ scavenge_thunk_srt(info);
+ evacuate(&((StgThunk *)p)->payload[0]);
+ p += sizeofW(StgThunk) + 2;
+ break;
case FUN_1_1:
- scavenge_fun_srt(info);
+ scavenge_fun_srt(info);
case CONSTR_1_1:
- evacuate(&((StgClosure *)p)->payload[0]);
- p += sizeofW(StgHeader) + 2;
- break;
-
+ evacuate(&((StgClosure *)p)->payload[0]);
+ p += sizeofW(StgHeader) + 2;
+ break;
+
case FUN:
- scavenge_fun_srt(info);
- goto gen_obj;
+ scavenge_fun_srt(info);
+ goto gen_obj;
case THUNK:
{
- StgPtr end;
-
- scavenge_thunk_srt(info);
- end = (P_)((StgThunk *)p)->payload + info->layout.payload.ptrs;
- for (p = (P_)((StgThunk *)p)->payload; p < end; p++) {
- evacuate((StgClosure **)p);
- }
- p += info->layout.payload.nptrs;
- break;
+ StgPtr end;
+
+ scavenge_thunk_srt(info);
+ end = (P_)((StgThunk *)p)->payload + info->layout.payload.ptrs;
+ for (p = (P_)((StgThunk *)p)->payload; p < end; p++) {
+ evacuate((StgClosure **)p);
+ }
+ p += info->layout.payload.nptrs;
+ break;
}
-
+
gen_obj:
case CONSTR:
case WEAK:
case PRIM:
{
- StgPtr end;
-
- end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
- for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
- evacuate((StgClosure **)p);
- }
- p += info->layout.payload.nptrs;
- break;
+ StgPtr end;
+
+ end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
+ for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
+ evacuate((StgClosure **)p);
+ }
+ p += info->layout.payload.nptrs;
+ break;
}
case BCO: {
- StgBCO *bco = (StgBCO *)p;
- evacuate((StgClosure **)&bco->instrs);
- evacuate((StgClosure **)&bco->literals);
- evacuate((StgClosure **)&bco->ptrs);
- p += bco_sizeW(bco);
- break;
+ StgBCO *bco = (StgBCO *)p;
+ evacuate((StgClosure **)&bco->instrs);
+ evacuate((StgClosure **)&bco->literals);
+ evacuate((StgClosure **)&bco->ptrs);
+ p += bco_sizeW(bco);
+ break;
}
case IND_PERM:
case BLACKHOLE:
- evacuate(&((StgInd *)p)->indirectee);
- p += sizeofW(StgInd);
- break;
+ evacuate(&((StgInd *)p)->indirectee);
+ p += sizeofW(StgInd);
+ break;
case MUT_VAR_CLEAN:
case MUT_VAR_DIRTY:
- gct->eager_promotion = rtsFalse;
- evacuate(&((StgMutVar *)p)->var);
- gct->eager_promotion = saved_eager_promotion;
-
- if (gct->failed_to_evac) {
- ((StgClosure *)q)->header.info = &stg_MUT_VAR_DIRTY_info;
- } else {
- ((StgClosure *)q)->header.info = &stg_MUT_VAR_CLEAN_info;
- }
- p += sizeofW(StgMutVar);
- break;
+ gct->eager_promotion = rtsFalse;
+ evacuate(&((StgMutVar *)p)->var);
+ gct->eager_promotion = saved_eager_promotion;
+
+ if (gct->failed_to_evac) {
+ ((StgClosure *)q)->header.info = &stg_MUT_VAR_DIRTY_info;
+ } else {
+ ((StgClosure *)q)->header.info = &stg_MUT_VAR_CLEAN_info;
+ }
+ p += sizeofW(StgMutVar);
+ break;
case BLOCKING_QUEUE:
{
StgBlockingQueue *bq = (StgBlockingQueue *)p;
-
- gct->eager_promotion = rtsFalse;
+
+ gct->eager_promotion = rtsFalse;
evacuate(&bq->bh);
evacuate((StgClosure**)&bq->owner);
evacuate((StgClosure**)&bq->queue);
evacuate((StgClosure**)&bq->link);
- gct->eager_promotion = saved_eager_promotion;
+ gct->eager_promotion = saved_eager_promotion;
- if (gct->failed_to_evac) {
- bq->header.info = &stg_BLOCKING_QUEUE_DIRTY_info;
- } else {
- bq->header.info = &stg_BLOCKING_QUEUE_CLEAN_info;
- }
+ if (gct->failed_to_evac) {
+ bq->header.info = &stg_BLOCKING_QUEUE_DIRTY_info;
+ } else {
+ bq->header.info = &stg_BLOCKING_QUEUE_CLEAN_info;
+ }
p += sizeofW(StgBlockingQueue);
break;
}
case THUNK_SELECTOR:
- {
- StgSelector *s = (StgSelector *)p;
- evacuate(&s->selectee);
- p += THUNK_SELECTOR_sizeW();
- break;
+ {
+ StgSelector *s = (StgSelector *)p;
+ evacuate(&s->selectee);
+ p += THUNK_SELECTOR_sizeW();
+ break;
}
// A chunk of stack saved in a heap object
case AP_STACK:
{
- StgAP_STACK *ap = (StgAP_STACK *)p;
+ StgAP_STACK *ap = (StgAP_STACK *)p;
- evacuate(&ap->fun);
- scavenge_stack((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
- p = (StgPtr)ap->payload + ap->size;
- break;
+ evacuate(&ap->fun);
+ scavenge_stack((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
+ p = (StgPtr)ap->payload + ap->size;
+ break;
}
case PAP:
- p = scavenge_PAP((StgPAP *)p);
- break;
+ p = scavenge_PAP((StgPAP *)p);
+ break;
case AP:
- p = scavenge_AP((StgAP *)p);
- break;
+ p = scavenge_AP((StgAP *)p);
+ break;
case ARR_WORDS:
- // nothing to follow
- p += arr_words_sizeW((StgArrWords *)p);
- break;
+ // nothing to follow
+ p += arr_words_sizeW((StgArrWords *)p);
+ break;
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
@@ -634,31 +639,31 @@ scavenge_block (bdescr *bd)
p = scavenge_mut_arr_ptrs((StgMutArrPtrs*)p);
- if (gct->failed_to_evac) {
- ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_DIRTY_info;
- } else {
- ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_CLEAN_info;
- }
+ if (gct->failed_to_evac) {
+ ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_DIRTY_info;
+ } else {
+ ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_CLEAN_info;
+ }
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // always put it on the mutable list.
- break;
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // always put it on the mutable list.
+ break;
}
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
- // follow everything
+ // follow everything
{
p = scavenge_mut_arr_ptrs((StgMutArrPtrs*)p);
- // If we're going to put this object on the mutable list, then
- // set its info ptr to MUT_ARR_PTRS_FROZEN0 to indicate that.
- if (gct->failed_to_evac) {
+ // If we're going to put this object on the mutable list, then
+ // set its info ptr to MUT_ARR_PTRS_FROZEN0 to indicate that.
+ if (gct->failed_to_evac) {
((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN0_info;
- } else {
- ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN_info;
- }
- break;
+ } else {
+ ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN_info;
+ }
+ break;
}
case SMALL_MUT_ARR_PTRS_CLEAN:
@@ -710,10 +715,10 @@ scavenge_block (bdescr *bd)
}
case TSO:
- {
+ {
scavengeTSO((StgTSO *)p);
p += sizeofW(StgTSO);
- break;
+ break;
}
case STACK:
@@ -732,56 +737,56 @@ scavenge_block (bdescr *bd)
case MUT_PRIM:
{
- StgPtr end;
+ StgPtr end;
- gct->eager_promotion = rtsFalse;
+ gct->eager_promotion = rtsFalse;
- end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
- for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
- evacuate((StgClosure **)p);
- }
- p += info->layout.payload.nptrs;
+ end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
+ for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
+ evacuate((StgClosure **)p);
+ }
+ p += info->layout.payload.nptrs;
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // mutable
- break;
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // mutable
+ break;
}
case TREC_CHUNK:
{
- StgWord i;
- StgTRecChunk *tc = ((StgTRecChunk *) p);
- TRecEntry *e = &(tc -> entries[0]);
- gct->eager_promotion = rtsFalse;
- evacuate((StgClosure **)&tc->prev_chunk);
- for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
- evacuate((StgClosure **)&e->tvar);
- evacuate((StgClosure **)&e->expected_value);
- evacuate((StgClosure **)&e->new_value);
- }
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // mutable
- p += sizeofW(StgTRecChunk);
- break;
+ StgWord i;
+ StgTRecChunk *tc = ((StgTRecChunk *) p);
+ TRecEntry *e = &(tc -> entries[0]);
+ gct->eager_promotion = rtsFalse;
+ evacuate((StgClosure **)&tc->prev_chunk);
+ for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
+ evacuate((StgClosure **)&e->tvar);
+ evacuate((StgClosure **)&e->expected_value);
+ evacuate((StgClosure **)&e->new_value);
+ }
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // mutable
+ p += sizeofW(StgTRecChunk);
+ break;
}
default:
- barf("scavenge: unimplemented/strange closure type %d @ %p",
- info->type, p);
+ barf("scavenge: unimplemented/strange closure type %d @ %p",
+ info->type, p);
}
/*
* We need to record the current object on the mutable list if
- * (a) It is actually mutable, or
+ * (a) It is actually mutable, or
* (b) It contains pointers to a younger generation.
* Case (b) arises if we didn't manage to promote everything that
* the current object points to into the current generation.
*/
if (gct->failed_to_evac) {
- gct->failed_to_evac = rtsFalse;
- if (bd->gen_no > 0) {
- recordMutableGen_GC((StgClosure *)q, bd->gen_no);
- }
+ gct->failed_to_evac = rtsFalse;
+ if (bd->gen_no > 0) {
+ recordMutableGen_GC((StgClosure *)q, bd->gen_no);
+ }
}
}
@@ -825,22 +830,22 @@ scavenge_mark_stack(void)
while ((p = pop_mark_stack())) {
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
- info = get_itbl((StgClosure *)p);
-
- q = p;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
+ info = get_itbl((StgClosure *)p);
+
+ q = p;
switch (info->type) {
-
+
case MVAR_CLEAN:
case MVAR_DIRTY:
- {
+ {
StgMVar *mvar = ((StgMVar *)p);
gct->eager_promotion = rtsFalse;
evacuate((StgClosure **)&mvar->head);
evacuate((StgClosure **)&mvar->tail);
evacuate((StgClosure **)&mvar->value);
gct->eager_promotion = saved_eager_promotion;
-
+
if (gct->failed_to_evac) {
mvar->header.info = &stg_MVAR_DIRTY_info;
} else {
@@ -865,128 +870,128 @@ scavenge_mark_stack(void)
break;
}
- case FUN_2_0:
- scavenge_fun_srt(info);
- evacuate(&((StgClosure *)p)->payload[1]);
- evacuate(&((StgClosure *)p)->payload[0]);
- break;
-
- case THUNK_2_0:
- scavenge_thunk_srt(info);
- evacuate(&((StgThunk *)p)->payload[1]);
- evacuate(&((StgThunk *)p)->payload[0]);
- break;
-
- case CONSTR_2_0:
- evacuate(&((StgClosure *)p)->payload[1]);
- evacuate(&((StgClosure *)p)->payload[0]);
- break;
-
- case FUN_1_0:
- case FUN_1_1:
- scavenge_fun_srt(info);
- evacuate(&((StgClosure *)p)->payload[0]);
- break;
-
- case THUNK_1_0:
- case THUNK_1_1:
- scavenge_thunk_srt(info);
- evacuate(&((StgThunk *)p)->payload[0]);
- break;
-
- case CONSTR_1_0:
- case CONSTR_1_1:
- evacuate(&((StgClosure *)p)->payload[0]);
- break;
-
- case FUN_0_1:
- case FUN_0_2:
- scavenge_fun_srt(info);
- break;
-
- case THUNK_0_1:
- case THUNK_0_2:
- scavenge_thunk_srt(info);
- break;
-
- case CONSTR_0_1:
- case CONSTR_0_2:
- break;
-
- case FUN:
- scavenge_fun_srt(info);
- goto gen_obj;
-
- case THUNK:
- {
- StgPtr end;
-
- scavenge_thunk_srt(info);
- end = (P_)((StgThunk *)p)->payload + info->layout.payload.ptrs;
- for (p = (P_)((StgThunk *)p)->payload; p < end; p++) {
- evacuate((StgClosure **)p);
- }
- break;
- }
-
- gen_obj:
- case CONSTR:
- case WEAK:
- case PRIM:
- {
- StgPtr end;
-
- end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
- for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
- evacuate((StgClosure **)p);
- }
- break;
- }
-
- case BCO: {
- StgBCO *bco = (StgBCO *)p;
- evacuate((StgClosure **)&bco->instrs);
- evacuate((StgClosure **)&bco->literals);
- evacuate((StgClosure **)&bco->ptrs);
- break;
- }
-
- case IND_PERM:
- // don't need to do anything here: the only possible case
- // is that we're in a 1-space compacting collector, with
- // no "old" generation.
- break;
-
- case IND:
+ case FUN_2_0:
+ scavenge_fun_srt(info);
+ evacuate(&((StgClosure *)p)->payload[1]);
+ evacuate(&((StgClosure *)p)->payload[0]);
+ break;
+
+ case THUNK_2_0:
+ scavenge_thunk_srt(info);
+ evacuate(&((StgThunk *)p)->payload[1]);
+ evacuate(&((StgThunk *)p)->payload[0]);
+ break;
+
+ case CONSTR_2_0:
+ evacuate(&((StgClosure *)p)->payload[1]);
+ evacuate(&((StgClosure *)p)->payload[0]);
+ break;
+
+ case FUN_1_0:
+ case FUN_1_1:
+ scavenge_fun_srt(info);
+ evacuate(&((StgClosure *)p)->payload[0]);
+ break;
+
+ case THUNK_1_0:
+ case THUNK_1_1:
+ scavenge_thunk_srt(info);
+ evacuate(&((StgThunk *)p)->payload[0]);
+ break;
+
+ case CONSTR_1_0:
+ case CONSTR_1_1:
+ evacuate(&((StgClosure *)p)->payload[0]);
+ break;
+
+ case FUN_0_1:
+ case FUN_0_2:
+ scavenge_fun_srt(info);
+ break;
+
+ case THUNK_0_1:
+ case THUNK_0_2:
+ scavenge_thunk_srt(info);
+ break;
+
+ case CONSTR_0_1:
+ case CONSTR_0_2:
+ break;
+
+ case FUN:
+ scavenge_fun_srt(info);
+ goto gen_obj;
+
+ case THUNK:
+ {
+ StgPtr end;
+
+ scavenge_thunk_srt(info);
+ end = (P_)((StgThunk *)p)->payload + info->layout.payload.ptrs;
+ for (p = (P_)((StgThunk *)p)->payload; p < end; p++) {
+ evacuate((StgClosure **)p);
+ }
+ break;
+ }
+
+ gen_obj:
+ case CONSTR:
+ case WEAK:
+ case PRIM:
+ {
+ StgPtr end;
+
+ end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
+ for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
+ evacuate((StgClosure **)p);
+ }
+ break;
+ }
+
+ case BCO: {
+ StgBCO *bco = (StgBCO *)p;
+ evacuate((StgClosure **)&bco->instrs);
+ evacuate((StgClosure **)&bco->literals);
+ evacuate((StgClosure **)&bco->ptrs);
+ break;
+ }
+
+ case IND_PERM:
+ // don't need to do anything here: the only possible case
+ // is that we're in a 1-space compacting collector, with
+ // no "old" generation.
+ break;
+
+ case IND:
case BLACKHOLE:
- evacuate(&((StgInd *)p)->indirectee);
- break;
-
- case MUT_VAR_CLEAN:
- case MUT_VAR_DIRTY: {
- gct->eager_promotion = rtsFalse;
- evacuate(&((StgMutVar *)p)->var);
- gct->eager_promotion = saved_eager_promotion;
-
- if (gct->failed_to_evac) {
- ((StgClosure *)q)->header.info = &stg_MUT_VAR_DIRTY_info;
- } else {
- ((StgClosure *)q)->header.info = &stg_MUT_VAR_CLEAN_info;
- }
- break;
- }
+ evacuate(&((StgInd *)p)->indirectee);
+ break;
+
+ case MUT_VAR_CLEAN:
+ case MUT_VAR_DIRTY: {
+ gct->eager_promotion = rtsFalse;
+ evacuate(&((StgMutVar *)p)->var);
+ gct->eager_promotion = saved_eager_promotion;
+
+ if (gct->failed_to_evac) {
+ ((StgClosure *)q)->header.info = &stg_MUT_VAR_DIRTY_info;
+ } else {
+ ((StgClosure *)q)->header.info = &stg_MUT_VAR_CLEAN_info;
+ }
+ break;
+ }
case BLOCKING_QUEUE:
{
StgBlockingQueue *bq = (StgBlockingQueue *)p;
-
+
gct->eager_promotion = rtsFalse;
evacuate(&bq->bh);
evacuate((StgClosure**)&bq->owner);
evacuate((StgClosure**)&bq->queue);
evacuate((StgClosure**)&bq->link);
gct->eager_promotion = saved_eager_promotion;
-
+
if (gct->failed_to_evac) {
bq->header.info = &stg_BLOCKING_QUEUE_DIRTY_info;
} else {
@@ -995,43 +1000,43 @@ scavenge_mark_stack(void)
break;
}
- case ARR_WORDS:
- break;
-
- case THUNK_SELECTOR:
- {
- StgSelector *s = (StgSelector *)p;
- evacuate(&s->selectee);
- break;
- }
-
- // A chunk of stack saved in a heap object
- case AP_STACK:
- {
- StgAP_STACK *ap = (StgAP_STACK *)p;
-
- evacuate(&ap->fun);
- scavenge_stack((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
- break;
- }
-
- case PAP:
- scavenge_PAP((StgPAP *)p);
- break;
-
- case AP:
- scavenge_AP((StgAP *)p);
- break;
-
- case MUT_ARR_PTRS_CLEAN:
- case MUT_ARR_PTRS_DIRTY:
- // follow everything
- {
- // We don't eagerly promote objects pointed to by a mutable
- // array, but if we find the array only points to objects in
- // the same or an older generation, we mark it "clean" and
- // avoid traversing it during minor GCs.
- gct->eager_promotion = rtsFalse;
+ case ARR_WORDS:
+ break;
+
+ case THUNK_SELECTOR:
+ {
+ StgSelector *s = (StgSelector *)p;
+ evacuate(&s->selectee);
+ break;
+ }
+
+ // A chunk of stack saved in a heap object
+ case AP_STACK:
+ {
+ StgAP_STACK *ap = (StgAP_STACK *)p;
+
+ evacuate(&ap->fun);
+ scavenge_stack((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
+ break;
+ }
+
+ case PAP:
+ scavenge_PAP((StgPAP *)p);
+ break;
+
+ case AP:
+ scavenge_AP((StgAP *)p);
+ break;
+
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
+ // follow everything
+ {
+ // We don't eagerly promote objects pointed to by a mutable
+ // array, but if we find the array only points to objects in
+ // the same or an older generation, we mark it "clean" and
+ // avoid traversing it during minor GCs.
+ gct->eager_promotion = rtsFalse;
scavenge_mut_arr_ptrs((StgMutArrPtrs *)p);
@@ -1041,28 +1046,28 @@ scavenge_mark_stack(void)
((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_CLEAN_info;
}
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // mutable anyhow.
- break;
- }
-
- case MUT_ARR_PTRS_FROZEN:
- case MUT_ARR_PTRS_FROZEN0:
- // follow everything
- {
- StgPtr q = p;
-
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // mutable anyhow.
+ break;
+ }
+
+ case MUT_ARR_PTRS_FROZEN:
+ case MUT_ARR_PTRS_FROZEN0:
+ // follow everything
+ {
+ StgPtr q = p;
+
scavenge_mut_arr_ptrs((StgMutArrPtrs *)p);
- // If we're going to put this object on the mutable list, then
- // set its info ptr to MUT_ARR_PTRS_FROZEN0 to indicate that.
- if (gct->failed_to_evac) {
- ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN0_info;
- } else {
- ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN_info;
- }
- break;
- }
+ // If we're going to put this object on the mutable list, then
+ // set its info ptr to MUT_ARR_PTRS_FROZEN0 to indicate that.
+ if (gct->failed_to_evac) {
+ ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN0_info;
+ } else {
+ ((StgClosure *)q)->header.info = &stg_MUT_ARR_PTRS_FROZEN_info;
+ }
+ break;
+ }
case SMALL_MUT_ARR_PTRS_CLEAN:
case SMALL_MUT_ARR_PTRS_DIRTY:
@@ -1098,7 +1103,7 @@ scavenge_mark_stack(void)
// follow everything
{
StgPtr next, q = p;
-
+
next = p + small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs*)p);
for (p = (P_)((StgSmallMutArrPtrs *)p)->payload; p < next; p++) {
evacuate((StgClosure **)p);
@@ -1114,11 +1119,11 @@ scavenge_mark_stack(void)
break;
}
- case TSO:
- {
+ case TSO:
+ {
scavengeTSO((StgTSO*)p);
- break;
- }
+ break;
+ }
case STACK:
{
@@ -1136,47 +1141,47 @@ scavenge_mark_stack(void)
case MUT_PRIM:
{
StgPtr end;
-
+
gct->eager_promotion = rtsFalse;
-
+
end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
evacuate((StgClosure **)p);
}
-
+
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // mutable
+ break;
+ }
+
+ case TREC_CHUNK:
+ {
+ StgWord i;
+ StgTRecChunk *tc = ((StgTRecChunk *) p);
+ TRecEntry *e = &(tc -> entries[0]);
+ gct->eager_promotion = rtsFalse;
+ evacuate((StgClosure **)&tc->prev_chunk);
+ for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
+ evacuate((StgClosure **)&e->tvar);
+ evacuate((StgClosure **)&e->expected_value);
+ evacuate((StgClosure **)&e->new_value);
+ }
gct->eager_promotion = saved_eager_promotion;
gct->failed_to_evac = rtsTrue; // mutable
break;
+ }
+
+ default:
+ barf("scavenge_mark_stack: unimplemented/strange closure type %d @ %p",
+ info->type, p);
}
- case TREC_CHUNK:
- {
- StgWord i;
- StgTRecChunk *tc = ((StgTRecChunk *) p);
- TRecEntry *e = &(tc -> entries[0]);
- gct->eager_promotion = rtsFalse;
- evacuate((StgClosure **)&tc->prev_chunk);
- for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
- evacuate((StgClosure **)&e->tvar);
- evacuate((StgClosure **)&e->expected_value);
- evacuate((StgClosure **)&e->new_value);
- }
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // mutable
- break;
- }
-
- default:
- barf("scavenge_mark_stack: unimplemented/strange closure type %d @ %p",
- info->type, p);
- }
-
- if (gct->failed_to_evac) {
- gct->failed_to_evac = rtsFalse;
+ if (gct->failed_to_evac) {
+ gct->failed_to_evac = rtsFalse;
if (gct->evac_gen_no) {
recordMutableGen_GC((StgClosure *)q, gct->evac_gen_no);
- }
- }
+ }
+ }
} // while (p = pop_mark_stack())
}
@@ -1194,45 +1199,45 @@ scavenge_one(StgPtr p)
const StgInfoTable *info;
rtsBool no_luck;
rtsBool saved_eager_promotion;
-
+
saved_eager_promotion = gct->eager_promotion;
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
info = get_itbl((StgClosure *)p);
-
+
switch (info->type) {
-
+
case MVAR_CLEAN:
case MVAR_DIRTY:
- {
- StgMVar *mvar = ((StgMVar *)p);
- gct->eager_promotion = rtsFalse;
- evacuate((StgClosure **)&mvar->head);
- evacuate((StgClosure **)&mvar->tail);
- evacuate((StgClosure **)&mvar->value);
- gct->eager_promotion = saved_eager_promotion;
-
- if (gct->failed_to_evac) {
- mvar->header.info = &stg_MVAR_DIRTY_info;
- } else {
- mvar->header.info = &stg_MVAR_CLEAN_info;
- }
- break;
+ {
+ StgMVar *mvar = ((StgMVar *)p);
+ gct->eager_promotion = rtsFalse;
+ evacuate((StgClosure **)&mvar->head);
+ evacuate((StgClosure **)&mvar->tail);
+ evacuate((StgClosure **)&mvar->value);
+ gct->eager_promotion = saved_eager_promotion;
+
+ if (gct->failed_to_evac) {
+ mvar->header.info = &stg_MVAR_DIRTY_info;
+ } else {
+ mvar->header.info = &stg_MVAR_CLEAN_info;
+ }
+ break;
}
case TVAR:
{
- StgTVar *tvar = ((StgTVar *)p);
- gct->eager_promotion = rtsFalse;
+ StgTVar *tvar = ((StgTVar *)p);
+ gct->eager_promotion = rtsFalse;
evacuate((StgClosure **)&tvar->current_value);
evacuate((StgClosure **)&tvar->first_watch_queue_entry);
- gct->eager_promotion = saved_eager_promotion;
+ gct->eager_promotion = saved_eager_promotion;
- if (gct->failed_to_evac) {
- tvar->header.info = &stg_TVAR_DIRTY_info;
- } else {
- tvar->header.info = &stg_TVAR_CLEAN_info;
- }
+ if (gct->failed_to_evac) {
+ tvar->header.info = &stg_TVAR_DIRTY_info;
+ } else {
+ tvar->header.info = &stg_TVAR_CLEAN_info;
+ }
break;
}
@@ -1243,17 +1248,17 @@ scavenge_one(StgPtr p)
case THUNK_0_2:
case THUNK_2_0:
{
- StgPtr q, end;
-
- end = (StgPtr)((StgThunk *)p)->payload + info->layout.payload.ptrs;
- for (q = (StgPtr)((StgThunk *)p)->payload; q < end; q++) {
- evacuate((StgClosure **)q);
- }
- break;
+ StgPtr q, end;
+
+ end = (StgPtr)((StgThunk *)p)->payload + info->layout.payload.ptrs;
+ for (q = (StgPtr)((StgThunk *)p)->payload; q < end; q++) {
+ evacuate((StgClosure **)q);
+ }
+ break;
}
case FUN:
- case FUN_1_0: // hardly worth specialising these guys
+ case FUN_1_0: // hardly worth specialising these guys
case FUN_0_1:
case FUN_1_1:
case FUN_0_2:
@@ -1268,42 +1273,42 @@ scavenge_one(StgPtr p)
case PRIM:
case IND_PERM:
{
- StgPtr q, end;
-
- end = (StgPtr)((StgClosure *)p)->payload + info->layout.payload.ptrs;
- for (q = (StgPtr)((StgClosure *)p)->payload; q < end; q++) {
- evacuate((StgClosure **)q);
- }
- break;
+ StgPtr q, end;
+
+ end = (StgPtr)((StgClosure *)p)->payload + info->layout.payload.ptrs;
+ for (q = (StgPtr)((StgClosure *)p)->payload; q < end; q++) {
+ evacuate((StgClosure **)q);
+ }
+ break;
}
-
+
case MUT_VAR_CLEAN:
case MUT_VAR_DIRTY: {
- StgPtr q = p;
-
- gct->eager_promotion = rtsFalse;
- evacuate(&((StgMutVar *)p)->var);
- gct->eager_promotion = saved_eager_promotion;
-
- if (gct->failed_to_evac) {
- ((StgClosure *)q)->header.info = &stg_MUT_VAR_DIRTY_info;
- } else {
- ((StgClosure *)q)->header.info = &stg_MUT_VAR_CLEAN_info;
- }
- break;
+ StgPtr q = p;
+
+ gct->eager_promotion = rtsFalse;
+ evacuate(&((StgMutVar *)p)->var);
+ gct->eager_promotion = saved_eager_promotion;
+
+ if (gct->failed_to_evac) {
+ ((StgClosure *)q)->header.info = &stg_MUT_VAR_DIRTY_info;
+ } else {
+ ((StgClosure *)q)->header.info = &stg_MUT_VAR_CLEAN_info;
+ }
+ break;
}
case BLOCKING_QUEUE:
{
StgBlockingQueue *bq = (StgBlockingQueue *)p;
-
+
gct->eager_promotion = rtsFalse;
evacuate(&bq->bh);
evacuate((StgClosure**)&bq->owner);
evacuate((StgClosure**)&bq->queue);
evacuate((StgClosure**)&bq->link);
gct->eager_promotion = saved_eager_promotion;
-
+
if (gct->failed_to_evac) {
bq->header.info = &stg_BLOCKING_QUEUE_DIRTY_info;
} else {
@@ -1313,70 +1318,70 @@ scavenge_one(StgPtr p)
}
case THUNK_SELECTOR:
- {
- StgSelector *s = (StgSelector *)p;
- evacuate(&s->selectee);
- break;
+ {
+ StgSelector *s = (StgSelector *)p;
+ evacuate(&s->selectee);
+ break;
}
-
+
case AP_STACK:
{
- StgAP_STACK *ap = (StgAP_STACK *)p;
+ StgAP_STACK *ap = (StgAP_STACK *)p;
- evacuate(&ap->fun);
- scavenge_stack((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
- p = (StgPtr)ap->payload + ap->size;
- break;
+ evacuate(&ap->fun);
+ scavenge_stack((StgPtr)ap->payload, (StgPtr)ap->payload + ap->size);
+ p = (StgPtr)ap->payload + ap->size;
+ break;
}
case PAP:
- p = scavenge_PAP((StgPAP *)p);
- break;
+ p = scavenge_PAP((StgPAP *)p);
+ break;
case AP:
- p = scavenge_AP((StgAP *)p);
- break;
+ p = scavenge_AP((StgAP *)p);
+ break;
case ARR_WORDS:
- // nothing to follow
- break;
+ // nothing to follow
+ break;
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
{
- // We don't eagerly promote objects pointed to by a mutable
- // array, but if we find the array only points to objects in
- // the same or an older generation, we mark it "clean" and
- // avoid traversing it during minor GCs.
- gct->eager_promotion = rtsFalse;
+ // We don't eagerly promote objects pointed to by a mutable
+ // array, but if we find the array only points to objects in
+ // the same or an older generation, we mark it "clean" and
+ // avoid traversing it during minor GCs.
+ gct->eager_promotion = rtsFalse;
scavenge_mut_arr_ptrs((StgMutArrPtrs *)p);
- if (gct->failed_to_evac) {
- ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_DIRTY_info;
- } else {
- ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_CLEAN_info;
- }
+ if (gct->failed_to_evac) {
+ ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_DIRTY_info;
+ } else {
+ ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_CLEAN_info;
+ }
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue;
- break;
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue;
+ break;
}
case MUT_ARR_PTRS_FROZEN:
case MUT_ARR_PTRS_FROZEN0:
{
- // follow everything
+ // follow everything
scavenge_mut_arr_ptrs((StgMutArrPtrs *)p);
-
- // If we're going to put this object on the mutable list, then
- // set its info ptr to MUT_ARR_PTRS_FROZEN0 to indicate that.
- if (gct->failed_to_evac) {
- ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_FROZEN0_info;
- } else {
- ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_FROZEN_info;
- }
- break;
+
+ // If we're going to put this object on the mutable list, then
+ // set its info ptr to MUT_ARR_PTRS_FROZEN0 to indicate that.
+ if (gct->failed_to_evac) {
+ ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_FROZEN0_info;
+ } else {
+ ((StgClosure *)p)->header.info = &stg_MUT_ARR_PTRS_FROZEN_info;
+ }
+ break;
}
case SMALL_MUT_ARR_PTRS_CLEAN:
@@ -1413,7 +1418,7 @@ scavenge_one(StgPtr p)
{
// follow everything
StgPtr next, q=p;
-
+
next = p + small_mut_arr_ptrs_sizeW((StgSmallMutArrPtrs*)p);
for (p = (P_)((StgSmallMutArrPtrs *)p)->payload; p < next; p++) {
evacuate((StgClosure **)p);
@@ -1431,10 +1436,10 @@ scavenge_one(StgPtr p)
case TSO:
{
- scavengeTSO((StgTSO*)p);
- break;
+ scavengeTSO((StgTSO*)p);
+ break;
}
-
+
case STACK:
{
StgStack *stack = (StgStack*)p;
@@ -1450,36 +1455,36 @@ scavenge_one(StgPtr p)
case MUT_PRIM:
{
- StgPtr end;
-
- gct->eager_promotion = rtsFalse;
-
- end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
- for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
- evacuate((StgClosure **)p);
- }
-
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // mutable
- break;
+ StgPtr end;
+
+ gct->eager_promotion = rtsFalse;
+
+ end = (P_)((StgClosure *)p)->payload + info->layout.payload.ptrs;
+ for (p = (P_)((StgClosure *)p)->payload; p < end; p++) {
+ evacuate((StgClosure **)p);
+ }
+
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // mutable
+ break;
}
case TREC_CHUNK:
{
- StgWord i;
- StgTRecChunk *tc = ((StgTRecChunk *) p);
- TRecEntry *e = &(tc -> entries[0]);
- gct->eager_promotion = rtsFalse;
- evacuate((StgClosure **)&tc->prev_chunk);
- for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
- evacuate((StgClosure **)&e->tvar);
- evacuate((StgClosure **)&e->expected_value);
- evacuate((StgClosure **)&e->new_value);
- }
- gct->eager_promotion = saved_eager_promotion;
- gct->failed_to_evac = rtsTrue; // mutable
- break;
+ StgWord i;
+ StgTRecChunk *tc = ((StgTRecChunk *) p);
+ TRecEntry *e = &(tc -> entries[0]);
+ gct->eager_promotion = rtsFalse;
+ evacuate((StgClosure **)&tc->prev_chunk);
+ for (i = 0; i < tc -> next_entry_idx; i ++, e++ ) {
+ evacuate((StgClosure **)&e->tvar);
+ evacuate((StgClosure **)&e->expected_value);
+ evacuate((StgClosure **)&e->new_value);
+ }
+ gct->eager_promotion = saved_eager_promotion;
+ gct->failed_to_evac = rtsTrue; // mutable
+ break;
}
case IND:
@@ -1488,38 +1493,38 @@ scavenge_one(StgPtr p)
// on the large-object list and then gets updated. See #3424.
case BLACKHOLE:
case IND_STATIC:
- evacuate(&((StgInd *)p)->indirectee);
+ evacuate(&((StgInd *)p)->indirectee);
#if 0 && defined(DEBUG)
- if (RtsFlags.DebugFlags.gc)
+ if (RtsFlags.DebugFlags.gc)
/* Debugging code to print out the size of the thing we just
- * promoted
+ * promoted
*/
- {
- StgPtr start = gen->scan;
- bdescr *start_bd = gen->scan_bd;
- StgWord size = 0;
- scavenge(&gen);
- if (start_bd != gen->scan_bd) {
- size += (P_)BLOCK_ROUND_UP(start) - start;
- start_bd = start_bd->link;
- while (start_bd != gen->scan_bd) {
- size += BLOCK_SIZE_W;
- start_bd = start_bd->link;
- }
- size += gen->scan -
- (P_)BLOCK_ROUND_DOWN(gen->scan);
- } else {
- size = gen->scan - start;
- }
- debugBelch("evac IND_OLDGEN: %ld bytes", size * sizeof(W_));
+ {
+ StgPtr start = gen->scan;
+ bdescr *start_bd = gen->scan_bd;
+ StgWord size = 0;
+ scavenge(&gen);
+ if (start_bd != gen->scan_bd) {
+ size += (P_)BLOCK_ROUND_UP(start) - start;
+ start_bd = start_bd->link;
+ while (start_bd != gen->scan_bd) {
+ size += BLOCK_SIZE_W;
+ start_bd = start_bd->link;
+ }
+ size += gen->scan -
+ (P_)BLOCK_ROUND_DOWN(gen->scan);
+ } else {
+ size = gen->scan - start;
+ }
+ debugBelch("evac IND_OLDGEN: %ld bytes", size * sizeof(W_));
}
#endif
break;
default:
- barf("scavenge_one: strange object %d", (int)(info->type));
- }
+ barf("scavenge_one: strange object %d", (int)(info->type));
+ }
no_luck = gct->failed_to_evac;
gct->failed_to_evac = rtsFalse;
@@ -1543,24 +1548,24 @@ scavenge_mutable_list(bdescr *bd, generation *gen)
gen_no = gen->no;
gct->evac_gen_no = gen_no;
for (; bd != NULL; bd = bd->link) {
- for (q = bd->start; q < bd->free; q++) {
- p = (StgPtr)*q;
- ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
+ for (q = bd->start; q < bd->free; q++) {
+ p = (StgPtr)*q;
+ ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
-#ifdef DEBUG
- switch (get_itbl((StgClosure *)p)->type) {
- case MUT_VAR_CLEAN:
+#ifdef DEBUG
+ switch (get_itbl((StgClosure *)p)->type) {
+ case MUT_VAR_CLEAN:
// can happen due to concurrent writeMutVars
- case MUT_VAR_DIRTY:
- mutlist_MUTVARS++; break;
- case MUT_ARR_PTRS_CLEAN:
- case MUT_ARR_PTRS_DIRTY:
- case MUT_ARR_PTRS_FROZEN:
- case MUT_ARR_PTRS_FROZEN0:
- mutlist_MUTARRS++; break;
- case MVAR_CLEAN:
- barf("MVAR_CLEAN on mutable list");
- case MVAR_DIRTY:
+ case MUT_VAR_DIRTY:
+ mutlist_MUTVARS++; break;
+ case MUT_ARR_PTRS_CLEAN:
+ case MUT_ARR_PTRS_DIRTY:
+ case MUT_ARR_PTRS_FROZEN:
+ case MUT_ARR_PTRS_FROZEN0:
+ mutlist_MUTARRS++; break;
+ case MVAR_CLEAN:
+ barf("MVAR_CLEAN on mutable list");
+ case MVAR_DIRTY:
mutlist_MVARS++; break;
case TVAR:
mutlist_TVAR++; break;
@@ -1583,18 +1588,18 @@ scavenge_mutable_list(bdescr *bd, generation *gen)
}
#endif
- // Check whether this object is "clean", that is it
- // definitely doesn't point into a young generation.
- // Clean objects don't need to be scavenged. Some clean
- // objects (MUT_VAR_CLEAN) are not kept on the mutable
- // list at all; others, such as MUT_ARR_PTRS
- // are always on the mutable list.
- //
- switch (get_itbl((StgClosure *)p)->type) {
- case MUT_ARR_PTRS_CLEAN:
+ // Check whether this object is "clean", that is it
+ // definitely doesn't point into a young generation.
+ // Clean objects don't need to be scavenged. Some clean
+ // objects (MUT_VAR_CLEAN) are not kept on the mutable
+ // list at all; others, such as MUT_ARR_PTRS
+ // are always on the mutable list.
+ //
+ switch (get_itbl((StgClosure *)p)->type) {
+ case MUT_ARR_PTRS_CLEAN:
recordMutableGen_GC((StgClosure *)p,gen_no);
- continue;
- case MUT_ARR_PTRS_DIRTY:
+ continue;
+ case MUT_ARR_PTRS_DIRTY:
{
rtsBool saved_eager_promotion;
saved_eager_promotion = gct->eager_promotion;
@@ -1611,18 +1616,18 @@ scavenge_mutable_list(bdescr *bd, generation *gen)
gct->eager_promotion = saved_eager_promotion;
gct->failed_to_evac = rtsFalse;
recordMutableGen_GC((StgClosure *)p,gen_no);
- continue;
+ continue;
}
default:
- ;
- }
+ ;
+ }
- if (scavenge_one(p)) {
- // didn't manage to promote everything, so put the
- // object back on the list.
+ if (scavenge_one(p)) {
+ // didn't manage to promote everything, so put the
+ // object back on the list.
recordMutableGen_GC((StgClosure *)p,gen_no);
- }
- }
+ }
+ }
}
}
@@ -1668,50 +1673,50 @@ scavenge_static(void)
list... */
while (1) {
-
+
/* get the next static object from the list. Remember, there might
* be more stuff on this list after each evacuation...
* (static_objects is a global)
*/
p = gct->static_objects;
if (p == END_OF_STATIC_LIST) {
- break;
+ break;
}
-
+
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
info = get_itbl(p);
/*
- if (info->type==RBH)
- info = REVERT_INFOPTR(info); // if it's an RBH, look at the orig closure
+ if (info->type==RBH)
+ info = REVERT_INFOPTR(info); // if it's an RBH, look at the orig closure
*/
- // make sure the info pointer is into text space
-
+ // make sure the info pointer is into text space
+
/* Take this object *off* the static_objects list,
* and put it on the scavenged_static_objects list.
*/
gct->static_objects = *STATIC_LINK(info,p);
*STATIC_LINK(info,p) = gct->scavenged_static_objects;
gct->scavenged_static_objects = p;
-
+
switch (info -> type) {
-
+
case IND_STATIC:
{
- StgInd *ind = (StgInd *)p;
- evacuate(&ind->indirectee);
-
- /* might fail to evacuate it, in which case we have to pop it
- * back on the mutable list of the oldest generation. We
- * leave it *on* the scavenged_static_objects list, though,
- * in case we visit this object again.
- */
- if (gct->failed_to_evac) {
- gct->failed_to_evac = rtsFalse;
- recordMutableGen_GC((StgClosure *)p,oldest_gen->no);
- }
- break;
+ StgInd *ind = (StgInd *)p;
+ evacuate(&ind->indirectee);
+
+ /* might fail to evacuate it, in which case we have to pop it
+ * back on the mutable list of the oldest generation. We
+ * leave it *on* the scavenged_static_objects list, though,
+ * in case we visit this object again.
+ */
+ if (gct->failed_to_evac) {
+ gct->failed_to_evac = rtsFalse;
+ recordMutableGen_GC((StgClosure *)p,oldest_gen->no);
+ }
+ break;
}
-
+
case THUNK_STATIC:
scavenge_thunk_srt(info);
break;
@@ -1719,19 +1724,19 @@ scavenge_static(void)
case FUN_STATIC:
scavenge_fun_srt(info);
break;
-
+
case CONSTR_STATIC:
- {
- StgPtr q, next;
-
- next = (P_)p->payload + info->layout.payload.ptrs;
- // evacuate the pointers
- for (q = (P_)p->payload; q < next; q++) {
- evacuate((StgClosure **)q);
- }
- break;
+ {
+ StgPtr q, next;
+
+ next = (P_)p->payload + info->layout.payload.ptrs;
+ // evacuate the pointers
+ for (q = (P_)p->payload; q < next; q++) {
+ evacuate((StgClosure **)q);
+ }
+ break;
}
-
+
default:
barf("scavenge_static: strange closure %d", (int)(info->type));
}
@@ -1749,7 +1754,7 @@ scavenge_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, StgWord size )
{
nat i, j, b;
StgWord bitmap;
-
+
b = 0;
for (i = 0; i < size; b++) {
@@ -1760,8 +1765,8 @@ scavenge_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, StgWord size )
if ((bitmap & 1) == 0) {
evacuate((StgClosure **)p);
}
- bitmap = bitmap >> 1;
- }
+ bitmap = bitmap >> 1;
+ }
}
}
@@ -1779,39 +1784,39 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
StgWord bitmap;
StgWord size;
- /*
+ /*
* Each time around this loop, we are looking at a chunk of stack
- * that starts with an activation record.
+ * that starts with an activation record.
*/
while (p < stack_end) {
info = get_ret_itbl((StgClosure *)p);
-
+
switch (info->i.type) {
-
+
case UPDATE_FRAME:
- // In SMP, we can get update frames that point to indirections
- // when two threads evaluate the same thunk. We do attempt to
- // discover this situation in threadPaused(), but it's
- // possible that the following sequence occurs:
- //
- // A B
- // enter T
- // enter T
- // blackhole T
- // update T
- // GC
- //
- // Now T is an indirection, and the update frame is already
- // marked on A's stack, so we won't traverse it again in
- // threadPaused(). We could traverse the whole stack again
- // before GC, but that seems like overkill.
- //
- // Scavenging this update frame as normal would be disastrous;
- // the updatee would end up pointing to the value. So we
- // check whether the value after evacuation is a BLACKHOLE,
- // and if not, we change the update frame to an stg_enter
- // frame that simply returns the value. Hence, blackholing is
+ // In SMP, we can get update frames that point to indirections
+ // when two threads evaluate the same thunk. We do attempt to
+ // discover this situation in threadPaused(), but it's
+ // possible that the following sequence occurs:
+ //
+ // A B
+ // enter T
+ // enter T
+ // blackhole T
+ // update T
+ // GC
+ //
+ // Now T is an indirection, and the update frame is already
+ // marked on A's stack, so we won't traverse it again in
+ // threadPaused(). We could traverse the whole stack again
+ // before GC, but that seems like overkill.
+ //
+ // Scavenging this update frame as normal would be disastrous;
+ // the updatee would end up pointing to the value. So we
+ // check whether the value after evacuation is a BLACKHOLE,
+ // and if not, we change the update frame to an stg_enter
+ // frame that simply returns the value. Hence, blackholing is
// compulsory (otherwise we would have to check for thunks
// too).
//
@@ -1839,7 +1844,7 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
continue;
}
- // small bitmap (< 32 entries, or 64 on a 64-bit machine)
+ // small bitmap (< 32 entries, or 64 on a 64-bit machine)
case CATCH_STM_FRAME:
case CATCH_RETRY_FRAME:
case ATOMICALLY_FRAME:
@@ -1847,60 +1852,60 @@ scavenge_stack(StgPtr p, StgPtr stack_end)
case STOP_FRAME:
case CATCH_FRAME:
case RET_SMALL:
- bitmap = BITMAP_BITS(info->i.layout.bitmap);
- size = BITMAP_SIZE(info->i.layout.bitmap);
- // NOTE: the payload starts immediately after the info-ptr, we
- // don't have an StgHeader in the same sense as a heap closure.
- p++;
- p = scavenge_small_bitmap(p, size, bitmap);
+ bitmap = BITMAP_BITS(info->i.layout.bitmap);
+ size = BITMAP_SIZE(info->i.layout.bitmap);
+ // NOTE: the payload starts immediately after the info-ptr, we
+ // don't have an StgHeader in the same sense as a heap closure.
+ p++;
+ p = scavenge_small_bitmap(p, size, bitmap);
follow_srt:
- if (major_gc)
- scavenge_srt((StgClosure **)GET_SRT(info), info->i.srt_bitmap);
- continue;
+ if (major_gc)
+ scavenge_srt((StgClosure **)GET_SRT(info), info->i.srt_bitmap);
+ continue;
case RET_BCO: {
- StgBCO *bco;
- StgWord size;
-
- p++;
- evacuate((StgClosure **)p);
- bco = (StgBCO *)*p;
- p++;
- size = BCO_BITMAP_SIZE(bco);
- scavenge_large_bitmap(p, BCO_BITMAP(bco), size);
- p += size;
- continue;
+ StgBCO *bco;
+ StgWord size;
+
+ p++;
+ evacuate((StgClosure **)p);
+ bco = (StgBCO *)*p;
+ p++;
+ size = BCO_BITMAP_SIZE(bco);
+ scavenge_large_bitmap(p, BCO_BITMAP(bco), size);
+ p += size;
+ continue;
}
- // large bitmap (> 32 entries, or > 64 on a 64-bit machine)
+ // large bitmap (> 32 entries, or > 64 on a 64-bit machine)
case RET_BIG:
{
- StgWord size;
-
- size = GET_LARGE_BITMAP(&info->i)->size;
- p++;
- scavenge_large_bitmap(p, GET_LARGE_BITMAP(&info->i), size);
- p += size;
- // and don't forget to follow the SRT
- goto follow_srt;
+ StgWord size;
+
+ size = GET_LARGE_BITMAP(&info->i)->size;
+ p++;
+ scavenge_large_bitmap(p, GET_LARGE_BITMAP(&info->i), size);
+ p += size;
+ // and don't forget to follow the SRT
+ goto follow_srt;
}
case RET_FUN:
{
- StgRetFun *ret_fun = (StgRetFun *)p;
- StgFunInfoTable *fun_info;
+ StgRetFun *ret_fun = (StgRetFun *)p;
+ StgFunInfoTable *fun_info;
- evacuate(&ret_fun->fun);
- fun_info = get_fun_itbl(UNTAG_CLOSURE(ret_fun->fun));
- p = scavenge_arg_block(fun_info, ret_fun->payload);
- goto follow_srt;
+ evacuate(&ret_fun->fun);
+ fun_info = get_fun_itbl(UNTAG_CLOSURE(ret_fun->fun));
+ p = scavenge_arg_block(fun_info, ret_fun->payload);
+ goto follow_srt;
}
default:
- barf("scavenge_stack: weird activation record found on stack: %d", (int)(info->i.type));
+ barf("scavenge_stack: weird activation record found on stack: %d", (int)(info->i.type));
}
- }
+ }
}
/*-----------------------------------------------------------------------------
@@ -1921,26 +1926,26 @@ scavenge_large (gen_workspace *ws)
gct->evac_gen_no = ws->gen->no;
bd = ws->todo_large_objects;
-
+
for (; bd != NULL; bd = ws->todo_large_objects) {
-
- // take this object *off* the large objects list and put it on
- // the scavenged large objects list. This is so that we can
- // treat new_large_objects as a stack and push new objects on
- // the front when evacuating.
- ws->todo_large_objects = bd->link;
-
+
+ // take this object *off* the large objects list and put it on
+ // the scavenged large objects list. This is so that we can
+ // treat new_large_objects as a stack and push new objects on
+ // the front when evacuating.
+ ws->todo_large_objects = bd->link;
+
ACQUIRE_SPIN_LOCK(&ws->gen->sync);
- dbl_link_onto(bd, &ws->gen->scavenged_large_objects);
- ws->gen->n_scavenged_large_blocks += bd->blocks;
+ dbl_link_onto(bd, &ws->gen->scavenged_large_objects);
+ ws->gen->n_scavenged_large_blocks += bd->blocks;
RELEASE_SPIN_LOCK(&ws->gen->sync);
-
- p = bd->start;
- if (scavenge_one(p)) {
- if (ws->gen->no > 0) {
- recordMutableGen_GC((StgClosure *)p, ws->gen->no);
- }
- }
+
+ p = bd->start;
+ if (scavenge_one(p)) {
+ if (ws->gen->no > 0) {
+ recordMutableGen_GC((StgClosure *)p, ws->gen->no);
+ }
+ }
// stats
gct->scanned += closure_sizeW((StgClosure*)p);
@@ -1982,7 +1987,7 @@ loop:
did_something = rtsFalse;
for (g = RtsFlags.GcFlags.generations-1; g >= 0; g--) {
ws = &gct->gens[g];
-
+
gct->scan_bd = NULL;
// If we have a scan block with some work to do,
@@ -2048,25 +2053,24 @@ scavenge_loop(void)
loop:
work_to_do = rtsFalse;
- // scavenge static objects
+ // scavenge static objects
if (major_gc && gct->static_objects != END_OF_STATIC_LIST) {
- IF_DEBUG(sanity, checkStaticObjects(gct->static_objects));
- scavenge_static();
+ IF_DEBUG(sanity, checkStaticObjects(gct->static_objects));
+ scavenge_static();
}
-
+
// scavenge objects in compacted generation
if (mark_stack_bd != NULL && !mark_stack_empty()) {
- scavenge_mark_stack();
- work_to_do = rtsTrue;
+ scavenge_mark_stack();
+ work_to_do = rtsTrue;
}
-
+
// Order is important here: we want to deal in full blocks as
// much as possible, so go for global work in preference to
// local work. Only if all the global work has been exhausted
// do we start scavenging the fragments of blocks in the local
// workspaces.
if (scavenge_find_work()) goto loop;
-
+
if (work_to_do) goto loop;
}
-
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index e8b83e8c3c..d3dc9cb467 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -30,6 +30,7 @@ Thumbs.db
*.genscript
*.stderr.normalised
+*.stderr-mingw32.normalised
*.stderr-ghc.normalised
*.stdout.normalised
*.interp.stdout
@@ -53,9 +54,9 @@ tmp.d
*.so
*bindisttest_install___dir_bin_ghc.mk
*bindisttest_install___dir_bin_ghc.exe.mk
-mk/ghcconfig_*_inplace_bin_ghc-stage1.mk
-mk/ghcconfig_*_inplace_bin_ghc-stage2.mk
-mk/ghcconfig_*_inplace_bin_ghc-stage2.exe.mk
+mk/ghcconfig*_inplace_bin_ghc-stage1.mk
+mk/ghcconfig*_inplace_bin_ghc-stage2.mk
+mk/ghcconfig*_inplace_bin_ghc-stage2.exe.mk
*.imports
# -----------------------------------------------------------------------------
@@ -592,8 +593,18 @@ mk/ghcconfig_*_inplace_bin_ghc-stage2.exe.mk
/tests/driver/recomp012/Main
/tests/driver/recomp012/Main.hs
/tests/driver/recomp012/MyBool.hs
+/tests/driver/recomp014/A.hs
+/tests/driver/recomp014/A1.hs
+/tests/driver/recomp014/B.hsig
+/tests/driver/recomp014/C.hs
+/tests/driver/recomp014/recomp014
/tests/driver/rtsOpts
/tests/driver/rtsopts002
+/tests/driver/sigof01/Main
+/tests/driver/sigof01/tmp_*
+/tests/driver/sigof02/tmp_*
+/tests/driver/sigof03/tmp_*
+/tests/driver/sigof04/containers
/tests/driver/spacesInArgs
/tests/driver/stub017/
/tests/driver/stub028/
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 93b18a8614..3093982336 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -16,6 +16,7 @@ import datetime
import copy
import glob
from math import ceil, trunc
+import collections
have_subprocess = False
try:
@@ -493,20 +494,47 @@ def normalise_slashes( name, opts ):
def normalise_exe( name, opts ):
opts.extra_normaliser = normalise_exe_
-def normalise_fun( fun ):
- return lambda name, opts, f=fun: _normalise_fun(name, opts, f)
+def normalise_fun( *fs ):
+ return lambda name, opts: _normalise_fun(name, opts, fs)
-def _normalise_fun( name, opts, f ):
- opts.extra_normaliser = f
+def _normalise_fun( name, opts, *fs ):
+ opts.extra_normaliser = join_normalisers(fs)
-def normalise_errmsg_fun( fun ):
- return lambda name, opts, f=fun: _normalise_errmsg_fun(name, opts, f)
+def normalise_errmsg_fun( *fs ):
+ return lambda name, opts: _normalise_errmsg_fun(name, opts, fs)
-def _normalise_errmsg_fun( name, opts, f ):
- opts.extra_errmsg_normaliser = f
+def _normalise_errmsg_fun( name, opts, *fs ):
+ opts.extra_errmsg_normaliser = join_normalisers(fs)
-def two_normalisers(f, g):
- return lambda x, f=f, g=g: f(g(x))
+def join_normalisers(*a):
+ """
+ Compose functions, flattening sequences.
+
+ join_normalisers(f1,[f2,f3],f4)
+
+ is the same as
+
+ lambda x: f1(f2(f3(f4(x))))
+ """
+
+ def flatten(l):
+ """
+ Taken from http://stackoverflow.com/a/2158532/946226
+ """
+ for el in l:
+ if isinstance(el, collections.Iterable) and not isinstance(el, basestring):
+ for sub in flatten(el):
+ yield sub
+ else:
+ yield el
+
+ a = flatten(a)
+
+ fn = lambda x:x # identity function
+ for f in a:
+ assert callable(f)
+ fn = lambda x,f=f,fn=fn: fn(f(x))
+ return fn
# ----
# Function for composing two opt-fns together
@@ -890,11 +918,29 @@ def run_command( name, way, cmd ):
# -----------------------------------------------------------------------------
# GHCi tests
-def ghci_script( name, way, script ):
+def ghci_script_without_flag(flag):
+ def apply(name, way, script):
+ overrides = filter(lambda f: f != flag, getTestOpts().compiler_always_flags)
+ return ghci_script_override_default_flags(overrides)(name, way, script)
+
+ return apply
+
+def ghci_script_override_default_flags(overrides):
+ def apply(name, way, script):
+ return ghci_script(name, way, script, overrides)
+
+ return apply
+
+def ghci_script( name, way, script, override_flags = None ):
+ # Use overriden default flags when given
+ if override_flags:
+ default_flags = override_flags
+ else:
+ default_flags = getTestOpts().compiler_always_flags
+
# filter out -fforce-recomp from compiler_always_flags, because we're
# actually testing the recompilation behaviour in the GHCi tests.
- flags = [f for f in getTestOpts().compiler_always_flags if f != '-fforce-recomp']
-
+ flags = [f for f in default_flags if f != '-fforce-recomp']
flags.append(getTestOpts().extra_hc_opts)
if getTestOpts().outputdir != None:
flags.extend(["-outputdir", getTestOpts().outputdir])
@@ -913,6 +959,32 @@ def ghci_script( name, way, script ):
# -----------------------------------------------------------------------------
# Compile-only tests
+def compile_override_default_flags(overrides):
+ def apply(name, way, extra_opts):
+ return do_compile(name, way, 0, '', [], extra_opts, overrides)
+
+ return apply
+
+def compile_fail_override_default_flags(overrides):
+ def apply(name, way, extra_opts):
+ return do_compile(name, way, 1, '', [], extra_opts, overrides)
+
+ return apply
+
+def compile_without_flag(flag):
+ def apply(name, way, extra_opts):
+ overrides = filter(lambda f: f != flag, getTestOpts().compiler_always_flags)
+ return compile_override_default_flags(overrides)(name, way, extra_opts)
+
+ return apply
+
+def compile_fail_without_flag(flag):
+ def apply(name, way, extra_opts):
+ overrides = filter(lambda f: f != flag, getTestOpts().compiler_always_flags)
+ return compile_fail_override_default_flags(overrides)(name, way, extra_opts)
+
+ return apply
+
def compile( name, way, extra_hc_opts ):
return do_compile( name, way, 0, '', [], extra_hc_opts )
@@ -931,7 +1003,7 @@ def multi_compile( name, way, top_mod, extra_mods, extra_hc_opts ):
def multi_compile_fail( name, way, top_mod, extra_mods, extra_hc_opts ):
return do_compile( name, way, 1, top_mod, extra_mods, extra_hc_opts)
-def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts ):
+def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts, override_flags = None ):
# print 'Compile only, extra args = ', extra_hc_opts
pretest_cleanup(name)
@@ -943,7 +1015,7 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts ):
force = 0
if extra_mods:
force = 1
- result = simple_build( name, way, extra_hc_opts, should_fail, top_mod, 0, 1, force)
+ result = simple_build( name, way, extra_hc_opts, should_fail, top_mod, 0, 1, force, override_flags )
if badResult(result):
return result
@@ -960,8 +1032,10 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts ):
(platform_specific, expected_stderr_file) = platform_wordsize_qualify(namebase, 'stderr')
actual_stderr_file = qualify(name, 'comp.stderr')
- if not compare_outputs('stderr', \
- two_normalisers(two_normalisers(getTestOpts().extra_errmsg_normaliser, normalise_errmsg), normalise_whitespace), \
+ if not compare_outputs('stderr',
+ join_normalisers(getTestOpts().extra_errmsg_normaliser,
+ normalise_errmsg,
+ normalise_whitespace),
expected_stderr_file, actual_stderr_file):
return failBecause('stderr mismatch')
@@ -988,7 +1062,7 @@ def compile_cmp_asm( name, way, extra_hc_opts ):
(platform_specific, expected_asm_file) = platform_wordsize_qualify(namebase, 'asm')
actual_asm_file = qualify(name, 's')
- if not compare_outputs('asm', two_normalisers(normalise_errmsg, normalise_asm), \
+ if not compare_outputs('asm', join_normalisers(normalise_errmsg, normalise_asm), \
expected_asm_file, actual_asm_file):
return failBecause('asm mismatch')
@@ -1103,7 +1177,7 @@ def extras_build( way, extra_mods, extra_hc_opts ):
return {'passFail' : 'pass', 'hc_opts' : extra_hc_opts}
-def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, noforce ):
+def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, noforce, override_flags = None ):
opts = getTestOpts()
errname = add_suffix(name, 'comp.stderr')
rm_no_fail( qualify(errname, '') )
@@ -1151,7 +1225,11 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
else:
cmd_prefix = getTestOpts().compile_cmd_prefix + ' '
- comp_flags = copy.copy(getTestOpts().compiler_always_flags)
+ if override_flags:
+ comp_flags = copy.copy(override_flags)
+ else:
+ comp_flags = copy.copy(getTestOpts().compiler_always_flags)
+
if noforce:
comp_flags = [f for f in comp_flags if f != '-fforce-recomp']
if getTestOpts().outputdir != None:
@@ -1421,14 +1499,14 @@ def check_stdout_ok( name ):
else:
return normalise_output(str)
- two_norm = two_normalisers(norm, getTestOpts().extra_normaliser)
+ extra_norm = join_normalisers(norm, getTestOpts().extra_normaliser)
check_stdout = getTestOpts().check_stdout
if check_stdout:
- return check_stdout(actual_stdout_file, two_norm)
+ return check_stdout(actual_stdout_file, extra_norm)
return compare_outputs('stdout', \
- two_norm, \
+ extra_norm, \
expected_stdout_file, actual_stdout_file)
def dump_stdout( name ):
@@ -1451,7 +1529,7 @@ def check_stderr_ok( name ):
return normalise_errmsg(str)
return compare_outputs('stderr', \
- two_normalisers(norm, getTestOpts().extra_errmsg_normaliser), \
+ join_normalisers(norm, getTestOpts().extra_errmsg_normaliser), \
expected_stderr_file, actual_stderr_file)
def dump_stderr( name ):
@@ -1525,7 +1603,7 @@ def check_prof_ok(name):
return True
else:
return compare_outputs('prof', \
- two_normalisers(normalise_whitespace,normalise_prof), \
+ join_normalisers(normalise_whitespace,normalise_prof), \
expected_prof_file, prof_file)
# Compare expected output to actual output, and optionally accept the
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk
index 2ff8616eba..0229cfd5b3 100644
--- a/testsuite/mk/test.mk
+++ b/testsuite/mk/test.mk
@@ -36,6 +36,14 @@ endif
# in nested Makefiles
TEST_HC_OPTS = -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS)
+# The warning suppression flag below is a temporary kludge. While working with
+# tests that contain tabs, please de-tab them so this flag can be eventually
+# removed. See
+# http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
+# for details
+#
+TEST_HC_OPTS += -fno-warn-tabs
+
RUNTEST_OPTS =
ifeq "$(filter $(TargetOS_CPP), cygwin32 mingw32)" ""
diff --git a/testsuite/tests/array/should_run/arr016.hs b/testsuite/tests/array/should_run/arr016.hs
index 055e6602be..0e8e2bfe2e 100644
--- a/testsuite/tests/array/should_run/arr016.hs
+++ b/testsuite/tests/array/should_run/arr016.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE ScopedTypeVariables, DatatypeContexts #-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Main where
@@ -151,7 +151,7 @@ instance Show (a -> b) where { show _ = "<FN>" }
------------------------------------------------------------------------------
-data (Ix a) => Array a b = MkArray (a,a) (a -> b) deriving ()
+data Array a b = MkArray (a,a) (a -> b) deriving ()
array :: (Ix a) => (a,a) -> [(a,b)] -> Array a b
array b ivs =
@@ -259,6 +259,10 @@ generate n rnd (Gen m) = m size rnd'
instance Functor Gen where
fmap f m = m >>= return . f
+instance Applicative Gen where
+ pure = return
+ (<*>) = liftM2 id
+
instance Monad Gen where
return a = Gen (\n r -> a)
Gen m >>= k =
@@ -508,4 +512,4 @@ instance Observable StdGen where { observer = observeBase }
instance Observable a => Observable (Gen a) where
observer (Gen a) = send "Gen" (return (Gen) << a)
--} \ No newline at end of file
+-}
diff --git a/testsuite/tests/cabal/all.T b/testsuite/tests/cabal/all.T
index 60f8d6df9b..08df23dc34 100644
--- a/testsuite/tests/cabal/all.T
+++ b/testsuite/tests/cabal/all.T
@@ -36,8 +36,7 @@ test('ghcpkg05',
'local05a.package.conf.old',
'local05b.package.conf',
'local05b.package.conf.old']),
- normalise_errmsg_fun(two_normalisers(normalise_haddock_junk,
- normaliseDynlibNames))
+ normalise_errmsg_fun(normalise_haddock_junk, normaliseDynlibNames)
],
run_command,
['$MAKE -s --no-print-directory ghcpkg05'])
diff --git a/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs b/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs
index 7243fadb06..05a84df210 100644
--- a/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs
+++ b/testsuite/tests/codeGen/should_run/CopySmallArrayStressTest.hs
@@ -361,7 +361,7 @@ cloneMArraySlow !marr !off n =
-- Utilities for simplifying RNG passing
newtype Rng s a = Rng { unRng :: StateT StdGen (ST s) a }
- deriving Monad
+ deriving (Functor, Applicative, Monad)
-- Same as 'randomR', but using the RNG state kept in the 'Rng' monad.
rnd :: Random a => (a, a) -> Rng s a
diff --git a/testsuite/tests/codeGen/should_run/cgrun068.hs b/testsuite/tests/codeGen/should_run/cgrun068.hs
index 69a8b279f8..00d1249eaa 100644
--- a/testsuite/tests/codeGen/should_run/cgrun068.hs
+++ b/testsuite/tests/codeGen/should_run/cgrun068.hs
@@ -361,7 +361,7 @@ cloneMArraySlow !marr !off n =
-- Utilities for simplifying RNG passing
newtype Rng s a = Rng { unRng :: StateT StdGen (ST s) a }
- deriving Monad
+ deriving (Functor, Applicative, Monad)
-- Same as 'randomR', but using the RNG state kept in the 'Rng' monad.
rnd :: Random a => (a, a) -> Rng s a
diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T
index ac748d3ae4..ac8f95c0c2 100644
--- a/testsuite/tests/deSugar/should_compile/all.T
+++ b/testsuite/tests/deSugar/should_compile/all.T
@@ -59,9 +59,9 @@ test('ds052', normal, compile, [''])
test('ds053', normal, compile, [''])
test('ds054', normal, compile, [''])
test('ds055', only_compiler_types(['ghc']), compile, [''])
-test('ds056', normal, compile, ['-Wall'])
+test('ds056', normal, compile, ['-Wall -fno-warn-tabs'])
test('ds057', normal, compile, [''])
-test('ds058', normal, compile, ['-W'])
+test('ds058', normal, compile, ['-W -fno-warn-tabs'])
test('ds059', normal, compile, ['-W'])
test('ds060', expect_broken(322), compile, [''])
test('ds062', normal, compile, [''])
diff --git a/testsuite/tests/driver/recomp014/Makefile b/testsuite/tests/driver/recomp014/Makefile
new file mode 100644
index 0000000000..58c6f2a833
--- /dev/null
+++ b/testsuite/tests/driver/recomp014/Makefile
@@ -0,0 +1,27 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# -fforce-recomp makes lots of driver tests trivially pass, so we
+# filter it out from $(TEST_HC_OPTS).
+TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS))
+
+# Recompilation tests
+
+clean:
+ rm -f *.o *.hi
+
+recomp014: clean
+ echo 'module A where a = False' > A.hs
+ echo 'module A1 where a = False' > A1.hs
+ echo 'module B where a :: Bool' > B.hsig
+ echo 'first run'
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c A.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c A1.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of main:A
+ echo 'second run'
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of main:A1
+ echo 'import B; main = print a' > C.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c C.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) A1.o C.o -o recomp014
+ ./recomp014
diff --git a/testsuite/tests/driver/recomp014/all.T b/testsuite/tests/driver/recomp014/all.T
new file mode 100644
index 0000000000..affccd2f7f
--- /dev/null
+++ b/testsuite/tests/driver/recomp014/all.T
@@ -0,0 +1,4 @@
+test('recomp014',
+ [ clean_cmd('$MAKE -s clean') ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp014'])
diff --git a/testsuite/tests/driver/recomp014/recomp014.stdout b/testsuite/tests/driver/recomp014/recomp014.stdout
new file mode 100644
index 0000000000..2f899ed73e
--- /dev/null
+++ b/testsuite/tests/driver/recomp014/recomp014.stdout
@@ -0,0 +1,3 @@
+first run
+second run
+False
diff --git a/testsuite/tests/driver/sigof01/A.hs b/testsuite/tests/driver/sigof01/A.hs
new file mode 100644
index 0000000000..644432a283
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/A.hs
@@ -0,0 +1,10 @@
+module A where
+data T = T
+ deriving (Show)
+x = True
+y = False
+mkT = T
+class Foo a where
+ foo :: a -> a
+instance Foo Bool where
+ foo = not
diff --git a/testsuite/tests/driver/sigof01/B.hsig b/testsuite/tests/driver/sigof01/B.hsig
new file mode 100644
index 0000000000..289d3bcb18
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/B.hsig
@@ -0,0 +1,6 @@
+module B where
+data T
+x :: Bool
+mkT :: T
+class Foo a where
+ foo :: a -> a
diff --git a/testsuite/tests/driver/sigof01/Main.hs b/testsuite/tests/driver/sigof01/Main.hs
new file mode 100644
index 0000000000..c90cfaf1db
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/Main.hs
@@ -0,0 +1,6 @@
+import B
+y = foo x
+main = do
+ print y
+ print mkT
+ print (foo y)
diff --git a/testsuite/tests/driver/sigof01/Makefile b/testsuite/tests/driver/sigof01/Makefile
new file mode 100644
index 0000000000..a54a1b97e4
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/Makefile
@@ -0,0 +1,23 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# -fforce-recomp makes lots of driver tests trivially pass, so we
+# filter it out from $(TEST_HC_OPTS).
+TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS))
+
+S01_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof01 -i -itmp_sigof01
+sigof01:
+ rm -rf tmp_sigof01
+ mkdir tmp_sigof01
+ '$(TEST_HC)' $(S01_OPTS) -c A.hs
+ '$(TEST_HC)' $(S01_OPTS) -c B.hsig -sig-of main:A
+ '$(TEST_HC)' $(S01_OPTS) -c Main.hs
+ '$(TEST_HC)' $(S01_OPTS) tmp_sigof01/A.o tmp_sigof01/Main.o -o tmp_sigof01/Main
+ tmp_sigof01/Main
+
+sigof01m:
+ rm -rf tmp_sigof01m
+ mkdir tmp_sigof01m
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof01m --make Main.hs -sig-of "B is main:A" -o tmp_sigof01m/Main
+ tmp_sigof01m/Main
diff --git a/testsuite/tests/driver/sigof01/all.T b/testsuite/tests/driver/sigof01/all.T
new file mode 100644
index 0000000000..d0cdc3c02c
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/all.T
@@ -0,0 +1,9 @@
+test('sigof01',
+ [ clean_cmd('rm -rf tmp_sigof01') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof01'])
+
+test('sigof01m',
+ [ clean_cmd('rm -rf tmp_sigof01m') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof01m'])
diff --git a/testsuite/tests/driver/sigof01/sigof01.stdout b/testsuite/tests/driver/sigof01/sigof01.stdout
new file mode 100644
index 0000000000..bb614cd2a0
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/sigof01.stdout
@@ -0,0 +1,3 @@
+False
+T
+True
diff --git a/testsuite/tests/driver/sigof01/sigof01m.stdout b/testsuite/tests/driver/sigof01/sigof01m.stdout
new file mode 100644
index 0000000000..a7fdd8298e
--- /dev/null
+++ b/testsuite/tests/driver/sigof01/sigof01m.stdout
@@ -0,0 +1,7 @@
+[1 of 3] Compiling A ( A.hs, tmp_sigof01m/A.o )
+[2 of 3] Compiling B[sig of A] ( B.hsig, nothing )
+[3 of 3] Compiling Main ( Main.hs, tmp_sigof01m/Main.o )
+Linking tmp_sigof01m/Main ...
+False
+T
+True
diff --git a/testsuite/tests/driver/sigof02/Double.hs b/testsuite/tests/driver/sigof02/Double.hs
new file mode 100644
index 0000000000..8111b1cc0f
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/Double.hs
@@ -0,0 +1,13 @@
+import Map
+import MapAsSet
+
+main = do
+ let x = insert 0 "foo"
+ . delete 1
+ . insert 1 undefined
+ . insert (6 :: Int) "foo"
+ $ empty
+ print (member 1 x)
+ print (keysSet x)
+ print (toList x)
+ print x
diff --git a/testsuite/tests/driver/sigof02/Main.hs b/testsuite/tests/driver/sigof02/Main.hs
new file mode 100644
index 0000000000..b6f41da773
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/Main.hs
@@ -0,0 +1,11 @@
+import Map
+
+main = do
+ let x = insert 0 "foo"
+ . delete 1
+ . insert 1 undefined
+ . insert (6 :: Int) "foo"
+ $ empty
+ print (member 1 x)
+ print (toList x)
+ print x
diff --git a/testsuite/tests/driver/sigof02/Makefile b/testsuite/tests/driver/sigof02/Makefile
new file mode 100644
index 0000000000..b61fe612ce
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/Makefile
@@ -0,0 +1,75 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# -fforce-recomp makes lots of driver tests trivially pass, so we
+# filter it out from $(TEST_HC_OPTS).
+TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS))
+
+S02_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02 -i -itmp_sigof02
+sigof02:
+ rm -rf tmp_sigof02
+ mkdir tmp_sigof02
+ '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02/containers
+ '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02/containers`:Data.Map.Strict"
+ '$(TEST_HC)' $(S02_OPTS) -c Main.hs
+ '$(TEST_HC)' $(S02_OPTS) -package containers tmp_sigof02/Main.o -o tmp_sigof02/StrictMain
+ ! ./tmp_sigof02/StrictMain
+ '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02/containers`:Data.Map.Lazy"
+ '$(TEST_HC)' $(S02_OPTS) -c Main.hs
+ '$(TEST_HC)' $(S02_OPTS) -package containers tmp_sigof02/Main.o -o tmp_sigof02/LazyMain
+ ./tmp_sigof02/LazyMain
+
+S02T_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -fno-code -fwrite-interface -outputdir tmp_sigof02t -i -itmp_sigof02t
+sigof02t:
+ rm -rf tmp_sigof02t
+ mkdir tmp_sigof02t
+ '$(TEST_HC)' $(S02T_OPTS) -c Map.hsig
+ '$(TEST_HC)' $(S02T_OPTS) -c Main.hs
+
+S02M_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02m
+sigof02m:
+ rm -rf tmp_sigof02m
+ mkdir tmp_sigof02m
+ '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02m/containers
+ '$(TEST_HC)' $(S02M_OPTS) --make Main.hs -sig-of "Map is `cat tmp_sigof02m/containers`:Data.Map.Strict" -o tmp_sigof02m/StrictMain
+ ! ./tmp_sigof02m/StrictMain
+ '$(TEST_HC)' $(S02M_OPTS) --make Main.hs -sig-of "Map is `cat tmp_sigof02m/containers`:Data.Map.Lazy" -o tmp_sigof02m/LazyMain
+ ./tmp_sigof02m/LazyMain
+
+sigof02mt:
+ rm -rf tmp_sigof02mt
+ mkdir tmp_sigof02mt
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02mt --make Main.hs -fno-code -fwrite-interface
+
+S02D_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02d -i -itmp_sigof02d
+sigof02d:
+ rm -rf tmp_sigof02d
+ mkdir tmp_sigof02d
+ '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02d/containers
+ '$(TEST_HC)' $(S02D_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02d/containers`:Data.Map.Lazy"
+ '$(TEST_HC)' $(S02D_OPTS) -c MapAsSet.hsig -sig-of "`cat tmp_sigof02d/containers`:Data.Map.Lazy"
+ '$(TEST_HC)' $(S02D_OPTS) -c Double.hs
+ '$(TEST_HC)' $(S02D_OPTS) -package containers tmp_sigof02d/Main.o -o tmp_sigof02d/Double
+ ./tmp_sigof02d/Double
+
+S02DT_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02dt -i -itmp_sigof02dt -fno-code -fwrite-interface
+sigof02dt:
+ rm -rf tmp_sigof02dt
+ mkdir tmp_sigof02dt
+ '$(TEST_HC)' $(S02DT_OPTS) -c Map.hsig
+ '$(TEST_HC)' $(S02DT_OPTS) -c MapAsSet.hsig
+ ! '$(TEST_HC)' $(S02DT_OPTS) -c Double.hs
+
+sigof02dm:
+ rm -rf tmp_sigof02dm
+ mkdir tmp_sigof02dm
+ '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02dm/containers
+ '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02dm --make Double.hs -sig-of "Map is `cat tmp_sigof02dm/containers`:Data.Map.Lazy, MapAsSet is `cat tmp_sigof02dm/containers`:Data.Map.Lazy" -o tmp_sigof02dm/Double
+ ./tmp_sigof02dm/Double
+
+sigof02dmt:
+ rm -rf tmp_sigof02dmt
+ mkdir tmp_sigof02dmt
+ # doesn't typecheck due to lack of alias
+ ! '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02dmt -fno-code -fwrite-interface --make Double.hs -o tmp_sigof02dm/Double
diff --git a/testsuite/tests/driver/sigof02/Map.hsig b/testsuite/tests/driver/sigof02/Map.hsig
new file mode 100644
index 0000000000..cd094df17f
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/Map.hsig
@@ -0,0 +1,133 @@
+{-# LANGUAGE RoleAnnotations #-}
+module Map where
+
+import Data.Typeable
+import Data.Data
+import Data.Traversable
+import Data.Foldable
+import Data.Monoid
+import Control.DeepSeq
+import Control.Applicative
+
+infixl 9 !,\\
+
+type role Map nominal representational
+data Map k a
+
+instance Typeable Map
+instance Functor (Map k)
+instance Foldable (Map k)
+instance Traversable (Map k)
+instance (Eq k, Eq a) => Eq (Map k a)
+instance (Data k, Data a, Ord k) => Data (Map k a)
+instance (Ord k, Ord v) => Ord (Map k v)
+instance (Ord k, Read k, Read e) => Read (Map k e)
+instance (Show k, Show a) => Show (Map k a)
+instance Ord k => Monoid (Map k v)
+instance (NFData k, NFData a) => NFData (Map k a)
+
+(!) :: Ord k => Map k a -> k -> a
+(\\) :: Ord k => Map k a -> Map k b -> Map k a
+null :: Map k a -> Bool
+size :: Map k a -> Int
+member :: Ord k => k -> Map k a -> Bool
+notMember :: Ord k => k -> Map k a -> Bool
+lookup :: Ord k => k -> Map k a -> Maybe a
+findWithDefault :: Ord k => a -> k -> Map k a -> a
+lookupLT :: Ord k => k -> Map k v -> Maybe (k, v)
+lookupGT :: Ord k => k -> Map k v -> Maybe (k, v)
+lookupLE :: Ord k => k -> Map k v -> Maybe (k, v)
+lookupGE :: Ord k => k -> Map k v -> Maybe (k, v)
+empty :: Map k a
+singleton :: k -> a -> Map k a
+insert :: Ord k => k -> a -> Map k a -> Map k a
+insertWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
+insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
+insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)
+delete :: Ord k => k -> Map k a -> Map k a
+adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a
+adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a
+update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a
+updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a
+updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a)
+alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a
+union :: Ord k => Map k a -> Map k a -> Map k a
+unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
+unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a
+unions :: Ord k => [Map k a] -> Map k a
+unionsWith :: Ord k => (a -> a -> a) -> [Map k a] -> Map k a
+difference :: Ord k => Map k a -> Map k b -> Map k a
+differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
+differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
+intersection :: Ord k => Map k a -> Map k b -> Map k a
+intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
+intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c
+mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (Map k a -> Map k c) -> (Map k b -> Map k c) -> Map k a -> Map k b -> Map k c
+map :: (a -> b) -> Map k a -> Map k b
+mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
+traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b)
+mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
+mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
+mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
+mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
+mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a
+mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a
+foldr :: (a -> b -> b) -> b -> Map k a -> b
+foldl :: (a -> b -> a) -> a -> Map k b -> a
+foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b
+foldlWithKey :: (a -> k -> b -> a) -> a -> Map k b -> a
+foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m
+foldr' :: (a -> b -> b) -> b -> Map k a -> b
+foldl' :: (a -> b -> a) -> a -> Map k b -> a
+foldrWithKey' :: (k -> a -> b -> b) -> b -> Map k a -> b
+foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a
+elems :: Map k a -> [a]
+keys :: Map k a -> [k]
+assocs :: Map k a -> [(k, a)]
+toList :: Map k a -> [(k, a)]
+fromList :: Ord k => [(k, a)] -> Map k a
+fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
+fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
+toAscList :: Map k a -> [(k, a)]
+toDescList :: Map k a -> [(k, a)]
+fromAscList :: Eq k => [(k, a)] -> Map k a
+fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a
+fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
+fromDistinctAscList :: [(k, a)] -> Map k a
+filter :: (a -> Bool) -> Map k a -> Map k a
+filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a
+partition :: (a -> Bool) -> Map k a -> (Map k a, Map k a)
+partitionWithKey :: (k -> a -> Bool) -> Map k a -> (Map k a, Map k a)
+mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b
+mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b
+mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c)
+mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)
+split :: Ord k => k -> Map k a -> (Map k a, Map k a)
+splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a)
+splitRoot :: Map k b -> [Map k b]
+isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool
+isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool
+isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool
+isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool
+lookupIndex :: Ord k => k -> Map k a -> Maybe Int
+findIndex :: Ord k => k -> Map k a -> Int
+elemAt :: Int -> Map k a -> (k, a)
+updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a
+deleteAt :: Int -> Map k a -> Map k a
+findMin :: Map k a -> (k, a)
+findMax :: Map k a -> (k, a)
+deleteMin :: Map k a -> Map k a
+deleteMax :: Map k a -> Map k a
+deleteFindMin :: Map k a -> ((k, a), Map k a)
+deleteFindMax :: Map k a -> ((k, a), Map k a)
+updateMin :: (a -> Maybe a) -> Map k a -> Map k a
+updateMax :: (a -> Maybe a) -> Map k a -> Map k a
+updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
+updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
+minView :: Map k a -> Maybe (a, Map k a)
+maxView :: Map k a -> Maybe (a, Map k a)
+minViewWithKey :: Map k a -> Maybe ((k, a), Map k a)
+maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a)
+showTree :: (Show k, Show a) => Map k a -> String
+showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String
+valid :: Ord k => Map k a -> Bool
diff --git a/testsuite/tests/driver/sigof02/MapAsSet.hsig b/testsuite/tests/driver/sigof02/MapAsSet.hsig
new file mode 100644
index 0000000000..1defbc7717
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/MapAsSet.hsig
@@ -0,0 +1,11 @@
+{-# LANGUAGE RoleAnnotations #-}
+module MapAsSet where
+
+import Data.Set
+
+type role Map nominal representational
+data Map k a
+instance Functor (Map k)
+
+keysSet :: Map k a -> Set k
+fromSet :: (k -> a) -> Set k -> Map k a
diff --git a/testsuite/tests/driver/sigof02/all.T b/testsuite/tests/driver/sigof02/all.T
new file mode 100644
index 0000000000..62f50a6aa8
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/all.T
@@ -0,0 +1,41 @@
+test('sigof02',
+ [ clean_cmd('rm -rf tmp_sigof02') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02'])
+
+test('sigof02t',
+ [ clean_cmd('rm -rf tmp_sigof02t') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02t'])
+
+test('sigof02m',
+ [ clean_cmd('rm -rf tmp_sigof02m') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02m'])
+
+test('sigof02mt',
+ [ clean_cmd('rm -rf tmp_sigof02mt') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02mt'])
+
+test('sigof02d',
+ [ clean_cmd('rm -rf tmp_sigof02d') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02d'])
+
+test('sigof02dt',
+ [ clean_cmd('rm -rf tmp_sigof02dt') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02dt'])
+
+
+test('sigof02dm',
+ [ clean_cmd('rm -rf tmp_sigof02dm') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02dm'])
+
+test('sigof02dmt',
+ [ clean_cmd('rm -rf tmp_sigof02dmt') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof02dmt'])
+
diff --git a/testsuite/tests/driver/sigof02/sigof02.stderr b/testsuite/tests/driver/sigof02/sigof02.stderr
new file mode 100644
index 0000000000..264efdacb0
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02.stderr
@@ -0,0 +1 @@
+StrictMain: Prelude.undefined
diff --git a/testsuite/tests/driver/sigof02/sigof02.stdout b/testsuite/tests/driver/sigof02/sigof02.stdout
new file mode 100644
index 0000000000..687b80c41d
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02.stdout
@@ -0,0 +1,3 @@
+False
+[(0,"foo"),(6,"foo")]
+fromList [(0,"foo"),(6,"foo")]
diff --git a/testsuite/tests/driver/sigof02/sigof02d.stdout b/testsuite/tests/driver/sigof02/sigof02d.stdout
new file mode 100644
index 0000000000..0d0e0f9383
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02d.stdout
@@ -0,0 +1,4 @@
+False
+fromList [0,6]
+[(0,"foo"),(6,"foo")]
+fromList [(0,"foo"),(6,"foo")]
diff --git a/testsuite/tests/driver/sigof02/sigof02dm.stdout b/testsuite/tests/driver/sigof02/sigof02dm.stdout
new file mode 100644
index 0000000000..14ee83789b
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02dm.stdout
@@ -0,0 +1,8 @@
+[1 of 3] Compiling MapAsSet[sig of Data.Map.Lazy] ( MapAsSet.hsig, nothing )
+[2 of 3] Compiling Map[sig of Data.Map.Lazy] ( Map.hsig, nothing )
+[3 of 3] Compiling Main ( Double.hs, tmp_sigof02dm/Main.o )
+Linking tmp_sigof02dm/Double ...
+False
+fromList [0,6]
+[(0,"foo"),(6,"foo")]
+fromList [(0,"foo"),(6,"foo")]
diff --git a/testsuite/tests/driver/sigof02/sigof02dmt.stderr b/testsuite/tests/driver/sigof02/sigof02dmt.stderr
new file mode 100644
index 0000000000..1da04499ba
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02dmt.stderr
@@ -0,0 +1,8 @@
+
+Double.hs:11:20:
+ Couldn't match expected type ‘MapAsSet.Map k0 a0’
+ with actual type ‘Map.Map Int [Char]’
+ NB: ‘MapAsSet.Map’ is defined at MapAsSet.hsig:7:1-12
+ ‘Map.Map’ is defined at Map.hsig:15:1-12
+ In the first argument of ‘keysSet’, namely ‘x’
+ In the first argument of ‘print’, namely ‘(keysSet x)’
diff --git a/testsuite/tests/driver/sigof02/sigof02dmt.stdout b/testsuite/tests/driver/sigof02/sigof02dmt.stdout
new file mode 100644
index 0000000000..5df6557883
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02dmt.stdout
@@ -0,0 +1,3 @@
+[1 of 3] Compiling MapAsSet[abstract sig] ( MapAsSet.hsig, nothing )
+[2 of 3] Compiling Map[abstract sig] ( Map.hsig, nothing )
+[3 of 3] Compiling Main ( Double.hs, nothing )
diff --git a/testsuite/tests/driver/sigof02/sigof02dt.stderr b/testsuite/tests/driver/sigof02/sigof02dt.stderr
new file mode 100644
index 0000000000..227a34f136
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02dt.stderr
@@ -0,0 +1,8 @@
+
+Double.hs:11:20:
+ Couldn't match expected type ‘MapAsSet.Map k0 a0’
+ with actual type ‘Map.Map Int [Char]’
+ NB: ‘MapAsSet.Map’ is defined in ‘MapAsSet’
+ ‘Map.Map’ is defined in ‘Map’
+ In the first argument of ‘keysSet’, namely ‘x’
+ In the first argument of ‘print’, namely ‘(keysSet x)’
diff --git a/testsuite/tests/driver/sigof02/sigof02m.stderr b/testsuite/tests/driver/sigof02/sigof02m.stderr
new file mode 100644
index 0000000000..264efdacb0
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02m.stderr
@@ -0,0 +1 @@
+StrictMain: Prelude.undefined
diff --git a/testsuite/tests/driver/sigof02/sigof02m.stdout b/testsuite/tests/driver/sigof02/sigof02m.stdout
new file mode 100644
index 0000000000..41cc4a7bb3
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02m.stdout
@@ -0,0 +1,9 @@
+[1 of 2] Compiling Map[sig of Data.Map.Strict] ( Map.hsig, nothing )
+[2 of 2] Compiling Main ( Main.hs, tmp_sigof02m/Main.o )
+Linking tmp_sigof02m/StrictMain ...
+[1 of 2] Compiling Map[sig of Data.Map.Lazy] ( Map.hsig, nothing ) [sig-of changed]
+[2 of 2] Compiling Main ( Main.hs, tmp_sigof02m/Main.o ) [Map changed]
+Linking tmp_sigof02m/LazyMain ...
+False
+[(0,"foo"),(6,"foo")]
+fromList [(0,"foo"),(6,"foo")]
diff --git a/testsuite/tests/driver/sigof02/sigof02mt.stdout b/testsuite/tests/driver/sigof02/sigof02mt.stdout
new file mode 100644
index 0000000000..dd7a193aea
--- /dev/null
+++ b/testsuite/tests/driver/sigof02/sigof02mt.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling Map[abstract sig] ( Map.hsig, nothing )
+[2 of 2] Compiling Main ( Main.hs, nothing )
diff --git a/testsuite/tests/driver/sigof03/A.hs b/testsuite/tests/driver/sigof03/A.hs
new file mode 100644
index 0000000000..67435f038c
--- /dev/null
+++ b/testsuite/tests/driver/sigof03/A.hs
@@ -0,0 +1,3 @@
+module A where
+class C a where
+instance C Bool where
diff --git a/testsuite/tests/driver/sigof03/ASig1.hsig b/testsuite/tests/driver/sigof03/ASig1.hsig
new file mode 100644
index 0000000000..9428e0cf04
--- /dev/null
+++ b/testsuite/tests/driver/sigof03/ASig1.hsig
@@ -0,0 +1,3 @@
+module ASig1 where
+class C a
+instance C Bool
diff --git a/testsuite/tests/driver/sigof03/ASig2.hsig b/testsuite/tests/driver/sigof03/ASig2.hsig
new file mode 100644
index 0000000000..6f278b0a89
--- /dev/null
+++ b/testsuite/tests/driver/sigof03/ASig2.hsig
@@ -0,0 +1,3 @@
+module ASig2 where
+class C a
+instance C Bool
diff --git a/testsuite/tests/driver/sigof03/Main.hs b/testsuite/tests/driver/sigof03/Main.hs
new file mode 100644
index 0000000000..9aae9cc798
--- /dev/null
+++ b/testsuite/tests/driver/sigof03/Main.hs
@@ -0,0 +1,3 @@
+import ASig1
+import ASig2
+main = return ()
diff --git a/testsuite/tests/driver/sigof03/Makefile b/testsuite/tests/driver/sigof03/Makefile
new file mode 100644
index 0000000000..28c59805aa
--- /dev/null
+++ b/testsuite/tests/driver/sigof03/Makefile
@@ -0,0 +1,30 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# -fforce-recomp makes lots of driver tests trivially pass, so we
+# filter it out from $(TEST_HC_OPTS).
+TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS))
+
+S03_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof03 -i -itmp_sigof03
+sigof03:
+ rm -rf tmp_sigof03
+ mkdir tmp_sigof03
+ '$(TEST_HC)' $(S03_OPTS) -c A.hs
+ '$(TEST_HC)' $(S03_OPTS) -c ASig1.hsig -sig-of main:A
+ '$(TEST_HC)' $(S03_OPTS) -c ASig2.hsig -sig-of main:A
+ '$(TEST_HC)' $(S03_OPTS) -c Main.hs
+ '$(TEST_HC)' $(S03_OPTS) tmp_sigof03/A.o tmp_sigof03/Main.o -o tmp_sigof03/Main
+ ./tmp_sigof03/Main
+
+S03M_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof03m
+sigof03m:
+ rm -rf tmp_sigof03m
+ mkdir tmp_sigof03m
+ '$(TEST_HC)' $(S03M_OPTS) --make Main.hs -sig-of "ASig1 is main:A, ASig2 is main:A"
+ ./tmp_sigof03m/Main
+
+# Currently, the type-check tests are omitted, because we don't have a
+# way of telling GHC that ASig1 and ASig2 have the same identities
+# (sig-of is not right because it requires the target to have an hi
+# file, but in general we won't have it.)
diff --git a/testsuite/tests/driver/sigof03/all.T b/testsuite/tests/driver/sigof03/all.T
new file mode 100644
index 0000000000..e8df3e10f4
--- /dev/null
+++ b/testsuite/tests/driver/sigof03/all.T
@@ -0,0 +1,11 @@
+test('sigof03',
+ [ clean_cmd('rm -rf tmp_sigof03') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof03'])
+
+# This doesn't work yet, because the instances aren't found the
+# right way (they don't go in the EPS, differently from one-shot)
+test('sigof03m',
+ [ clean_cmd('rm -rf tmp_sigof03m'), expect_fail ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof03m'])
diff --git a/testsuite/tests/driver/sigof04/Makefile b/testsuite/tests/driver/sigof04/Makefile
new file mode 100644
index 0000000000..e68d7b6bfc
--- /dev/null
+++ b/testsuite/tests/driver/sigof04/Makefile
@@ -0,0 +1,14 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# -fforce-recomp makes lots of driver tests trivially pass, so we
+# filter it out from $(TEST_HC_OPTS).
+TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS))
+
+clean:
+ rm -rf containers
+
+sigof04:
+ '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > containers
+ ! '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c Sig.hsig -sig-of "`cat containers`:Data.Map.Strict"
diff --git a/testsuite/tests/driver/sigof04/Sig.hsig b/testsuite/tests/driver/sigof04/Sig.hsig
new file mode 100644
index 0000000000..3110f28fff
--- /dev/null
+++ b/testsuite/tests/driver/sigof04/Sig.hsig
@@ -0,0 +1,2 @@
+module Sig(insert) where
+import Data.Map.Lazy (insert)
diff --git a/testsuite/tests/driver/sigof04/all.T b/testsuite/tests/driver/sigof04/all.T
new file mode 100644
index 0000000000..7844bf8a69
--- /dev/null
+++ b/testsuite/tests/driver/sigof04/all.T
@@ -0,0 +1,4 @@
+test('sigof04',
+ [ clean_cmd('$MAKE -s clean') ],
+ run_command,
+ ['$MAKE -s --no-print-directory sigof04'])
diff --git a/testsuite/tests/driver/sigof04/sigof04.stderr b/testsuite/tests/driver/sigof04/sigof04.stderr
new file mode 100644
index 0000000000..acb04679cd
--- /dev/null
+++ b/testsuite/tests/driver/sigof04/sigof04.stderr
@@ -0,0 +1,3 @@
+
+<no location info>:
+ insert is exported by the hsig file, but not exported by the module
diff --git a/testsuite/tests/ghci/scripts/T5979.stderr b/testsuite/tests/ghci/scripts/T5979.stderr
index c2869b09c6..c8fc7c2208 100644
--- a/testsuite/tests/ghci/scripts/T5979.stderr
+++ b/testsuite/tests/ghci/scripts/T5979.stderr
@@ -2,6 +2,6 @@
<no location info>:
Could not find module ‘Control.Monad.Trans.State’
Perhaps you meant
- Control.Monad.Trans.State (from transformers-0.4.1.0@trans_5jw4w9yTgmZ89ByuixDAKP)
- Control.Monad.Trans.Class (from transformers-0.4.1.0@trans_5jw4w9yTgmZ89ByuixDAKP)
- Control.Monad.Trans.Cont (from transformers-0.4.1.0@trans_5jw4w9yTgmZ89ByuixDAKP)
+ Control.Monad.Trans.State (from transformers-0.4.1.0@trans_<HASH>)
+ Control.Monad.Trans.Class (from transformers-0.4.1.0@trans_<HASH>)
+ Control.Monad.Trans.Cont (from transformers-0.4.1.0@trans_<HASH>)
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 4b20d0b3e3..ede9807d00 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -1,5 +1,8 @@
# coding=utf8
+def normaliseTransformersPackageKey(str):
+ return re.sub('trans_[A-Za-z0-9]+', 'trans_<HASH>', str)
+
setTestOpts(when(compiler_profiled(), skip))
test('ghci001', combined_output, ghci_script, ['ghci001.script'])
@@ -82,7 +85,7 @@ test('ghci056',
],
ghci_script, ['ghci056.script'])
-test('ghci057', normal, ghci_script, ['ghci057.script'])
+test('ghci057', normal, ghci_script_without_flag('-fno-warn-tabs'), ['ghci057.script'])
test('T2452', normal, ghci_script, ['T2452.script'])
test('T2766', normal, ghci_script, ['T2766.script'])
@@ -114,7 +117,11 @@ test('T5564', normal, ghci_script, ['T5564.script'])
test('Defer02', normal, ghci_script, ['Defer02.script'])
test('T5820', normal, ghci_script, ['T5820.script'])
test('T5836', normal, ghci_script, ['T5836.script'])
-test('T5979', [reqlib('transformers'), normalise_slashes], ghci_script, ['T5979.script'])
+test('T5979',
+ [reqlib('transformers'),
+ normalise_slashes,
+ normalise_errmsg_fun(normaliseTransformersPackageKey)],
+ ghci_script, ['T5979.script'])
test('T5975a',
[pre_cmd('touch föøbàr1.hs'),
clean_cmd('rm föøbàr1.hs')],
diff --git a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs
index 0117b81d47..063f7021cf 100644
--- a/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs
+++ b/testsuite/tests/indexed-types/should_compile/PushedInAsGivens.hs
@@ -8,7 +8,7 @@ type family F a
bar y = let foo :: (F Int ~ [a]) => a -> Int
foo x = length [x,y]
- in (y,foo y)
+ in (y,foo y)
-- This example demonstrates why we need to push in
@@ -20,5 +20,12 @@ bar y = let foo :: (F Int ~ [a]) => a -> Int
-- Given/Solved, it will be discarded when we meet the given (F Int ~ [a]) and
-- we will not be able to solve the implication constraint.
+-- Oct 14: actually this example is _really_ strange, and doesn't illustrate
+-- the real issue in Trac #4935, for which there is a separate test
+--
+-- The example here requires us to infer a type
+-- bar :: F Int ~ [a] => ...
+-- which is a strange type to quantify over; better to complain about
+-- having no instance for F Int.
diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T
index ff45df2c83..58fc964879 100644
--- a/testsuite/tests/indexed-types/should_compile/all.T
+++ b/testsuite/tests/indexed-types/should_compile/all.T
@@ -170,7 +170,7 @@ test('T4981-V2', normal, compile, [''])
test('T4981-V3', normal, compile, [''])
test('T5002', normal, compile, [''])
-test('PushedInAsGivens', normal, compile, [''])
+test('PushedInAsGivens', normal, compile_fail, [''])
# Superclass equalities
test('T4338', normal, compile, [''])
diff --git a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs
index 42d1be9254..62798fad39 100644
--- a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs
+++ b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.hs
@@ -1,9 +1,9 @@
{-# LANGUAGE TypeFamilies, FunctionalDependencies, FlexibleContexts, GADTs, ScopedTypeVariables #-}
-module ExtraTcsUntch where
+module ExtraTcsUntch where
-class C x y | x -> y where
+class C x y | x -> y where
op :: x -> y -> ()
instance C [a] [a]
@@ -13,12 +13,12 @@ type family F a :: *
h :: F Int -> ()
h = undefined
-data TEx where
- TEx :: a -> TEx
+data TEx where
+ TEx :: a -> TEx
-f x =
+f x =
let g1 :: forall b. b -> ()
g1 _ = h [x]
@@ -27,10 +27,10 @@ f x =
in (g1 '3', g2 undefined)
-{- This example comes from Note [Extra TcS Untouchables] in TcSimplify. It demonstrates
+{- This example comes from Note [Extra TcS Untouchables] in TcSimplify. It demonstrates
why when floating equalities out of an implication constraint we must record the free
variables of the equalities as untouchables. With GHC 7.4.1 this program gives a Core
- Lint error because of an existential escaping.
+ Lint error because of an existential escaping.
assuming x:beta
@@ -41,18 +41,21 @@ f x =
-
+
{- Assume x:beta
- From g1 we get (forall b. F Int ~ [beta])
+ From g1 we get [W] (forall b. F Int ~ [beta])
- From g2 we get (forall c. 0 => F Int ~ [[alpha]] /\ C beta [c])
+ From g2 we get [W] (forall c. 0 => F Int ~ [[alpha]] /\ C beta [c])
(g2 is not generalised; the forall comes from the TEx pattern)
-Floating we get
- F Int ~ [beta], F Int ~ [[alpha]], alpha ~ alpha', forall c. C beta [c]
-= { alpha := alpha' }
-= beta ~ [alpha'], F Int ~ [[alpha']], forall c. C beta [c]
-= { beta := [alpha']
- F Int ~ [[alpha']], forall c. C [alpha'] [c]
-= F Int ~ [[alpha']], forall c. (C [alpha'] [c], alpha' ~ c)
+approximateWC then gives the candidate constraints to quantify
+ F Int ~ [beta], F Int ~ [[alpha']]
+
+(alpha' is the promoted version of alpha)
+
+Now decide inferred sig for f :: F Int ~ [beta] => beta -> blah
+since beta is mentioned in tau-type for f but alpha' is not
+
+Perhaps this is a stupid constraint to generalise over (we don't
+generalise over (C Int).
-} \ No newline at end of file
diff --git a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr
index 3e34058def..13f9911e6c 100644
--- a/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr
+++ b/testsuite/tests/indexed-types/should_fail/ExtraTcsUntch.stderr
@@ -1,10 +1,16 @@
-ExtraTcsUntch.hs:24:53:
- Could not deduce (C [t] [a]) arising from a use of ‘op’
- from the context (F Int ~ [[t]])
- bound by the inferred type of
- f :: (F Int ~ [[t]]) => [t] -> ((), ((), ()))
- at ExtraTcsUntch.hs:(21,1)-(25,29)
- In the expression: op x [y]
+ExtraTcsUntch.hs:23:18:
+ Couldn't match expected type ‘F Int’ with actual type ‘[t]’
+ Relevant bindings include
+ x :: t (bound at ExtraTcsUntch.hs:21:3)
+ f :: t -> ((), ((), ())) (bound at ExtraTcsUntch.hs:21:1)
+ In the first argument of ‘h’, namely ‘[x]’
+ In the expression: h [x]
+ In an equation for ‘g1’: g1 _ = h [x]
+
+ExtraTcsUntch.hs:25:38:
+ Couldn't match expected type ‘F Int’ with actual type ‘[[t0]]’
+ The type variable ‘t0’ is ambiguous
+ In the first argument of ‘h’, namely ‘[[undefined]]’
+ In the expression: h [[undefined]]
In the expression: (h [[undefined]], op x [y])
- In a case alternative: TEx y -> (h [[undefined]], op x [y])
diff --git a/testsuite/tests/indexed-types/should_fail/T1897b.stderr b/testsuite/tests/indexed-types/should_fail/T1897b.stderr
index cb2b99cddf..936aa26924 100644
--- a/testsuite/tests/indexed-types/should_fail/T1897b.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T1897b.stderr
@@ -3,8 +3,10 @@ T1897b.hs:16:1:
Couldn't match type ‘Depend a’ with ‘Depend a0’
NB: ‘Depend’ is a type function, and may not be injective
The type variable ‘a0’ is ambiguous
- Expected type: [Depend a] -> Bool
- Actual type: [Depend a0] -> Bool
+ Expected type: t (Depend a) -> Bool
+ Actual type: t (Depend a0) -> Bool
When checking that ‘isValid’ has the inferred type
- isValid :: forall a. Bug a => [Depend a] -> Bool
+ isValid :: forall a (t :: * -> *).
+ (Foldable t, Bug a) =>
+ t (Depend a) -> Bool
Probable cause: the inferred type is ambiguous
diff --git a/testsuite/tests/indexed-types/should_fail/T4093a.hs b/testsuite/tests/indexed-types/should_fail/T4093a.hs
index 21d16b3113..746f996d57 100644
--- a/testsuite/tests/indexed-types/should_fail/T4093a.hs
+++ b/testsuite/tests/indexed-types/should_fail/T4093a.hs
@@ -32,4 +32,8 @@ hang = Just ()
[W] fmv2 ~ Maybe e
[W] fmv2 ~ Maybe ee
+Now the question is whether we get a derived equality e ~ ee. Currently
+we don't, but we easily could. But then we'd need to be careful not to
+report insoluble Int ~ Bool if we had
+ F a ~ Int, F a ~ Bool
-} \ No newline at end of file
diff --git a/testsuite/tests/indexed-types/should_fail/T4093a.stderr b/testsuite/tests/indexed-types/should_fail/T4093a.stderr
index 90b8a592f6..076041be32 100644
--- a/testsuite/tests/indexed-types/should_fail/T4093a.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T4093a.stderr
@@ -1,14 +1,11 @@
-T4093a.hs:8:8:
- Could not deduce (e ~ ())
+T4093a.hs:7:9:
+ Could not deduce (Foo e0 ~ Maybe e0)
from the context (Foo e ~ Maybe e)
bound by the type signature for hang :: (Foo e ~ Maybe e) => Foo e
at T4093a.hs:7:9-34
- ‘e’ is a rigid type variable bound by
- the type signature for hang :: (Foo e ~ Maybe e) => Foo e
- at T4093a.hs:7:9
- Expected type: Foo e
- Actual type: Maybe ()
- Relevant bindings include hang :: Foo e (bound at T4093a.hs:8:1)
- In the expression: Just ()
- In an equation for ‘hang’: hang = Just ()
+ The type variable ‘e0’ is ambiguous
+ In the ambiguity check for: forall e. (Foo e ~ Maybe e) => Foo e
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ In the type signature for ‘hang’:
+ hang :: (Foo e ~ Maybe e) => Foo e
diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T
index cb5ce2fe8d..c91d30c7b4 100644
--- a/testsuite/tests/module/all.T
+++ b/testsuite/tests/module/all.T
@@ -309,7 +309,7 @@ test('mod170', extra_clean(['Mod170_A.hi', 'Mod170_A.o']),
test('mod171', extra_clean(['Mod171_A.hi', 'Mod171_A.o', 'Mod171_B.hi', 'Mod171_B.o']),
- multimod_compile, ['mod171', '-v0 -Wall'])
+ multimod_compile, ['mod171', '-v0 -Wall -fno-warn-tabs'])
test('mod172', extra_clean(['Mod172_B.hi', 'Mod172_B.o', 'Mod172_C.hi', 'Mod172_C.o']),
diff --git a/testsuite/tests/perf/compiler/T4007.stdout b/testsuite/tests/perf/compiler/T4007.stdout
index aabd6101cd..c924781e0e 100644
--- a/testsuite/tests/perf/compiler/T4007.stdout
+++ b/testsuite/tests/perf/compiler/T4007.stdout
@@ -7,7 +7,7 @@ Rule fired: Class op return
Rule fired: Class op foldr
Rule fired: Class op >>
Rule fired: Class op return
-Rule fired: <=#
+Rule fired: <#
Rule fired: tagToEnum#
Rule fired: Class op foldr
Rule fired: fold/build
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 489289b5d0..1a9dfcb297 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -267,27 +267,30 @@ test('T3064',
# (amd64/Linux) (09/09/2014): 407416464, AMP changes (larger interfaces, more loading)
# (amd64/Linux) (14/09/2014): 385145080, BPP changes (more NoImplicitPrelude in base)
- compiler_stats_num_field('max_bytes_used',
- [(wordsize(32), 11202304, 20),
- # 2011-06-28: 2247016 (x86/Linux) (28/6/2011):
- #(some date): 5511604
- # 2013-11-13: 7218200 (x86/Windows, 64bit machine)
- # 2014-04-04: 11202304 (x86/Windows, 64bit machine)
- (wordsize(64), 13251728, 20)]),
- # (amd64/Linux, intree) (28/06/2011): 4032024
- # (amd64/Linux, intree) (07/02/2013): 9819288
- # (amd64/Linux) (14/02/2013): 8687360
- # (amd64/Linux) (18/02/2013): 9397488
- # (amd64/Linux) (02/08/2013): 10742536, increase from roles
- # (amd64/Linux) (19/08/2013): 9211816, decrease apparently from better eta reduction
- # (amd64/Linux) (11/09/2013): 12000480, increase from AMP warnings
- # 933cdf15a2d85229d3df04b437da31fdfbf4961f
- # (amd64/Linux) (22/11/2013): 16266992, GND via Coercible and counters for constraints solving
- # (amd64/Linux) (12/12/2013): 19821544, better One shot analysis
- # (amd64/Linux) (09/09/2014): 24357392, AMP changes (larger interfaces, more loading)
- # (amd64/Linux) (14/09/2014): 16053888, BPP changes (more NoImplicitPrelude in base)
- # (amd64/Linux) (19/09/2014): 18744992, unknown
- # (amd64/Linux) 2014-10-13: 13251728, Stricter seqDmdType
+###################################
+# deactivated for now, as this metric became too volatile recently
+#
+# compiler_stats_num_field('max_bytes_used',
+# [(wordsize(32), 11202304, 20),
+# # 2011-06-28: 2247016 (x86/Linux) (28/6/2011):
+# #(some date): 5511604
+# # 2013-11-13: 7218200 (x86/Windows, 64bit machine)
+# # 2014-04-04: 11202304 (x86/Windows, 64bit machine)
+# (wordsize(64), 13251728, 20)]),
+# # (amd64/Linux, intree) (28/06/2011): 4032024
+# # (amd64/Linux, intree) (07/02/2013): 9819288
+# # (amd64/Linux) (14/02/2013): 8687360
+# # (amd64/Linux) (18/02/2013): 9397488
+# # (amd64/Linux) (02/08/2013): 10742536, increase from roles
+# # (amd64/Linux) (19/08/2013): 9211816, decrease apparently from better eta reduction
+# # (amd64/Linux) (11/09/2013): 12000480, increase from AMP warnings
+# # 933cdf15a2d85229d3df04b437da31fdfbf4961f
+# # (amd64/Linux) (22/11/2013): 16266992, GND via Coercible and counters for constraints solving
+# # (amd64/Linux) (12/12/2013): 19821544, better One shot analysis
+# # (amd64/Linux) (09/09/2014): 24357392, AMP changes (larger interfaces, more loading)
+# # (amd64/Linux) (14/09/2014): 16053888, BPP changes (more NoImplicitPrelude in base)
+# # (amd64/Linux) (19/09/2014): 18744992, unknown
+# # (amd64/Linux) 2014-10-13: 13251728, Stricter seqDmdType
only_ways(['normal'])
],
diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T
index 08f0b61820..732f6fb387 100644
--- a/testsuite/tests/safeHaskell/check/pkg01/all.T
+++ b/testsuite/tests/safeHaskell/check/pkg01/all.T
@@ -8,6 +8,12 @@ def normaliseArrayPackage(str):
def normaliseBytestringPackage(str):
return re.sub('bytestring-[0-9]+(\.[0-9]+)*', 'bytestring-<VERSION>', str)
+def normaliseIntegerPackage(str):
+ return re.sub('integer-(gmp|simple)-[0-9.]+', 'integer-<IMPL>-<VERSION>', str)
+
+def normaliseArrayPackageKey(str):
+ return re.sub('array_[A-Za-z0-9]+', 'array_<HASH>', str)
+
def ignoreLdOutput(str):
return re.sub('Creating library file: pdb.safePkg01/dist.build.libHSsafePkg01-1.0-ghc[0-9.]*.dll.a\n', '', str)
@@ -35,9 +41,11 @@ make_args = 'VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn
test('safePkg01',
[clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.safePkg01'),
normalise_errmsg_fun(ignoreLdOutput),
- normalise_fun(two_normalisers(normaliseArrayPackage,
- normaliseBytestringPackage))],
- run_command,
+ normalise_fun(
+ normaliseArrayPackage,
+ normaliseArrayPackageKey,
+ normaliseBytestringPackage)],
+ run_command,
['$MAKE -s --no-print-directory safePkg01 ' + make_args])
# Fail since we enable package trust
diff --git a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout
index 7ce7704d23..62074dedab 100644
--- a/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout
+++ b/testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout
@@ -29,17 +29,17 @@ trusted: safe
require own pkg trusted: True
M_SafePkg6
-package dependencies: array-0.5.0.1@array_GX4NwjS8xZkC2ZPtjgwhnz
+package dependencies: array-0.5.0.1@array_<HASH>
trusted: trustworthy
require own pkg trusted: False
M_SafePkg7
-package dependencies: array-0.5.0.1@array_GX4NwjS8xZkC2ZPtjgwhnz
+package dependencies: array-0.5.0.1@array_<HASH>
trusted: safe
require own pkg trusted: False
M_SafePkg8
-package dependencies: array-0.5.0.1@array_GX4NwjS8xZkC2ZPtjgwhnz
+package dependencies: array-0.5.0.1@array_<HASH>
trusted: trustworthy
require own pkg trusted: False
diff --git a/testsuite/tests/simplCore/should_compile/T3772.stdout b/testsuite/tests/simplCore/should_compile/T3772.stdout
index decff0910a..6609024183 100644
--- a/testsuite/tests/simplCore/should_compile/T3772.stdout
+++ b/testsuite/tests/simplCore/should_compile/T3772.stdout
@@ -1,16 +1,15 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 29, types: 12, coercions: 0}
+Result size of Tidy Core = {terms: 26, types: 11, coercions: 0}
Rec {
-xs :: GHC.Prim.Int# -> ()
-[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType <L,U>]
-xs =
- \ (m :: GHC.Prim.Int#) ->
- case GHC.Prim.tagToEnum# @ Bool (GHC.Prim.<=# m 1)
- of _ [Occ=Dead] {
- False -> xs (GHC.Prim.-# m 1);
- True -> GHC.Tuple.()
+$wxs :: GHC.Prim.Int# -> ()
+[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U>]
+$wxs =
+ \ (ww :: GHC.Prim.Int#) ->
+ case ww of ds1 {
+ __DEFAULT -> $wxs (GHC.Prim.-# ds1 1);
+ 1 -> GHC.Tuple.()
}
end Rec }
@@ -18,11 +17,10 @@ foo [InlPrag=NOINLINE] :: Int -> ()
[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType <S,1*U(U)>]
foo =
\ (n :: Int) ->
- case n of _ [Occ=Dead] { GHC.Types.I# n# ->
- case GHC.Prim.tagToEnum# @ Bool (GHC.Prim.<=# n# 0)
- of _ [Occ=Dead] {
- False -> xs n#;
- True -> GHC.Tuple.()
+ case n of _ [Occ=Dead] { GHC.Types.I# y ->
+ case GHC.Prim.tagToEnum# @ Bool (GHC.Prim.<# 0 y) of _ [Occ=Dead] {
+ False -> GHC.Tuple.();
+ True -> $wxs y
}
}
diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr
index ccc4de8f32..2cd7c2100e 100644
--- a/testsuite/tests/simplCore/should_compile/T7360.stderr
+++ b/testsuite/tests/simplCore/should_compile/T7360.stderr
@@ -53,8 +53,8 @@ fun2 :: forall a. [a] -> ((), Int)
case x of wild {
[] -> T7360.fun3;
: _ [Occ=Dead] _ [Occ=Dead] ->
- case GHC.List.$wlenAcc @ a wild 0 of ww { __DEFAULT ->
- GHC.Types.I# ww
+ case GHC.List.$wlenAcc @ a wild 0 of ww2 { __DEFAULT ->
+ GHC.Types.I# ww2
}
})}]
fun2 =
@@ -63,8 +63,8 @@ fun2 =
case x of wild {
[] -> T7360.fun3;
: ds ds1 ->
- case GHC.List.$wlenAcc @ a wild 0 of ww { __DEFAULT ->
- GHC.Types.I# ww
+ case GHC.List.$wlenAcc @ a wild 0 of ww2 { __DEFAULT ->
+ GHC.Types.I# ww2
}
})
diff --git a/testsuite/tests/th/T9692.hs b/testsuite/tests/th/T9692.hs
index 82e5951b61..770290d7db 100644
--- a/testsuite/tests/th/T9692.hs
+++ b/testsuite/tests/th/T9692.hs
@@ -5,6 +5,7 @@ module T9692 where
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import Language.Haskell.TH.Ppr
+import System.IO
class C a where
data F a (b :: k) :: *
@@ -14,4 +15,5 @@ instance C Int where
$( do info <- qReify (mkName "F")
runIO $ putStrLn $ pprint info
+ runIO $ hFlush stdout
return [])
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 5708cfc298..a6cb78a3cd 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -357,6 +357,7 @@ test('tc262', normal, compile, [''])
test('tc263',
extra_clean(['Tc263_Help.o','Tc263_Help.hi']),
multimod_compile, ['tc263','-v0'])
+test('tc264', normal, multimod_compile, ['tc264.hsig', '-sig-of base:Data.STRef'])
test('GivenOverlapping', normal, compile, [''])
test('GivenTypeSynonym', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_compile/tc264.hsig b/testsuite/tests/typecheck/should_compile/tc264.hsig
new file mode 100644
index 0000000000..0bfdb2b9f4
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/tc264.hsig
@@ -0,0 +1,2 @@
+module ShouldCompile(newSTRef) where
+import Data.STRef(newSTRef)
diff --git a/testsuite/tests/typecheck/should_compile/tc264.stderr b/testsuite/tests/typecheck/should_compile/tc264.stderr
new file mode 100644
index 0000000000..4eb1124cad
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/tc264.stderr
@@ -0,0 +1 @@
+[1 of 1] Compiling ShouldCompile[sig of Data.STRef] ( tc264.hsig, nothing )
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 960b5c3ac2..2738e81fff 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -244,6 +244,11 @@ test('tcfail215', normal, compile_fail, [''])
test('tcfail216', normal, compile_fail, [''])
test('tcfail217', normal, compile_fail, [''])
test('tcfail218', normal, compile_fail, [''])
+test('tcfail219', normal, multimod_compile_fail, ['tcfail219.hsig', '-sig-of base:Data.Bool'])
+test('tcfail220', normal, multimod_compile_fail, ['tcfail220.hsig', '-sig-of base:Prelude'])
+test('tcfail221', normal, multimod_compile_fail, ['tcfail221.hsig', '-sig-of base:Prelude'])
+test('tcfail222', normal, multimod_compile_fail, ['tcfail222.hsig', '-sig-of base:Data.STRef'])
+
test('SilentParametersOverlapping', normal, compile_fail, [''])
test('FailDueToGivenOverlapping', normal, compile_fail, [''])
test('LongWayOverlapping', normal, compile_fail, [''])
diff --git a/testsuite/tests/typecheck/should_fail/tcfail219.hsig b/testsuite/tests/typecheck/should_fail/tcfail219.hsig
new file mode 100644
index 0000000000..ec6d6076ab
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail219.hsig
@@ -0,0 +1,2 @@
+module ShouldFail where
+data Booly
diff --git a/testsuite/tests/typecheck/should_fail/tcfail219.stderr b/testsuite/tests/typecheck/should_fail/tcfail219.stderr
new file mode 100644
index 0000000000..53a7edebe0
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail219.stderr
@@ -0,0 +1,3 @@
+[1 of 1] Compiling ShouldFail[sig of Data.Bool] ( tcfail219.hsig, nothing )
+
+tcfail219.hsig:1:1: Not in scope: type constructor or class ‘Booly’
diff --git a/testsuite/tests/typecheck/should_fail/tcfail220.hsig b/testsuite/tests/typecheck/should_fail/tcfail220.hsig
new file mode 100644
index 0000000000..129bae368c
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail220.hsig
@@ -0,0 +1,5 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+module ShouldFail where
+
+data Bool a b c d = False
+data Maybe a b = Nothing
diff --git a/testsuite/tests/typecheck/should_fail/tcfail220.stderr b/testsuite/tests/typecheck/should_fail/tcfail220.stderr
new file mode 100644
index 0000000000..aea79067c2
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail220.stderr
@@ -0,0 +1,13 @@
+[1 of 1] Compiling ShouldFail[sig of Prelude] ( tcfail220.hsig, nothing )
+
+tcfail220.hsig:4:1:
+ Type constructor ‘Bool’ has conflicting definitions in the module
+ and its hsig file
+ Main module: data Bool = False | GHC.Types.True
+ Hsig file: data Bool a b c d = False
+
+tcfail220.hsig:5:1:
+ Type constructor ‘Maybe’ has conflicting definitions in the module
+ and its hsig file
+ Main module: data Maybe a = Nothing | GHC.Base.Just a
+ Hsig file: data Maybe a b = Nothing
diff --git a/testsuite/tests/typecheck/should_fail/tcfail221.hsig b/testsuite/tests/typecheck/should_fail/tcfail221.hsig
new file mode 100644
index 0000000000..a60c1a0d80
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail221.hsig
@@ -0,0 +1,3 @@
+module ShouldFail where
+instance Show Int
+instance Show Int
diff --git a/testsuite/tests/typecheck/should_fail/tcfail221.stderr b/testsuite/tests/typecheck/should_fail/tcfail221.stderr
new file mode 100644
index 0000000000..8781bd056e
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail221.stderr
@@ -0,0 +1,6 @@
+[1 of 1] Compiling ShouldFail[sig of Prelude] ( tcfail221.hsig, nothing )
+
+tcfail221.hsig:2:10:
+ Duplicate instance declarations:
+ instance Show Int -- Defined at tcfail221.hsig:2:10
+ instance Show Int -- Defined at tcfail221.hsig:3:10
diff --git a/testsuite/tests/typecheck/should_fail/tcfail222.hsig b/testsuite/tests/typecheck/should_fail/tcfail222.hsig
new file mode 100644
index 0000000000..e83f4e3b83
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail222.hsig
@@ -0,0 +1,2 @@
+module ShouldFail(newSTRef) where
+import Data.STRef.Lazy(newSTRef)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail222.stderr b/testsuite/tests/typecheck/should_fail/tcfail222.stderr
new file mode 100644
index 0000000000..86242b1c2d
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/tcfail222.stderr
@@ -0,0 +1,4 @@
+[1 of 1] Compiling ShouldFail[sig of Data.STRef] ( tcfail222.hsig, nothing )
+
+<no location info>:
+ newSTRef is exported by the hsig file, but not exported by the module
diff --git a/testsuite/tests/warnings/should_compile/T9230.hs b/testsuite/tests/warnings/should_compile/T9230.hs
new file mode 100644
index 0000000000..cb369f7fea
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T9230.hs
@@ -0,0 +1,5 @@
+module T9230 where
+
+test :: Monad m => m ()
+test = do
+ return ()
diff --git a/testsuite/tests/warnings/should_compile/T9230.stderr b/testsuite/tests/warnings/should_compile/T9230.stderr
new file mode 100644
index 0000000000..09e1f647ed
--- /dev/null
+++ b/testsuite/tests/warnings/should_compile/T9230.stderr
@@ -0,0 +1,2 @@
+
+T9230.hs:5:1: Warning: Tab character
diff --git a/testsuite/tests/warnings/should_compile/all.T b/testsuite/tests/warnings/should_compile/all.T
index f6747bf849..903ab69a84 100644
--- a/testsuite/tests/warnings/should_compile/all.T
+++ b/testsuite/tests/warnings/should_compile/all.T
@@ -1,3 +1,4 @@
test('T9178', extra_clean(['T9178.o', 'T9178DataType.o',
'T9178.hi', 'T9178DataType.hi']),
- multimod_compile, ['T9178', '-Wall']) \ No newline at end of file
+ multimod_compile, ['T9178', '-Wall'])
+test('T9230', normal, compile_without_flag('-fno-warn-tabs'), [''])
diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
index 9bf21609f1..72605d755e 100644
--- a/utils/deriveConstants/DeriveConstants.hs
+++ b/utils/deriveConstants/DeriveConstants.hs
@@ -643,7 +643,10 @@ getWanted verbose tmpdir gccProgram gccFlags nmProgram
oFile = tmpdir </> "tmp.o"
writeFile cFile cStuff
execute verbose gccProgram (gccFlags ++ ["-c", cFile, "-o", oFile])
- xs <- readProcess nmProgram ["-P", oFile] ""
+ xs <- case os of
+ "openbsd" -> readProcess "/usr/bin/objdump" ["--syms", oFile] ""
+ _ -> readProcess nmProgram ["-P", oFile] ""
+
let ls = lines xs
ms = map parseNmLine ls
m = Map.fromList $ catMaybes ms
@@ -723,6 +726,7 @@ getWanted verbose tmpdir gccProgram gccFlags nmProgram
('_' : n) : "C" : s : _ -> mkP n s
n : "C" : s : _ -> mkP n s
[n, "D", _, s] -> mkP n s
+ [s, "O", "*COM*", _, n] -> mkP n s
_ -> Nothing
where mkP r s = case (stripPrefix prefix r, readHex s) of
(Just name, [(size, "")]) -> Just (name, size)
diff --git a/utils/haddock b/utils/haddock
-Subproject c3f27a96bd2a1ec14f441c72a2df95c16c2c540
+Subproject 3fb325a2ca6b6397905116024922d079447a2e0