Compilation strategy

Walter Bright newshound2 at digitalmars.com
Mon Dec 17 13:36:45 PST 2012


On 12/17/2012 12:49 PM, deadalnix wrote:
> Granted, this is still easier than assembly, but you neglected the fact that
> java is rather simple, where D isn't. It is unlikely that an optimized D
> bytecode can ever be decompiled in a satisfying way.

Please listen to me.

You have FULL TYPE INFORMATION in the Java bytecode.

You have ZERO, ZERO, ZERO type information in object code. (Well, you might be 
able to extract some from mangled global symbol names, for C++ and D (not C), if 
they haven't been stripped.) Do not underestimate what the loss of ALL the type 
information means to be able to do meaningful decompilation.

Please understand that I actually do know what I'm talking about with this 
stuff. I have written a Java compiler. I know what it emits. I know what's in 
Java bytecode, and how it is TRIVIALLY reversed back into Java source.

The only difference between Java source code and Java bytecode is the latter has 
local symbol names and comments stripped out. There's a 1:1 correspondence.

This is not at all true with object code.

(Because .class files have full type information, a Java compiler can "import" 
either a .java file or a .class file with equal facility.)


More information about the Digitalmars-d mailing list