Skip to content

Conversation

ychenfo
Copy link
Member

@ychenfo ychenfo commented Sep 16, 2025

TODO

  • Move nofibs to the benchmark subproject
  • Fix the paths

ychenfo added 30 commits March 12, 2025 16:07
…ges to avoid creating needless matchRest functions
def addToBindings(symbol: Local, name: String, shadow: Bool) =
if !shadow then assert(lookup(symbol).isEmpty, (symbol, this.showAsTree))
// FIXME: deforestation makes this assertion fail
// if !shadow then assert(lookup(symbol).isEmpty, (symbol, this.showAsTree))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to look into how to handle this issue, which seems to be caused by using the same Scope for generating programs both before/after deforestation?

given Config =
if file.segments.contains("nofib-deforest") then
Config.default.copy(deforest = S(Config.Deforestation(
importedPublicModNames = Set("NofibPrelude"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
importedPublicModNames = Set("NofibPrelude"),
seethroughModules = Set("NofibPrelude"),

preludeFile)
deforestResult match
case Right(msg) =>
println(msg) // TODO: no println
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println(msg) // TODO: no println

case Right(msg) =>
println(msg) // TODO: no println
le
case Left(prog -> summary -> detail) =>
Copy link
Contributor

@LPTK LPTK Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't build a summary string even when not used – use a lambda?


def uid =
import Result.*
val uidValue = ResultId(System.identityHashCode(this))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not guaranteed to be unique. Use the Uid definitions.

def rewriteOneBlk(b: Block) = b match
case Assign(lhs, Value.Lam(params, body), rest) if !lhs.isInstanceOf[TempSymbol] =>
val newSym = BlockMemberSymbol(lhs.nme, Nil,
val newSym = BlockMemberSymbol(lhs.nme, syntax.Tree.DummyTermDef(syntax.Fun) :: Nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document why the dummy Fun.

val sym = BlockMemberSymbol("lambda", Nil, nameIsMeaningful = false)
val sym = BlockMemberSymbol(
"lambda",
syntax.Tree.DummyTermDef(syntax.Fun) :: Nil,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document why the dummy Fun.

case _ => N
val singleCallBms = BlockMemberSymbol(d.sym.nme + "$", Nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

Comment on lines +314 to +316
args(fs): args =>
val tmpSym = TempSymbol(N, "arr")
Assign(tmpSym, Value.Arr(mut = false, args), k(Value.Ref(tmpSym)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed? At the very least, we shouldn't do it when the array is immediately returned or already assigned to a variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants