# HG changeset patch # User Thomas Wuerthinger # Date 1433189590 -7200 # Node ID 7eb156f30b61168d373f03ef030559a011719398 # Parent 2c6802ac343cc4c4608a9a6d1d9ed51ee648bef3# Parent 2081f8f294fee6444872237c9e22fd704dcd1a54 Merge. diff -r 2c6802ac343c -r 7eb156f30b61 .hgignore --- a/.hgignore Mon Jun 01 22:12:57 2015 +0200 +++ b/.hgignore Mon Jun 01 22:13:10 2015 +0200 @@ -11,6 +11,7 @@ ^mx/includes ^build/ ^build-nograal/ +^build-nojvmci/ ^dist/ ^java/ ^lib/ diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Jun 01 22:13:10 2015 +0200 @@ -25,18 +25,11 @@ import com.oracle.jvmci.code.Architecture; import com.oracle.jvmci.code.CompilationResult; import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.SpeculationLog; import com.oracle.jvmci.code.InstalledCode; import com.oracle.jvmci.code.CallingConvention; import com.oracle.jvmci.code.CodeCacheProvider; -import com.oracle.jvmci.meta.DeoptimizationReason; -import com.oracle.jvmci.meta.ResolvedJavaMethod; -import com.oracle.jvmci.meta.Kind; -import com.oracle.jvmci.meta.ConstantReflectionProvider; -import com.oracle.jvmci.meta.JavaType; -import com.oracle.jvmci.meta.ResolvedJavaType; -import com.oracle.jvmci.meta.ProfilingInfo; -import com.oracle.jvmci.meta.MetaAccessProvider; +import com.oracle.jvmci.meta.*; + import static com.oracle.jvmci.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.compiler.common.GraalOptions.*; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Mon Jun 01 22:13:10 2015 +0200 @@ -25,13 +25,11 @@ import com.oracle.jvmci.code.CodeUtil; import com.oracle.jvmci.code.CompilationResult; import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.SpeculationLog; import com.oracle.jvmci.code.InstalledCode; import com.oracle.jvmci.code.CallingConvention; import com.oracle.jvmci.code.CodeCacheProvider; -import com.oracle.jvmci.meta.ResolvedJavaMethod; -import com.oracle.jvmci.meta.ProfilingInfo; -import com.oracle.jvmci.meta.MetaAccessProvider; +import com.oracle.jvmci.meta.*; + import java.lang.reflect.*; import java.util.concurrent.atomic.*; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Jun 01 22:13:10 2015 +0200 @@ -25,16 +25,9 @@ import com.oracle.jvmci.code.CompilationResult; import com.oracle.jvmci.code.TargetDescription; import com.oracle.jvmci.code.RegisterConfig; -import com.oracle.jvmci.code.SpeculationLog; import com.oracle.jvmci.code.CallingConvention; -import com.oracle.jvmci.meta.Assumptions; -import com.oracle.jvmci.meta.Kind; -import com.oracle.jvmci.meta.JavaConstant; -import com.oracle.jvmci.meta.ProfilingInfo; -import com.oracle.jvmci.meta.TriState; -import com.oracle.jvmci.meta.ResolvedJavaMethod; -import com.oracle.jvmci.meta.DefaultProfilingInfo; -import com.oracle.jvmci.meta.VMConstant; +import com.oracle.jvmci.meta.*; + import static com.oracle.graal.compiler.GraalCompiler.Options.*; import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig.*; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.hotspot.jfr/src/com/oracle/graal/hotspot/jfr/events/JFREventProvider.java --- a/graal/com.oracle.graal.hotspot.jfr/src/com/oracle/graal/hotspot/jfr/events/JFREventProvider.java Mon Jun 01 22:12:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.jfr.events; - -import java.net.*; - -import com.oracle.graal.hotspot.events.*; -import com.oracle.jrockit.jfr.*; -import com.oracle.jvmci.service.*; - -/** - * A JFR implementation for {@link EventProvider}. This implementation is used when Flight Recorder - * is turned on. - */ -@ServiceProvider(EventProvider.class) -public final class JFREventProvider implements EventProvider { - - @SuppressWarnings("deprecation") private final Producer producer; - - @SuppressWarnings("deprecation") - public JFREventProvider() { - try { - /* - * The "HotSpot JVM" producer is a native producer and we cannot use it. So we create - * our own. This has the downside that Mission Control is confused and doesn't show - * Graal's events in the "Code" tab. There are plans to revise the JFR code for JDK 9. - */ - producer = new Producer("HotSpot JVM", "Oracle Hotspot JVM", "http://www.oracle.com/hotspot/jvm/"); - producer.register(); - } catch (URISyntaxException e) { - throw new InternalError(e); - } - - // Register event classes with Producer. - for (Class c : JFREventProvider.class.getDeclaredClasses()) { - if (c.isAnnotationPresent(EventDefinition.class)) { - assert com.oracle.jrockit.jfr.InstantEvent.class.isAssignableFrom(c) : c; - registerEvent(c); - } - } - } - - /** - * Register an event class with the {@link Producer}. - * - * @param c event class - * @return the {@link EventToken event token} - */ - @SuppressWarnings({"deprecation", "javadoc", "unchecked"}) - private EventToken registerEvent(Class c) { - try { - return producer.addEvent((Class) c); - } catch (InvalidEventDefinitionException | InvalidValueException e) { - throw new InternalError(e); - } - } - - public CompilationEvent newCompilationEvent() { - return new JFRCompilationEvent(); - } - - /** - * A JFR compilation event. - * - *

