-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve memory-safety of Semigroup instances (#443)
* Improve memory-safety of Semigroup instances Some nearby low-hanging fruit are also gathered. * Add tests for Int overflows in concat-like functions * Incorporate cosmetic suggestions from review * Adjust conversion and overflow detection for stimes * Implement checked multiplication for older GHCs The 'timesInt2#' primop just doesn't exist before 9.0.1. * 'Fix' poor specialization behavior of strict stimes This causes GHC 9.2.1 to panic, for reasons I do not understand. * More stimes-related cleanup and bug fixes * Remove safety-unrelated changes to other instances * Make several essentially cosmetic adjustments * Subtly adjust the negative-input check for stimes * Add basic benchmark for strict stimes * Remove efforts to avoid Integer in stimes * Add comments for 'checkedIntegerToInt' * Move/add INLINE pragmas for checked arithmetic * Reduce arity of stimesPolymorphic Its ByteString argument is also marked as strict. This doesn't change the optimized code produced by GHC, but allows it to be consistent with the published imprecise exception semantics.
- Loading branch information
Showing
5 changed files
with
210 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters