Hi,

As far as I think (but please prove me wrong), Stable class is not loaded until someone explicitly asks for it in Java code (referring to Stable type in bytecode like with Stable.class literal or parsing annotations of a field that contains such annotation triggered by Java API for annotations).

The VM code that parses some annotations like @Stable, @CallerSensitive, @ForceInline, etc... works by matching the Symbol names of annotation classes and doesn't need the to load the annotation class for that. See parse_annotations in classFileParser.cpp...

Regards, Peter


On 03/28/18 04:21, David Holmes wrote:
On 28/03/2018 12:07 PM, Martin Buchholz wrote:
java -Xlog:class+init=trace -version |& grep -Ew 'annotation|lang.Thread|Stable' [0.019s][info][class,init] 10 Initializing 'java/lang/Thread' (0x00000007c0006400)

Thanks.

Intuitively, class+init should be a subset of class+load, and the experiment above supports that.

The initialization order can be quite different to the load order.

David

On Tue, Mar 27, 2018 at 6:59 PM, David Holmes <david.hol...@oracle.com <mailto:david.hol...@oracle.com>> wrote:

    On 28/03/2018 11:50 AM, Martin Buchholz wrote:



        On Tue, Mar 27, 2018 at 6:24 PM, Martin Buchholz
        <marti...@google.com <mailto:marti...@google.com>
        <mailto:marti...@google.com <mailto:marti...@google.com>>> wrote:

               At least the VM doesn't have to run any risky java code


        ??  Why is Martin so sure ??
        Let's check:

        java -Xlog:class+load=trace -version |& grep -Ew
        'annotation|lang.Thread'
        [0.010s][info ][class,load] java.lang.Thread source: jrt:/java.base
        [0.010s][info ][class,load]
        java.lang.Thread$UncaughtExceptionHandler source: jrt:/java.base
        [0.012s][info ][class,load] java.lang.annotation.Annotation
        source: jrt:/java.base

        So Stable does __not__ have to be class-loaded when Thread is
        class-loaded.


    Can you check with class+initialization please.

    Thanks,
    David



Reply via email to