-
Notifications
You must be signed in to change notification settings - Fork 97
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
AST-89 Range restricted Nat* and Int* #487
Merged
Merged
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
9609c1e
add finite-bitwidth integral primitive types
ggreif ad41b0b
WIP: compiles
ggreif 4637882
WIP: more progress
ggreif a9fb7a3
WIP: first round of backed changes
ggreif 1a42bce
More conversions
ggreif b710aa4
WIP: added WordN->NatN/IntN
ggreif e0e3dcf
refactor tests
ggreif 1e59f40
implement and test Nat->Nat32 and Int->Int32
ggreif 324e416
implement Nat->Nat* and Int->Int*
ggreif 8c0fec8
fix Word32->Nat32
ggreif 4ba1823
soup up roundtrip tests
ggreif 77c4693
fix roundtrip bug
ggreif 6dbc868
serialisation support
ggreif bdc2d91
compile literals
ggreif 34f8a8e
New primitive types for emacs mode (AST-89)
ggreif 656e268
fix conversions (i.e. boxing)
ggreif e83eca6
test Int/Nat16/32 serialisation
ggreif e8a5240
trap for outrange Nat->Nat8/16/32
ggreif 664c798
range check for Int->Int8/16/32
ggreif 18dd7a9
cope with libTomMath flaw for now
ggreif e8ebf62
range check for ->Nat64
ggreif 76dc485
resolved
ggreif 15f798b
range check for ->Int64
ggreif 53652f2
factor out special_unop_typing
ggreif 921a8ac
extend special_unop_typing to other Nat* types too
ggreif 93c4f20
Merge remote-tracking branch 'origin/master' into gabor/ranged-int-nat
ggreif e324f85
fix func import oversight
ggreif 74be50d
update ok files
ggreif 2b53e98
intro of/to_big_int method for NumType
ggreif b662da3
WIP: more intermediate string elimination
ggreif 84b63c4
fix Nat64->Word64
ggreif 250c033
test literal max Nat64
ggreif 34d731f
fix max Nat64Lit in backend
ggreif 4245894
add @tex_of functions for ranged numeric types
ggreif 7ab1dd3
fix data-params.as
ggreif e46e42c
implement debug show for range-limited numeric types
ggreif 8fdd687
update output
ggreif bb2c388
remove-duplicate
ggreif ad78ca5
convert exceptions to traps
ggreif 5a8de71
obsolete test
ggreif 1d19805
Merge remote-tracking branch 'origin/master' into gabor/ranged-int-nat
ggreif a55e103
port portions of e46e42c4f from src/ir_passes/show.ml
ggreif 9ba1105
simplify
ggreif bafbef2
Merge remote-tracking branch 'origin/master' into gabor/ranged-int-nat
ggreif b37c85a
bad merge
ggreif fd4a921
negation for Int*/Nat*
ggreif 5ba6157
refactor relops a bit
ggreif f57de0f
relops for Int* in interpreter
ggreif 3222223
codegen comparisons
ggreif 1bcf9e3
trapping negation for Int* and comparisons for Nat*/Int*
ggreif 449e99b
resolve TODO
ggreif 704e0c2
test negation corner case
ggreif 6c5ee4a
fix compile warnings
ggreif 2db2fc7
Merge branch 'master' into gabor/ranged-int-nat
ggreif 48e11ee
lower-case
ggreif bc0ed24
add Nat8 negation test
ggreif 5963583
refactor to share code
ggreif b4caf31
commit @nomeata's fix for fits_signed_bits
ggreif a5afc38
revert the ability to negate Nat{8,16,32,64} and get an Int{8,16,32,64}
ggreif ce7b7a7
tweaks
ggreif 032a91e
handle a few review comments
ggreif 129ca99
more review feedback
ggreif bbbda66
more review feedback
ggreif f5d8987
implement ordering relation(s)
ggreif 1ded795
minor tweaks, doc fixes and codegen optimisations
ggreif de4e053
fix build
ggreif eafa524
pattern matching {Word,Int,Nat}x{8,16,32,64}
ggreif 789f1f9
rename BoxedWord64
ggreif 2fe00c8
remove FIXMEs
ggreif 8f45485
factor out the type-dependent creation of UnboxedSmallWord literals
ggreif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5132,6 +5132,48 @@ and compile_lit_pat env l = | |
| (NatLit _ | IntLit _) -> | ||
compile_lit_as env SR.Vanilla l ^^ | ||
BigNum.compile_eq env | ||
| Nat8Lit _ -> | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Nat8) | ||
| Nat16Lit _ -> | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Nat16) | ||
| Nat32Lit _ -> | ||
BoxedSmallWord.unbox env ^^ | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Nat32) | ||
| Nat64Lit _ -> | ||
BoxedWord.unbox env ^^ | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Nat64) | ||
| Int8Lit _ -> | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Int8) | ||
| Int16Lit _ -> | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Int16) | ||
| Int32Lit _ -> | ||
BoxedSmallWord.unbox env ^^ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the scrutinee is captured as |
||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Int32) | ||
| Int64Lit _ -> | ||
BoxedWord.unbox env ^^ | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Int64) | ||
| Word8Lit _ -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Words were an earlier omission, filled in now. |
||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Word8) | ||
| Word16Lit _ -> | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Word16) | ||
| Word32Lit _ -> | ||
BoxedSmallWord.unbox env ^^ | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Word32) | ||
| Word64Lit _ -> | ||
BoxedWord.unbox env ^^ | ||
snd (compile_lit env l) ^^ | ||
compile_eq env Type.(Prim Word64) | ||
| (TextLit t) -> | ||
Text.lit env t ^^ | ||
Text.compare env | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I see no point spelling out the
SR
forcompile_lit_as
all the time, instead I rely on what is done by both lines below implicitly. Also there is no guarantee that the latter operates onVanilla
(other than inspecting the implementation).