[commit: packages/base] master: Comments only (1b725f6)

git at git.haskell.org git at git.haskell.org
Fri Aug 23 09:50:12 CEST 2013


Repository : ssh://git@git.haskell.org/base

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1b725f6ada6c4ddb011172408291a64498d199cb/base

>---------------------------------------------------------------

commit 1b725f6ada6c4ddb011172408291a64498d199cb
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date:   Fri Aug 23 08:49:28 2013 +0100

    Comments only
    
    Add note for Integre constant folding


>---------------------------------------------------------------

1b725f6ada6c4ddb011172408291a64498d199cb
 GHC/Real.lhs |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/GHC/Real.lhs b/GHC/Real.lhs
index 347cfd9..1d53637 100644
--- a/GHC/Real.lhs
+++ b/GHC/Real.lhs
@@ -382,6 +382,18 @@ instance Enum Word where
 instance  Real Integer  where
     toRational x        =  x :% 1
 
+-- Note [Integer division constant folding]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--
+-- Constant folding of quot, rem, div, mod, divMod and quotRem for
+-- Integer arguments depends crucially on inlining. Constant folding
+-- rules defined in compiler/prelude/PrelRules.lhs trigger for
+-- quotInteger, remInteger and so on. So if calls to quot, rem and so on
+-- were not inlined the rules would not fire. The rules would also not
+-- fire if calls to quotInteger and so on were inlined, but this does not
+-- happen because they are all marked with NOINLINE pragma - see documentation
+-- of integer-gmp or integer-simple.
+
 instance  Integral Integer where
     toInteger n      = n
 





More information about the ghc-commits mailing list