Introduction

JITWatch, the HotSpot JIT compilation visualiser contains a static bytecode analysis tool named JarScan.
JarScan accepts a list of jar files and examines the bytecode instructions of each method, performing an operation that implements the interface:
public interface IJarScanOperation
{
   void processInstructions(String className, MemberBytecode memberBytecode);
}
A basic understanding of how the JVM executes bytecode is useful for reading this blog post.
It may be helpful to have the JVM spec to hand: https://docs.oracle.com/javase/specs/jvms/se8/html/
Clicking on a bytecode instruction opens its definition in the JVM specification.

Usage

Here is the JarScan usage:
JarScan --mode=<mode> [--packages=a,b,c,...] [params] <jars>
----------------------------------------------------------------------------------------------
Available modes:
----------------------------------------------------------------------------------------------
 maxMethodSize            List every method with bytecode larger than specified limit.
    --limit=n             Report methods larger than n bytes.
----------------------------------------------------------------------------------------------
 sequenceCount            Count instruction sequences.
    --length=n            Report sequences of length n.
----------------------------------------------------------------------------------------------
 invokeCount              Count the most called methods for each invoke instruction.
   [--limit=n]            Limit to top n results per invoke type.
----------------------------------------------------------------------------------------------
 nextInstructionFreq      List the most popular next instruction for each bytecode instruction.
   [--limit=n]            Limit to top n results per instruction.
----------------------------------------------------------------------------------------------
 allocationCount          Count the most allocated types.
   [--limit=n]            Limit to top n results.
----------------------------------------------------------------------------------------------
 instructionCount         Count occurences of each bytecode instruction.
   [--limit=n]            Limit to top n results.
----------------------------------------------------------------------------------------------
 sequenceSearch           List methods containing the specified bytecode sequence.
    --sequence=a,b,c,...  Comma separated sequence of bytecode instructions.

The JarScan Modes

NB: Some of the new JarScan operations are stateful and attempt to follow the bytecode instruction flow in the same way as the JVM's interpreter would. Since JarScan is a static analysis tool assumptions have had to be made about how to handle control flow when a conditional code is met.
JarScan control flow processes bytecode instructions sequentially except for:
  • *return instructions end the current sequence. It is discarded if not of the required length.
  • athrow also ends the current sequence, discarding if not the required length.
  • invoke* instructions are not followed and proceed to the next instruction.
  • goto, goto_w instructions (unconditional branches) are followed.
  • if* instructions assume not taken and proceed to the next instruction.
  • tableswitch, lookupswitch instructions proceed to the next instruction.
  • jsr, jsr_w, ret instructions are not handled and the sequence is discarded.
  • An instruction offset (BCI) can be visited only once per sequence to prevent infinite loops.
The degree to which these control flow limitations affect the results is unclear.
Following invoke instructions is a possible future enhancement.
The assumption that branches are not taken seems reasonable in the case of loops since the taken branch is usually the loop exit which is the uncommon case.

The code corpus

For this investigation, the class file corpus is the Java core libraries contained in rt.jar from Java 8 update 74 on Linux x86-64.
This is a 63M compressed jar file containing the following package size distribution:
javax   19M
java    20M
org      4M
sun     24M
com     48M
jdk      2M

A little snag

While verifying my results I discovered very unusual dominating bytecode sequences and on further investigation discovered that repeated code from *hundreds* of localisation classes was skewing the results.
com.sun.accessibility.internal.resources.accessibility_*.getContents()
com.sun.java.swing.plaf.gtk.resources.gtk_*.getContents()
com.sun.java.swing.plaf.motif.resources.motif_*.getContents()
com.sun.java.swing.plaf.windows.resources.windows_*.getContents()
com.sun.java.util.jar.pack.DriverResource_*.<clinit>()
com.sun.org.apache.xalan.internal.res.XSLTErrorResources_*.getContents()
com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMessages_*.getContents()
sun.awt.resources.awt_*.getContents()
sun.security.tools.policytool.Resources_*.<clinit>()
...
Where * in (en,fr,es,de,...)
To avoid this bias I added support to JarScan for filtering by package and have restated the results considering only classes from the package java.*

Recreating this investigation

Here are the JarScan commands executed to create these results:
#!/bin/sh
export JAR=/home/chris/jdk1.8.0_74/jre/lib/rt.jar
export PACKAGES=java.*

./jarScan.sh --mode=maxMethodSize --limit=325 --packages=$PACKAGES $JAR > results/freqInlineSize.csv
./jarScan.sh --mode=sequenceCount --length=2  --packages=$PACKAGES $JAR > results/sequence2.csv
./jarScan.sh --mode=sequenceCount --length=3  --packages=$PACKAGES $JAR > results/sequence3.csv
./jarScan.sh --mode=sequenceCount --length=4  --packages=$PACKAGES $JAR > results/sequence4.csv
./jarScan.sh --mode=sequenceCount --length=5  --packages=$PACKAGES $JAR > results/sequence5.csv
./jarScan.sh --mode=invokeCount               --packages=$PACKAGES $JAR > results/invokeCount.csv
./jarScan.sh --mode=allocationCount           --packages=$PACKAGES $JAR > results/allocationCount.csv
./jarScan.sh --mode=nextInstructionFreq       --packages=$PACKAGES $JAR > results/nextInstruction.csv
./jarScan.sh --mode=instructionCount          --packages=$PACKAGES $JAR > results/instructionCount.csv
./jarScan.sh --mode=sequenceSearch --sequence=iconst_2,newarray --packages=$PACKAGES $JAR > results/sequenceSearchExample.csv

Let's get started

maxMethodSize - Identify hot methods too large for inlining

This is the original functionality present in the JarScan tool.
The operation finds methods larger than the VM's JIT compiler limit for inlining of hot methods (default limit is 325 bytes on 64-bit Linux, overridden on command line using -XX:FreqInlineSize=n).
This operation can be useful in identifying methods that you would like to be inlined at runtime because they are important for performance but can't be because they have become too large and need refactoring.
./jarScan.sh --mode=maxMethodSize --limit=325 --packages=java.* rt.jar
Here are the top 10 methods in the java.* core packages that are above the default Linux 64-bit inlining threshold of 325 bytes for hot methods.
Hover over a method to view the full signature.
java.*
MethodBytecode Size
ComponentColorModel.getDataElements3206
GridBagLayout.GetLayoutInfo2978
KeyEvent.getKeyText2455
JapaneseImperialCalendar.roll2423
ComponentColorModel.coerceData2118
SimpleDateFormat.subParse1765
GregorianCalendar.roll1760
Formatter$FormatSpecifier.print1723
CharacterData01.getNumericValue1675
DecimalFormat.applyPattern1591
Here are the 10 largest methods from the java.lang.* packages
java.lang.*
MethodBytecode Size
BoundMethodHandle$Factory.generateConcreteBMHClass1105
DirectMethodHandle.makePreparedFieldLambdaForm1073
AbstractValidatingLambdaMetafactory.validateMetafactoryArgs864
LambdaFormEditor.permuteArgumentsForm739
MethodTypeForm.MethodTypeForm687
MethodHandleImpl.makePairwiseConvertIndirect679
LambdaForm.createIdentityForms679
DirectMethodHandle.makePreparedLambdaForm645
Invokers.invokeHandleForm633
ThreadInfo.toString616
And finally the 10 largest methods from the java.util.* packages
java.util.*
MethodBytecode Size
StampedLock.acquireRead1233
Pattern.escape1151
Pattern.group0994
ConcurrentHashMap.transfer830
Exchanger.arenaExchange684
StampedLock.acquireWrite661
ConcurrentSkipListMap.doPut646
ConcurrentHashMap.compute617
XMLFormatter.format615
ConcurrentHashMap$TreeBin.removeTreeNode575
Note that many of these methods will not be called in hot code and so would not benefit from inlining but there are a few surprises.
Take a look at java.lang.String's toUpperCase(Locale) and toLowerCase(Locale) weighing in at 439 bytes each, well above the default inlining limit.
For more information, see these previous blog posts:

sequenceCount - Count instruction sequences of a given length (NB: Attempts to follow bytecode)

Find all bytecode instruction sequences of the given length and count their occurrence.
This could help identify popular bytecode idioms and perhaps give an insight into the javac compiler or even some hints for possible JIT compiler optimisations.

Instruction sequences of length 2

./jarScan.sh --mode=sequenceCount --length=2 --packages=java.* rt.jar
8 most frequent bytecode sequences of length 2
Instruction 1Instruction 2CountPercent
aload_0getfield340184.67%
newdup163372.24%
aload_0aload_184891.17%
putfieldaload_080661.11%
aload_0invokevirtual80261.10%
invokespecialathrow64290.88%
dupinvokespecial63380.87%
aload_1invokevirtual62090.85%
Here we can see that the most popular 2-instruction sequence is aload_0, getfield.
  • aload_n pushes a reference onto the stack (aload_0 is most likely referring to "this").
  • getfield is accessing a field on the pushed object.
I believe that the top 2-instruction sequence is accessing a field on "this".

Instruction sequences of length 3

./jarScan.sh --mode=sequenceCount --length=3 --packages=java.* rt.jar
8 most frequent bytecode sequences of length 3
Instruction 1Instruction 2Instruction 3CountPercent
newdupinvokespecial63380.93%
aload_0getfieldinvokevirtual40540.60%
newdupldc33040.49%
aload_0getfieldaload_028050.41%
dupinvokespecialathrow26780.39%
getfieldaload_0getfield25510.38%
dupldcinvokespecial23670.35%
ldcinvokespecialathrow21350.31%
Here we can see that the most popular 3-instruction sequence is new, dup, invokespecial.
  • new allocates a new object.
  • dup duplicates it to prevent it being popped off the stack.
  • invokespecial is probably a constructor call.
I believe the top 3-instruction sequence is an object allocation and constructor call.

Instruction sequences of length 4

./jarScan.sh --mode=sequenceCount --length=4 --packages=java.* rt.jar
8 most frequent bytecode sequences of length 4
Instruction 1Instruction 2Instruction 3Instruction 4CountPercent
newdupinvokespecialathrow26780.42%
newdupldcinvokespecial23670.37%
aload_0getfieldaload_0getfield22140.35%
dupldcinvokespecialathrow21060.33%
newdupinvokespecialldc15310.24%
dupinvokespecialldcinvokevirtual15230.24%
invokespecialputstaticnewdup10880.17%
aload_0aload_1putfieldaload_010790.17%
Here we can see that the most popular 4-instruction sequence is new, dup, invokespecial, athrow.
  • new allocates a new object.
  • dup duplicates it to prevent it being popped off the stack.
  • invokespecial is probably a constructor call.
  • athrow throws an exception.
I believe the top 4-instruction sequence is the object allocation, constructor call, and throwing of an exception.

Instruction sequences of length 5

./jarScan.sh --mode=sequenceCount --length=5 --packages=java.* rt.jar
8 most frequent bytecode sequences of length 5
Instruction 1Instruction 2Instruction 3Instruction 4Instruction 5CountPercent
newdupldcinvokespecialathrow21060.36%
newdupinvokespecialldcinvokevirtual15230.26%
newdupnewdupinvokespecial9800.17%
aastoredupsipushldcaastore8870.15%
dupsipushldcaastoredup8860.15%
sipushldcaastoredupsipush8860.15%
dupnewdupinvokespecialldc8540.14%
aastoredupsipushldc_waastore6960.12%
Here we can see that the most popular 5-instruction sequence is new, dup, ldc, invokespecial, athrow.
  • new allocates a new object.
  • dup duplicates it to prevent it being popped off the stack.
  • ldc loads a constant from the constant pool.
  • invokespecial is probably a constructor call.
  • athrow throws an exception.
I believe the top 5-instruction sequence is the object allocation, load error message String constant, constructor call with error message, and throwing of an exception.
If you want to explore these sequences further and find out what kind of source code they are compiled from then this next JarScan mode can help.

sequenceSearch - Find methods containing a given bytecode instruction sequence (NB: Attempts to follow bytecode)

Find all methods that contain the specified comma separated sequence of bytecode instructions.
For example, to find all methods that instantiate a primitive array (any primitive type) of constant length 2 you would search for the instruction sequence:
iconst_2 // push integer constant 2 onto the stack
newarray // create a primitive array
./jarScan.sh --mode=sequenceSearch --sequence=iconst_2,newarray --packages=java.* rt.jar
Here are the results, filtered to just the java.lang package.
java.lang.*
Method containing sequenceBytecode offset
java.lang.Character.toChars(int)23
java.lang.CharacterData00.<clinit>()1005
java.lang.CharacterData00.<clinit>()1043
java.lang.CharacterData00.<clinit>()1081
java.lang.CharacterData00.<clinit>()1119
java.lang.CharacterData00.<clinit>()1157
java.lang.CharacterData00.<clinit>()1195
java.lang.CharacterData00.<clinit>()1233
java.lang.CharacterData00.<clinit>()1271
java.lang.CharacterData00.<clinit>()1309

Back to the source code