- * See: event {@code Compilation} in {@code src/share/vm/trace/trace.xml} - */ - @SuppressWarnings("deprecation") - @EventDefinition(name = "Compilation", path = "vm/compiler/compilation") - public static class JFRCompilationEvent extends com.oracle.jrockit.jfr.DurationEvent implements CompilationEvent { - - /* - * FIXME method should be a Method* but we can't express that in Java. - */ - @ValueDefinition(name = "Java Method") public String method; - @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId; - @ValueDefinition(name = "Compilation Level") public short compileLevel; - @ValueDefinition(name = "Succeeded") public boolean succeeded; - @ValueDefinition(name = "On Stack Replacement") public boolean isOsr; - @ValueDefinition(name = "Compiled Code Size", contentType = ContentType.Bytes) public int codeSize; - @ValueDefinition(name = "Inlined Code Size", contentType = ContentType.Bytes) public int inlinedBytes; - - public void setMethod(String method) { - this.method = method; - } - - public void setCompileId(int id) { - this.compileId = id; - } - - public void setCompileLevel(int compileLevel) { - this.compileLevel = (short) compileLevel; - } - - public void setSucceeded(boolean succeeded) { - this.succeeded = succeeded; - } - - public void setIsOsr(boolean isOsr) { - this.isOsr = isOsr; - } - - public void setCodeSize(int codeSize) { - this.codeSize = codeSize; - } - - public void setInlinedBytes(int inlinedBytes) { - this.inlinedBytes = inlinedBytes; - } - } - - public CompilerFailureEvent newCompilerFailureEvent() { - return new JFRCompilerFailureEvent(); - } - - /** - * A JFR compiler failure event. - * - *

- * See: event {@code CompilerFailure} in {@code src/share/vm/trace/trace.xml} - */ - @SuppressWarnings("deprecation") - @EventDefinition(name = "Compilation Failure", path = "vm/compiler/failure") - public static class JFRCompilerFailureEvent extends com.oracle.jrockit.jfr.InstantEvent implements CompilerFailureEvent { - - @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId; - @ValueDefinition(name = "Message", description = "The failure message") public String failure; - - public void setCompileId(int id) { - this.compileId = id; - } - - public void setMessage(String message) { - this.failure = message; - } - } - -} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Mon Jun 01 22:13:10 2015 +0200 @@ -36,9 +36,6 @@ import java.util.concurrent.*; import com.oracle.graal.api.runtime.*; -import com.oracle.graal.hotspot.events.*; -import com.oracle.graal.hotspot.events.EventProvider.CompilationEvent; -import com.oracle.graal.hotspot.events.EventProvider.CompilerFailureEvent; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.lir.asm.*; @@ -55,13 +52,26 @@ import com.oracle.jvmci.debug.Debug.Scope; import com.oracle.jvmci.debug.internal.*; import com.oracle.jvmci.hotspot.*; +import com.oracle.jvmci.hotspot.events.*; +import com.oracle.jvmci.hotspot.events.EventProvider.*; import com.oracle.jvmci.meta.*; +import com.oracle.jvmci.service.*; //JaCoCo Exclude public class CompilationTask { private static final DebugMetric BAILOUTS = Debug.metric("Bailouts"); + private static final EventProvider eventProvider; + static { + EventProvider provider = Services.loadSingle(EventProvider.class, false); + if (provider == null) { + eventProvider = new EmptyEventProvider(); + } else { + eventProvider = provider; + } + } + private final HotSpotBackend backend; private final HotSpotResolvedJavaMethod method; private final int entryBCI; @@ -149,7 +159,7 @@ protected ProfilingInfo getProfilingInfo() { boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI; - return method.getCompilationProfilingInfo(osrCompilation); + return method.getProfilingInfo(!osrCompilation, osrCompilation); } public void runCompilation() { @@ -160,7 +170,6 @@ final boolean isOSR = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI; // Log a compilation event. - EventProvider eventProvider = Graal.getRequiredCapability(EventProvider.class); CompilationEvent compilationEvent = eventProvider.newCompilationEvent(); // If there is already compiled code for this method on our level we simply return. diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Mon Jun 01 22:13:10 2015 +0200 @@ -37,7 +37,6 @@ import com.oracle.graal.compiler.target.*; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.debug.*; -import com.oracle.graal.hotspot.events.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.printer.*; import com.oracle.graal.replacements.*; @@ -246,10 +245,6 @@ registerBackend(factory.createBackend(this, null, hostBackend)); } } - - try (InitTimer t = timer("createEventProvider")) { - eventProvider = createEventProvider(); - } } /** @@ -355,22 +350,6 @@ private final NodeCollectionsProvider nodeCollectionsProvider = new DefaultNodeCollectionsProvider(); - private final EventProvider eventProvider; - - private EventProvider createEventProvider() { - if (getConfig().flightRecorder) { - Iterable sl = Services.load(EventProvider.class); - EventProvider singleProvider = null; - for (EventProvider ep : sl) { - assert singleProvider == null : String.format("multiple %s service implementations found: %s and %s", EventProvider.class.getName(), singleProvider.getClass().getName(), - ep.getClass().getName()); - singleProvider = ep; - } - return singleProvider; - } - return new EmptyEventProvider(); - } - @SuppressWarnings("unchecked") @Override public T getCapability(Class clazz) { @@ -382,8 +361,6 @@ return (T) this; } else if (clazz == SnippetReflectionProvider.class) { return (T) getHostProviders().getSnippetReflection(); - } else if (clazz == EventProvider.class) { - return (T) eventProvider; } return null; } diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/events/EmptyEventProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/events/EmptyEventProvider.java Mon Jun 01 22:12:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.events; - -import com.oracle.jvmci.common.*; - -/** - * An empty implementation for {@link EventProvider}. This implementation is used when no logging is - * requested. - */ -public final class EmptyEventProvider implements EventProvider { - - public CompilationEvent newCompilationEvent() { - return new EmptyCompilationEvent(); - } - - class EmptyCompilationEvent implements CompilationEvent { - public void commit() { - throw JVMCIError.shouldNotReachHere(); - } - - public boolean shouldWrite() { - // Events of this class should never been written. - return false; - } - - public void begin() { - } - - public void end() { - } - - public void setMethod(String method) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setCompileId(int compileId) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setCompileLevel(int compileLevel) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setSucceeded(boolean succeeded) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setIsOsr(boolean isOsr) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setCodeSize(int codeSize) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setInlinedBytes(int inlinedBytes) { - throw JVMCIError.shouldNotReachHere(); - } - } - - public CompilerFailureEvent newCompilerFailureEvent() { - return new EmptyCompilerFailureEvent(); - } - - class EmptyCompilerFailureEvent implements CompilerFailureEvent { - public void commit() { - throw JVMCIError.shouldNotReachHere(); - } - - public boolean shouldWrite() { - // Events of this class should never been written. - return false; - } - - public void setCompileId(int compileId) { - throw JVMCIError.shouldNotReachHere(); - } - - public void setMessage(String message) { - throw JVMCIError.shouldNotReachHere(); - } - } - -} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/events/EventProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/events/EventProvider.java Mon Jun 01 22:12:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.events; - -/** - * A provider that provides a specific implementation for events that can be logged in the compiler. - */ -public interface EventProvider { - - /** - * An instant event is an event that is not considered to have taken any time. - */ - interface InstantEvent { - /** - * Commits the event. - */ - void commit(); - - /** - * Determines if this particular event instance would be committed to the data stream right - * now if application called {@link #commit()}. This in turn depends on whether the event is - * enabled and possible other factors. - * - * @return if this event would be committed on a call to {@link #commit()}. - */ - boolean shouldWrite(); - } - - /** - * Timed events describe an operation that somehow consumes time. - */ - interface TimedEvent extends InstantEvent { - /** - * Starts the timing for this event. - */ - void begin(); - - /** - * Ends the timing period for this event. - */ - void end(); - } - - /** - * Creates a new {@link CompilationEvent}. - * - * @return a compilation event - */ - CompilationEvent newCompilationEvent(); - - /** - * A compilation event. - */ - interface CompilationEvent extends TimedEvent { - void setMethod(String method); - - void setCompileId(int compileId); - - void setCompileLevel(int compileLevel); - - void setSucceeded(boolean succeeded); - - void setIsOsr(boolean isOsr); - - void setCodeSize(int codeSize); - - void setInlinedBytes(int inlinedBytes); - } - - /** - * Creates a new {@link CompilerFailureEvent}. - * - * @return a compiler failure event - */ - CompilerFailureEvent newCompilerFailureEvent(); - - /** - * A compiler failure event. - */ - interface CompilerFailureEvent extends InstantEvent { - void setCompileId(int compileId); - - void setMessage(String message); - } -} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestResolvedJavaMethod.java --- a/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestResolvedJavaMethod.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestResolvedJavaMethod.java Mon Jun 01 22:13:10 2015 +0200 @@ -358,6 +358,7 @@ "isInVirtualMethodTable", "toParameterTypes", "getParameterAnnotation", + "getSpeculationLog", "$jacocoInit" }; // @formatter:on diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java Mon Jun 01 22:13:10 2015 +0200 @@ -22,9 +22,8 @@ */ package com.oracle.graal.phases.tiers; -import com.oracle.jvmci.code.SpeculationLog; import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.meta.ProfilingInfo; +import com.oracle.jvmci.meta.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.util.*; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitCore.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitCore.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitCore.java Mon Jun 01 22:13:10 2015 +0200 @@ -104,7 +104,7 @@ } } try { - classes.add(Class.forName(each)); + classes.add(Class.forName(each, false, GraalJUnitCore.class.getClassLoader())); } catch (ClassNotFoundException e) { system.out().println("Could not find class: " + each); Description description = Description.createSuiteDescription(each); diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java Mon Jun 01 22:13:10 2015 +0200 @@ -23,8 +23,8 @@ package com.oracle.graal.truffle; import com.oracle.jvmci.code.InstalledCode; -import com.oracle.jvmci.code.SpeculationLog; import com.oracle.jvmci.code.BailoutException; + import static com.oracle.graal.truffle.TruffleCompilerOptions.*; import java.io.*; @@ -36,6 +36,7 @@ import com.oracle.graal.truffle.debug.*; import com.oracle.jvmci.common.*; import com.oracle.jvmci.debug.*; +import com.oracle.jvmci.meta.*; import com.oracle.truffle.api.*; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.frame.*; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java Mon Jun 01 22:13:10 2015 +0200 @@ -25,11 +25,9 @@ import com.oracle.jvmci.code.CallingConvention; import com.oracle.jvmci.code.CodeCacheProvider; import com.oracle.jvmci.code.InstalledCode; -import com.oracle.jvmci.code.SpeculationLog; import com.oracle.jvmci.code.CompilationResult; -import com.oracle.jvmci.meta.MetaAccessProvider; -import com.oracle.jvmci.meta.ResolvedJavaType; -import com.oracle.jvmci.meta.ConstantReflectionProvider; +import com.oracle.jvmci.meta.*; + import static com.oracle.jvmci.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java --- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java Mon Jun 01 22:13:10 2015 +0200 @@ -22,9 +22,7 @@ */ package com.oracle.jvmci.code; -import com.oracle.jvmci.meta.Constant; -import com.oracle.jvmci.meta.ResolvedJavaMethod; -import com.oracle.jvmci.meta.JavaConstant; +import com.oracle.jvmci.meta.*; import com.oracle.jvmci.code.CompilationResult.DataPatch; import com.oracle.jvmci.code.DataSection.Data; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SpeculationLog.java --- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SpeculationLog.java Mon Jun 01 22:12:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.jvmci.code; - -import com.oracle.jvmci.meta.JavaConstant; -import java.util.*; -import java.util.concurrent.*; - -/** - * Manages a list of unique deoptimization reasons. - * - */ -public abstract class SpeculationLog { - private volatile Object lastFailed; - private volatile Collection speculations; - private Set failedSpeculations; - - public synchronized void collectFailedSpeculations() { - if (lastFailed != null) { - if (failedSpeculations == null) { - failedSpeculations = new HashSet<>(2); - } - failedSpeculations.add(lastFailed); - lastFailed = null; - speculations = null; - } - } - - public boolean maySpeculate(Object reason) { - if (failedSpeculations != null && failedSpeculations.contains(reason)) { - return false; - } - return true; - } - - protected void addSpeculation(Object reason) { - assert maySpeculate(reason); - if (speculations == null) { - synchronized (this) { - if (speculations == null) { - speculations = new ConcurrentLinkedQueue<>(); - } - } - } - speculations.add(reason); - } - - public abstract JavaConstant speculate(Object reason); -} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java --- a/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java Mon Jun 01 22:13:10 2015 +0200 @@ -23,7 +23,7 @@ /** * Package that defines the interface between a Java application that wants to install code and the runtime. * The runtime provides in implementation of the {@link com.oracle.jvmci.code.CodeCacheProvider} interface. - * The method {@link com.oracle.jvmci.code.CodeCacheProvider#addMethod(com.oracle.jvmci.meta.ResolvedJavaMethod, CompilationResult, SpeculationLog, InstalledCode)} + * The method {@link com.oracle.jvmci.code.CodeCacheProvider#addMethod(com.oracle.jvmci.meta.ResolvedJavaMethod, CompilationResult, com.oracle.jvmci.meta.SpeculationLog, InstalledCode)} * can be used to install code for a given method. */ package com.oracle.jvmci.code; diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot.jfr/src/com/oracle/jvmci/hotspot/jfr/events/JFREventProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.hotspot.jfr/src/com/oracle/jvmci/hotspot/jfr/events/JFREventProvider.java Mon Jun 01 22:13:10 2015 +0200 @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.jvmci.hotspot.jfr.events; + +import java.net.*; + +import com.oracle.jrockit.jfr.*; +import com.oracle.jvmci.hotspot.*; +import com.oracle.jvmci.hotspot.events.*; +import com.oracle.jvmci.hotspot.events.EmptyEventProvider.EmptyCompilerFailureEvent; +import com.oracle.jvmci.hotspot.events.EmptyEventProvider.EmptyCompilationEvent; +import com.oracle.jvmci.service.*; + +/** + * A JFR implementation for {@link EventProvider}. This implementation is used when Flight Recorder + * is turned on. + */ +@ServiceProvider(EventProvider.class) +public final class JFREventProvider implements EventProvider { + + private final boolean enabled; + + @SuppressWarnings("deprecation") + public JFREventProvider() { + enabled = HotSpotJVMCIRuntime.runtime().getConfig().flightRecorder; + if (enabled) { + try { + /* + * The "HotSpot JVM" producer is a native producer and we cannot use it. So we + * create our own. This has the downside that Mission Control is confused and + * doesn't show Graal's events in the "Code" tab. There are plans to revise the JFR + * code for JDK 9. + */ + Producer producer = new Producer("HotSpot JVM", "Oracle Hotspot JVM", "http://www.oracle.com/hotspot/jvm/"); + producer.register(); + // Register event classes with Producer. + for (Class c : JFREventProvider.class.getDeclaredClasses()) { + if (c.isAnnotationPresent(EventDefinition.class)) { + assert com.oracle.jrockit.jfr.InstantEvent.class.isAssignableFrom(c) : c; + registerEvent(producer, c); + } + } + } catch (URISyntaxException e) { + throw new InternalError(e); + } + } + } + + /** + * Register an event class with the {@link Producer}. + * + * @param c event class + * @return the {@link EventToken event token} + */ + @SuppressWarnings({"deprecation", "javadoc", "unchecked"}) + private static EventToken registerEvent(Producer producer, Class c) { + try { + return producer.addEvent((Class) c); + } catch (InvalidEventDefinitionException | InvalidValueException e) { + throw new InternalError(e); + } + } + + public CompilationEvent newCompilationEvent() { + if (enabled) { + return new JFRCompilationEvent(); + } + return new EmptyCompilationEvent(); + } + + /** + * A JFR compilation event. + * + *

