# HG changeset patch # User Doug Simon # Date 1432911717 -7200 # Node ID 93f282187d90a0df7c19351f074f65f5d678e316 # Parent 4437f0da4b26cca0c8fc1ce8c2030b2dedb622b5 moved JVMCI service API into separate com.oracle.jvmci.service module (JBS:GRAAL-53) diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java --- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Fri May 29 17:01:57 2015 +0200 @@ -26,7 +26,7 @@ import sun.reflect.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * Access point for {@linkplain #getRuntime() retrieving} the single {@link GraalRuntime} instance. @@ -43,7 +43,7 @@ } if (rt != null) { // The constant is patched in-situ by the build system - System.setProperty("graal.version", "@@graal.version@@"); + System.setProperty("graal.version", "@@graal.version@@".trim()); assert !System.getProperty("graal.version").startsWith("@@") && !System.getProperty("graal.version").endsWith("@@") : "Graal version string constant was not patched by build system"; return rt; } diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntimeFactory.java --- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntimeFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntimeFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.graal.api.runtime; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public interface GraalRuntimeFactory extends Service { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfigOptionsParsed.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfigOptionsParsed.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfigOptionsParsed.java Fri May 29 17:01:57 2015 +0200 @@ -24,6 +24,7 @@ import com.oracle.jvmci.debug.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * Implementation of {@link OptionsParsed} for setting system properties used in the initialization diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Fri May 29 17:01:57 2015 +0200 @@ -32,7 +32,7 @@ import com.oracle.jvmci.common.*; import com.oracle.jvmci.debug.*; import com.oracle.jvmci.debug.Debug.Scope; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public class MatchRuleRegistry { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java Fri May 29 17:01:57 2015 +0200 @@ -25,7 +25,7 @@ import java.util.*; import com.oracle.graal.compiler.gen.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public interface MatchStatementSet extends Service { /** diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java Fri May 29 17:01:57 2015 +0200 @@ -28,7 +28,7 @@ import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(CompilerConfiguration.class) public class BasicCompilerConfiguration implements CompilerConfiguration { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EconomyCompilerConfiguration.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EconomyCompilerConfiguration.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EconomyCompilerConfiguration.java Fri May 29 17:01:57 2015 +0200 @@ -28,7 +28,7 @@ import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(CompilerConfiguration.class) public class EconomyCompilerConfiguration implements CompilerConfiguration { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,10 +22,6 @@ */ package com.oracle.graal.hotspot.amd64; -import com.oracle.jvmci.code.Register; -import com.oracle.jvmci.code.RegisterConfig; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.meta.Value; import static com.oracle.jvmci.hotspot.InitTimer.*; import java.util.*; @@ -38,8 +34,11 @@ import com.oracle.graal.hotspot.word.*; import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.amd64.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.hotspot.*; +import com.oracle.jvmci.meta.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(HotSpotBackendFactory.class) public class AMD64HotSpotBackendFactory implements HotSpotBackendFactory { @@ -173,15 +172,15 @@ } else { /* * System V Application Binary Interface, AMD64 Architecture Processor Supplement - * + * * Draft Version 0.96 - * + * * http://www.uclibc.org/docs/psABI-x86_64.pdf - * + * * 3.2.1 - * + * * ... - * + * * This subsection discusses usage of each register. Registers %rbp, %rbx and %r12 * through %r15 "belong" to the calling function and the called function is required to * preserve their values. In other words, a called function must preserve these diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/jvmci/AMD64HotSpotJVMCIBackendFactory.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/jvmci/AMD64HotSpotJVMCIBackendFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/jvmci/AMD64HotSpotJVMCIBackendFactory.java Fri May 29 17:01:57 2015 +0200 @@ -33,6 +33,7 @@ import com.oracle.jvmci.hotspot.*; import com.oracle.jvmci.meta.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(HotSpotJVMCIBackendFactory.class) public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { diff -r 4437f0da4b26 -r 93f282187d90 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 Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.jfr/src/com/oracle/graal/hotspot/jfr/events/JFREventProvider.java Fri May 29 17:01:57 2015 +0200 @@ -26,7 +26,7 @@ import com.oracle.graal.hotspot.events.*; import com.oracle.jrockit.jfr.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * A JFR implementation for {@link EventProvider}. This implementation is used when Flight Recorder diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,10 +22,6 @@ */ package com.oracle.graal.hotspot.sparc; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.code.RegisterConfig; -import com.oracle.jvmci.code.Register; -import com.oracle.jvmci.meta.Value; import java.util.*; import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins; @@ -36,8 +32,11 @@ import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.sparc.*; import com.oracle.graal.sparc.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.hotspot.*; +import com.oracle.jvmci.meta.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(HotSpotBackendFactory.class) public class SPARCHotSpotBackendFactory implements HotSpotBackendFactory { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/jvmci/SPARCHotSpotJVMCIBackendFactory.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/jvmci/SPARCHotSpotJVMCIBackendFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/jvmci/SPARCHotSpotJVMCIBackendFactory.java Fri May 29 17:01:57 2015 +0200 @@ -33,6 +33,7 @@ import com.oracle.jvmci.code.*; import com.oracle.jvmci.hotspot.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(HotSpotJVMCIBackendFactory.class) public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackendFactory.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackendFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackendFactory.java Fri May 29 17:01:57 2015 +0200 @@ -24,6 +24,7 @@ import com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.Options; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public interface HotSpotBackendFactory extends Service { diff -r 4437f0da4b26 -r 93f282187d90 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 Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri May 29 17:01:57 2015 +0200 @@ -51,6 +51,7 @@ import com.oracle.jvmci.meta.*; import com.oracle.jvmci.options.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; //JaCoCo Exclude diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeFactory.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeFactory.java Fri May 29 17:01:57 2015 +0200 @@ -23,7 +23,7 @@ package com.oracle.graal.hotspot; import com.oracle.graal.api.runtime.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(GraalRuntimeFactory.class) public class HotSpotGraalRuntimeFactory implements GraalRuntimeFactory { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java Fri May 29 17:01:57 2015 +0200 @@ -27,7 +27,7 @@ import com.oracle.graal.hotspot.CompileTheWorld.Config; import com.oracle.jvmci.debug.*; import com.oracle.jvmci.hotspot.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; @ServiceProvider(HotSpotVMEventListener.class) public class HotSpotGraalVMEventListener implements HotSpotVMEventListener { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Fri May 29 17:01:57 2015 +0200 @@ -24,6 +24,7 @@ import com.oracle.jvmci.meta.ResolvedJavaMethod; import com.oracle.jvmci.meta.ForeignCallDescriptor; + import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.jvmci.hotspot.InitTimer.*; @@ -33,7 +34,7 @@ import com.oracle.jvmci.debug.*; import com.oracle.jvmci.debug.Debug.Scope; import com.oracle.jvmci.hotspot.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * Common functionality of HotSpot host backends. diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Fri May 29 17:01:57 2015 +0200 @@ -22,16 +22,16 @@ */ package com.oracle.graal.hotspot.replacements; -import com.oracle.jvmci.code.TargetDescription; -import com.oracle.jvmci.meta.MetaAccessProvider; import sun.misc.*; import sun.reflect.*; import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.replacements.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.hotspot.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.meta.*; +import com.oracle.jvmci.service.*; @ServiceProvider(ReplacementsProvider.class) public class HotSpotSubstitutions implements ReplacementsProvider { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java Fri May 29 17:01:57 2015 +0200 @@ -25,7 +25,7 @@ import com.oracle.graal.api.replacements.*; import com.oracle.jvmci.code.*; import com.oracle.jvmci.meta.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * Interface for service providers that register replacements with the compiler. diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java Fri May 29 17:01:57 2015 +0200 @@ -27,7 +27,7 @@ import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext; import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext; import com.oracle.graal.phases.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public interface CompilerConfiguration extends Service { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Fri May 29 17:01:57 2015 +0200 @@ -30,7 +30,7 @@ import com.oracle.graal.phases.*; import com.oracle.jvmci.common.*; import com.oracle.jvmci.options.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public final class Suites { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java --- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,15 +22,7 @@ */ package com.oracle.graal.truffle.hotspot.amd64; -import com.oracle.jvmci.code.Register; -import com.oracle.jvmci.code.InstalledCode; -import com.oracle.jvmci.code.ForeignCallsProvider; -import com.oracle.jvmci.code.CodeCacheProvider; -import com.oracle.jvmci.code.CompilationResult; -import com.oracle.jvmci.meta.Kind; -import com.oracle.jvmci.meta.ResolvedJavaMethod; import com.oracle.graal.amd64.*; -import com.oracle.jvmci.code.CallingConvention.Type; import com.oracle.graal.asm.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; @@ -39,8 +31,11 @@ import com.oracle.graal.lir.framemap.*; import com.oracle.graal.truffle.*; import com.oracle.graal.truffle.hotspot.*; +import com.oracle.jvmci.code.CallingConvention.Type; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.hotspot.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.meta.*; +import com.oracle.jvmci.service.*; @ServiceProvider(OptimizedCallTargetInstrumentationFactory.class) public class AMD64OptimizedCallTargetInstrumentationFactory implements OptimizedCallTargetInstrumentationFactory { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64RawNativeCallNodeFactory.java --- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64RawNativeCallNodeFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64RawNativeCallNodeFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,12 +22,11 @@ */ package com.oracle.graal.truffle.hotspot.amd64; -import com.oracle.jvmci.meta.Kind; -import com.oracle.jvmci.meta.JavaConstant; import com.oracle.graal.hotspot.amd64.*; import com.oracle.graal.nodes.*; import com.oracle.graal.truffle.hotspot.nfi.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.meta.*; +import com.oracle.jvmci.service.*; @ServiceProvider(RawNativeCallNodeFactory.class) public class AMD64RawNativeCallNodeFactory implements RawNativeCallNodeFactory { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java --- a/graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,19 +22,13 @@ */ package com.oracle.graal.truffle.hotspot.sparc; -import com.oracle.jvmci.code.Register; -import com.oracle.jvmci.code.InstalledCode; -import com.oracle.jvmci.code.CompilationResult; -import com.oracle.jvmci.code.ForeignCallsProvider; -import com.oracle.jvmci.code.CodeCacheProvider; -import com.oracle.jvmci.meta.ResolvedJavaMethod; -import static com.oracle.jvmci.code.CallingConvention.Type.*; -import static com.oracle.jvmci.meta.Kind.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*; import static com.oracle.graal.sparc.SPARC.CPUFeature.*; +import static com.oracle.jvmci.code.CallingConvention.Type.*; +import static com.oracle.jvmci.meta.Kind.*; import com.oracle.graal.asm.*; import com.oracle.graal.asm.sparc.*; @@ -44,8 +38,10 @@ import com.oracle.graal.lir.framemap.*; import com.oracle.graal.truffle.*; import com.oracle.graal.truffle.hotspot.*; +import com.oracle.jvmci.code.*; import com.oracle.jvmci.hotspot.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.meta.*; +import com.oracle.jvmci.service.*; @ServiceProvider(OptimizedCallTargetInstrumentationFactory.class) public class SPARCOptimizedCallTargetInstumentationFactory implements OptimizedCallTargetInstrumentationFactory { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Fri May 29 17:01:57 2015 +0200 @@ -29,6 +29,7 @@ import com.oracle.jvmci.meta.ResolvedJavaType; import com.oracle.jvmci.meta.ResolvedJavaMethod; import com.oracle.jvmci.meta.MetaAccessProvider; + import static com.oracle.jvmci.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.graph.util.CollectionsAccess.*; @@ -64,7 +65,7 @@ import com.oracle.jvmci.debug.*; import com.oracle.jvmci.debug.Debug.Scope; import com.oracle.jvmci.hotspot.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; import com.oracle.nfi.api.*; import com.oracle.truffle.api.*; import com.oracle.truffle.api.nodes.*; diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/RawNativeCallNodeFactory.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/RawNativeCallNodeFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/RawNativeCallNodeFactory.java Fri May 29 17:01:57 2015 +0200 @@ -25,7 +25,7 @@ import com.oracle.jvmci.meta.Kind; import com.oracle.jvmci.meta.JavaConstant; import com.oracle.graal.nodes.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * Factory for creating a node that makes a direct call to a native function pointer. diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/DefaultLoopNodeFactory.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/DefaultLoopNodeFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/DefaultLoopNodeFactory.java Fri May 29 17:01:57 2015 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.graal.truffle; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; import com.oracle.truffle.api.nodes.*; @ServiceProvider(LoopNodeFactory.class) diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetInstrumentationFactory.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetInstrumentationFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetInstrumentationFactory.java Fri May 29 17:01:57 2015 +0200 @@ -24,7 +24,7 @@ import com.oracle.jvmci.meta.ResolvedJavaMethod; import com.oracle.graal.lir.asm.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * A service for creating a specialized {@link CompilationResultBuilder} used to inject code into diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java Fri May 29 17:01:57 2015 +0200 @@ -23,6 +23,7 @@ package com.oracle.jvmci.hotspot; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public interface HotSpotJVMCIBackendFactory extends Service { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java Fri May 29 17:01:57 2015 +0200 @@ -35,6 +35,7 @@ import com.oracle.jvmci.meta.*; import com.oracle.jvmci.options.*; import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; //JaCoCo Exclude diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java Fri May 29 17:01:57 2015 +0200 @@ -25,7 +25,7 @@ import java.util.*; import com.oracle.jvmci.options.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; //JaCoCo Exclude diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java --- a/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java Fri May 29 17:01:57 2015 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.jvmci.hotspot; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; public interface HotSpotVMEventListener extends Service { diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java --- a/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java Fri May 29 17:01:57 2015 +0200 @@ -24,7 +24,7 @@ import java.util.*; -import com.oracle.jvmci.runtime.*; +import com.oracle.jvmci.service.*; /** * Helper class used to load option descriptors. Only to be used in the slow-path. diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.runtime.processor/src/META-INF/services/javax.annotation.processing.Processor --- a/graal/com.oracle.jvmci.runtime.processor/src/META-INF/services/javax.annotation.processing.Processor Fri May 29 16:24:25 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -com.oracle.jvmci.runtime.processor.ServiceProviderProcessor diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.runtime.processor/src/com/oracle/jvmci/runtime/processor/ServiceProviderProcessor.java --- a/graal/com.oracle.jvmci.runtime.processor/src/com/oracle/jvmci/runtime/processor/ServiceProviderProcessor.java Fri May 29 16:24:25 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2013, 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.runtime.processor; - -import java.io.*; -import java.util.*; - -import javax.annotation.processing.*; -import javax.lang.model.*; -import javax.lang.model.element.*; -import javax.lang.model.type.*; -import javax.tools.Diagnostic.Kind; -import javax.tools.*; - -import com.oracle.jvmci.runtime.*; - -@SupportedAnnotationTypes("com.oracle.jvmci.runtime.ServiceProvider") -public class ServiceProviderProcessor extends AbstractProcessor { - - private final Set processed = new HashSet<>(); - - @Override - public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latest(); - } - - private boolean verifyAnnotation(TypeMirror serviceInterface, TypeElement serviceProvider) { - if (!processingEnv.getTypeUtils().isSubtype(serviceProvider.asType(), serviceInterface)) { - String msg = String.format("Service provider class %s doesn't implement service interface %s", serviceProvider.getSimpleName(), serviceInterface); - processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider); - return false; - } - - return true; - } - - private void processElement(TypeElement serviceProvider) { - if (processed.contains(serviceProvider)) { - return; - } - - processed.add(serviceProvider); - ServiceProvider annotation = serviceProvider.getAnnotation(ServiceProvider.class); - if (annotation != null) { - try { - annotation.value(); - } catch (MirroredTypeException ex) { - TypeMirror serviceInterface = ex.getTypeMirror(); - if (verifyAnnotation(serviceInterface, serviceProvider)) { - String interfaceName = ex.getTypeMirror().toString(); - createProviderFile(serviceProvider, interfaceName); - } - } - } - } - - private void createProviderFile(TypeElement serviceProvider, String interfaceName) { - if (serviceProvider.getNestingKind().isNested()) { - // This is a simplifying constraint that means we don't have to - // processed the qualified name to insert '$' characters at - // the relevant positions. - String msg = String.format("Service provider class %s must be a top level class", serviceProvider.getSimpleName()); - processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider); - return; - } - - String filename = "META-INF/providers/" + serviceProvider.getQualifiedName(); - try { - FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, serviceProvider); - PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8")); - writer.println(interfaceName); - writer.close(); - } catch (IOException e) { - processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), serviceProvider); - } - } - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (roundEnv.processingOver()) { - return true; - } - - for (Element element : roundEnv.getElementsAnnotatedWith(ServiceProvider.class)) { - assert element.getKind().isClass(); - processElement((TypeElement) element); - } - - return true; - } -} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/OptionsParsed.java --- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/OptionsParsed.java Fri May 29 16:24:25 2015 +0200 +++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/OptionsParsed.java Fri May 29 17:01:57 2015 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.jvmci.runtime; +import com.oracle.jvmci.service.*; + /** * Extension for doing post-processing once all JVMCI options have been parsed and initialized. */ diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/Service.java --- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/Service.java Fri May 29 16:24:25 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013, 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.runtime; - -/** - * Denotes a service that may be efficiently loaded by {@link Services#load(Class)}. - */ -public interface Service { -} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/ServiceProvider.java --- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/ServiceProvider.java Fri May 29 16:24:25 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013, 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.runtime; - -import java.lang.annotation.*; - -@Retention(RetentionPolicy.CLASS) -@Target(ElementType.TYPE) -public @interface ServiceProvider { - - Class value(); -} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/Services.java --- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/Services.java Fri May 29 16:24:25 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +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.jvmci.runtime; - -import static java.lang.String.*; - -import java.util.*; - -/** - * A mechanism on top of the standard {@link ServiceLoader} that enables a runtime to efficiently - * load services marked by {@link Service}. This may be important for services loaded early in the - * runtime initialization process. - */ -public class Services { - - 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.runtime.processor\")", - type.getSimpleName(), type.getSimpleName(), Service.class, type.getSimpleName())); - } - return Arrays.asList(names); - } - }; - - /** - * Gets an {@link Iterable} of the implementations available for a given service. - */ - @SuppressWarnings("unchecked") - public static Iterable load(Class service) { - if (Service.class.isAssignableFrom(service)) { - try { - return (Iterable) cache.get(service); - } catch (UnsatisfiedLinkError e) { - // Fall back to standard SerivceLoader - } - } - return ServiceLoader.load(service, Services.class.getClassLoader()); - } - - private static native S[] getServiceImpls(Class service); -} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.service.processor/src/META-INF/services/javax.annotation.processing.Processor --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.service.processor/src/META-INF/services/javax.annotation.processing.Processor Fri May 29 17:01:57 2015 +0200 @@ -0,0 +1,1 @@ +com.oracle.jvmci.service.processor.ServiceProviderProcessor diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.service.processor/src/com/oracle/jvmci/service/processor/ServiceProviderProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.service.processor/src/com/oracle/jvmci/service/processor/ServiceProviderProcessor.java Fri May 29 17:01:57 2015 +0200 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2013, 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.service.processor; + +import java.io.*; +import java.util.*; + +import javax.annotation.processing.*; +import javax.lang.model.*; +import javax.lang.model.element.*; +import javax.lang.model.type.*; +import javax.tools.Diagnostic.Kind; +import javax.tools.*; + +import com.oracle.jvmci.service.*; + +@SupportedAnnotationTypes("com.oracle.jvmci.service.ServiceProvider") +public class ServiceProviderProcessor extends AbstractProcessor { + + private final Set processed = new HashSet<>(); + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + + private boolean verifyAnnotation(TypeMirror serviceInterface, TypeElement serviceProvider) { + if (!processingEnv.getTypeUtils().isSubtype(serviceProvider.asType(), serviceInterface)) { + String msg = String.format("Service provider class %s doesn't implement service interface %s", serviceProvider.getSimpleName(), serviceInterface); + processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider); + return false; + } + + return true; + } + + private void processElement(TypeElement serviceProvider) { + if (processed.contains(serviceProvider)) { + return; + } + + processed.add(serviceProvider); + ServiceProvider annotation = serviceProvider.getAnnotation(ServiceProvider.class); + if (annotation != null) { + try { + annotation.value(); + } catch (MirroredTypeException ex) { + TypeMirror serviceInterface = ex.getTypeMirror(); + if (verifyAnnotation(serviceInterface, serviceProvider)) { + String interfaceName = ex.getTypeMirror().toString(); + createProviderFile(serviceProvider, interfaceName); + } + } + } + } + + private void createProviderFile(TypeElement serviceProvider, String interfaceName) { + if (serviceProvider.getNestingKind().isNested()) { + // This is a simplifying constraint that means we don't have to + // processed the qualified name to insert '$' characters at + // the relevant positions. + String msg = String.format("Service provider class %s must be a top level class", serviceProvider.getSimpleName()); + processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider); + return; + } + + String filename = "META-INF/providers/" + serviceProvider.getQualifiedName(); + try { + FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, serviceProvider); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8")); + writer.println(interfaceName); + writer.close(); + } catch (IOException e) { + processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), serviceProvider); + } + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (roundEnv.processingOver()) { + return true; + } + + for (Element element : roundEnv.getElementsAnnotatedWith(ServiceProvider.class)) { + assert element.getKind().isClass(); + processElement((TypeElement) element); + } + + return true; + } +} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Service.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Service.java Fri May 29 17:01:57 2015 +0200 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013, 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.service; + +/** + * Denotes a service that may be efficiently loaded by {@link Services#load(Class)}. + */ +public interface Service { +} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/ServiceProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/ServiceProvider.java Fri May 29 17:01:57 2015 +0200 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, 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.service; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE) +public @interface ServiceProvider { + + Class value(); +} diff -r 4437f0da4b26 -r 93f282187d90 graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.service/src/com/oracle/jvmci/service/Services.java Fri May 29 17:01:57 2015 +0200 @@ -0,0 +1,65 @@ +/* + * 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.service; + +import static java.lang.String.*; + +import java.util.*; + +/** + * A mechanism on top of the standard {@link ServiceLoader} that enables a runtime to efficiently + * load services marked by {@link Service}. This may be important for services loaded early in the + * runtime initialization process. + */ +public class Services { + + 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); + } + }; + + /** + * Gets an {@link Iterable} of the implementations available for a given service. + */ + @SuppressWarnings("unchecked") + public static Iterable load(Class service) { + if (Service.class.isAssignableFrom(service)) { + try { + return (Iterable) cache.get(service); + } catch (UnsatisfiedLinkError e) { + // Fall back to standard SerivceLoader + } + } + return ServiceLoader.load(service, Services.class.getClassLoader()); + } + + private static native S[] getServiceImpls(Class service); +} diff -r 4437f0da4b26 -r 93f282187d90 mx/mx_graal.py --- a/mx/mx_graal.py Fri May 29 16:24:25 2015 +0200 +++ b/mx/mx_graal.py Fri May 29 17:01:57 2015 +0200 @@ -570,7 +570,7 @@ classification[className] = False break superInterfaces = afterName[len(' extends '):-len(' {')].split(',') - if 'com.oracle.jvmci.runtime.Service' in superInterfaces: + if 'com.oracle.jvmci.service.Service' in superInterfaces: classification[className] = True break maybe = [_eraseGenerics(superInterface) for superInterface in superInterfaces] diff -r 4437f0da4b26 -r 93f282187d90 mx/suite.py --- a/mx/suite.py Fri May 29 16:24:25 2015 +0200 +++ b/mx/suite.py Fri May 29 17:01:57 2015 +0200 @@ -153,6 +153,14 @@ }, "projects" : { + "com.oracle.jvmci.service" : { + "subDir" : "graal", + "sourceDirs" : ["src"], + "checkstyle" : "com.oracle.graal.graph", + "javaCompliance" : "1.8", + "workingSets" : "API,Graal", + }, + "com.oracle.jvmci.common" : { "subDir" : "graal", "sourceDirs" : ["src"], @@ -165,6 +173,7 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ + "com.oracle.jvmci.service", "com.oracle.jvmci.code" ], "checkstyle" : "com.oracle.graal.graph", @@ -179,6 +188,7 @@ "com.oracle.jvmci.hotspotvmconfig", "com.oracle.jvmci.options", "com.oracle.jvmci.debug", + "com.oracle.jvmci.runtime", "com.oracle.jvmci.common", "FINDBUGS", ], @@ -242,7 +252,7 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.jvmci.runtime", + "com.oracle.jvmci.service", ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", @@ -287,10 +297,10 @@ "workingSets" : "API,Graal,Replacements", }, - "com.oracle.jvmci.runtime.processor" : { + "com.oracle.jvmci.service.processor" : { "subDir" : "graal", "sourceDirs" : ["src"], - "dependencies" : ["com.oracle.jvmci.runtime"], + "dependencies" : ["com.oracle.jvmci.service"], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", "workingSets" : "Codegen,HotSpot", @@ -343,7 +353,7 @@ "checkstyle" : "com.oracle.graal.graph", "annotationProcessors" : [ "com.oracle.graal.replacements.verifier", - "com.oracle.jvmci.runtime.processor", + "com.oracle.jvmci.service.processor", ], "javaCompliance" : "1.8", "workingSets" : "Graal,HotSpot", @@ -366,7 +376,7 @@ "JFR", ], "checkstyle" : "com.oracle.graal.graph", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "javaCompliance" : "1.8", "profile" : "", "workingSets" : "Graal,HotSpot", @@ -381,7 +391,7 @@ "com.oracle.graal.replacements.amd64", ], "checkstyle" : "com.oracle.graal.graph", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "javaCompliance" : "1.8", "workingSets" : "Graal,HotSpot,AMD64", }, @@ -394,7 +404,7 @@ "com.oracle.graal.replacements.sparc", ], "checkstyle" : "com.oracle.graal.graph", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor", "com.oracle.graal.compiler.match.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor", "com.oracle.graal.compiler.match.processor"], "javaCompliance" : "1.8", "workingSets" : "Graal,HotSpot,SPARC", }, @@ -427,7 +437,7 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.jvmci.runtime", + "com.oracle.jvmci.service", ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", @@ -602,7 +612,7 @@ "javaCompliance" : "1.8", "annotationProcessors" : [ "com.oracle.graal.replacements.verifier", - "com.oracle.jvmci.runtime.processor", + "com.oracle.jvmci.service.processor", ], "workingSets" : "Graal,Replacements", }, @@ -616,7 +626,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "workingSets" : "Graal,Replacements,AMD64", }, @@ -741,12 +751,13 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ + "com.oracle.jvmci.runtime", "com.oracle.graal.virtual", "com.oracle.graal.loop", ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "workingSets" : "Graal", }, @@ -832,7 +843,7 @@ "com.oracle.graal.graphbuilderconf" ], "checkstyle" : "com.oracle.graal.graph", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "javaCompliance" : "1.8", "workingSets" : "Graal,Java", }, @@ -869,6 +880,7 @@ "com.oracle.jvmci.options", "com.oracle.jvmci.debug", "com.oracle.jvmci.common", + "com.oracle.jvmci.code", ], "annotationProcessors" : ["com.oracle.jvmci.options.processor"], "checkstyle" : "com.oracle.graal.graph", @@ -1203,7 +1215,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "workingSets" : "Graal,Truffle", }, @@ -1216,7 +1228,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "workingSets" : "Graal,Truffle", }, @@ -1229,7 +1241,7 @@ ], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", - "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"], + "annotationProcessors" : ["com.oracle.jvmci.service.processor"], "workingSets" : "Graal,Truffle,SPARC", } }, diff -r 4437f0da4b26 -r 93f282187d90 src/share/vm/jvmci/jvmciRuntime.hpp --- a/src/share/vm/jvmci/jvmciRuntime.hpp Fri May 29 16:24:25 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.hpp Fri May 29 17:01:57 2015 +0200 @@ -79,7 +79,7 @@ /** * Instantiates a service object, calls its default constructor and returns it. * - * @param name the name of a class implementing com.oracle.jvmci.runtime.Service + * @param name the name of a class implementing com.oracle.jvmci.service.Service */ static Handle create_Service(const char* name, TRAPS); @@ -138,7 +138,7 @@ /** * Given an interface representing a JVMCI service (i.e. sub-interface of - * com.oracle.jvmci.api.runtime.Service), gets an array of objects, one per + * com.oracle.jvmci.api.service.Service), gets an array of objects, one per * known implementation of the service. */ static objArrayHandle get_service_impls(KlassHandle serviceKlass, TRAPS); diff -r 4437f0da4b26 -r 93f282187d90 src/share/vm/prims/nativeLookup.cpp --- a/src/share/vm/prims/nativeLookup.cpp Fri May 29 16:24:25 2015 +0200 +++ b/src/share/vm/prims/nativeLookup.cpp Fri May 29 17:01:57 2015 +0200 @@ -151,7 +151,7 @@ #ifdef JVMCI { CC"Java_com_oracle_jvmci_hotspot_loader_Factory_init", NULL, FN_PTR(JVM_InitJVMCIClassLoader) }, { CC"Java_com_oracle_jvmci_runtime_JVMCI_initializeRuntime", NULL, FN_PTR(JVM_GetJVMCIRuntime) }, - { CC"Java_com_oracle_jvmci_runtime_Services_getServiceImpls", NULL, FN_PTR(JVM_GetJVMCIServiceImpls) }, + { CC"Java_com_oracle_jvmci_service_Services_getServiceImpls", NULL, FN_PTR(JVM_GetJVMCIServiceImpls) }, { CC"Java_com_oracle_truffle_api_Truffle_createRuntime", NULL, FN_PTR(JVM_CreateTruffleRuntime) }, { CC"Java_com_oracle_nfi_NativeFunctionInterfaceRuntime_createInterface", NULL, FN_PTR(JVM_CreateNativeFunctionInterface) }, { CC"Java_com_oracle_jvmci_hotspot_CompilerToVMImpl_init", NULL, FN_PTR(JVM_InitializeJVMCINatives) },