Qubit Posted April 26, 2016 Share Posted April 26, 2016 For the past term I've been taking a class "Computer Organization and Intro to Assembly" also known as 15-213 at CMU. It teaches about dissembling programs and being able to look at assembly interpretation of your program. I found the course although, very hard very informative and gives a lot of useful and applicable knowledge. As I primarily use Java, I am transitioning from it more and more everyday. But I was mainly curious if Java has something similar to c or c++ where you can look at the guts and insides of he program more. I know Java uses byte code but is it similar to assembly as being able to read it and understand it ? TL:DR is there something similar to C's disassembling and examining the assembly code in java Quote Link to comment Share on other sites More sharing options...
DragonAlpha Posted April 26, 2016 Share Posted April 26, 2016 For the past term I've been taking a class "Computer Organization and Intro to Assembly" also known as 15-213 at CMU. It teaches about dissembling programs and being able to look at assembly interpretation of your program. I found the course although, very hard very informative and gives a lot of useful and applicable knowledge. As I primarily use Java, I am transitioning from it more and more everyday. But I was mainly curious if Java has something similar to c or c++ where you can look at the guts and insides of he program more. I know Java uses byte code but is it similar to assembly as being able to read it and understand it ? TL:DR is there something similar to C's disassembling and examining the assembly code in java Yes it's called Java bytecode. You will find it much easier to understand than assembly. Java files compile into java bytecode. These bytecode instructions are then run by the "Java Virtual Machine" on the person's device. Quote Link to comment Share on other sites More sharing options...
Botre Posted April 26, 2016 Share Posted April 26, 2016 Study x86. Study the JVM. Java doesn't compile to native code, that's kind off the whole point of having the JVM :p You can look a bit into bytecode if you want to see Java's guts, not remotely as useful as knowing x86 though. Quote Link to comment Share on other sites More sharing options...
DragonAlpha Posted April 26, 2016 Share Posted April 26, 2016 (edited) Study x86. Study the JVM. Java doesn't compile to native code, that's kind off the whole point of having the JVM You can look a bit into bytecode if you want to see Java's guts, not remotely as useful as knowing x86 though. He was asking what the assembly version of java was. Not which is more useful though. By his original post, it sounds like he is already studying x86. Edited April 26, 2016 by DragonAlpha 2 Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted April 26, 2016 Share Posted April 26, 2016 (edited) For examining class files you can download http://bytecodeviewer.com/, it comes with several disassemblers and decompilers. The class file format is documented here, that document also includes a lot of details on how you would implement a VM to execute java bytecode, including opcodes/operands and what they should do. From this you could for example create a small interpreter which takes a class with one main method and starts executing it. I think it's nice to look into a stack-based 'assembly' language as well, it's quite a common model amongst interpreted languages (and it's even used in malware to defeat static code analysis, although the VM is a lot simpler in that case).Oh I almost forgot, there's not only decompilers/disassemblers for java, but also an assembler Jasmin which lets you create class files from scratch Edited April 26, 2016 by Flamezzz 1 Quote Link to comment Share on other sites More sharing options...
Botre Posted April 26, 2016 Share Posted April 26, 2016 He was asking what the assembly version of java was. Not which is more useful though. By his original post, it sounds like he is already studying x86. The java version of assembly is assembly. And if you want to know what the JVM spits out: http://www.ashishpaliwal.com/blog/2013/05/jvm-how-to-see-assembly-code-for-your-java-program/ It's runtime specific though. @OP: get this course from a torrent, it's amazing :https://www.coursera.org/course/hwswinterface Quote Link to comment Share on other sites More sharing options...