+ * See: event {@code Compilation} in {@code src/share/vm/trace/trace.xml} + */ + @SuppressWarnings("deprecation") + @EventDefinition(name = "Compilation", path = "vm/compiler/compilation") + public static class JFRCompilationEvent extends com.oracle.jrockit.jfr.DurationEvent implements CompilationEvent { + + /* + * FIXME method should be a Method* but we can't express that in Java. + */ + @ValueDefinition(name = "Java Method") public String method; + @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId; + @ValueDefinition(name = "Compilation Level") public short compileLevel; + @ValueDefinition(name = "Succeeded") public boolean succeeded; + @ValueDefinition(name = "On Stack Replacement") public boolean isOsr; + @ValueDefinition(name = "Compiled Code Size", contentType = ContentType.Bytes) public int codeSize; + @ValueDefinition(name = "Inlined Code Size", contentType = ContentType.Bytes) public int inlinedBytes; + + public void setMethod(String method) { + this.method = method; + } + + public void setCompileId(int id) { + this.compileId = id; + } + + public void setCompileLevel(int compileLevel) { + this.compileLevel = (short) compileLevel; + } + + public void setSucceeded(boolean succeeded) { + this.succeeded = succeeded; + } + + public void setIsOsr(boolean isOsr) { + this.isOsr = isOsr; + } + + public void setCodeSize(int codeSize) { + this.codeSize = codeSize; + } + + public void setInlinedBytes(int inlinedBytes) { + this.inlinedBytes = inlinedBytes; + } + } + + public CompilerFailureEvent newCompilerFailureEvent() { + if (enabled) { + return new JFRCompilerFailureEvent(); + } + return new EmptyCompilerFailureEvent(); + } + + /** + * A JFR compiler failure event. + * + *

+ * See: event {@code CompilerFailure} in {@code src/share/vm/trace/trace.xml} + */ + @SuppressWarnings("deprecation") + @EventDefinition(name = "Compilation Failure", path = "vm/compiler/failure") + public static class JFRCompilerFailureEvent extends com.oracle.jrockit.jfr.InstantEvent implements CompilerFailureEvent { + + @ValueDefinition(name = "Compilation ID", relationKey = "COMP_ID") public int compileId; + @ValueDefinition(name = "Message", description = "The failure message") public String failure; + + public void setCompileId(int id) { + this.compileId = id; + } + + public void setMessage(String message) { + this.failure = message; + } + } + +} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java Mon Jun 01 22:13:10 2015 +0200 @@ -26,6 +26,7 @@ import static com.oracle.jvmci.hotspot.InitTimer.*; import com.oracle.jvmci.code.*; +import com.oracle.jvmci.meta.*; /** * Entries into the HotSpot VM from Java code. diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java Mon Jun 01 22:13:10 2015 +0200 @@ -97,7 +97,7 @@ /** * Try to convert {@code offset} into an an index into {@code array}. * - * @return -1 if the offset isn't within the array or the computed index + * @return the computed index or -1 if the offset isn't within the array */ private int indexForOffset(JavaConstant array, long offset) { if (array.getKind() != Kind.Object || array.isNull()) { diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java Mon Jun 01 22:13:10 2015 +0200 @@ -24,7 +24,6 @@ import java.lang.reflect.*; -import com.oracle.jvmci.code.*; import com.oracle.jvmci.meta.*; /** @@ -85,8 +84,6 @@ */ boolean hasCompiledCodeAtLevel(int level); - ProfilingInfo getCompilationProfilingInfo(boolean isOSR); - default boolean isDefault() { if (isConstructor()) { return false; @@ -116,6 +113,4 @@ int allocateCompileId(int entryBCI); boolean hasCodeAtLevel(int entryBCI, int level); - - SpeculationLog getSpeculationLog(); } diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java Mon Jun 01 22:13:10 2015 +0200 @@ -30,7 +30,6 @@ import java.lang.reflect.*; import java.util.*; -import com.oracle.jvmci.code.*; import com.oracle.jvmci.common.*; import com.oracle.jvmci.debug.*; import com.oracle.jvmci.meta.*; @@ -411,15 +410,7 @@ private static final String TraceMethodDataFilter = System.getProperty("graal.traceMethodDataFilter"); @Override - public ProfilingInfo getProfilingInfo() { - return getProfilingInfo(true, true); - } - - public ProfilingInfo getCompilationProfilingInfo(boolean isOSR) { - return getProfilingInfo(!isOSR, isOSR); - } - - private ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) { + public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) { ProfilingInfo info; if (UseProfilingInformation.getValue() && methodData == null) { diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java Mon Jun 01 22:13:10 2015 +0200 @@ -22,7 +22,6 @@ */ package com.oracle.jvmci.hotspot; -import com.oracle.jvmci.code.*; import com.oracle.jvmci.meta.*; public class HotSpotSpeculationLog extends SpeculationLog { diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EmptyEventProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EmptyEventProvider.java Mon Jun 01 22:13:10 2015 +0200 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.jvmci.hotspot.events; + +import com.oracle.jvmci.common.*; + +/** + * An empty implementation for {@link EventProvider}. This implementation is used when no logging is + * requested. + */ +public final class EmptyEventProvider implements EventProvider { + + public CompilationEvent newCompilationEvent() { + return new EmptyCompilationEvent(); + } + + public static class EmptyCompilationEvent implements CompilationEvent { + public void commit() { + throw JVMCIError.shouldNotReachHere(); + } + + public boolean shouldWrite() { + // Events of this class should never been written. + return false; + } + + public void begin() { + } + + public void end() { + } + + public void setMethod(String method) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setCompileId(int compileId) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setCompileLevel(int compileLevel) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setSucceeded(boolean succeeded) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setIsOsr(boolean isOsr) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setCodeSize(int codeSize) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setInlinedBytes(int inlinedBytes) { + throw JVMCIError.shouldNotReachHere(); + } + } + + public CompilerFailureEvent newCompilerFailureEvent() { + return new EmptyCompilerFailureEvent(); + } + + public static class EmptyCompilerFailureEvent implements CompilerFailureEvent { + public void commit() { + throw JVMCIError.shouldNotReachHere(); + } + + public boolean shouldWrite() { + // Events of this class should never been written. + return false; + } + + public void setCompileId(int compileId) { + throw JVMCIError.shouldNotReachHere(); + } + + public void setMessage(String message) { + throw JVMCIError.shouldNotReachHere(); + } + } + +} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EventProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/events/EventProvider.java Mon Jun 01 22:13:10 2015 +0200 @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.jvmci.hotspot.events; + +import com.oracle.jvmci.service.*; + +/** + * A provider that provides a specific implementation for events that can be logged in the compiler. + */ +public interface EventProvider extends Service { + + /** + * An instant event is an event that is not considered to have taken any time. + */ + interface InstantEvent { + /** + * Commits the event. + */ + void commit(); + + /** + * Determines if this particular event instance would be committed to the data stream right + * now if application called {@link #commit()}. This in turn depends on whether the event is + * enabled and possible other factors. + * + * @return if this event would be committed on a call to {@link #commit()}. + */ + boolean shouldWrite(); + } + + /** + * Timed events describe an operation that somehow consumes time. + */ + interface TimedEvent extends InstantEvent { + /** + * Starts the timing for this event. + */ + void begin(); + + /** + * Ends the timing period for this event. + */ + void end(); + } + + /** + * Creates a new {@link CompilationEvent}. + * + * @return a compilation event + */ + CompilationEvent newCompilationEvent(); + + /** + * A compilation event. + */ + interface CompilationEvent extends TimedEvent { + void setMethod(String method); + + void setCompileId(int compileId); + + void setCompileLevel(int compileLevel); + + void setSucceeded(boolean succeeded); + + void setIsOsr(boolean isOsr); + + void setCodeSize(int codeSize); + + void setInlinedBytes(int inlinedBytes); + } + + /** + * Creates a new {@link CompilerFailureEvent}. + * + * @return a compiler failure event + */ + CompilerFailureEvent newCompilerFailureEvent(); + + /** + * A compiler failure event. + */ + interface CompilerFailureEvent extends InstantEvent { + void setCompileId(int compileId); + + void setMessage(String message); + } +} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java --- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java Mon Jun 01 22:13:10 2015 +0200 @@ -64,7 +64,7 @@ /** * Reads a value from the given array at the given offset if it is a stable array. The offset - * will decoded relative to the platform addressing into an index into the array. Returns + * will be decoded relative to the platform addressing into an index into the array. Returns * {@code null} if the constant is not a stable array, if it is a default value, if the offset * is out of bounds, or if the value is not available at this point. */ diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java --- a/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java Mon Jun 01 22:13:10 2015 +0200 @@ -128,7 +128,23 @@ /** * Returns an object that provides access to the profiling information recorded for this method. */ - ProfilingInfo getProfilingInfo(); + default ProfilingInfo getProfilingInfo() { + return getProfilingInfo(true, true); + } + + /** + * Returns an object that provides access to the profiling information recorded for this method. + * + * @param includeNormal if true, + * {@linkplain ProfilingInfo#getDeoptimizationCount(DeoptimizationReason) + * deoptimization counts} will include deoptimization that happened during execution + * of standard non-osr methods. + * @param includeOSR if true, + * {@linkplain ProfilingInfo#getDeoptimizationCount(DeoptimizationReason) + * deoptimization counts} will include deoptimization that happened during execution + * of on-stack-replacement methods. + */ + ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR); /** * Invalidates the profiling information and restarts profiling upon the next invocation. @@ -295,4 +311,6 @@ default boolean isJavaLangObjectInit() { return getDeclaringClass().isJavaLangObject() && getName().equals(""); } + + SpeculationLog getSpeculationLog(); } diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SpeculationLog.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SpeculationLog.java Mon Jun 01 22:13:10 2015 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.jvmci.meta; + +import java.util.*; +import java.util.concurrent.*; + +/** + * Manages a list of unique deoptimization reasons. + * + */ +public abstract class SpeculationLog { + private volatile Object lastFailed; + private volatile Collection speculations; + private Set failedSpeculations; + + public synchronized void collectFailedSpeculations() { + if (lastFailed != null) { + if (failedSpeculations == null) { + failedSpeculations = new HashSet<>(2); + } + failedSpeculations.add(lastFailed); + lastFailed = null; + speculations = null; + } + } + + public boolean maySpeculate(Object reason) { + if (failedSpeculations != null && failedSpeculations.contains(reason)) { + return false; + } + return true; + } + + protected void addSpeculation(Object reason) { + assert maySpeculate(reason); + if (speculations == null) { + synchronized (this) { + if (speculations == null) { + speculations = new ConcurrentLinkedQueue<>(); + } + } + } + speculations.add(reason); + } + + public abstract JavaConstant speculate(Object reason); +} diff -r 2c6802ac343c -r 7eb156f30b61 graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java --- a/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java Mon Jun 01 22:12:57 2015 +0200 +++ b/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java Mon Jun 01 22:13:10 2015 +0200 @@ -22,8 +22,6 @@ */ package com.oracle.jvmci.service; -import static java.lang.String.*; - import java.util.*; import sun.reflect.*; @@ -39,23 +37,23 @@ private static final ClassValue> cache = new ClassValue>() { @Override protected List computeValue(Class type) { - Service[] names = getServiceImpls(type); - if (names == null || names.length == 0) { - throw new InternalError( - format("No implementations for %s found (ensure %s extends %s and that in suite.py the \"annotationProcessors\" attribute for the project enclosing %s includes \"com.oracle.jvmci.service.processor\")", - type.getSimpleName(), type.getSimpleName(), Service.class, type.getSimpleName())); - } - return Arrays.asList(names); + return Arrays.asList(getServiceImpls(type)); } }; /** * Gets an {@link Iterable} of the implementations available for a given service. + * + * @throws SecurityException if a security manager is present and it denies + * {@link RuntimePermission}("jvmciServices") */ @SuppressWarnings("unchecked") @CallerSensitive public static Iterable load(Class service) { - // TODO(ds): add SecurityManager checks + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission("jvmciServices")); + } if (Service.class.isAssignableFrom(service)) { try { return (Iterable) cache.get(service); @@ -76,11 +74,16 @@ * @param service the service whose implementation is being requested * @param required specifies if an {@link InternalError} should be thrown if no implementation * of {@code service} is available + * @throws SecurityException if a security manager is present and it denies + * {@link RuntimePermission}("jvmciServices") */ @SuppressWarnings("unchecked") @CallerSensitive public static S loadSingle(Class service, boolean required) { - // TODO(ds): add SecurityManager checks + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission("jvmciServices")); + } Iterable impls = null; if (Service.class.isAssignableFrom(service)) { try { @@ -114,5 +117,10 @@ return singleImpl; } + static { + Reflection.registerMethodsToFilter(Services.class, "getServiceImpls"); + Reflection.registerFieldsToFilter(Services.class, "cache"); + } + private static native S[] getServiceImpls(Class service); } diff -r 2c6802ac343c -r 7eb156f30b61 graal/findbugs-SuppressFBWarnings.jar Binary file graal/findbugs-SuppressFBWarnings.jar has changed diff -r 2c6802ac343c -r 7eb156f30b61 lib/findbugs-SuppressFBWarnings.jar Binary file lib/findbugs-SuppressFBWarnings.jar has changed diff -r 2c6802ac343c -r 7eb156f30b61 make/Makefile --- a/make/Makefile Mon Jun 01 22:12:57 2015 +0200 +++ b/make/Makefile Mon Jun 01 22:13:10 2015 +0200 @@ -63,6 +63,10 @@ # Default is build both product fastdebug and create export area + +# Directory for shared code (e.g. jvmci.jar) +SHARED_DIR=$(OUTPUTDIR)/shared + # Allow to build HotSpot in local directory from sources specified by GAMMADIR. # After make/defs.make GAMMADIR is defined. ifdef GAMMADIR @@ -84,9 +88,6 @@ ALT_OUT= endif -# Directory for shared code (e.g. jvmci.jar) -SHARED_DIR=$(OUTPUTDIR)/shared - # Typical C1/C2 targets made available with this Makefile C1_VM_TARGETS=product1 fastdebug1 optimized1 debug1 C2_VM_TARGETS=product fastdebug optimized debug diff -r 2c6802ac343c -r 7eb156f30b61 make/defs.make --- a/make/defs.make Mon Jun 01 22:12:57 2015 +0200 +++ b/make/defs.make Mon Jun 01 22:13:10 2015 +0200 @@ -343,6 +343,7 @@ EXPORT_JRE_LIB_EXT_DIR = $(EXPORT_JRE_LIB_DIR)/ext EXPORT_JRE_LIB_JVMCI_DIR = $(EXPORT_JRE_LIB_DIR)/jvmci EXPORT_JRE_LIB_JVMCI_SERVICES_DIR = $(EXPORT_JRE_LIB_JVMCI_DIR)/services +EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR = $(EXPORT_JRE_LIB_JVMCI_DIR)/options EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)/$(LIBARCH) # non-universal macosx builds need to appear universal @@ -369,6 +370,10 @@ EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotVMEventListener EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.debug.DebugInitializationPropertyProvider +ifneq ("$(wildcard $(SHARED_DIR)/services/com.oracle.jvmci.hotspot.events.EventProvider)","") +EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.events.EventProvider +endif + EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.api.runtime.GraalRuntimeAccess EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.compiler.match.MatchStatementSet EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.hotspot.HotSpotBackendFactory @@ -398,7 +403,6 @@ EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.InstanceOfSnippets EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.MonitorSnippets EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.NewObjectSnippets -EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.java.AbstractBytecodeParser EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LinearScan EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LocationMarker EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.OptimizingLinearScanWalker diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/debug.make diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/fastdebug.make diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/mapfile-vers-GRAAL --- a/make/solaris/makefiles/mapfile-vers-GRAAL Mon Jun 01 22:12:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -# - -# -# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Define public interface. -SUNWprivate_1.1 { - global: -}; diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/mapfile-vers-JVMCI --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/solaris/makefiles/mapfile-vers-JVMCI Mon Jun 01 22:13:10 2015 +0200 @@ -0,0 +1,30 @@ +# + +# +# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# + +# Define public interface. +SUNWprivate_1.1 { + global: +}; diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/optimized.make diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/product.make diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/reorder_GRAAL_amd64 diff -r 2c6802ac343c -r 7eb156f30b61 make/solaris/makefiles/reorder_JVMCI_amd64 diff -r 2c6802ac343c -r 7eb156f30b61 mx/FilterTypes.java --- a/mx/FilterTypes.java Mon Jun 01 22:12:57 2015 +0200 +++ b/mx/FilterTypes.java Mon Jun 01 22:13:10 2015 +0200 @@ -34,8 +34,8 @@ StringBuilder buf = new StringBuilder(); for (int i = 1; i < args.length; ++i) { String serviceName = args[i]; - Class service = Class.forName(serviceName, false, FilterTypes.class.getClassLoader()); - if (jvmciServiceInterface.isAssignableFrom(service)) { + Class service = lookupService(serviceName); + if (service != null && jvmciServiceInterface.isAssignableFrom(service)) { if (buf.length() != 0) { buf.append('|'); } @@ -45,4 +45,19 @@ } System.out.print(buf); } + + private static Class lookupService(String serviceName) { + try { + // This can fail in the case of running against a JDK + // with out of date JVMCI jars. In that case, just print + // a warning sinc the expectation is that the jars will be + // updated later on. + return Class.forName(serviceName, false, FilterTypes.class.getClassLoader()); + } catch (ClassNotFoundException e) { + // Must be stderr to avoid polluting the result being + // written to stdout. + System.err.println(e); + return null; + } + } } diff -r 2c6802ac343c -r 7eb156f30b61 mx/mx_graal.py --- a/mx/mx_graal.py Mon Jun 01 22:12:57 2015 +0200 +++ b/mx/mx_graal.py Mon Jun 01 22:13:10 2015 +0200 @@ -54,6 +54,8 @@ 'client-nojvmci' : None, # all compilation with client compiler, JVMCI omitted 'original' : None, # default VM copied from bootstrap JDK 'graal' : None, # alias for jvmci + 'server-nograal' : None, # alias for server-nojvmci + 'client-nograal' : None, # alias for client-nojvmci } """ The VM that will be run by the 'vm' command and built by default by the 'build' command. @@ -121,12 +123,12 @@ return _vm vm = mx.get_env('DEFAULT_VM') envPath = join(_graal_home, 'mx', 'env') - if vm == 'graal': + if vm and 'graal' in vm: if exists(envPath): with open(envPath) as fp: - if 'DEFAULT_VM=graal' in fp.read(): - mx.log('Please update the DEFAULT_VM entry in ' + envPath + ' to use "jvmci" instead of "graal" as the value') - vm = 'jvmci' + if 'DEFAULT_VM=' + vm in fp.read(): + mx.log('Please update the DEFAULT_VM value in ' + envPath + ' to replace "graal" with "jvmci"') + vm = vm.replace('graal', 'jvmci') if vm is None: if not mx.is_interactive(): mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable') @@ -555,7 +557,7 @@ """ _, binDir = mx._compile_mx_class('FilterTypes', os.pathsep.join(classpath), myDir=dirname(__file__)) cmd = [mx.java().java, '-cp', mx._cygpathU2W(os.pathsep.join([binDir] + classpath)), 'FilterTypes', 'com.oracle.jvmci.service.Service'] + serviceImplNames - services = subprocess.check_output(cmd, stderr=subprocess.PIPE) + services = subprocess.check_output(cmd) if len(services) == 0: return [] return services.split('|') @@ -1296,7 +1298,7 @@ if _get_vm() != 'jvmci': prefixArgs = ['-esa', '-ea'] else: - prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] + prefixArgs = ['-XX:-BootstrapJVMCI', '-esa', '-ea'] if gc_after_test: prefixArgs.append('-XX:-DisableExplicitGC') with open(testfile) as fp: @@ -1523,11 +1525,18 @@ # a non-None value from __enter__. The body of a 'with Task(...) as t' # statement should check 't' and exit immediately if it is None. filters = None + filtersExclude = False def __init__(self, title, tasks=None): self.tasks = tasks self.title = title - self.skipped = tasks is not None and Task.filters is not None and not any([f in title for f in Task.filters]) + if tasks is not None and Task.filters is not None: + if Task.filtersExclude: + self.skipped = any([f in title for f in Task.filters]) + else: + self.skipped = not any([f in title for f in Task.filters]) + else: + self.skipped = False if not self.skipped: self.start = time.time() self.end = None @@ -1710,6 +1719,7 @@ parser.add_argument('-i', '--omit-ide-clean', action='store_false', dest='cleanIde', help='omit cleaning the ide project files') parser.add_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM') parser.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run') + parser.add_argument('-x', action='store_true', help='makes --task-filter an exclusion instead of inclusion filter') parser.add_argument('--jacocout', help='specify the output directory for jacoco report') args = parser.parse_args(args) @@ -1717,6 +1727,9 @@ global _jacoco if args.task_filter: Task.filters = args.task_filter.split(',') + Task.filtersExclude = args.x + elif args.x: + mx.abort('-x option cannot be used without --task-filter option') # Force if not mx._opts.strict_compliance: @@ -2651,8 +2664,7 @@ if hasattr(opts, 'vm') and opts.vm is not None: global _vm _vm = opts.vm - if _vm == 'graal': - _vm = 'jvmci' + _vm = _vm.replace('graal', 'jvmci') if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: global _vmbuild _vmbuild = opts.vmbuild diff -r 2c6802ac343c -r 7eb156f30b61 mx/suite.py --- a/mx/suite.py Mon Jun 01 22:12:57 2015 +0200 +++ b/mx/suite.py Mon Jun 01 22:13:10 2015 +0200 @@ -81,7 +81,7 @@ }, "FINDBUGS" : { - "path" : "lib/findbugs-SuppressFBWarnings.jar", + "path" : "graal/findbugs-SuppressFBWarnings.jar", "sha1" : "fb78822d27c68fabf2cb2e5e573b3cdb5f9cae2d", }, @@ -166,7 +166,7 @@ "sourceDirs" : ["src"], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "API,Graal", + "workingSets" : "API,JVMCI", }, "com.oracle.jvmci.runtime" : { @@ -177,7 +177,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "API,Graal", + "workingSets" : "API,JVMCI", }, "com.oracle.jvmci.hotspot" : { @@ -197,7 +197,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "API,Graal", + "workingSets" : "JVMCI", }, "com.oracle.nfi" : { @@ -275,7 +275,7 @@ "sourceDirs" : ["src"], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "API,Graal", + "workingSets" : "API,JVMCI", }, "com.oracle.jvmci.code" : { @@ -284,7 +284,7 @@ "dependencies" : ["com.oracle.jvmci.meta"], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "API,Graal", + "workingSets" : "API,JVMCI", }, "com.oracle.graal.api.replacements" : { @@ -328,7 +328,7 @@ "sourceDirs" : ["src"], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "Graal,HotSpot", + "workingSets" : "JVMCI,HotSpot", }, "com.oracle.jvmci.hotspotvmconfig.processor" : { @@ -358,18 +358,18 @@ "workingSets" : "Graal,HotSpot", }, - "com.oracle.graal.hotspot.jfr" : { + "com.oracle.jvmci.hotspot.jfr" : { "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.graal.hotspot", + "com.oracle.jvmci.hotspot", "JFR", ], "checkstyle" : "com.oracle.graal.graph", "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "javaCompliance" : "1.8", "profile" : "", - "workingSets" : "Graal,HotSpot", + "workingSets" : "JVMCI,HotSpot", }, "com.oracle.graal.hotspot.amd64" : { @@ -431,7 +431,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "Graal", + "workingSets" : "JVMCI", }, "com.oracle.jvmci.options.processor" : { @@ -442,7 +442,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "Graal,Codegen", + "workingSets" : "JVMCI,Codegen", }, "com.oracle.jvmci.options.test" : { @@ -455,7 +455,7 @@ "checkstyle" : "com.oracle.graal.graph", "annotationProcessors" : ["com.oracle.jvmci.options.processor"], "javaCompliance" : "1.8", - "workingSets" : "Graal", + "workingSets" : "JVMCI", }, "com.oracle.graal.nodeinfo" : { @@ -512,7 +512,7 @@ "com.oracle.jvmci.service", ], "javaCompliance" : "1.8", - "workingSets" : "Graal,Debug", + "workingSets" : "JVMCI,Debug", }, "com.oracle.jvmci.debug.test" : { @@ -524,7 +524,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "workingSets" : "Graal,Debug,Test", + "workingSets" : "JVMCI,Debug,Test", }, "com.oracle.graal.lir" : { @@ -1268,7 +1268,10 @@ "path" : "build/jvmci-hotspot.jar", "subDir" : "graal", "sourcesPath" : "build/jvmci-hotspot.src.zip", - "dependencies" : ["com.oracle.jvmci.hotspot"], + "dependencies" : [ + "com.oracle.jvmci.hotspot", + "com.oracle.jvmci.hotspot.jfr", + ], "distDependencies" : [ "JVMCI_API", ], @@ -1282,7 +1285,6 @@ "com.oracle.graal.hotspot.amd64", "com.oracle.graal.hotspot.sparc", "com.oracle.graal.hotspot", - "com.oracle.graal.hotspot.jfr", ], "exclude" : ["FINDBUGS"], "distDependencies" : [ diff -r 2c6802ac343c -r 7eb156f30b61 mxtool/mx.py --- a/mxtool/mx.py Mon Jun 01 22:12:57 2015 +0200 +++ b/mxtool/mx.py Mon Jun 01 22:13:10 2015 +0200 @@ -1214,6 +1214,7 @@ # # Removed projects and libraries are also removed from # distributions in they are listed as dependencies. + ommittedDeps = set() for d in sorted_deps(includeLibs=True): if d.isLibrary(): if d.optional: @@ -1226,11 +1227,13 @@ d.optional = True if not path: logv('[omitting optional library {0} as {1} does not exist]'.format(d, d.path)) + ommittedDeps.add(d.name) del _libs[d.name] self.libs.remove(d) elif d.isProject(): if java(d.javaCompliance, cancel='some projects will be omitted which may result in errrors') is None: logv('[omitting project {0} as Java compliance {1} cannot be satisfied by configured JDKs]'.format(d, d.javaCompliance)) + ommittedDeps.add(d.name) del _projects[d.name] self.projects.remove(d) else: @@ -1240,17 +1243,19 @@ if not jreLib.is_present_in_jdk(java(d.javaCompliance)): if jreLib.optional: logv('[omitting project {0} as dependency {1} is missing]'.format(d, name)) + ommittedDeps.add(d.name) del _projects[d.name] self.projects.remove(d) else: abort('JRE library {0} required by {1} not found'.format(jreLib, d)) elif not dependency(name, fatalIfMissing=False): logv('[omitting project {0} as dependency {1} is missing]'.format(d, name)) + ommittedDeps.add(d.name) del _projects[d.name] self.projects.remove(d) for dist in _dists.itervalues(): for name in list(dist.deps): - if not dependency(name, fatalIfMissing=False): + if name in ommittedDeps: logv('[omitting {0} from distribution {1}]'.format(name, dist)) dist.deps.remove(name) diff -r 2c6802ac343c -r 7eb156f30b61 src/os/solaris/vm/thread_solaris.inline.hpp --- a/src/os/solaris/vm/thread_solaris.inline.hpp Mon Jun 01 22:12:57 2015 +0200 +++ b/src/os/solaris/vm/thread_solaris.inline.hpp Mon Jun 01 22:13:10 2015 +0200 @@ -47,7 +47,7 @@ uintptr_t raw = pd_raw_thread_id(); int ix = pd_cache_index(raw); Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix]; - if (candidate->self_raw_id() == raw) { + if (candidate != NULL && candidate->self_raw_id() == raw) { // hit return candidate; } else { diff -r 2c6802ac343c -r 7eb156f30b61 src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Mon Jun 01 22:12:57 2015 +0200 +++ b/src/share/vm/classfile/systemDictionary.hpp Mon Jun 01 22:13:10 2015 +0200 @@ -239,7 +239,7 @@ JVMCI_ONLY(do_klass(StackSlot_klass, com_oracle_jvmci_code_StackSlot, Jvmci)) \ JVMCI_ONLY(do_klass(StackLockValue_klass, com_oracle_jvmci_code_StackLockValue, Jvmci)) \ JVMCI_ONLY(do_klass(VirtualObject_klass, com_oracle_jvmci_code_VirtualObject, Jvmci)) \ - JVMCI_ONLY(do_klass(SpeculationLog_klass, com_oracle_jvmci_code_SpeculationLog, Jvmci)) \ + JVMCI_ONLY(do_klass(SpeculationLog_klass, com_oracle_jvmci_meta_SpeculationLog, Jvmci)) \ JVMCI_ONLY(do_klass(JavaConstant_klass, com_oracle_jvmci_meta_JavaConstant, Jvmci)) \ JVMCI_ONLY(do_klass(PrimitiveConstant_klass, com_oracle_jvmci_meta_PrimitiveConstant, Jvmci)) \ JVMCI_ONLY(do_klass(RawConstant_klass, com_oracle_jvmci_meta_RawConstant, Jvmci)) \ diff -r 2c6802ac343c -r 7eb156f30b61 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Mon Jun 01 22:12:57 2015 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Mon Jun 01 22:13:10 2015 +0200 @@ -331,6 +331,7 @@ JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_NoFinalizableSubclass, "com/oracle/jvmci/meta/Assumptions$NoFinalizableSubclass")) \ JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_ConcreteMethod, "com/oracle/jvmci/meta/Assumptions$ConcreteMethod")) \ JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_CallSiteTargetValue, "com/oracle/jvmci/meta/Assumptions$CallSiteTargetValue")) \ + JVMCI_ONLY(template(com_oracle_jvmci_meta_SpeculationLog, "com/oracle/jvmci/meta/SpeculationLog")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_Call, "com/oracle/jvmci/code/CompilationResult$Call")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_ConstantReference, "com/oracle/jvmci/code/CompilationResult$ConstantReference")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_DataPatch, "com/oracle/jvmci/code/CompilationResult$DataPatch")) \ @@ -352,7 +353,6 @@ JVMCI_ONLY(template(com_oracle_jvmci_code_VirtualObject, "com/oracle/jvmci/code/VirtualObject")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_RegisterSaveLayout, "com/oracle/jvmci/code/RegisterSaveLayout")) \ JVMCI_ONLY(template(com_oracle_jvmci_code_InvalidInstalledCodeException, "com/oracle/jvmci/code/InvalidInstalledCodeException")) \ - JVMCI_ONLY(template(com_oracle_jvmci_code_SpeculationLog, "com/oracle/jvmci/code/SpeculationLog")) \ JVMCI_ONLY(template(compileMetaspaceMethod_name, "compileMetaspaceMethod")) \ JVMCI_ONLY(template(compileMetaspaceMethod_signature, "(JIJI)V")) \ JVMCI_ONLY(template(com_oracle_jvmci_hotspot_Stable_signature, "Lcom/oracle/jvmci/hotspot/Stable;")) \ diff -r 2c6802ac343c -r 7eb156f30b61 src/share/vm/jvmci/jvmciCompilerToVM.cpp --- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp Mon Jun 01 22:12:57 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp Mon Jun 01 22:13:10 2015 +0200 @@ -1034,7 +1034,7 @@ #define TYPE "Lcom/oracle/jvmci/meta/JavaType;" #define METHOD "Lcom/oracle/jvmci/meta/JavaMethod;" #define FIELD "Lcom/oracle/jvmci/meta/JavaField;" -#define SPECULATION_LOG "Lcom/oracle/jvmci/code/SpeculationLog;" +#define SPECULATION_LOG "Lcom/oracle/jvmci/meta/SpeculationLog;" #define STRING "Ljava/lang/String;" #define OBJECT "Ljava/lang/Object;" #define CLASS "Ljava/lang/Class;" diff -r 2c6802ac343c -r 7eb156f30b61 src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Mon Jun 01 22:12:57 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Mon Jun 01 22:13:10 2015 +0200 @@ -1111,7 +1111,12 @@ int file_handle = os::open(path, 0, 0); if (file_handle != -1) { char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal); - int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size); + int num_read; + if(ThreadLocalStorage::thread() == NULL) { // Solaris needs a JavaThread for os::read, if no thread started yet, fallback. + num_read = (int) ::read(file_handle, (char*) buffer, st.st_size); + } else { + num_read = (int) os::read(file_handle, (char*) buffer, st.st_size); + } if (num_read == -1) { warning("Error reading file %s due to %s", path, strerror(errno)); } else if (num_read != st.st_size) { @@ -1200,7 +1205,7 @@ char sep = os::file_separator()[0]; sprintf(path, "%s%clib%cjvmci%cservices%c%s", home, sep, sep, sep, sep, serviceName); ServiceParseClosure closure; - parse_lines(path, &closure, true); // TODO(gd) cache parsing results? + parse_lines(path, &closure, false); GrowableArray* implNames = closure.implNames(); objArrayOop servicesOop = oopFactory::new_objArray(serviceKlass(), implNames->length(), CHECK_(objArrayHandle()));