[Git][ghc/ghc][wip/unboxed-codebuffer] Lint
Josh Meredith (@JoshMeredith)
gitlab at gitlab.haskell.org
Tue Feb 14 07:37:32 UTC 2023
Josh Meredith pushed to branch wip/unboxed-codebuffer at Glasgow Haskell Compiler / GHC
Commits:
0c4910b5 by Josh Meredith at 2023-02-14T07:37:08+00:00
Lint
- - - - -
5 changed files:
- libraries/base/GHC/IO/Encoding/Failure.hs
- libraries/base/GHC/IO/Encoding/Iconv.hs
- libraries/base/GHC/IO/Encoding/UTF16.hs
- libraries/base/GHC/IO/Encoding/UTF32.hs
- libraries/base/GHC/IO/Encoding/UTF8.hs
Changes:
=====================================
libraries/base/GHC/IO/Encoding/Failure.hs
=====================================
@@ -171,7 +171,7 @@ recoverDecode cfm input at Buffer{ bufRaw=iraw, bufL=ir, bufR=_ }
recoverEncode# :: CodingFailureMode -> Buffer Char -> Buffer Word8
-> State# RealWorld -> (# State# RealWorld, Buffer Char, Buffer Word8 #)
-recoverEncode# cfm input output st =
+recoverEncode# cfm input output st =
let (# st', (bIn, bOut) #) = unIO (recoverEncode cfm input output) st
in (# st', bIn, bOut #)
=====================================
libraries/base/GHC/IO/Encoding/Iconv.hs
=====================================
@@ -2,8 +2,8 @@
{-# LANGUAGE CPP
, NoImplicitPrelude
, NondecreasingIndentation
- , UnboxedTuples
- , MagicHash
+ , UnboxedTuples
+ , MagicHash
#-}
{-# OPTIONS_HADDOCK not-home #-}
@@ -136,7 +136,7 @@ newIConv from to rec fn =
iconvt <- throwErrnoIfMinus1 "mkTextEncoding" $ hs_iconv_open to_str from_str
let iclose = throwErrnoIfMinus1_ "Iconv.close" $ hs_iconv_close iconvt
fn_iconvt ibuf obuf st = case unIO (fn iconvt ibuf obuf) st of
- (# st', (prog, ibuf', obuf') #) -> (# st', prog, ibuf', obuf' #)
+ (# st', (prog, ibuf', obuf') #) -> (# st', prog, ibuf', obuf' #)
return BufferCodec{
encode# = fn_iconvt,
recover# = rec#,
=====================================
libraries/base/GHC/IO/Encoding/UTF16.hs
=====================================
@@ -3,7 +3,7 @@
, BangPatterns
, NondecreasingIndentation
, MagicHash
- , UnboxedTuples
+ , UnboxedTuples
#-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
@@ -111,7 +111,7 @@ utf16_decode seen_bom
Nothing ->
if iw - ir < 2 then (# st1,InputUnderflow,input,output #) else do
let !(# st2, c0 #) = unIO (readWord8Buf iraw ir ) st1
- !(# st3, c1 #) = unIO (readWord8Buf iraw (ir+1)) st2
+ !(# st3, c1 #) = unIO (readWord8Buf iraw (ir+1)) st2
case () of
_ | c0 == bomB && c1 == bomL ->
let !(# st4, () #) = unIO (writeIORef seen_bom (Just utf16be_decode)) st3
@@ -231,10 +231,10 @@ utf16be_decode
-- lambda-lifted, to avoid thunks being built in the inner-loop:
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> DecodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input { bufL = 0, bufR = 0 } else input { bufL = ir }
- !ro = output{ bufR = ow }
- in (# st', why, ri, ro #)
+ !ro = output{ bufR = ow }
+ in (# st', why, ri, ro #)
in
loop ir0 ow0 st
@@ -270,10 +270,10 @@ utf16le_decode
-- lambda-lifted, to avoid thunks being built in the inner-loop:
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> DecodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL = 0, bufR = 0 } else input{ bufL = ir }
- !ro = output{ bufR = ow }
- in (# st', why, ri, ro #)
+ !ro = output{ bufR = ow }
+ in (# st', why, ri, ro #)
in
loop ir0 ow0 st
@@ -285,10 +285,10 @@ utf16be_encode
= let
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> EncodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL = 0, bufR = 0 } else input{ bufL=ir }
!ro = output{ bufR=ow }
- in (# st', why, ri, ro #)
+ in (# st', why, ri, ro #)
loop :: Int -> Int -> EncodingBuffer
loop !ir !ow st0
| ir >= iw = done InputUnderflow ir ow st0
@@ -326,10 +326,10 @@ utf16le_encode
= let
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> EncodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL = 0, bufR = 0 } else input{ bufL = ir }
- !ro = output{ bufR = ow }
- in (# st', why, ri, ro #)
+ !ro = output{ bufR = ow }
+ in (# st', why, ri, ro #)
loop :: Int -> Int -> EncodingBuffer
loop !ir !ow st0
| ir >= iw = done InputUnderflow ir ow st0
=====================================
libraries/base/GHC/IO/Encoding/UTF32.hs
=====================================
@@ -230,10 +230,10 @@ utf32be_decode
-- lambda-lifted, to avoid thunks being built in the inner-loop:
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> DecodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }
!ro = output{ bufR=ow }
- in (# st', why, ri, ro #)
+ in (# st', why, ri, ro #)
in
loop ir0 ow0 st
@@ -257,16 +257,16 @@ utf32le_decode
let (# st5, ow' #) = unIO (writeCharBuf oraw ow x1) st4
loop (ir+4) ow' st5
where
- invalid :: DecodingBuffer
+ invalid :: DecodingBuffer
invalid st' = done InvalidSequence ir ow st'
-- lambda-lifted, to avoid thunks being built in the inner-loop:
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> DecodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }
!ro = output{ bufR=ow }
- in (# st', why, ri, ro #)
+ in (# st', why, ri, ro #)
in
loop ir0 ow0 st
@@ -278,7 +278,7 @@ utf32be_encode
= let
{-# NOINLINE done #-}
done :: CodingProgress -> Int -> Int -> EncodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }
!ro = output{ bufR=ow }
in (# st', why, ri, ro #)
@@ -305,7 +305,7 @@ utf32le_encode
st
= let
done :: CodingProgress -> Int -> Int -> EncodingBuffer
- done why !ir !ow st' =
+ done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL=0, bufR=0 } else input{ bufL=ir }
!ro = output{ bufR=ow }
in (# st', why, ri, ro #)
=====================================
libraries/base/GHC/IO/Encoding/UTF8.hs
=====================================
@@ -3,7 +3,7 @@
, BangPatterns
, NondecreasingIndentation
, MagicHash
- , UnboxedTuples
+ , UnboxedTuples
#-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
@@ -196,7 +196,7 @@ utf8_decode
if not (validate4 c0 c1 0x80 0x80)
then invalid st2 else done InputUnderflow ir ow st2
3 -> do
- let !(# st2, c1 #) = unIO (readWord8Buf iraw (ir+1)) st1
+ let !(# st2, c1 #) = unIO (readWord8Buf iraw (ir+1)) st1
!(# st3, c2 #) = unIO (readWord8Buf iraw (ir+2)) st2
if not (validate4 c0 c1 c2 0x80)
then invalid st3 else done InputUnderflow ir ow st3
@@ -210,7 +210,7 @@ utf8_decode
| otherwise ->
invalid st1
where
- invalid :: DecodingBuffer
+ invalid :: DecodingBuffer
invalid st' = done InvalidSequence ir ow st'
-- lambda-lifted, to avoid thunks being built in the inner-loop:
@@ -218,8 +218,8 @@ utf8_decode
done :: CodingProgress -> Int -> Int -> DecodingBuffer
done why !ir !ow st' =
let !ri = if ir == iw then input{ bufL = 0, bufR = 0} else input{ bufL = ir }
- !ro = output { bufR = ow }
- in (# st', why, ri, ro #)
+ !ro = output { bufR = ow }
+ in (# st', why, ri, ro #)
in
loop ir0 ow0 st
@@ -244,7 +244,7 @@ utf8_encode
case ord c of
x | x <= 0x7F -> do
let !(# st2, () #) = unIO (writeWord8Buf oraw ow (fromIntegral x)) st1
- loop ir' (ow+1) st2
+ loop ir' (ow+1) st2
| x <= 0x07FF ->
if os - ow < 2 then done OutputUnderflow ir ow st1 else do
let (c1,c2) = ord2 c
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c4910b59cc0b133a17396a4c47f74930885029d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0c4910b59cc0b133a17396a4c47f74930885029d
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230214/68f378b6/attachment-0001.html>
More information about the ghc-commits
mailing list