All Questions
10
questions
0
votes
0
answers
76
views
Java: Safety of rewriting bytecode to add interface
To try to forestall any concern, this is for a personal project. I'm more interested in learning about the internals of the jvm than I am in hearing about what a horrible idea this is :)
Normally, ...
4
votes
2
answers
399
views
java JVM bytecode notation, comment grammar. InvokeDynamic
Question: What does line 14 means?
Use javap -v -c to disassembly the following code:
public class test {
static int i = 2;
public static void main(String[] args) {
test x = new ...
0
votes
1
answer
164
views
Does the instruction istore start at index 1 in the main method?
Given the instruction istore_<n> and its documentation:
n must be an index into the local variable array of the current frame (§2.6).
It does not specify what index it starts at. I assume 0. ...
0
votes
1
answer
699
views
Where can I find the source code for javap application? [closed]
javap is the Java Class File Disassembler.
Which, in my system, is an application that belongs to Oracle JDK.
$ javap -version
1.8.0_201
$ which javap
/opt/jdk1.8.0_201/bin/javap
$ head -2 /opt/...
2
votes
1
answer
341
views
Stack=4 in Java bytecode. How does the Java Compiler compute the 4 value? (depth of the the stack)
Java Code:
public class SimpleRecursion {
public int factorial(int n) {
if (n == 0) {
return 1;
}
return n * factorial(n - 1);
}
}
Gives the following ...
1
vote
0
answers
56
views
What does stack=1 (or any integer value) mean in Java bytecode [duplicate]
I've been trying to understand how the bytecode of the following Java code works. I couldn't find the explanation of what the stack=1 and the stack=4 part mean.
Java Code:
public class ...
0
votes
0
answers
845
views
Can we Use Javap command inside a java program?
I need to write a program where I can track the way how methods are called. So , i'm trying to use invokestatic, invokevirtual , invokeinterface , invokespecial to track the method calls and follow ...
2
votes
2
answers
897
views
Does javac also inline?
I was playing around with javap and some very simple code and that raised a - hopefully simple - question.
here is the code first:
public class Main {
public static void main(String[] args) ...
4
votes
2
answers
2k
views
java: String concat in bytecode converted to StringBuilder
I reviewed my compiled code with javac command line and I saw whenever I used String concatenation with + operator, compiled code replaced with StringBuilder's append() method.
now I think using ...
0
votes
2
answers
407
views
Jasmin how to force long field to be long constant?
I managed to isolate my problem in this test case:
.bytecode 50.0
.class public test
.super java/lang/Object
.field public static final foo1 J = 1
.method public <init>()V
.limit stack 1
...