Java has a dup2_x2 instruction which, according to the documentation, has the following behavior: Duplicate the top one or two values on the operand stack and insert the duplicated values, in the original order, into the operand stack. Does javac produce bytecode with this instruction? What are its potential …
Tag: jvm-bytecode
I don’t understand this opcode in JVM Implementation
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…
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 …
Forge 1.12.2 Coremodding: java.lang.StringIndexOutOfBoundsException
I try to make a coremod on 1.12.2 Forge in order to patch some missing stuff in the Lost Cities mod. (Source: https://github.com/McJtyMods/LostCities/blob/1.12/src/main/java/mcjty/lostcities/dimensions/world/lost/BuildingInfo.java) A friend and I have written this LostCitiesClassTransformer.java: (Full source…
Forge 1.12.2 Coremodding: java.lang.ClassCircularityError
I try to make a coremod on 1.12.2 Forge in order to patch some missing stuff in the Lost Cities mod. (Source: https://github.com/McJtyMods/LostCities/blob/1.12/src/main/java/mcjty/lostcities/dimensions/world/lost/BuildingInfo.java) A friend and I have written this LostCitiesClassTransformer.java: The original…
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 m…
Invokedynamic with non-static context
I learnt that invokedynamic instruction of bytecode calls a static method representation of lambda. Please let me know if that is incorrect. if correct, then how is below code working? Answer It’s not correct to say that lambda expressions were always compiled to a static method. It’s not specified, how they …
short -> int -> long type promotion: is there any overhead?
If, for example, I define method’s return type/parameter as char, but both the caller and implementation actually immediately use it as an int, is there any overhead? If I understand correctly, the values on the stack are 32-bits aligned anyway, as are the ‘registers’ (I’m sorry, IR…