Hi all,

I'm working on a project that depends on another project, a B-tree 
implementation called Persistit, which has a class com.persistit.Key. We 
also use Guice in a fairly limited way, to create singleton service 
instance (each service is effectively a singleton -- we use Guice to 
instantiate and start the services. Once the services are started, there's 
no more Guice work). When we profiled our software (using Oracle Solaris 
Performance Analyzer, v12.2) we saw 
com.google.inject.Key$AnnotationInstanceStrategy showing up in 
com.persistit.Key.<init> -- which is odd, because Persistit doesn't depend 
on Guice at all. So we're just wondering whether Guice is injecting itself 
into various classes, or whether something else is going on (I suspect the 
profiler is getting confused and thinking one Key is another).

So, in summary:
    - project Akiban Server depends on:
        - project Persistit
        - project Guice)
        - (other project)
    - Persistit does *not* depend on Guice
    - Guice Key$AnnotationInstanceStrategy shows up in Persistit 
Key.<init>'s profile info
    - We're just trying to figure out if Guice did some weaving, or whether 
this is caused by something like faulty profiling

Here is the com.persistit.Key.<init> that I *think* is being profiled. It 
could be one of the others, if methods they called are being inlined; this 
is the only one that allocates byte[] directly. (Full source code is 
here<http://bazaar.launchpad.net/~akiban-technologies/akiban-persistit/trunk/view/head:/src/main/java/com/persistit/Key.java>
.)

    private Key(final Persistit persistit, final int maxLength) {
        _persistit = persistit;
        if (maxLength <= 0) {
            throw new IllegalArgumentException("Key length must be 
positive");
        }
        if (maxLength > MAX_KEY_LENGTH) {
            throw new IllegalArgumentException("Key length must be less 
than " + MAX_KEY_LENGTH);
        }
        _maxSize = maxLength;
        _bytes = new byte[maxLength + 1];
        _size = 0;
        _depth = 0;
    }

And here is the disassembled code:

0.    0.          [960] 00000000: aload_0 
0.010 0.010       [960] 00000001: invokespecial 
com/google/inject/Key$AnnotationInstanceStrategy
0.    0.          [961] 00000004: aload_0 
0.    0.          [961] 00000005: aload_1 
0.030 0.030       [961] 00000006: putfield 
com/google/inject/Key$AnnotationTypeStrategy
0.    0.          [962] 00000009: iload_2 
0.    0.          [962] 0000000a: ifgt 0x17
0.    0.          [963] 0000000d: new 
com.google.inject.Key$AnnotationInstanceStrategy
0.    0.          [963] 00000010: dup 
0.    0.          [963] 00000011: ldc AnnotationInstanceStrategy
0.    0.          [963] 00000013: invokespecial 
com/google/inject/Key$NullAnnotationStrategy
0.    0.          [963] 00000016: athrow 
0.    0.          [965] 00000017: iload_2 
0.    0.          [965] 00000018: sipush 2047
0.    0.          [965] 0000001b: if_icmple 0x28
0.    0.          [966] 0000001e: new 
com.google.inject.Key$AnnotationInstanceStrategy
0.    0.          [966] 00000021: dup 
0.    0.          [966] 00000022: ldc 
com.google.inject.Key$NullAnnotationStrategy
0.    0.          [966] 00000024: invokespecial 
com/google/inject/Key$NullAnnotationStrategy
0.    0.          [966] 00000027: athrow 
0.    0.          [968] 00000028: aload_0 
0.    0.          [968] 00000029: iload_2 
0.    0.          [968] 0000002a: putfield com/google/inject/Key
0.    0.          [969] 0000002d: aload_0 
0.    0.          [969] 0000002e: iload_2 
0.    0.          [969] 0000002f: iconst_1 
0.    0.          [969] 00000030: iadd 
2.621 2.621       [969] 00000031: newarray byte
0.020 0.020       [969] 00000033: putfield com.google.inject.Key
0.    0.          [970] 00000036: aload_0 
0.    0.          [970] 00000037: iconst_0 
0.    0.          [970] 00000038: putfield 
<T:Ljava/lang/Object;>Ljava/lang/Object;
0.    0.          [971] 0000003b: aload_0 
0.    0.          [971] 0000003c: iconst_0 
0.010 0.010       [971] 0000003d: putfield Key.java
0.    0.          [972] 00000040: return

Thanks in advance!
-Yuval


-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/H0W-5oveT8EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to