1
1
mirror of https://github.com/anoma/juvix.git synced 2024-09-11 16:26:33 +03:00

Inline immediate values (#2842)

* Closes #2745 
* Adds inlining of immediate values, i.e., values that don't require
computation or memory allocation.
* Non-immediate zero-argument functions / values should not be inlined,
because when not inlined they can be computed only once.
This commit is contained in:
Łukasz Czajka 2024-06-20 21:23:08 +02:00 committed by GitHub
parent a5cd3c9aa9
commit af758cc8ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,7 +55,13 @@ convertNode inlineDepth recSyms md = dmapL go
Just InlineFullyApplied | argsNum == 0 -> def
Just (InlinePartiallyApplied 0) -> def
Just InlineAlways -> def
_ -> node
Just InlineNever -> node
_
| not (HashSet.member _identSymbol recSyms)
&& isImmediate md def ->
def
| otherwise ->
node
where
ii = lookupIdentifierInfo md _identSymbol
pi = ii ^. identifierPragmas . pragmasInline