Skip to content

Add borrow checker to fast dfa engine - #23572

Open
rikkimax wants to merge 1 commit into
dlang:masterfrom
rikkimax:fastdfa-borrowchecker
Open

Add borrow checker to fast dfa engine#23572
rikkimax wants to merge 1 commit into
dlang:masterfrom
rikkimax:fastdfa-borrowchecker

Conversation

@rikkimax

@rikkimax rikkimax commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Pretty much entirely written by DeepSeek V4 flash in the span of about 2 and half hours.
I'm very happy with the results.

Oh and those plan files are fully intended to be merged; it's a little something for @LightBender to learn from for PhobosV3 legal stuff.

@rikkimax rikkimax added the AI Generated Code that is generated by an LLM AI. label Aug 10, 2026
@rikkimax
rikkimax force-pushed the fastdfa-borrowchecker branch from 3e0a2c9 to 0f34c27 Compare August 10, 2026 20:58
@rikkimax
rikkimax force-pushed the fastdfa-borrowchecker branch from 0f34c27 to 879c7c9 Compare August 10, 2026 21:12
@github-actions

Copy link
Copy Markdown

DMD perf check

Metric Base PR delta
compile hello.d (instr) 216.1 M 216.1 M +0.01%
compile hello.d -O (instr) 234.6 M 234.6 M 0.00%
compile Phobos (instr) 5,136.8 M 5,136.5 M -0.01%
compile Phobos codegen (instr) 1,474.6 M 1,474.2 M -0.03%
compile vibe.d (instr) 15,161.1 M 15,160.9 M 0.00%
dmd binary size (stripped) 6.92 MB 6.93 MB +0.17%
hello binary size 0.72 MB 0.72 MB 0.00%
peak RSS (compile hello.d) 44 MB 44 MB -0.05%
peak RSS (compile Phobos) 636 MB 636 MB -0.01%
peak RSS (compile vibe.d) 1980 MB 1979 MB -0.05%

* the `-preview=fastdfa` switch). It is subject to change and may be removed
* at a later date without notice; do not rely on it in production code.
*/
enum __fastdfa_returnborrow;

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.

I presume the leading double underscore is because it is experimental? do we have a plan to remove that, e.g. remove the leading underscores and add a deprecated alias __fastdfa_returnborrow = fastdfa_returnborrow;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it would become an in-language attribute i.e. @escape(return^)
The borrow checker is an integrated part of the escape analysis, but I left it out before to focus on the basics and not have to deal with the many to many problem which I didn't figure out how to solve (the LLM figured it out pretty much instantly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Code that is generated by an LLM AI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants