recently I am doing an experiment on JVM and bytecode.
I use these code snippets to test.
import java.util.*;
public class Simple {
private String a = "abcdefghijklmnopaqrstuvwaxyazaaabcdefghijklmnopaqrstuvwaxyazaabcdefghijklmnopaqrstuvwaxyazaabcdefghijklmnopaqrstuvwaxyaz";
public int test()
{
String bb = "abcdefghijklmnopaqrstuvwaxyazaaabcdefghijklmnopaqrstuvwaxyazaabcdefghijklmnopaqrstuvwaxyazaabcdefghijklmnopaqrstuvwaxyaz";
int a = 0;
int b = a;
int c = a + b;
return c;
}
public static void main(String[] args)
{
String cc = "abcdefghijklmnopaqrstuvwaxyazaaabcdefghijklmnopaqrstuvwaxyazaabcdefghijklmnopaqrstuvwaxyazaabcdefghijklmnopaqrstuvwaxyaz";
Simple simple = new Simple();
simple.test();
Scanner input=new Scanner(System.in);
System.out.println("how much money do you need?");
double number=input.nextDouble();
}
}
FIrstly I use HotSpot to conduct the experiment. On Windows, I trun off the
-Djava.compiler=NONE
and use HeapMemView to view the HotSpot's heap memory. I can find a sequence of "6162 6364.."(whichs match my private String variant) and find my code snippet's bytecode sequence.
But I cannot find the bytecode sequence of Java Standard library.. like
Java.Lang.Obeject
Java.Lang.Math
What's wrong..? In my understanding, I think I should find their bytecode sequence in the JVM's heap..
Then I use JRocket to do it again.. use
-Djava.compiler=NONE
to turn of the complier mode... but this time I cannot even find my String variant on the heap....
I am trapped here for two days.. Could anybody can me some help...? I really really appreciate it...
Thank you!