last day (14 days later) » 

5:59 AM
1
A: Query on load/link/initialise phase of java class file

Filip BulovicOnly Example is initialized. Class Sub is retrieved from Constant pool Constant pool: #1 = Methodref #16.#39 // java/lang/Object."<init>":()V #2 = Class #40 // Sub and relevant code from main Code: stack=4, locals=4, args_size=1 0: ldc_w ...

 
when you say: "Sub was not initialised. No instance of Sub is created in other words.". Does that mean, any class gets initialised only before its instance is about to get created?
 
@overexchange looks like it, not required for execution - no initialization. Tested on JDK7 and JDK8
 
But, instance of class Example did not get created in my above code, But class Example passed thru initialisation phase. am not sure, I get you.
 
@overexchange Example is initialised, add static like for Sub and it will show. Though instance creation was not required since static method was called. Maybe my instance comment is confusing.
 
yes I verified, Example is initialised, and query output results says the same, but you did not answer my first comment. I did not get you when you said: "not required for execution - no initialization. " because instance(new Example()) of class Example is not created in above code.
 
5:59 AM
@overexchange maybe my instance wording is not best. Rather not required for execution results in not instantiation.
 
So, when you say, "Class Sub is retrieved from Constant pool", it means Class Sub is loaded&linked to JVM?
hi
 
Yes, it is placed in constant pool
 
13
A: What is the purpose of the Java Constant Pool?

James DrinkardI think understanding how the frame is constructed using a diagram would help. The frame is where the operands (operation instructions) reside and that is where the dynamic linking occurs. It is a shorthand way, so to speak, using the constant pool to keep track of the class and it's members...

 
am trying to understand the meaning of "Class Sub is retrieved from Constant pool" . I got the meaning of contant pool today from this answer. am new to java. 2 months old in java
I guess you understood my problem in understanding Class Sub is retrieved from Constant poo
 
6:02 AM
If you like to decompile it yourself, compile it with -g switch and use /usr/lib/jvm/java-7-oracle/bin/javap -c -v -l -p Example or whatever is the path to javap on your box
 
I want to confirm this belwo statement is correct or wrong...
 
Those are constants determined to be required for execution of program
 
class loading phase mean class Example coming and sitting in constant pool for the first time of , correct?
 
that is correct Example is also in constant pool
 
ok
class linking phase mean, class Sub gets linked to JVM, when Sub.class expression is evaluated in statement Class myClass = Sub.class; correct?
 
6:07 AM
it says litterals but "Class reference: an index within the constant pool to a UTF-8 string containing the fully qualified class name (in internal format) (big-endian)" is also there
 
ya not expression but class literal
 
not sure about timeline, will have to go through JVM spec
 
timeline? which timeline?
 
how exact loading and execution looks like
 
ok
but here in this answer it explains that quickly:Each frame contains a reference to the runtime constant pool. The reference points to the constant pool for the class of the method being executed for that frame. This reference helps to support dynamic linking.
where frame is..
frame is where the operands (operation instructions) reside and that is where the dynamic linking occurs. It is a shorthand way, so to speak, using the constant pool to keep track of the class and it's members.
 
6:11 AM
though from output and bytecode may be concluded that initialization of Sub is not taking place
if that helps you great
 
are you C programmer as well?
C/C++
linking phase in C/C++ is done before starting execution, but in java it is during runtime
 
correct for all
that article metioned in answer is also interesting blog.jamesdbloom.com/JVMInternals.html
 
am just trying to find type loading mean creating a runtime constant pool for that type in this link
is my meaning of class loading is correct?
 
looks it is loaded and linked and verified in your example
I agree with your obsevation
that lazy resolution is probably why it is not initialised
on the other hand it spares CPU from work which is not really required for execution
not sure about verification but retriaving methods will not be possible without loading/linking
 
am raising another query in SO to understand the anatomy of load/link/initialise
 
6:24 AM
sure
 
what is your profession?
what do you do?
 
programmer
 
developer
 
developer in specific language?
 
6:26 AM
quite few, c, c++, Java, c3, Perl, Python, PHP ....
 
can go on for long yime enumerating
sory that c3 is c#
 
am also learning python github.com/shamhub/paradigms_using_python joined UOC berkeley online course. teacher is from Google ):
 
Python is nice language, much better for lambda acrobatics than pure inperative languages
I am self educated
 
you can go thru Inversion Of control written in C here if you like it
I did 25 years of education but learned nothing except flirting girls
I learned later after joining job
I took a break(resigned) after may 15 this year from job and want to brush up myself to work for another job
 
6:32 AM
be sure to get another job I am 6 months out of work
 
why? did the company told to leave?
which country do you belong?
Bulovic. this name seem to be russian
 
couldn't work with their lead, guy is not programmer but accountant, I left
I am Serbian
 
same reason for me
my boss irritated me, so I left
why dont you try immigrating to other countries? you have exposure to many languages
 
nowadays they need driver, bookkeeper, pilot and developer in one person
 
yes, that is crazy!!
i think life would be easy if you can move to other countries
 
6:36 AM
I am already 55 so nobody will take me
 
oh ok
sorry I used some bad language, you are very elder to me. almost my father's age
 
be sure to sort your finances before you are in forties after that is difficult
OK it was pleasure talking to you
 
one last point..
 
I already applied for CANADA/New zealand for immigration to settle myself before 40. I felt happy that you told me: sort your finances before you are in forties
thanx a lot
you are a nice person
see u later.
 
6:39 AM
you are welcome
 

last day (14 days later) »