United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7171890 C1: add Class.isInstance intrinsic
JDK-7171890 : C1: add Class.isInstance intrinsic

Details
Type:
Enhancement
Submit Date:
2012-05-25
Status:
Resolved
Updated Date:
2013-04-30
Project Name:
JDK
Resolved Date:
2012-06-16
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P5
Resolution:
Fixed
Affected Versions:
hs23
Fixed Versions:
hs24 (b14)

Related Reports
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
The new JSR 292 implementation heavily uses Class.cast which calls Class.isInstance.  This is a major bottleneck for some benchmarks like JRuby's bench_red_black.rb:

$ jruby -J-Xprof -J-showversion -X+C bench/bench_red_black.rb 
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b39)
Java HotSpot(TM) Client VM (build 24.0-b08-internal, mixed mode)

19.803
GC.count = 46
10.803
GC.count = 55
10.159
GC.count = 63
10.258
GC.count = 72
10.128
GC.count = 79
9.977
GC.count = 86
10.174
GC.count = 93
10.031
GC.count = 100
10.172
GC.count = 107
10.254
GC.count = 114

Flat profile of 122.85 secs (5753 total ticks): main

  Interpreted + native   Method                        
  3.7%     0  +   211    java.io.FileOutputStream.open
  3.3%     0  +   192    java.io.FileOutputStream.close0
  0.4%     0  +    21    java.io.UnixFileSystem.getBooleanAttributes0
  0.2%     0  +    13    java.lang.Class.forName0
  0.2%     0  +    12    sun.misc.Unsafe.defineAnonymousClass
  0.1%     0  +     5    java.util.zip.ZipFile.read
  0.1%     1  +     3    org.jruby.Ruby.initCore
  0.1%     0  +     4    java.lang.Class.getDeclaredConstructors0
  0.1%     0  +     4    java.lang.ClassLoader$NativeLibrary.load
  0.1%     4  +     0    bench.bench_red_black.method__27$RUBY$insert_helper
  0.1%     3  +     1    java.lang.ClassLoader.defineClass1
  0.1%     3  +     0    bench.bench_red_black.method__16$RUBY$minimum
  0.1%     0  +     3    sun.security.pkcs11.wrapper.PKCS11.C_Initialize
  0.1%     0  +     3    org.jruby.parser.Ruby19Parser.<clinit>
  0.1%     0  +     3    org.jruby.RubyInstanceConfig.<init>
  0.0%     0  +     2    java.util.zip.ZipFile.open
  0.0%     0  +     2    java.io.FileInputStream.open
  0.0%     0  +     2    java.io.UnixFileSystem.canonicalize0
  0.0%     2  +     0    home.cthaling.mlvm.jruby.lib.ruby.shared.rubygems.specification.class_1$RUBY$Specification
  0.0%     0  +     2    org.joni.Regex.<init>
  0.0%     2  +     0    org.jruby.compiler.impl.InvokeDynamicCacheCompiler.cacheStaticScope
  0.0%     0  +     2    java.lang.invoke.MethodHandleNatives.resolve
  0.0%     0  +     2    java.lang.String.intern
  0.0%     1  +     0    com.sun.xml.internal.ws.org.objectweb.asm.Frame.set
  0.0%     1  +     0    java.util.regex.Matcher.<init>
  9.9%    51  +   518    Total interpreted (including elided)

     Compiled + native   Method                        
  2.2%     0  +   128    bench.bench_red_black.method__16$RUBY$minimum
  1.9%     0  +   107    bench.bench_red_black.method__27$RUBY$insert_helper
  1.3%     0  +    75    bench.bench_red_black.method__25$RUBY$left_rotate
  0.9%     0  +    52    bench.bench_red_black.method__14$RUBY$insert
  0.0%     0  +     1    org.jruby.runtime.Arity.createArity
  0.0%     0  +     1    bench.bench_red_black.method__19$RUBY$predecessor
  0.0%     0  +     1    java.lang.StringBuilder.<init>
  0.0%     1  +     0    bench.bench_red_black.block_3$RUBY$rbt_bm
  6.4%     1  +   365    Total compiled

         Stub + native   Method                        
 77.5%     0  +  4460    java.lang.Class.isInstance
  0.8%     0  +    46    java.io.FileOutputStream.open
  0.8%     0  +    44    java.io.FileOutputStream.close0
  0.2%     0  +    14    java.lang.Class.isPrimitive
  0.1%     0  +     5    java.lang.Class.isArray
  0.1%     0  +     4    java.lang.Throwable.fillInStackTrace
  0.1%     0  +     3    java.lang.Class.isInterface
  0.1%     0  +     3    sun.misc.Unsafe.ensureClassInitialized
  0.1%     0  +     3    java.lang.reflect.Array.newArray
  0.0%     0  +     2    java.lang.System.arraycopy
  0.0%     0  +     2    java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal
  0.0%     0  +     2    java.lang.Object.getClass
  0.0%     0  +     2    java.lang.Class.getComponentType
  0.0%     0  +     1    java.lang.Thread.currentThread
  0.0%     0  +     1    java.lang.String.intern
  0.0%     0  +     1    java.security.AccessController.doPrivileged
  0.0%     0  +     1    java.lang.Class.getEnclosingMethod0
  0.0%     0  +     1    java.lang.invoke.MethodHandleNatives.resolve
  0.0%     0  +     1    java.util.zip.Inflater.inflateBytes
 79.9%     0  +  4596    Total stub

  Thread-local ticks:
  3.9%   222             Class loader


Flat profile of 0.01 secs (2 total ticks): DestroyJavaVM

  Thread-local ticks:
 50.0%     1             Blocked (of total)
100.0%     1             Class loader


Global summary of 122.87 seconds:
100.0%  5989             Received ticks
  3.9%   232             Received GC ticks
  1.1%    68             Compilation
  0.0%     2             Other VM operations
  3.7%   223             Class loader

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/8f37087fc13f
                                     
2012-06-05
EVALUATION

http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/8f37087fc13f
                                     
2012-06-29



Hardware and Software, Engineered to Work Together