Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.
See all our reports

Java Bytecode For Discriminating Developers

The Flashback

If you’ve never goofed around with assembler or machine code, Java bytecode can seem an obscure piece of low-level magic. But sometimes, when things go really wrong, understanding that magic may be what stands between you and solving the problem at hand. Understanding bytecode is necessary to solve performance issues, some classloading issues and to generate code at runtime. And some things you can do are just plain freakin’ cool.

Previously this year, I published some posts about the topic and I’m becoming even more passionate about it – learning more about the corner cases and finding new ways to work with bytecode.

My first post was mainly an attempt to explain the topic to myself. When I’m writing a post, I learn more about the topic, so that’s what that was. I covered pretty much the most basic aspects of Java bytecode and how to read it – the constant table, the local variables table, what happens to the stack when the opcodes are executed, etc.

Many things were left uncovered by the first post and quite a lot was still there to learn. In the next blog post, some more interesting aspects were covered – especially the method invocation mechanics. The 4 main method invocation instructions were covered: invokestatic, invokespecial, invokevirtual, invokeinterface. Invokedynamic instruction wasn’t covered there since I don’t have much experience with it yet.

GeeCON 2011: Java Bytecode For Discriminating Developers

After some time I had the pleasure to deliver a talk about the bytecode fundamentals at GeeCON organized in the beautiful city of Krakow in May this year. This was actually my first talk at an international-level conference, so it was a bit scary to deliver the talk to the rough crowd. You can notice I’m a bit nervous at the recording :)

It seems the crowd liked it and people asked quite good questions about the topic later. Hopefully, I can find more interesting aspects in the bytecode while we progress with JRebel development and there will be more interesting stuff to share with others!

In fact, my talk was inspired by the Charles Nutter presentation called Bytecode for Dummies. You may want to check out Charles blog – there he writes a lot of interesting things about the bytecode related topics and his work on JRuby project.

I will be presenting this same topic at JavaZone in Norway next week (Sept 8th, 10:20-11:20 AM). If you want to talk more about this, or just need a beer-buddy, get in touch with me @jrebel.

No Responses

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.