Out of curiosity, I looked at JAR files in all RPMs in Fedora rawhide (the development version of Fedora that will turn into Fedora 21) and counted the number of RPM packages which had Java classes referencing individual methods in sun.misc.Unsafe. The attached table is sorted by decreasing package count, and grouped by method name and descriptor.

These numbers do not include references through reflection, for obvious reasons.

Java programming practices are sometimes at odds with distribution packaging, and due to licensing bias, the Fedora repository might not be representative of the general Java ecosystem. However, the statistics cover 1177 Java source RPMs containing 550829 classes in 570477 versions, so it's quite a bit of code, despite the fairly low number of references to sun.misc.Unsafe.

--
Florian Weimer / Red Hat Product Security Team

         name         |                         descriptor                      
   | count 
----------------------+------------------------------------------------------------+-------
 objectFieldOffset    | (Ljava/lang/reflect/Field;)J                            
   |    17
 arrayBaseOffset      | (Ljava/lang/Class;)I                                    
   |    14
 putObject            | (Ljava/lang/Object;JLjava/lang/Object;)V                
   |    12
 arrayIndexScale      | (Ljava/lang/Class;)I                                    
   |    11
 getLong              | (Ljava/lang/Object;J)J                                  
   |    11
 compareAndSwapInt    | (Ljava/lang/Object;JII)Z                                
   |     9
 compareAndSwapLong   | (Ljava/lang/Object;JJJ)Z                                
   |     9
 getUnsafe            | ()Lsun/misc/Unsafe;                                     
   |     9
 compareAndSwapObject | 
(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z |     8
 getObject            | (Ljava/lang/Object;J)Ljava/lang/Object;                 
   |     8
 getInt               | (Ljava/lang/Object;J)I                                  
   |     7
 putInt               | (Ljava/lang/Object;JI)V                                 
   |     6
 putLong              | (Ljava/lang/Object;JJ)V                                 
   |     6
 getObjectVolatile    | (Ljava/lang/Object;J)Ljava/lang/Object;                 
   |     5
 putBoolean           | (Ljava/lang/Object;JZ)V                                 
   |     5
 putByte              | (Ljava/lang/Object;JB)V                                 
   |     5
 putChar              | (Ljava/lang/Object;JC)V                                 
   |     5
 putDouble            | (Ljava/lang/Object;JD)V                                 
   |     5
 putFloat             | (Ljava/lang/Object;JF)V                                 
   |     5
 putObjectVolatile    | (Ljava/lang/Object;JLjava/lang/Object;)V                
   |     5
 putOrderedObject     | (Ljava/lang/Object;JLjava/lang/Object;)V                
   |     5
 putShort             | (Ljava/lang/Object;JS)V                                 
   |     5
 getBoolean           | (Ljava/lang/Object;J)Z                                  
   |     4
 getByte              | (Ljava/lang/Object;J)B                                  
   |     4
 getChar              | (Ljava/lang/Object;J)C                                  
   |     4
 getDouble            | (Ljava/lang/Object;J)D                                  
   |     4
 getFloat             | (Ljava/lang/Object;J)F                                  
   |     4
 getInt               | (J)I                                                    
   |     4
 getLong              | (J)J                                                    
   |     4
 getShort             | (J)S                                                    
   |     4
 getShort             | (Ljava/lang/Object;J)S                                  
   |     4
 park                 | (ZJ)V                                                   
   |     4
 putInt               | (JI)V                                                   
   |     4
 putLong              | (JJ)V                                                   
   |     4
 putShort             | (JS)V                                                   
   |     4
 throwException       | (Ljava/lang/Throwable;)V                                
   |     4
 unpark               | (Ljava/lang/Object;)V                                   
   |     4
 copyMemory           | (JJJ)V                                                  
   |     3
 copyMemory           | (Ljava/lang/Object;JLjava/lang/Object;JJ)V              
   |     3
 getByte              | (J)B                                                    
   |     3
 putByte              | (JB)V                                                   
   |     3
 putOrderedInt        | (Ljava/lang/Object;JI)V                                 
   |     3
 allocateInstance     | (Ljava/lang/Class;)Ljava/lang/Object;                   
   |     2
 defineClass          | (Ljava/lang/String;[BII)Ljava/lang/Class;               
   |     2
 getDouble            | (J)D                                                    
   |     2
 getFloat             | (J)F                                                    
   |     2
 putDouble            | (JD)V                                                   
   |     2
 putFloat             | (JF)V                                                   
   |     2
 addressSize          | ()I                                                     
   |     1
 getLong              | (Ljava/lang/Object;I)J                                  
   |     1
 monitorEnter         | (Ljava/lang/Object;)V                                   
   |     1
 monitorExit          | (Ljava/lang/Object;)V                                   
   |     1
 setMemory            | (JJB)V                                                  
   |     1
(53 rows)

Reply via email to