Questions about the JVM .class bytecode format or instruction set.
Questions tagged [jvm-bytecode]
188 questions
0
votes
1 answer
ASM skips Classes if COMPUTE_FRAMES is set in ClassWriter
I have been working on a Java Agent which is run together with the maven-surfire-plugin. The agent should be able to inject method calls using the ASM library into loaded methods at three different points: 1) In the beginning of each method; 2) At…

eftex
- 1
0
votes
1 answer
How can I distinguish attribute_info in JVM ClassFile?
I'm digging into The ClassFile Structure.
According to the document mentioned above, attribute_info can be appeared in various position.
My question is how can I distinguish the type of attribute_infos?
I know I can distinguish constant_infos by…

Jin Kwon
- 20,295
- 14
- 115
- 184
0
votes
0 answers
CannotCompileException while Instrumenting Java code with using Java Assist, cannot find class
I'm trying create a generic Java Agent to instrument any Java application's methods.
I've followed this tutorial https://javapapers.com/core-java/java-instrumentation/ and created a java agent.
The java agent is supposed to look for a particular…

Michael P
- 2,017
- 3
- 25
- 33
0
votes
1 answer
ASM - Inconsistent stackmap frames at branch target
I am trying to do a simple Java bytecode obfuscator which works by replacing GOTO instructions with simple conditional jumps, say, if 10 != 15 GOTO else throw IllegalStateException. My current code is:
final AbstractInsnNode[] insns =…

German Vekhorev
- 339
- 6
- 16
0
votes
1 answer
ASM parameter numbering
Let's say I have a dummy class
public class B {
public Object run(long v, String f){
if(v == 2) {
if(f.equals("x")) {
return new Object();
}
}
return null;
}
}
asmifier will…

User1291
- 7,664
- 8
- 51
- 108
0
votes
1 answer
Is it good option to use groovy objects rather than using java reflection
In java reflection, we generally try to get fields value at runtime by its attribute name. But considering performance impact its not recommended to use reflection.
But in this case can we use groovy objects which allows the retrieval of value by…

Mahendra Kapadne
- 426
- 1
- 3
- 10
0
votes
0 answers
Butchers algorithm in Jasmin
I keep getting errors and I have been trying to print this forever it seems. Ive looked for info on Jasmin and as far as I can tell there really isn't a lot of information. Any help with my code would be greatly appreciated. I'm supposed to use…

Jessica
- 11
- 1
0
votes
2 answers
Jasmin ByteCode Storing a String
I am trying to store a String in Jasmin Bytecode. After allot of research I could not find if this was possible and if it was, how it should be done. I could only find out how I could print it out(this is how I print a string).
I also thought of…

shiteatlife
- 57
- 2
- 12
0
votes
1 answer
How to count local variable indexes in MethodVariableAccess?
According to [1], in a method frame, the local variable array contains a reference to the called instance, the parameters and, finally, any other variables used in the method's code. Also, long and double values occupies two local variables.
When…

Carlos Melo
- 3,052
- 3
- 37
- 45
0
votes
0 answers
ASM Visitor to remove unreachable code
I'm trying to get a way of detect dead code and remove it from bytecode using ASM.
I'm following ASM 4 Guide, and in page 119 is stated a dead code removal visitor as this:
public class RemoveDeadCodeAdapter extends MethodVisitor {
String owner;
…

Sergio Figueras
- 297
- 1
- 6
- 18
0
votes
1 answer
How to get references in ASM?
Summarization: Using ASM, Given a bytecode class, for each method instruction (MethodInsnNode) I need to get the references that are being used on it.
Considering the following class:
public void myMethod(){
String str1 = "str12";
String str2 =…

Sergio Figueras
- 297
- 1
- 6
- 18
0
votes
1 answer
Possible optimize the bytecode sequence
I generate a sequence of bytecode after inline multiple method invocation. At the beginning of inline, I first poped existing variable indexes to a new local variable numbers in case of any exception in the inlined method. This operation results to…

shijie xu
- 1,975
- 21
- 52
0
votes
2 answers
Using ASM for bytecode analysis
I am evaluating the possibility of using ASM as framework for implementing some bytecode analysis. So far I have been playing with a few examples but there are a couple of things that I need to sort out:
1) I don't see how I can detect a method…

Abel Garcia
- 178
- 1
- 12
0
votes
0 answers
ASM Analyze MethodNode failure
I am wondering whether I can create an MethodNode directly and then analyze it. Therefore, I write below code to test:
ClassNode classNode = new ClassNode(Opcodes.ASM5);
classNode.visit(V1_8, ACC_PUBLIC + ACC_SUPER, className, null,…

shijie xu
- 1,975
- 21
- 52
0
votes
1 answer
How to generate bytecode for if-else statement
how do I generate the code corresponding to a bytecode instruction IF THEN - ELSE with the optioanal ELSE branch?
For example, the program If-else.pas is considered correct, while the program If.pas isn't considered correct, because it doesn't…
user3602008