From 837d2ba4b3da6bb4b7c639f1c3a868619502dca0 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sat, 28 Dec 2024 19:03:06 -0800 Subject: [PATCH] Make sure alexScanUser is inlined --- data/AlexTemplate.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/AlexTemplate.hs b/data/AlexTemplate.hs index ba7346a..80e6ac1 100644 --- a/data/AlexTemplate.hs +++ b/data/AlexTemplate.hs @@ -96,6 +96,11 @@ data AlexReturn a alexScan input__ IBOX(sc) = alexScanUser (error "alex rule requiring context was invoked by alexScan; use alexScanUser instead?") input__ IBOX(sc) +-- If the generated alexScan/alexScanUser functions are called multiple times +-- in the same file, alexScanUser gets broken out into a separate function and +-- increases memory usage. Make sure GHC inlines this function and optimizes it. +{-# INLINE alexScanUser #-} + alexScanUser user__ input__ IBOX(sc) = case alex_scan_tkn user__ input__ ILIT(0) input__ sc AlexNone of (AlexNone, input__') ->