Skip to content

Constant-time Reference Counting in Effekt#1299

Open
danielflat wants to merge 28 commits intomainfrom
final-constant-time-rc
Open

Constant-time Reference Counting in Effekt#1299
danielflat wants to merge 28 commits intomainfrom
final-constant-time-rc

Conversation

@danielflat
Copy link
Copy Markdown

@phischu Here is my final PR for my thesis. Can you check it, please?

@danielflat danielflat requested a review from phischu February 27, 2026 10:33
@jiribenes
Copy link
Copy Markdown
Contributor

Hey @danielflat, thanks for the PR.
Does it subsume #1130 and #1182? If so, could you please close those that are subsumed by this PR?

@danielflat
Copy link
Copy Markdown
Author

hi @jiribenes, yes. I closed the other ones.

Copy link
Copy Markdown
Collaborator

@phischu phischu left a comment

Choose a reason for hiding this comment

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

Looks very good so far, impressive work.

I still need to review llvm/Transformer.scala.

Comment on lines +310 to +326
// only relevant for macOS
val arch: String = System.getProperty("os.arch")
assert(!OS.contains("mac") || List("aarch64", "x86_64").contains(arch), "If you have a macbook -> It should have either an aarch64 or x86_64 architecture.")

val libraries = C.config.clangLibraries.toOption.map(file).orElse {
OS match {
case os if os.contains("mac") => Some(file("/opt/homebrew/lib"))
case os if os.contains("mac") && arch.equals("aarch64") => Some(file("/opt/homebrew/lib"))
case os if os.contains("mac") => Some(file("/usr/local/lib"))
case os if os.contains("win") => None
case os if os.contains("linux") => Some(file("/usr/local/lib"))
case os => None
}
}
val includes = C.config.clangIncludes.toOption.map(file).orElse {
OS match {
case os if os.contains("mac") => Some(file("/opt/homebrew/include"))
case os if os.contains("mac") && arch.equals("aarch64") => Some(file("/opt/homebrew/include"))
case os if os.contains("mac") => Some(file("/usr/local/include"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Someone with a Mac should test and approve this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fwiw, this works on my machine (though I use nix-darwin, so I'm not the best guinea pig)

)

override lazy val withoutOptimizations: Set[File] = Set(
examplesDir / "ctrc" / "nooptimized",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are the tests in a folder nooptimized? I can't find the "optimized" folder.

I personally would not add any tests at all. Others surely disagree.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, there is no optimized folder because during the thesis, it was helpful to work with the pure program rather than the optimized one. These tests were done to "debug" better through Effekt.

It would be cool if we could test stronger by asserting the number of used chunks or other invariants. Then these tests would have more value

@jiribenes
Copy link
Copy Markdown
Contributor

If kept separate, the CRTC tests should likely be grouped with LLVM tests (i.e. added to both testBackendLLVM and separatedTests below)

effekt/build.sbt

Lines 227 to 251 in 12001cf

testBackendLLVM := {
(Test / testOnly).toTask(
" effekt.LLVMTests effekt.LLVMNoValgrindTests effekt.StdlibLLVMTests"
).value
},
testRemaining := Def.taskDyn {
val log = streams.value.log
val allTests = (Test / definedTestNames).value.toSet
// Explicit list of tests run separately (union of all testBackend targets)
val separatedTests = Set(
"effekt.JavaScriptTests",
"effekt.StdlibJavaScriptTests",
"effekt.ChezSchemeMonadicTests",
"effekt.ChezSchemeCallCCTests",
"effekt.ChezSchemeCPSTests",
"effekt.StdlibChezSchemeMonadicTests",
"effekt.StdlibChezSchemeCallCCTests",
"effekt.StdlibChezCPSTests",
"effekt.LLVMTests",
"effekt.LLVMNoValgrindTests",
"effekt.StdlibLLVMTests"
)

@phischu phischu force-pushed the final-constant-time-rc branch from c42ca0a to cad45d6 Compare March 3, 2026 10:38
@phischu phischu force-pushed the final-constant-time-rc branch from cad45d6 to a1985c8 Compare March 3, 2026 10:40
Comment thread effekt/shared/src/main/scala/effekt/generator/llvm/Transformer.scala Outdated
@phischu phischu force-pushed the final-constant-time-rc branch from f617df0 to 42d07eb Compare March 3, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants