[GHC] #9505: Bounded instance for Word (and possibly others) uses unboxed literals

#9505: Bounded instance for Word (and possibly others) uses unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- There's a comment above saying GHC won't optimise. I think since 7.8 they are unboxed by default, so that comment and the explicit constructors can be removed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: 7.8.2 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * cc: dfeuer, core-libraries-committee@… (added) * owner: => ekmett * component: Compiler => Core Libraries Comment: For reference, from `libraries/base/GHC/Enum.hs`: {{{ #!haskell instance Bounded Word where minBound = 0 -- use unboxed literals for maxBound, because GHC doesn't optimise -- (fromInteger 0xffffffff :: Word). #if WORD_SIZE_IN_BITS == 32 maxBound = W# (int2Word# 0xFFFFFFFF#) #elif WORD_SIZE_IN_BITS == 64 maxBound = W# (int2Word# 0xFFFFFFFFFFFFFFFF#) #else #error Unhandled value for WORD_SIZE_IN_BITS #endif }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: 7.8.2 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by hvr): That's strange... I tried with GHC's going back to 6.12.3 but couldn't reproduce the problem described. I always end up with `GHC.Word.W# (__word 18446744073709551615)` with `-ddump-simpl`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: ekmett Type: task | Status: new Priority: lowest | Milestone: ⊥ Component: Core | Version: 7.8.2 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by hvr): * priority: normal => lowest * type: bug => task * milestone: => ⊥ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: ekmett Type: task | Status: new Priority: lowest | Milestone: ⊥ Component: Core | Version: 7.8.2 Libraries | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by thomie): 6.12.3 was released in June 2010. That code was introduced in {{{ commit 9eef5c0bc0cf1670f55427dacf592c0ea415e7e6 Author: simonmar <unknown> Date: Tue May 25 09:27:16 2004 +0000 [project @ 2004-05-25 09:27:16 by simonmar] Small performance hack in maxBound::Word. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals -------------------------------------+------------------------------------- Reporter: schyler | Owner: ekmett Type: task | Status: new Priority: lowest | Milestone: ⊥ Component: Core Libraries | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomie): In `libraries/base/GHC/Base.hs`: {{{#!haskell maxInt, minInt :: Int {- Seems clumsy. Should perhaps put minInt and MaxInt directly into MachDeps.h -} #if WORD_SIZE_IN_BITS == 31 minInt = I# (-0x40000000#) maxInt = I# 0x3FFFFFFF# #elif WORD_SIZE_IN_BITS == 32 minInt = I# (-0x80000000#) maxInt = I# 0x7FFFFFFF# #else minInt = I# (-0x8000000000000000#) maxInt = I# 0x7FFFFFFFFFFFFFFF# #endif }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9505#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed
literals
-------------------------------------+-------------------------------------
Reporter: schyler | Owner: (none)
Type: task | Status: new
Priority: lowest | Milestone: ⊥
Component: Core Libraries | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
-------------------------------------+-------------------------------------
Comment (by Ryan Scott
participants (1)
-
GHC