Jump to content

Anything like assembly for java?


Qubit

Recommended Posts

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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