-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support GHC 9.2 #863
Support GHC 9.2 #863
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After applying this patch, the tests with GHC 8.10.7 gets failed. Would you give a look?
You don't have to worry about the failures on GHC 9.0 or 9.2. They are due to GHC 9.x.
Can you show me an example or trigger the CI? I'm not sure if I follow what you mean by "due to GHC 9.x" |
The code smells so I just replaced the implementation with something more straightforward. Has |
I'm testing this patch on my local machine. For GHC 9, even |
I was asking which test is failing and how, not what your environment is, but it's OK as I was able to reproduce it too. Out of curiousity, could you tell me what kind of failure are you experiencing on GHC 9.0 with concrete examples? |
First of all, this is the result of
|
Right, I saw it too. Since the old implementation doesn't make much sense to me, I replaced mhDigitToInt with |
Also can you trigger the CI? Workflows don't run unless a maintainer approves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To run CI.
@kazu-yamamoto by approval, I meant approving workflow triggers, not the changes. See also https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks |
TBH I have no idea how it has been working before. It should have been like this: --- a/warp/Network/Wai/Handler/Warp/ReadInt.hs
+++ b/warp/Network/Wai/Handler/Warp/ReadInt.hs
@@ -37,13 +37,14 @@ readInt64 :: ByteString -> Int64
readInt64 bs = S.foldl' (\ !i !c -> i * 10 + fromIntegral (mhDigitToInt c)) 0
$ S.takeWhile isDigit bs
-data Table = Table !Addr#
+data Table = Table Addr#
{-# NOINLINE mhDigitToInt #-}
mhDigitToInt :: Word8 -> Int
-mhDigitToInt (W8# i) = I# (word2Int# (indexWord8OffAddr# addr (word2Int# i)))
- where
- !(Table addr) = table
+mhDigitToInt (W8# i) = case table of
+ Table addr -> I# (word2Int# (word8ToWord# (indexWord8OffAddr# addr (word2Int# (word8ToWord# i)))))
+
+{-# NOINLINE table #-}
table :: Table
table = Table
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ But of course it's a good practice not to write code like this. |
@fumieval Sorry for my confusing. I noticed it after I approved the change. X-( |
If I remember correctly, |
I agree that your code is much easier to understand. |
Talking about GHC 9.x. |
warp's test seems to pass after my |
What kind of OS do you use? |
Ubuntu 21.04, GHC 9.2.1, Cabal 3.6.2.0, Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz I can imagine that the old implementation is so fragile that it could get stuck or segfault in the worst case. |
On my monterey, the current this PR works well with GHC 8.10.7.
No progression after here. |
No objection from me at all, I don't remember the code |
Merged. Thank you, guys! |
I forgot to push the change but the bang patterns in foldl' are redundant (regardless of the Strict extension) |
@fumieval Would you send another PR? |
A new version of Warp has been released for GHC 9.2! |
I confirmed that this compiles with the following cabal.project:
Before submitting your PR, check that you've:
@since
declarations to the HaddockAfter submitting your PR: