Skip to content

feature: C++ Direct Call Support#727

Draft
stmonty wants to merge 31 commits into
jank-lang:mainfrom
stmonty:feat/cpp-direct-call
Draft

feature: C++ Direct Call Support#727
stmonty wants to merge 31 commits into
jank-lang:mainfrom
stmonty:feat/cpp-direct-call

Conversation

@stmonty
Copy link
Copy Markdown
Contributor

@stmonty stmonty commented Apr 5, 2026

This PR adds C++ codegen direct-call support. Right now I am still following similar to the LLVM codegen where we cache a var-root. This is pretty similar to the older PR, just modified for the current codegen strategy.

However, I am still working on making this match more closely to the JVM Clojure codegen, where it emits direct static calls to the var's function.

Just some current numbers. The simple benchmark is benchmarking mostly derefs:

With direct-call ray benchmark:
|               ms/op |                op/s |    err% |          ins/op |         bra/op |   miss% |     total | benchmark
|--------------------:|--------------------:|--------:|----------------:|---------------:|--------:|----------:|:----------
|               57.33 |               17.44 |    1.8% |  700,197,268.25 | 124,313,402.75 |    0.2% |     13.90 | `ray`

Without direct-call ray benchmark:
|               ms/op |                op/s |    err% |          ins/op |         bra/op |   miss% |     total | benchmark
|--------------------:|--------------------:|--------:|----------------:|---------------:|--------:|----------:|:----------
|               65.62 |               15.24 |    1.9% |  754,919,414.29 | 133,046,489.21 |    0.2% |     15.69 | `ray`

With direct-call simple benchmark:
|               ns/op |                op/s |    err% |          ins/op |         bra/op |   miss% |     total | benchmark
|--------------------:|--------------------:|--------:|----------------:|---------------:|--------:|----------:|:----------
|                7.27 |      137,565,593.91 |    0.6% |          124.00 |          24.00 |    0.0% |      0.08 | `basic`

Without direct-call simple benchmark:
|               ns/op |                op/s |    err% |          ins/op |         bra/op |   miss% |     total | benchmark
|--------------------:|--------------------:|--------:|----------------:|---------------:|--------:|----------:|:----------
|              104.75 |        9,546,938.67 |    0.1% |        1,829.57 |         294.00 |    0.0% |      1.27 | `basic`

Note: AI was used for general conversation, debugging and some code clean-up and comment clarity.

@stmonty stmonty marked this pull request as draft April 5, 2026 05:13
@jeaye
Copy link
Copy Markdown
Member

jeaye commented Apr 6, 2026

Hey Monty! Glad to see a PR coming through for this. On first glance, this approach looks pretty much like the old approach. It's not using the invokeStatic style of call which Clojure does. Did that not pan out?

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