Re:Show HN: I wrote a Java decompiler in pure C language
by neocanable on Tuesday June 03, 2025 @09:50AM
(#44170149)
I am writing the part of decompiling dex and apk. The current speed is about 10 times faster than that of Java, and it takes up less resources than Java. And the compiled binary is smaller, only about 300k. Thank you for your attention.
Re:Show HN: I wrote a Java decompiler in pure C language
by mdaniel on Tuesday June 03, 2025 @10:28AM
(#44170511)
This has been my life experience with things written in C/C++, so speed doesn't matter. Or, I guess from an alternative perspective, it ran very fast, but exited very fast, too :-D
$ ./objdir/garlic $the_jar_file -o out-dir -t $(nproc)
Progress : 85 (1024)Segmentation fault: 11
Re:Show HN: I wrote a Java decompiler in pure C language
by neocanable on Tuesday June 03, 2025 @10:49AM
(#44170739)
Sorry for giving you a bad experience. Please provide the jar file or class file. I hope I can fix it as soon as possible.
Re:Show HN: I wrote a Java decompiler in pure C language
by uecker on Tuesday June 03, 2025 @03:59PM
(#44174042)
Is it? This is my experience with Python. The C/C++ programs I use daily never seem to crash (Linux, bash, terminals, X, firefox, vim, etc.). It must be years ago one of those programs crashed while I used it.
Re:Show HN: I wrote a Java decompiler in pure C language
by 1718627440 on Tuesday June 03, 2025 @04:46PM
(#44174542)
Also a segfault IS the protection layer intervening, it is equivalent to a exception in other languages. The real problem is, when there is no segfault.
Re:Show HN: I wrote a Java decompiler in pure C language
by uecker on Tuesday June 03, 2025 @05:37PM
(#44175014)
This is absolutely true. But even this does not happen in the software I use every day. Software written is C is definitely the most stable I use - by far. That there are people running around claiming that it is impossible to write stable software in C and it crashes all the time due to bugs is rather unfortunate, as it is far from the truth.
Re:Show HN: I wrote a Java decompiler in pure C language
by Koshkin on Tuesday June 03, 2025 @07:08PM
(#44175752)
> 10 times faster than that of Java
I was hoping that these days' Java would be "almost" as fast C/C++. Oh well.
Re:Show HN: I wrote a Java decompiler in pure C language
by neocanable on Tuesday June 03, 2025 @10:36PM
(#44176725)
In the process of writing this, I learned a lot about JVM. JVM has done well enough, even surpassing C/C++ in some cases.
Re:Show HN: I wrote a Java decompiler in pure C language
by mdaniel on Tuesday June 03, 2025 @09:50AM
(#44170148)
The "jikes" compiler from IBM <https://github.com/daveshields/jikespg> was written in C++ and was for the longest time screaming fast. It also had its own parser generator lpg which was fun to play with, if you're into those things <https://github.com/daveshields/jikespg>
It seems someone liked it and made a "v2" along with LSP support https://github.com/A-LPG/LPG2#lpg2
Re:Show HN: I wrote a Java decompiler in pure C language
by amiga386 on Tuesday June 03, 2025 @12:54PM
(#44172067)
Jikes also gave massively better error messages than the official Java compiler, from what I remember, and it certainly ran a lot faster on the Amiga (https://aminet.net/package/dev/lang/jikes) than trying to run javac via Kaffe (https://en.wikipedia.org/wiki/Kaffe) did.
Re:Show HN: I wrote a Java decompiler in pure C language
by pjmlp on Tuesday June 03, 2025 @02:58PM
(#44173395)
Certainly not everything on Jikes, given that it was one of the first bootstraped Java toolchains.
Re:Show HN: I wrote a Java decompiler in pure C language
by neocanable on Tuesday June 03, 2025 @09:53AM
(#44170189)
It is processes inner classes recursively. First read all entry from jar, and analyze the relationships between classes. Then do some decompile job.
Re:Show HN: I wrote a Java decompiler in pure C language
by tslater2006 on Tuesday June 03, 2025 @08:56AM
(#44169502)
The readme shows support for dumping dex files. Edit: missed that it has a comment that stays "unsupport for now" but at least it looks like something planned
Re:Show HN: I wrote a Java decompiler in pure C language
by neocanable on Friday June 13, 2025 @11:09AM
(#44269241)
the project support dex and apk now.
Any plan to support `.dex` in the future? Also curious how you handle inner classes inside JARs.