changeset 23318:0adc3361952c

Report number of inlined bytecodes when compilation succeeds
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 18 Jan 2016 10:58:42 -0800
parents 15296f7da135
children cde2f72cb163
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java
diffstat 1 files changed, 3 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Jan 18 18:37:09 2016 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Jan 18 10:58:42 2016 -0800
@@ -29,9 +29,6 @@
 import static com.oracle.graal.compiler.GraalCompilerOptions.PrintCompilation;
 import static com.oracle.graal.compiler.GraalCompilerOptions.PrintFilter;
 import static com.oracle.graal.compiler.GraalCompilerOptions.PrintStackTraceOnException;
-
-import java.lang.reflect.Field;
-
 import jdk.vm.ci.code.BailoutException;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.CompilationRequestResult;
@@ -49,7 +46,6 @@
 import jdk.vm.ci.hotspot.events.EventProvider.CompilerFailureEvent;
 import jdk.vm.ci.runtime.JVMCICompiler;
 import jdk.vm.ci.services.Services;
-import sun.misc.Unsafe;
 
 import com.oracle.graal.code.CompilationResult;
 import com.oracle.graal.debug.Debug;
@@ -65,22 +61,6 @@
 
 public class CompilationTask {
 
-    private static final Unsafe UNSAFE = initUnsafe();
-
-    private static Unsafe initUnsafe() {
-        try {
-            return Unsafe.getUnsafe();
-        } catch (SecurityException se) {
-            try {
-                Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
-                theUnsafe.setAccessible(true);
-                return (Unsafe) theUnsafe.get(Unsafe.class);
-            } catch (Exception e) {
-                throw new RuntimeException("exception while trying to get Unsafe", e);
-            }
-        }
-    }
-
     private static final DebugMetric BAILOUTS = Debug.metric("Bailouts");
 
     private static final EventProvider eventProvider;
@@ -223,6 +203,9 @@
                 }
             }
             stats.finish(method, installedCode);
+            if (result != null) {
+                return CompilationRequestResult.success(result.getBytecodeSize() - method.getCodeSize());
+            }
             return null;
         } catch (BailoutException bailout) {
             BAILOUTS.increment();
@@ -276,13 +259,6 @@
                     compilationEvent.setInlinedBytes(compiledBytecodes);
                     compilationEvent.commit();
                 }
-
-                long jvmciEnv = request.getJvmciEnv();
-                if (jvmciEnv != 0) {
-                    long ctask = UNSAFE.getAddress(jvmciEnv + config.jvmciEnvTaskOffset);
-                    assert ctask != 0L;
-                    UNSAFE.putInt(ctask + config.compileTaskNumInlinedBytecodesOffset, compiledBytecodes);
-                }
             } catch (Throwable t) {
                 handleException(t);
             }