Taking java.lang.Character.toChars(int) as an example we can use the javap command line tool to output the bytecode for this method and see the matching sequence starting at offset 23
javap -v java.lang.Character
public static char[] toChars(int);
   descriptor: (I)[C
   flags: ACC_PUBLIC, ACC_STATIC
   Code:
     stack=4, locals=2, args_size=1
        0: iload_0
        1: invokestatic  #27                 // Method isBmpCodePoint:(I)Z
        4: ifeq          16
        7: iconst_1
        8: newarray       char
       10: dup
       11: iconst_0
       12: iload_0
       13: i2c
       14: castore
       15: areturn
       16: iload_0
       17: invokestatic  #28                 // Method isValidCodePoint:(I)Z
       20: ifeq          35
       23: iconst_2
       24: newarray       char
       26: astore_1
       27: iload_0
       28: aload_1
       29: iconst_0
       30: invokestatic  #29                 // Method toSurrogates:(I[CI)V
       33: aload_1
       34: areturn
       35: new           #30                 // class java/lang/IllegalArgumentException
       38: dup
       39: invokespecial #31                 // Method java/lang/IllegalArgumentException."<init>":()V
       42: athrow
Looking at the source code for java.lang.Character.toChars(int) we can see the Java source code allocates an integer array of size 2.
   public static char[] toChars(int codePoint) {
       if (isBmpCodePoint(codePoint)) {
           return new char[] { (char) codePoint };
       } else if (isValidCodePoint(codePoint)) {
           char[] result = new char[2];
           toSurrogates(codePoint, result, 0);
           return result;
       } else {
           throw new IllegalArgumentException();
       }
   }

invokeCount - Find the most invoked methods for each kind of invoke

For each invoke instruction (invokedynamic, invokeinterface, invokespecial, invokestatic, invokevirtual) count the most invoked methods.
NB: Static analysis can only count the call sites. It cannot tell you which invocations will occur at runtime.
./jarScan.sh --mode=invokeCount --packages=java.* rt.jar
Here are the most invoked methods in the core java.* packages.
invokevirtual
InvokeMethodCountPercent
invokevirtualjava.lang.StringBuilder.append(java.lang.String)560010.81%
invokevirtualjava.lang.StringBuilder.toString()23454.53%
invokevirtualjava.lang.StringBuilder.append(int)8221.59%
invokevirtualjava.lang.StringBuilder.append(java.lang.Object)6971.35%
invokevirtualjava.lang.String.length()6861.32%
invokevirtualjava.lang.StringBuilder.append(char)5181.00%
invokevirtualjava.lang.String.equals(java.lang.Object)5100.98%
invokevirtualjava.lang.Object.getClass()5030.97%
invokespecial
InvokeMethodCountPercent
invokespecialjava.lang.StringBuilder.<init>()22988.11%
invokespecialjava.lang.Object.<init>()17356.13%
invokespecialjava.lang.IllegalArgumentException.<init>(java.lang.String)11664.12%
invokespecialjava.lang.AssertionError.<init>()8723.08%
invokespecialjava.lang.NullPointerException.<init>()4971.75%
invokespecialjava.lang.NullPointerException.<init>(java.lang.String)2390.84%
invokespecialjava.nio.ReadOnlyBufferException.<init>()1930.68%
invokespecialjava.net.SocketException.<init>(java.lang.String)1890.67%
invokestatic
InvokeMethodCountPercent
invokestaticjava.lang.System.arraycopy(java.lang.Object,int,java.lang.Object,int,int)4012.32%
invokestaticjava.util.Objects.requireNonNull(java.lang.Object)3712.15%
invokestaticjava.lang.Integer.valueOf(int)2561.48%
invokestaticjava.util.Objects.requireNonNull(java.lang.Object,java.lang.String)2551.48%
invokestaticjava.lang.System.getSecurityManager()2351.36%
invokestaticjava.security.AccessController.doPrivileged(java.security.PrivilegedAction)1921.11%
invokestaticjava.lang.Thread.currentThread()1741.01%
invokestaticjava.lang.Math.min(int,int)1700.98%
invokeinterface
InvokeMethodCountPercent
invokeinterfacejava.util.Iterator.hasNext()4205.20%
invokeinterfacejava.util.Iterator.next()4195.19%
invokeinterfacejava.util.Map.put(java.lang.Object,java.lang.Object)2743.39%
invokeinterfacejava.util.Map.get(java.lang.Object)2182.70%
invokeinterfacejava.util.Set.iterator()1571.94%
invokeinterfacejava.util.Map$Entry.getKey()1491.84%
invokeinterfacejava.util.Map$Entry.getValue()1371.70%
invokeinterfacejava.util.List.add(java.lang.Object)1261.56%
invokedynamic
InvokeMethodCountPercent
invokedynamicjava.util.stream.Collectors.apply()308.50%
invokedynamicjava.util.stream.Collectors.get()195.38%
invokedynamicjava.time.temporal.TemporalQueries.queryFrom()71.98%
invokedynamicjava.time.chrono.AbstractChronology.compare()61.70%
invokedynamicjava.time.temporal.TemporalAdjusters.adjustInto()61.70%
invokedynamicjava.util.stream.Collectors.accept()61.70%
invokedynamicjava.util.stream.DoublePipeline.accept()61.70%
invokedynamicjava.util.stream.LongPipeline.applyAsLong()51.42%

allocationCount - Find the most allocated types for each kind of allocation instruction

For each allocation instruction (new, newarray, anewarray, multianewarray) count the most allocated types.
NB: Static analysis can only find the allocation sites. It cannot tell you which allocations will actually occur at runtime.
./jarScan.sh --mode=allocationCount --packages=java.* rt.jar
Here are the most allocated types in the core java.* packages.
new
InstructionTypeCountPercent
newjava.lang.StringBuilder236114.45%
newjava.lang.IllegalArgumentException13258.11%
newjava.lang.AssertionError10416.37%
newjava.lang.NullPointerException7364.51%
newjava.lang.UnsupportedOperationException2571.57%
newjava.lang.IllegalStateException2241.37%
newjava.lang.Character$UnicodeBlock2211.35%
newjava.nio.ReadOnlyBufferException1931.18%
newarray
InstructionTypeCountPercent
newarrayint49635.89%
newarraychar36526.41%
newarraybyte21515.56%
newarrayfloat1057.60%
newarraydouble805.79%
newarraylong664.78%
newarrayshort433.11%
newarrayboolean120.87%
anewarray
InstructionTypeCountPercent
anewarrayjava.lang.Object47930.22%
anewarrayjava.lang.String28618.04%
anewarrayjava.lang.Class1187.44%
anewarray[C1036.50%
anewarrayjava.io.ObjectStreamField301.89%
anewarrayjava.nio.file.LinkOption191.20%
anewarrayjava.lang.invoke.LambdaForm$Name161.01%
anewarrayjava.lang.management.PlatformComponent161.01%
multianewarray
InstructionTypeCountPercent
multianewarray[[I440.00%
multianewarray[[B110.00%
multianewarray[[D110.00%
multianewarray[[F110.00%
multianewarray[[Ljava.lang.annotation.Annotation;110.00%
multianewarray[[Ljava.lang.invoke.LambdaForm$Name;110.00%
multianewarray[[S110.00%

instructionCount - Count the occurrences of each bytecode instruction

NB: Static analysis can only count the occurrences of each instruction. It cannot tell you which instructions will be executed at runtime.
./jarScan.sh --mode=instructionCount --packages=java.* rt.jar
Here are the instructions counts from the core java.* packages.
Instruction Counts
InstructionCountPercent
aload_08380010.80%
invokevirtual517806.67%
getfield421035.42%
aload_1320254.13%
dup296043.81%
invokespecial283203.65%
iload256723.31%
aload247473.19%
goto182852.36%
invokestatic172772.23%
new163372.10%
aload_2162832.10%
areturn158292.04%
ldc156622.02%
iconst_0154361.99%
putfield151811.96%
iconst_1135941.75%
return125251.61%
getstatic116661.50%
bipush114021.47%
astore110901.43%
istore108781.40%
ifeq98781.27%
aload_398641.27%
ireturn97981.26%
iload_297861.26%
iload_194911.22%
athrow83281.07%
invokeinterface80771.04%
iload_379981.03%
ifne66380.86%
sipush64790.83%
aastore62440.80%
ifnull61770.80%
checkcast59480.77%
aconst_null55240.71%
iadd54540.70%
pop53290.69%
astore_247150.61%
iinc45450.59%
ifnonnull45120.58%
isub38280.49%
astore_336330.47%
if_icmpge36000.46%
putstatic33570.43%
arraylength33540.43%
astore_133240.43%
if_icmpne29880.38%
iconst_229460.38%
ldc2_w29370.38%
iastore29280.38%
lload28070.36%
istore_326140.34%
istore_225350.33%
aaload24550.32%
monitorexit24140.31%
dload23930.31%
ldc_w21740.28%
lcmp20140.26%
iconst_m118950.24%
iand18170.23%
lload_117760.23%
if_icmpeq17450.22%
instanceof17230.22%
if_acmpne16990.22%
iaload16750.22%
ifge16040.21%
i2l15850.20%
anewarray15850.20%
if_icmple15330.20%
lstore14870.19%
iload_014700.19%
castore14280.18%
iflt14270.18%
lconst_014140.18%
newarray13820.18%
ifle13510.17%
istore_113390.17%
iconst_313360.17%
if_icmplt10780.14%
monitorenter10650.14%
dstore10320.13%
iconst_410070.13%
lreturn9980.13%
lload_29900.13%
if_icmpgt9510.12%
ladd9220.12%
if_acmpeq9060.12%
ior7830.10%
ishl7780.10%
dup_x17600.10%
astore_07380.10%
imul7100.09%
lload_36910.09%
fload6870.09%
iconst_56420.08%
dmul6350.08%
l2i6220.08%
lload_06180.08%
lsub6100.08%
dadd5990.08%
caload5840.08%
lconst_15700.07%
bastore5670.07%
ifgt5490.07%
dload_15440.07%
land5420.07%
daload5360.07%
faload5070.07%
dastore4910.06%
dconst_04830.06%
iushr4830.06%
baload4670.06%
dload_34580.06%
fastore4310.06%
dcmpl4120.05%
dup24090.05%
fstore3930.05%
fmul3800.05%
ishr3710.05%
dreturn3630.05%
invokedynamic3530.05%
tableswitch3440.04%
laload3280.04%
i2f3260.04%
lshl3070.04%
idiv3060.04%
ixor2950.04%
f2d2910.04%
i2b2850.04%
fadd2840.04%
lastore2760.04%
dsub2720.04%
lstore_32700.03%
lmul2540.03%
dcmpg2490.03%
lushr2480.03%
dload_22400.03%
lstore_22400.03%
d2f2260.03%
ddiv2200.03%
saload2190.03%
dload_02120.03%
lstore_12100.03%
fload_12070.03%
lor1990.03%
fconst_01980.03%
lookupswitch1980.03%
ldiv1930.02%
fload_21890.02%
ineg1890.02%
freturn1810.02%
f2i1780.02%
irem1750.02%
i2c1580.02%
fcmpl1470.02%
dconst_11420.02%
istore_01380.02%
lrem1380.02%
i2d1270.02%
sastore1250.02%
fdiv1250.02%
lneg1250.02%
fsub1200.02%
fload_31110.01%
fload_01010.01%
fcmpg1010.01%
pop2980.01%
fconst_1950.01%
dneg940.01%
i2s890.01%
d2i880.01%
lshr800.01%
lxor790.01%
dstore_3730.01%
dstore_1670.01%
dup2_x1500.01%
lstore_0490.01%
fstore_1410.01%
dup_x2400.01%
dstore_2380.00%
l2d320.00%
fstore_3280.00%
fstore_2230.00%
fneg210.00%
dstore_0200.00%
fconst_2160.00%
multianewarray100.00%
l2f90.00%
d2l80.00%
fstore_050.00%
drem50.00%
f2l10.00%

nextInstructionFreq - Find probability of next instruction (NB: Attempts to follow bytecode)

For each type of bytecode instruction, find the frequency of the next instruction encountered.
This is done by finding all valid instruction sequences of length 2 and calculating the frequency of the each next instruction.
./jarScan.sh --mode=nextInstructionFreq --packages=java.* rt.jar
Here are the 4 most frequent next instructions for each bytecode instruction found in the core java.* packages.
aaload
InstructionNextCountPercent
aaloadastore48619.80%
aaloadinvokevirtual35614.50%
aaloadaastore1516.15%
aaloadareturn1265.13%
aastore
InstructionNextCountPercent
aastoredup441970.77%
aastoreinvokespecial2654.24%
aastoreiinc2453.92%
aastoreinvokestatic1832.93%
aconst_null
InstructionNextCountPercent
aconst_nullputfield111720.22%
aconst_nullareturn107119.39%
aconst_nullastore5479.90%
aconst_nullinvokespecial5289.56%
aload
InstructionNextCountPercent
aloadinvokevirtual432417.47%
aloadiload21328.62%
aloadgetfield18947.65%
aloadaload17957.25%
aload_0
InstructionNextCountPercent
aload_0getfield3401840.59%
aload_0aload_1848910.13%
aload_0invokevirtual80269.58%
aload_0invokespecial53556.39%
aload_1
InstructionNextCountPercent
aload_1invokevirtual620919.39%
aload_1getfield20756.48%
aload_1invokespecial20486.40%
aload_1aload_218865.89%
aload_2
InstructionNextCountPercent
aload_2invokevirtual293918.05%
aload_2getfield13118.05%
aload_2invokespecial10196.26%
aload_2invokeinterface7974.89%
aload_3
InstructionNextCountPercent
aload_3invokevirtual184718.72%
aload_3iload7467.56%
aload_3ifnull6116.19%
aload_3aload5895.97%
anewarray
InstructionNextCountPercent
anewarraydup95560.25%
anewarrayputfield1267.95%
anewarrayastore1247.82%
anewarrayputstatic714.48%
arraylength
InstructionNextCountPercent
arraylengthif_icmpge71021.17%
arraylengthiconst_13119.27%
arraylengthistore2768.23%
arraylengthinvokestatic2417.19%
astore
InstructionNextCountPercent
astoreaload439339.61%
astoreaload_0123511.14%
astoregoto9098.20%
astoreaload_35875.29%
astore_0
InstructionNextCountPercent
astore_0getstatic28638.75%
astore_0aload_018224.66%
astore_0new7710.43%
astore_0return466.23%
astore_1
InstructionNextCountPercent
astore_1aload_1125437.73%
astore_1aload_061618.53%
astore_1monitorenter33710.14%
astore_1goto2838.51%
astore_2
InstructionNextCountPercent
astore_2aload_2151932.22%
astore_2aload_086718.39%
astore_2aload_159212.56%
astore_2goto3727.89%
astore_3
InstructionNextCountPercent
astore_3aload_3108829.95%
astore_3aload_054515.00%
astore_3aload_247513.07%
astore_3aload_12877.90%
baload
InstructionNextCountPercent
baloadsipush16535.33%
baloadbipush439.21%
baloadinvokestatic306.42%
baloadifne265.57%
bastore
InstructionNextCountPercent
bastoredup29952.73%
bastoreaload_06811.99%
bastoreiinc6511.46%
bastoregoto274.76%
bipush
InstructionNextCountPercent
bipushbipush10208.95%
bipushinvokevirtual9138.01%
bipushcastore8347.31%
bipushif_icmpne7646.70%
caload
InstructionNextCountPercent
caloadbipush19132.71%
caloadcastore7412.67%
caloadistore7312.50%
caloadinvokevirtual355.99%
castore
InstructionNextCountPercent
castoredup93165.20%
castoreaastore20614.43%
castoreaload_0614.27%
castoregoto483.36%
checkcast
InstructionNextCountPercent
checkcastastore100916.96%
checkcastinvokevirtual94415.87%
checkcastareturn81313.67%
checkcastastore_25549.31%
d2f
InstructionNextCountPercent
d2ffastore10546.46%
d2fputfield6428.32%
d2ffreturn146.19%
d2faload_083.54%
d2i
InstructionNextCountPercent
d2iistore1921.59%
d2iputfield1213.64%
d2iireturn1011.36%
d2iinvokespecial66.82%
d2l
InstructionNextCountPercent
d2llreturn450.00%
d2lladd225.00%
d2llstore225.00%
dadd
InstructionNextCountPercent
dadddstore10617.70%
dadddastore6811.35%
daddputfield569.35%
daddinvokestatic538.85%
daload
InstructionNextCountPercent
daloaddstore9116.98%
daloadaload_06912.87%
daloaddastore499.14%
daloaddload397.28%
dastore
InstructionNextCountPercent
dastoredup12826.07%
dastoreaload_09018.33%
dastoreaload_15411.00%
dastoregoto499.98%
dcmpg
InstructionNextCountPercent
dcmpgifge11746.99%
dcmpgifgt7128.51%
dcmpgiflt3313.25%
dcmpgifle2811.24%
dcmpl
InstructionNextCountPercent
dcmplifne18143.93%
dcmplifeq8520.63%
dcmplifle7518.20%
dcmpliflt5312.86%
dconst_0
InstructionNextCountPercent
dconst_0dcmpl16534.16%
dconst_0dcmpg10822.36%
dconst_0putfield5310.97%
dconst_0dastore5210.77%
dconst_1
InstructionNextCountPercent
dconst_1dcmpl3423.94%
dconst_1dastore2719.01%
dconst_1putfield128.45%
dconst_1aload_0117.75%
ddiv
InstructionNextCountPercent
ddivdstore6630.00%
ddivputfield2812.73%
ddivinvokestatic188.18%
ddivdastore177.73%
dload
InstructionNextCountPercent
dloaddload65427.33%
dloaddmul26911.24%
dloaddadd1988.27%
dloaddconst_01144.76%
dload_0
InstructionNextCountPercent
dload_0invokestatic6430.19%
dload_0dload_24420.75%
dload_0ldc2_w2511.79%
dload_0dconst_0178.02%
dload_1
InstructionNextCountPercent
dload_1dload_311220.59%
dload_1dload7513.79%
dload_1invokestatic5610.29%
dload_1putfield346.25%
dload_2
InstructionNextCountPercent
dload_2invokestatic5121.25%
dload_2dload4518.75%
dload_2dmul2610.83%
dload_2aload_0114.58%
dload_3
InstructionNextCountPercent
dload_3dload15433.62%
dload_3aload_0449.61%
dload_3putfield265.68%
dload_3invokevirtual245.24%
dmul
InstructionNextCountPercent
dmuldadd18729.45%
dmuldload15123.78%
dmulputfield548.50%
dmuldsub436.77%
dneg
InstructionNextCountPercent
dnegdload1819.15%
dnegputfield1718.09%
dneginvokestatic1111.70%
dnegdstore1010.64%
drem
InstructionNextCountPercent
dremputfield240.00%
dremdstore120.00%
dremdstore_0120.00%
dremldc2_w120.00%
dstore
InstructionNextCountPercent
dstoredload31430.43%
dstoreaload_025925.10%
dstoregoto636.10%
dstoreiinc555.33%
dstore_0
InstructionNextCountPercent
dstore_0dload_01155.00%
dstore_0goto315.00%
dstore_0dload_2210.00%
dstore_0iload_2210.00%
dstore_1
InstructionNextCountPercent
dstore_1aload_02232.84%
dstore_1goto1420.90%
dstore_1dload_11319.40%
dstore_1dload_357.46%
dstore_2
InstructionNextCountPercent
dstore_2aload_02668.42%
dstore_2dload_2615.79%
dstore_2aload_125.26%
dstore_2dload_025.26%
dstore_3
InstructionNextCountPercent
dstore_3aload_02838.36%
dstore_3dload_1912.33%
dstore_3dload810.96%
dstore_3dload_379.59%
dsub
InstructionNextCountPercent
dsubdstore9534.93%
dsubdload4215.44%
dsubdmul196.99%
dsubinvokestatic165.88%
dup
InstructionNextCountPercent
dupinvokespecial633821.41%
dupbipush339411.46%
dupldc330411.16%
dupsipush27279.21%
dup2
InstructionNextCountPercent
dup2lstore11327.63%
dup2dstore7418.09%
dup2laload4511.00%
dup2iaload4110.02%
dup2_x1
InstructionNextCountPercent
dup2_x1putfield50100.00%
dup_x1
InstructionNextCountPercent
dup_x1putfield55873.42%
dup_x1iconst_120226.58%
dup_x2
InstructionNextCountPercent
dup_x2aastore1537.50%
dup_x2iastore1230.00%
dup_x2fastore1127.50%
dup_x2castore25.00%
f2d
InstructionNextCountPercent
f2ddreturn4314.78%
f2ddstore3411.68%
f2ddmul237.90%
f2ddup2227.56%
f2i
InstructionNextCountPercent
f2iistore3519.66%
f2ii2s2715.17%
f2iiastore2614.61%
f2iireturn179.55%
f2l
InstructionNextCountPercent
f2llreturn1100.00%
fadd
InstructionNextCountPercent
faddf2i12443.66%
faddfstore6823.94%
faddldc165.63%
faddfastore124.23%
faload
InstructionNextCountPercent
faloadf2d9518.74%
faloadfastore7214.20%
faloadfstore6212.23%
faloadfload448.68%
fastore
InstructionNextCountPercent
fastoreaload_011426.45%
fastoreiinc8319.26%
fastoregoto4610.67%
fastoreaload_1358.12%
fcmpg
InstructionNextCountPercent
fcmpgifge6463.37%
fcmpgifgt2726.73%
fcmpgifle76.93%
fcmpgiflt32.97%
fcmpl
InstructionNextCountPercent
fcmplifeq5638.10%
fcmplifne4429.93%
fcmplifle3423.13%
fcmpliflt106.80%
fconst_0
InstructionNextCountPercent
fconst_0fcmpl6030.30%
fconst_0fcmpg4020.20%
fconst_0fstore3015.15%
fconst_0fastore168.08%
fconst_1
InstructionNextCountPercent
fconst_1fcmpl1717.89%
fconst_1fload1010.53%
fconst_1fastore99.47%
fconst_1fcmpg99.47%
fconst_2
InstructionNextCountPercent
fconst_2fdiv743.75%
fconst_2aload_0318.75%
fconst_2fcmpl212.50%
fconst_2fload16.25%
fdiv
InstructionNextCountPercent
fdivfstore4233.60%
fdivfastore3427.20%
fdivldc97.20%
fdivfload75.60%
fload
InstructionNextCountPercent
floadfmul13219.21%
floadfload10515.28%
floadaload405.82%
floadfastore385.53%
fload_0
InstructionNextCountPercent
fload_0invokestatic2928.71%
fload_0fload_11514.85%
fload_0ldc1413.86%
fload_0f2d1110.89%
fload_1
InstructionNextCountPercent
fload_1fload_22512.08%
fload_1invokestatic2311.11%
fload_1putfield178.21%
fload_1fconst_0146.76%
fload_2
InstructionNextCountPercent
fload_2fload_32010.58%
fload_2invokestatic2010.58%
fload_2putfield2010.58%
fload_2f2d157.94%
fload_3
InstructionNextCountPercent
fload_3putfield1513.51%
fload_3f2d1412.61%
fload_3fload1210.81%
fload_3fastore65.41%
fmul
InstructionNextCountPercent
fmulldc12833.68%
fmulfstore5715.00%
fmulfadd5514.47%
fmulfastore379.74%
fneg
InstructionNextCountPercent
fnegaload_0419.05%
fnegf2d419.05%
fnegaload314.29%
fnegfstore314.29%
fstore
InstructionNextCountPercent
fstorefload11729.77%
fstoreaload_04812.21%
fstoreiconst_04110.43%
fstoreaload379.41%
fstore_0
InstructionNextCountPercent
fstore_0fload_05100.00%
fstore_1
InstructionNextCountPercent
fstore_1aload_0819.51%
fstore_1goto819.51%
fstore_1fload_1717.07%
fstore_1getstatic49.76%
fstore_2
InstructionNextCountPercent
fstore_2aload_0939.13%
fstore_2fload_2417.39%
fstore_2fload28.70%
fstore_2fload_328.70%
fstore_3
InstructionNextCountPercent
fstore_3aload_0621.43%
fstore_3fload_3414.29%
fstore_3goto414.29%
fstore_3fconst_027.14%
fsub
InstructionNextCountPercent
fsubfstore2823.33%
fsubfload1512.50%
fsubfmul1210.00%
fsubaload_075.83%
getfield
InstructionNextCountPercent
getfieldinvokevirtual459110.90%
getfieldaload_032067.61%
getfieldaload_122255.28%
getfieldinvokestatic14993.56%
getstatic
InstructionNextCountPercent
getstaticinvokevirtual155113.30%
getstaticaastore135511.61%
getstaticifne10378.89%
getstaticaload_07776.66%
goto
InstructionNextCountPercent
gotoiload238613.05%
gotoaload_0208611.41%
gotoreturn16919.25%
gotoireturn15308.37%
i2b
InstructionNextCountPercent
i2bbastore17160.00%
i2bireturn3311.58%
i2bistore207.02%
i2bputfield175.96%
i2c
InstructionNextCountPercent
i2cinvokevirtual5736.08%
i2ccastore3622.78%
i2cireturn159.49%
i2cistore_2159.49%
i2d
InstructionNextCountPercent
i2dldc2_w1511.81%
i2ddreturn1411.02%
i2ddmul1310.24%
i2daload_0107.87%
i2f
InstructionNextCountPercent
i2ffmul7422.70%
i2ffload7222.09%
i2fldc5717.48%
i2faload_0257.67%
i2l
InstructionNextCountPercent
i2lladd24915.71%
i2lldc2_w21813.75%
i2llsub1589.97%
i2llreturn935.87%
i2s
InstructionNextCountPercent
i2ssastore4955.06%
i2sireturn1820.22%
i2sputfield66.74%
i2si2l22.25%
iadd
InstructionNextCountPercent
iaddistore89816.46%
iaddputfield67912.45%
iaddinvokevirtual3937.21%
iaddiload3426.27%
iaload
InstructionNextCountPercent
ialoadistore22113.19%
ialoadiload975.79%
ialoadiadd965.73%
ialoadi2l905.37%
iand
InstructionNextCountPercent
iandifeq41522.84%
iandistore19710.84%
iandifne1256.88%
iandbipush915.01%
iastore
InstructionNextCountPercent
iastoredup178360.89%
iastoregoto38913.29%
iastoreiinc1976.73%
iastoreaload_01254.27%
iconst_0
InstructionNextCountPercent
iconst_0ireturn312320.23%
iconst_0istore246115.94%
iconst_0putfield12327.98%
iconst_0invokevirtual6594.27%
iconst_1
InstructionNextCountPercent
iconst_1goto202214.87%
iconst_1iadd166112.22%
iconst_1isub156111.48%
iconst_1ireturn12289.03%
iconst_2
InstructionNextCountPercent
iconst_2anewarray45015.27%
iconst_2iadd1926.52%
iconst_2newarray1896.42%
iconst_2invokevirtual1254.24%
iconst_3
InstructionNextCountPercent
iconst_3anewarray715.31%
iconst_3invokevirtual715.31%
iconst_3getstatic685.09%
iconst_3invokespecial614.57%
iconst_4
InstructionNextCountPercent
iconst_4invokevirtual717.05%
iconst_4anewarray646.36%
iconst_4iadd595.86%
iconst_4iand585.76%
iconst_5
InstructionNextCountPercent
iconst_5invokevirtual396.07%
iconst_5getstatic375.76%
iconst_5invokespecial375.76%
iconst_5iastore355.45%
iconst_m1
InstructionNextCountPercent
iconst_m1if_icmpne27214.35%
iconst_m1ireturn24112.72%
iconst_m1if_icmpeq23812.56%
iconst_m1putfield22611.93%
idiv
InstructionNextCountPercent
idivistore5417.65%
idiviadd5016.34%
idivbipush247.84%
idivdup227.19%
if_acmpeq
InstructionNextCountPercent
if_acmpeqaload_016918.65%
if_acmpeqnew14716.23%
if_acmpeqaload_113815.23%
if_acmpeqaload13514.90%
if_acmpne
InstructionNextCountPercent
if_acmpneaload_047527.96%
if_acmpneiconst_131718.66%
if_acmpneaload_11347.89%
if_acmpneaload1297.59%
if_icmpeq
InstructionNextCountPercent
if_icmpeqnew45426.02%
if_icmpeqaload_029416.85%
if_icmpeqiload22112.66%
if_icmpeqiconst_01488.48%
if_icmpge
InstructionNextCountPercent
if_icmpgeaload_0106329.53%
if_icmpgeaload54115.03%
if_icmpgeaload_146312.86%
if_icmpgeaload_22938.14%
if_icmpgt
InstructionNextCountPercent
if_icmpgtiload18919.87%
if_icmpgtaload_018419.35%
if_icmpgtiload_216517.35%
if_icmpgtiload_3626.52%
if_icmple
InstructionNextCountPercent
if_icmplenew66643.44%
if_icmpleaload_023315.20%
if_icmpleiload1278.28%
if_icmpleiconst_1664.31%
if_icmplt
InstructionNextCountPercent
if_icmpltaload_023321.61%
if_icmpltnew15714.56%
if_icmpltiload13712.71%
if_icmpltiload_1797.33%
if_icmpne
InstructionNextCountPercent
if_icmpneaload_082427.58%
if_icmpneiconst_133011.04%
if_icmpneiload2608.70%
if_icmpneaload2588.63%
ifeq
InstructionNextCountPercent
ifeqaload_0275027.84%
ifeqaload_199710.09%
ifeqaload9739.85%
ifeqnew8198.29%
ifge
InstructionNextCountPercent
ifgenew45128.12%
ifgeaload_026316.40%
ifgeiload1096.80%
ifgeiconst_0774.80%
ifgt
InstructionNextCountPercent
ifgtnew10519.13%
ifgtaload_06411.66%
ifgticonst_06211.29%
ifgtiload509.11%
ifle
InstructionNextCountPercent
ifleaload_037027.39%
ifleiload14911.03%
ifleaload926.81%
ifleiconst_1916.74%
iflt
InstructionNextCountPercent
ifltaload_023616.54%
ifltiload17612.33%
ifltiload_217312.12%
ifltiload_116811.77%
ifne
InstructionNextCountPercent
ifneaload_0161624.34%
ifnenew88313.30%
ifneiconst_15518.30%
ifneiconst_04877.34%
ifnonnull
InstructionNextCountPercent
ifnonnullnew131529.14%
ifnonnullaload_0105023.27%
ifnonnullaconst_null2876.36%
ifnonnulliconst_02776.14%
ifnull
InstructionNextCountPercent
ifnullaload_0153424.83%
ifnullaload118819.23%
ifnullaload_1105317.05%
ifnullaload_282513.36%
iinc
InstructionNextCountPercent
iincgoto262957.84%
iinciload52811.62%
iinciinc2034.47%
iincaload1342.95%
iload
InstructionNextCountPercent
iloadiload377214.69%
iloadiconst_112304.79%
iloadiadd11294.40%
iloadinvokevirtual10794.20%
iload_0
InstructionNextCountPercent
iload_0bipush24016.33%
iload_0invokestatic17211.70%
iload_0iload_11177.96%
iload_0sipush906.12%
iload_1
InstructionNextCountPercent
iload_1iload_2110211.61%
iload_1invokevirtual9089.57%
iload_1aload_06336.67%
iload_1invokestatic4875.13%
iload_2
InstructionNextCountPercent
iload_2iload_3100510.27%
iload_2aload_06556.69%
iload_2invokevirtual5855.98%
iload_2invokespecial4794.89%
iload_3
InstructionNextCountPercent
iload_3iload87710.97%
iload_3invokevirtual5366.70%
iload_3iadd3734.66%
iload_3aload_03454.31%
imul
InstructionNextCountPercent
imuliadd11516.20%
imulaload_07911.13%
imuliload618.59%
imuliload_1578.03%
ineg
InstructionNextCountPercent
inegireturn2211.64%
inegistore2111.11%
ineginvokevirtual2010.58%
ineginvokestatic189.52%
instanceof
InstructionNextCountPercent
instanceofifeq132476.84%
instanceofifne38322.23%
instanceofireturn130.75%
instanceofinvokespecial10.06%
invokedynamic
InstructionNextCountPercent
invokedynamicareturn8122.95%
invokedynamicinvokedynamic5716.15%
invokedynamicinvokeinterface4512.75%
invokedynamicinvokevirtual4512.75%
invokeinterface
InstructionNextCountPercent
invokeinterfacecheckcast101812.60%
invokeinterfaceifeq7949.83%
invokeinterfacepop7148.84%
invokeinterfaceareturn5046.24%
invokespecial
InstructionNextCountPercent
invokespecialathrow642922.70%
invokespecialreturn336911.90%
invokespecialaload_0312811.05%
invokespecialareturn25719.08%
invokestatic
InstructionNextCountPercent
invokestaticareturn195911.34%
invokestaticinvokevirtual10175.89%
invokestaticaload_08614.98%
invokestaticpop8544.94%
invokevirtual
InstructionNextCountPercent
invokevirtualinvokevirtual521010.06%
invokevirtualaload_043458.39%
invokevirtualpop34086.58%
invokevirtualareturn32666.31%
ior
InstructionNextCountPercent
iorputfield10713.67%
ioristore9412.01%
ioristore_1719.07%
iorireturn455.75%
irem
InstructionNextCountPercent
iremistore5531.43%
iremifne2514.29%
irembipush116.29%
iremiadd105.71%
ishl
InstructionNextCountPercent
ishliconst_111114.27%
ishlior11114.27%
ishlaload_0749.51%
ishlistore617.84%
ishr
InstructionNextCountPercent
ishrsipush8021.56%
ishristore4311.59%
ishrbipush379.97%
ishriadd359.43%
istore
InstructionNextCountPercent
istoreiload428339.37%
istoreaload_0127611.73%
istoregoto8808.09%
istoreaload6766.21%
istore_0
InstructionNextCountPercent
istore_0iload_08360.14%
istore_0goto1410.14%
istore_0getstatic85.80%
istore_0iinc75.07%
istore_1
InstructionNextCountPercent
istore_1iload_145634.06%
istore_1aload_042631.81%
istore_1goto15411.50%
istore_1iinc634.71%
istore_2
InstructionNextCountPercent
istore_2iload_280931.91%
istore_2aload_047818.86%
istore_2goto44317.48%
istore_2aload_11877.38%
istore_3
InstructionNextCountPercent
istore_3iload_386533.09%
istore_3aload_040215.38%
istore_3goto39815.23%
istore_3iconst_01746.66%
isub
InstructionNextCountPercent
isubistore73919.31%
isubputfield2015.25%
isubinvokevirtual1935.04%
isubiload1854.83%
iushr
InstructionNextCountPercent
iushristore11323.40%
iushrdup6112.63%
iushrdup_x1459.32%
iushrsipush459.32%
ixor
InstructionNextCountPercent
ixorireturn9833.22%
ixoristore_13612.20%
ixoraload_03511.86%
ixoriand217.12%
l2d
InstructionNextCountPercent
l2dddiv721.88%
l2dldc2_w721.88%
l2ddreturn618.75%
l2daload_0515.63%
l2f
InstructionNextCountPercent
l2ffreturn666.67%
l2fgetstatic222.22%
l2ffload_2111.11%
l2i
InstructionNextCountPercent
l2iistore12520.10%
l2iiastore6510.45%
l2iireturn619.81%
l2iinvokevirtual396.27%
ladd
InstructionNextCountPercent
laddlstore25727.87%
laddputfield677.27%
laddinvokestatic576.18%
laddlreturn485.21%
laload
InstructionNextCountPercent
laloadlstore4413.41%
laloadlcmp3610.98%
laloadaload_03410.37%
laloadlastore329.76%
land
InstructionNextCountPercent
landlconst_013324.54%
landlstore5610.33%
landdup2346.27%
landlor336.09%
lastore
InstructionNextCountPercent
lastoredup10337.32%
lastoreaload_05519.93%
lastoreiinc3914.13%
lastoreaastore207.25%
lcmp
InstructionNextCountPercent
lcmpifne49624.63%
lcmpifeq43621.65%
lcmpifge39119.41%
lcmpifle28614.20%
lconst_0
InstructionNextCountPercent
lconst_0lcmp90764.14%
lconst_0lstore765.37%
lconst_0invokespecial634.46%
lconst_0putfield543.82%
lconst_1
InstructionNextCountPercent
lconst_1ladd14325.09%
lconst_1lsub11820.70%
lconst_1invokevirtual5810.18%
lconst_1invokestatic396.84%
ldc
InstructionNextCountPercent
ldcinvokevirtual483730.88%
ldcinvokespecial269617.21%
ldcaastore161810.33%
ldcinvokestatic9536.08%
ldc2_w
InstructionNextCountPercent
ldc2_wlcmp47416.14%
ldc2_wland43614.85%
ldc2_winvokestatic32811.17%
ldc2_wldiv1645.58%
ldc_w
InstructionNextCountPercent
ldc_waastore107349.36%
ldc_winvokevirtual26312.10%
ldc_wiastore25711.82%
ldc_wgetstatic1235.66%
ldiv
InstructionNextCountPercent
ldivlreturn6634.20%
ldivlstore2814.51%
ldivl2i199.84%
ldivladd157.77%
lload
InstructionNextCountPercent
lloadldc2_w38113.57%
lloadlload32211.47%
lloadlcmp1696.02%
lloadlconst_01685.99%
lload_0
InstructionNextCountPercent
lload_0ldc2_w10016.18%
lload_0invokestatic7011.33%
lload_0lload_26811.00%
lload_0bipush518.25%
lload_1
InstructionNextCountPercent
lload_1ldc2_w33618.92%
lload_1invokevirtual26314.81%
lload_1lconst_01588.90%
lload_1aload_01106.19%
lload_2
InstructionNextCountPercent
lload_2lload12913.03%
lload_2invokestatic11211.31%
lload_2invokevirtual919.19%
lload_2ldc2_w888.89%
lload_3
InstructionNextCountPercent
lload_3ldc2_w8211.87%
lload_3lconst_07711.14%
lload_3invokestatic507.24%
lload_3lload507.24%
lmul
InstructionNextCountPercent
lmullstore4316.93%
lmulladd3312.99%
lmulaload_02610.24%
lmullload249.45%
lneg
InstructionNextCountPercent
lneginvokevirtual5241.60%
lnegaload_3118.80%
lnegl2i97.20%
lneginvokestatic75.60%
lookupswitch
InstructionNextCountPercent
lookupswitchaload_06130.81%
lookupswitchaload_22311.62%
lookupswitchiconst_1157.58%
lookupswitchldc157.58%
lor
InstructionNextCountPercent
lorlstore3618.09%
lorputstatic2512.56%
lorlconst_0136.53%
lorlstore_0136.53%
lrem
InstructionNextCountPercent
lremlconst_04834.78%
lremldc2_w2417.39%
lreml2i1913.77%
lremlstore96.52%
lshl
InstructionNextCountPercent
lshlinvokestatic5116.61%
lshlldc2_w3812.38%
lshlaload_03310.75%
lshllor309.77%
lshr
InstructionNextCountPercent
lshrl2i2936.25%
lshrldc2_w1113.75%
lshrlor67.50%
lshrlstore67.50%
lstore
InstructionNextCountPercent
lstorelload49433.22%
lstoreaload_020513.79%
lstoregoto15910.69%
lstoreaload684.57%
lstore_0
InstructionNextCountPercent
lstore_0lload_03877.55%
lstore_0goto24.08%
lstore_0iload_224.08%
lstore_0lload_224.08%
lstore_1
InstructionNextCountPercent
lstore_1lload_110148.10%
lstore_1aload_06129.05%
lstore_1goto104.76%
lstore_1ldc2_w83.81%
lstore_2
InstructionNextCountPercent
lstore_2lload_27029.17%
lstore_2aload_04317.92%
lstore_2lconst_02410.00%
lstore_2aload_1229.17%
lstore_3
InstructionNextCountPercent
lstore_3lload_36825.19%
lstore_3aload_06524.07%
lstore_3goto3613.33%
lstore_3lload_1155.56%
lsub
InstructionNextCountPercent
lsublstore16326.72%
lsubl2i6210.16%
lsubinvokestatic6110.00%
lsubinvokevirtual426.89%
lushr
InstructionNextCountPercent
lushrl2i6927.82%
lushrlstore5321.37%
lushrlxor2510.08%
lushrldc2_w239.27%
lxor
InstructionNextCountPercent
lxorland2227.85%
lxorldc2_w1316.46%
lxorl2i1215.19%
lxorlastore78.86%
monitorenter
InstructionNextCountPercent
monitorenteraload_071867.42%
monitorentergetstatic847.89%
monitorenteraload_1726.76%
monitorenternew575.35%
monitorexit
InstructionNextCountPercent
monitorexitgoto74530.86%
monitorexitaload57523.82%
monitorexitareturn32113.30%
monitorexitaload_324610.19%
multianewarray
InstructionNextCountPercent
multianewarrayareturn330.00%
multianewarrayastore330.00%
multianewarrayastore_1220.00%
multianewarrayputstatic220.00%
new
InstructionNextCountPercent
newdup16337100.00%
newarray
InstructionNextCountPercent
newarraydup43131.19%
newarrayastore34925.25%
newarrayputfield24918.02%
newarrayastore_2836.01%
pop
InstructionNextCountPercent
popaload_0128124.04%
popgoto92817.41%
popaload_158510.98%
popaload4929.23%
pop2
InstructionNextCountPercent
pop2aload_02626.53%
pop2getstatic1616.33%
pop2return99.18%
pop2aload_177.14%
putfield
InstructionNextCountPercent
putfieldaload_0806653.13%
putfieldreturn282718.62%
putfieldgoto9716.40%
putfieldaload_16284.14%
putstatic
InstructionNextCountPercent
putstaticnew125537.38%
putstaticreturn63819.01%
putstaticgetstatic48514.45%
putstaticldc1594.74%
saload
InstructionNextCountPercent
saloadldc7634.70%
saloadsastore3616.44%
saloadistore2210.05%
saloadif_icmpge167.31%
sastore
InstructionNextCountPercent
sastoreiinc4838.40%
sastoreaload_04233.60%
sastoregoto1612.80%
sastoreiload86.40%
sipush
InstructionNextCountPercent
sipushldc112417.35%
sipushiastore91314.09%
sipushldc_w91014.05%
sipushiand5418.35%
tableswitch
InstructionNextCountPercent
tableswitchaload_011031.98%
tableswitchaload_1339.59%
tableswitchnew288.14%
tableswitchaload_3185.23%

Summary

Summary not conclusion, investigation not experiment.
This was a fun detour into bytecode but falls well short of the scientific method.
Hopefully you've found it interesting and maybe these tools can further your understanding of bytecode and how source code is translated into this funky little instruction set.
If you enjoyed it please follow @chriswhocodes on Twitter for more dives into the JVM :)

Further Work

  • Generalising the JarScan tool is a new feature and I have ideas for several more static bytecode analyses.
  • Implement following of invoke instruction flow.
  • Code is not optimised. Parallel processing of bytecode would be nice.
  • JarScan GUI?
  • Re-run the investigation on a larger corpus of class files than just java.* from rt.jar