summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-12-20 14:56:41 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-06 02:24:54 -0500
commitc080b44314248545c6ddea0c0eff02f8c9edbca4 (patch)
tree57eedf35d743c95e720f8ac6fe003b7f716d1fc8 /utils
parente59bd46a6915c79e89d376aa22b0ae6def440e0a (diff)
downloadhaskell-c080b44314248545c6ddea0c0eff02f8c9edbca4.tar.gz
Perf: use SmallArray for primops' Ids cache (#20857)
SmallArray doesn't perform bounds check (faster). Make primop tags start at 0 to avoid index arithmetic.
Diffstat (limited to 'utils')
-rw-r--r--utils/genprimopcode/Main.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs
index c13447e527..2e0886e59b 100644
--- a/utils/genprimopcode/Main.hs
+++ b/utils/genprimopcode/Main.hs
@@ -741,13 +741,13 @@ gen_primop_vector_tycons (Info _ entries)
gen_primop_tag :: Info -> String
gen_primop_tag (Info _ entries)
= unlines (max_def_type : max_def :
- tagOf_type : zipWith f primop_entries [1 :: Int ..])
+ tagOf_type : zipWith f primop_entries [0 :: Int ..])
where
primop_entries = concatMap desugarVectorSpec $ filter is_primop entries
tagOf_type = "primOpTag :: PrimOp -> Int"
f i n = "primOpTag " ++ cons i ++ " = " ++ show n
max_def_type = "maxPrimOpTag :: Int"
- max_def = "maxPrimOpTag = " ++ show (length primop_entries)
+ max_def = "maxPrimOpTag = " ++ show (length primop_entries - 1)
gen_data_decl :: Info -> String
gen_data_decl (Info _ entries) =