@@ -119,7 +119,7 @@ inlineST = everywhereOnJS convertBlock
119 -- Look for runST blocks and inline the STRefs there.
119 -- Look for runST blocks and inline the STRefs there.
120 -- If all STRefs are used in the scope of the same runST, only using { read, write, modify }STRef then
120 -- If all STRefs are used in the scope of the same runST, only using { read, write, modify }STRef then
121 -- we can be more aggressive about inlining, and actually turn STRefs into local variables.
121 -- we can be more aggressive about inlining, and actually turn STRefs into local variables.
122− convertBlock (JSApp f [arg]) | isSTFunc C.runST f || isSTFunc C.runSTArray f =
122+ convertBlock (JSApp f [arg]) | isSTFunc C.runST f =
123 let refs = nub . findSTRefsIn $ arg
123 let refs = nub . findSTRefsIn $ arg
124 usages = findAllSTUsagesIn arg
124 usages = findAllSTUsagesIn arg
125 allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages
125 allUsagesAreLocalVars = all (\u -> let v = toVar u in isJust v && fromJust v `elem` refs) usages
@@ -137,10 +137,6 @@ inlineST = everywhereOnJS convertBlock
137 if agg then JSAssignment ref arg else JSAssignment (JSAccessor C.stRefValue ref) arg
137 if agg then JSAssignment ref arg else JSAssignment (JSAccessor C.stRefValue ref) arg
138 convert agg (JSApp (JSApp (JSApp f [ref]) [func]) []) | isSTFunc C.modifySTRef f =
138 convert agg (JSApp (JSApp (JSApp f [ref]) [func]) []) | isSTFunc C.modifySTRef f =
139 if agg then JSAssignment ref (JSApp func [ref]) else JSAssignment (JSAccessor C.stRefValue ref) (JSApp func [JSAccessor C.stRefValue ref])
139 if agg then JSAssignment ref (JSApp func [ref]) else JSAssignment (JSAccessor C.stRefValue ref) (JSApp func [JSAccessor C.stRefValue ref])
140− convert _ (JSApp (JSApp (JSApp f [arr]) [i]) []) | isSTFunc C.peekSTArray f =
142− convert _ (JSApp (JSApp (JSApp (JSApp f [arr]) [i]) [val]) []) | isSTFunc C.pokeSTArray f =
143− JSAssignment (JSIndexer i arr) val
144 convert _ other = other
140 convert _ other = other
145 -- Check if an expression represents a function in the ST module
141 -- Check if an expression represents a function in the ST module
146 isSTFunc name (JSAccessor name' (JSVar st)) = st == C.st && name == name'
142 isSTFunc name (JSAccessor name' (JSVar st)) = st == C.st && name == name'