Jump to content

Anything like assembly for java?


Recommended Posts

Posted

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

 

 

Posted

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.

Posted (edited)

Study x86.

Study the JVM.

 

Java doesn't compile to native code, that's kind off the whole point of having the JVM tongue.png

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 by DragonAlpha
  • Like 2
Posted (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 by Flamezzz
  • Like 1
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...