Hacker News new | ask | show | jobs
by xyzsparetimexyz 13 days ago
I'm not convinced this makes sense purely from a context point of view tbh. If you can do a matching decompile of 1 function in a file then it's only 5% more tokens for any other similar functions
2 comments

That's not at all how decomp works. The context window truly does not carry over useful data from one function to another. 99% of it is "this function is logically right but the registers are coming out different" or "the stack is pushed in a different order" or some other trivial thing that needs heavy experimentation to solve. None of that will help on the next function, even though the goals are the same; the specifics are all that matter.
In my experience (granted its mostly been with vs98 games) only 20% or so of functions have stack slot issues
I was glossing over all the various types of failure modes. It varies so much by individual compiler. "Was this really an inline function" was a huge bugbear as well for me, since it could permute register alloc. And it's not always obvious what the helper should cover--just a better? Or a whole block?
It doesn't make sense from a clean code point of view. But you're thinking someone's going to go in and modify something by hand.

> then it's only 5% more tokens for any other similar functions

Not if it's distributed and multiple nodes come up with it at the same time. But there's also no reason that passes could be done after if someone wanted to actually have clean code.

It's a tradeoff

Not like you need clean code for a video game either. This is not a project that will require long-term maintenance.
And the compiler will still find optimizations and copy things to the right location on the compiled binaries.

Once it builds, you can throw a profiler if you want to find bottlenecks. Find the same thing and you can start optimizing the code that makes sense.

This is what happens with decompiling.. which is essentially what’s happening.

GTA6? That's got to be a codebase with 20 years of history in it, assuming they started with GTA5 as the base.
I'm not sure what your point is. We're not talking about a product that will have a long life and have many others on it. We're talking about a decompilation of one of those so people can run it in places where it wasn't originally designed for.

Come GTA 7, assuming you're right and the trend continues where each iteration is based on the previous, the new decompilation will likely not be maintained on top of the GTA 6 decomp. It may use it as reference but it's likely to be a whole new project that will also not need to be maintained long-term as a product.