I am writing a JVM. I was implementing all opcodes one by one, until I faced dup2. The oracle instruction set https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.dup2 says Duplicate the top one or two values on the operand stack and push the duplicated value or values back onto the operand stack in the original order How am I supposed to choose which operation to perform?
Tag: bytecode
Java bytecode – Why is offset being skipped?
I have this very simple class That i compiled with javac and then decompiled with javap to see its bytecode. Lets check offsets 0 – is reserved for “this” reference 1 – is the method parameter 2 – skipped ? 3 – variable “d” 4 – skipped ? 5 – variable “k” Why were offsets 2 and 4 skipped? Is
Java Bytecode Error : Expecting to find object/array on stack
I am compiling a simple language into JVM Bytecode and having some issues with Java object method calls. The verifier gives the error below java.lang.VerifyError: (class: Test_1, method: main signature: ()V) Expecting to find object/array on stack and below is the generated Java source code from my bytecodes by IntelliJ which is exactly what I am trying to do. Creating
In Java, verify all methods in a class path that are called actually exist within that classpath [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Given a classpath (e.g. a set of jar files) I would like to know, do any of these jar files make a method call (ignoring
What JVM optimization is causing these performance results? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 years ago. Improve this question In a Java REST service performance test, I got an unexpected pattern: a method that creates and returns always the same value object in each
ASM: how to easily get proper Opcode based on type
I am using ASM to generate Java bytecode. I have a need to create a dynamic proxy which can override basically any kind of method with additional post-processing. I am able to do it all, but there is one thing I can’t see how to do in a nice way. The type of the first parameter to the method I