Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Haley Sapphie Owsianko
ACC-project
Commits
4399af88
Commit
4399af88
authored
May 06, 2021
by
Sapphie
Browse files
Implement blocklength reduction
parent
2ae235d7
Changes
1
Show whitespace changes
Inline
Side-by-side
compiler/src/l3/CPSOptimizer.scala
View file @
4399af88
...
...
@@ -142,14 +142,21 @@ abstract class CPSOptimizer[T <: CPSTreeModule { type Name = Symbol }]
// Right Absorbing
case
Seq
(
a1
,
AtomL
(
l2
))
if
rightAbsorbing
((
prim
,
l2
))
=>
shrink
(
body
,
s
.
withASubst
(
name
,
l2
))
case
Seq
(
a1
)
if
prim
==
blockTag
&&
s
.
eEnv
.
isDefinedAt
(
a1
)
=>
val
maybeBlockAlloc
=
s
.
eEnv
(
a1
)
.
_1
case
Seq
(
a1
)
if
s
.
eEnv
.
isDefinedAt
(
a1
)
=>
val
(
maybeBlockAlloc
,
maybeLengthAtom
)
=
s
.
eEnv
(
a1
)
blockAllocTag
.
lift
(
maybeBlockAlloc
)
match
{
case
Some
(
tag
)
=>
if
(
prim
==
blockTag
)
{
shrink
(
body
,
s
.
withASubst
(
name
,
AtomL
(
tag
)))
}
else
if
(
prim
==
blockLength
)
{
shrink
(
body
,
s
.
withASubst
(
name
,
maybeLengthAtom
(
0
)))
}
else
{
noOp
}
case
None
=>
noOp
}
case
_
=>
noOp
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment