< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntime.java

Print this page
rev 52509 : [mq]: graal2


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 
  27 import static jdk.vm.ci.common.InitTimer.timer;
  28 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  29 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
  30 import static org.graalvm.compiler.core.common.GraalOptions.HotSpotPrintInlining;
  31 import static org.graalvm.compiler.debug.DebugContext.DEFAULT_LOG_STREAM;
  32 

  33 import java.util.ArrayList;
  34 import java.util.EnumMap;
  35 import java.util.List;
  36 import java.util.Map;
  37 import java.util.concurrent.atomic.AtomicReference;
  38 
  39 import jdk.internal.vm.compiler.collections.EconomicMap;
  40 import jdk.internal.vm.compiler.collections.EconomicSet;
  41 import jdk.internal.vm.compiler.collections.Equivalence;
  42 import jdk.internal.vm.compiler.collections.UnmodifiableMapCursor;
  43 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
  44 import org.graalvm.compiler.api.runtime.GraalRuntime;
  45 import org.graalvm.compiler.core.CompilationWrapper.ExceptionAction;
  46 import org.graalvm.compiler.core.common.CompilationIdentifier;
  47 import org.graalvm.compiler.core.common.GraalOptions;
  48 import org.graalvm.compiler.core.target.Backend;
  49 import org.graalvm.compiler.debug.DebugContext;
  50 import org.graalvm.compiler.debug.DebugContext.Description;
  51 import org.graalvm.compiler.debug.DebugHandlersFactory;
  52 import org.graalvm.compiler.debug.DebugOptions;


 259     }
 260 
 261     private HotSpotBackend registerBackend(HotSpotBackend backend) {
 262         Class<? extends Architecture> arch = backend.getTarget().arch.getClass();
 263         HotSpotBackend oldValue = backends.put(arch, backend);
 264         assert oldValue == null : "cannot overwrite existing backend for architecture " + arch.getSimpleName();
 265         return backend;
 266     }
 267 
 268     @Override
 269     public HotSpotProviders getHostProviders() {
 270         return getHostBackend().getProviders();
 271     }
 272 
 273     @Override
 274     public GraalHotSpotVMConfig getVMConfig() {
 275         return config;
 276     }
 277 
 278     @Override
 279     public DebugContext openDebugContext(OptionValues compilationOptions, CompilationIdentifier compilationId, Object compilable, Iterable<DebugHandlersFactory> factories) {
 280         if (management != null && management.poll(false) != null) {
 281             if (compilable instanceof HotSpotResolvedJavaMethod) {
 282                 HotSpotResolvedObjectType type = ((HotSpotResolvedJavaMethod) compilable).getDeclaringClass();
 283                 if (type instanceof HotSpotResolvedJavaType) {
 284                     Class<?> clazz = runtime().getMirror(type);
 285                     try {
 286                         ClassLoader cl = clazz.getClassLoader();
 287                         if (cl != null) {
 288                             loaders.add(cl);
 289                         }
 290                     } catch (SecurityException e) {
 291                         // This loader can obviously not be used for resolving class names
 292                     }
 293                 }
 294             }
 295         }
 296         Description description = new Description(compilable, compilationId.toString(CompilationIdentifier.Verbosity.ID));
 297         return DebugContext.create(compilationOptions, description, metricValues, DEFAULT_LOG_STREAM, factories);
 298     }
 299 
 300     @Override
 301     public OptionValues getOptions() {
 302         return optionsRef.get();
 303     }
 304 
 305     @Override
 306     public Group createSnippetCounterGroup(String groupName) {
 307         if (snippetCounterGroups != null) {
 308             Group group = new Group(groupName);
 309             snippetCounterGroups.add(group);
 310             return group;
 311         }
 312         return null;
 313     }
 314 
 315     @Override
 316     public String getName() {
 317         return runtimeName;




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 
  27 import static jdk.vm.ci.common.InitTimer.timer;
  28 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  29 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
  30 import static org.graalvm.compiler.core.common.GraalOptions.HotSpotPrintInlining;

  31 
  32 import java.io.PrintStream;
  33 import java.util.ArrayList;
  34 import java.util.EnumMap;
  35 import java.util.List;
  36 import java.util.Map;
  37 import java.util.concurrent.atomic.AtomicReference;
  38 
  39 import jdk.internal.vm.compiler.collections.EconomicMap;
  40 import jdk.internal.vm.compiler.collections.EconomicSet;
  41 import jdk.internal.vm.compiler.collections.Equivalence;
  42 import jdk.internal.vm.compiler.collections.UnmodifiableMapCursor;
  43 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
  44 import org.graalvm.compiler.api.runtime.GraalRuntime;
  45 import org.graalvm.compiler.core.CompilationWrapper.ExceptionAction;
  46 import org.graalvm.compiler.core.common.CompilationIdentifier;
  47 import org.graalvm.compiler.core.common.GraalOptions;
  48 import org.graalvm.compiler.core.target.Backend;
  49 import org.graalvm.compiler.debug.DebugContext;
  50 import org.graalvm.compiler.debug.DebugContext.Description;
  51 import org.graalvm.compiler.debug.DebugHandlersFactory;
  52 import org.graalvm.compiler.debug.DebugOptions;


 259     }
 260 
 261     private HotSpotBackend registerBackend(HotSpotBackend backend) {
 262         Class<? extends Architecture> arch = backend.getTarget().arch.getClass();
 263         HotSpotBackend oldValue = backends.put(arch, backend);
 264         assert oldValue == null : "cannot overwrite existing backend for architecture " + arch.getSimpleName();
 265         return backend;
 266     }
 267 
 268     @Override
 269     public HotSpotProviders getHostProviders() {
 270         return getHostBackend().getProviders();
 271     }
 272 
 273     @Override
 274     public GraalHotSpotVMConfig getVMConfig() {
 275         return config;
 276     }
 277 
 278     @Override
 279     public DebugContext openDebugContext(OptionValues compilationOptions, CompilationIdentifier compilationId, Object compilable, Iterable<DebugHandlersFactory> factories, PrintStream logStream) {
 280         if (management != null && management.poll(false) != null) {
 281             if (compilable instanceof HotSpotResolvedJavaMethod) {
 282                 HotSpotResolvedObjectType type = ((HotSpotResolvedJavaMethod) compilable).getDeclaringClass();
 283                 if (type instanceof HotSpotResolvedJavaType) {
 284                     Class<?> clazz = runtime().getMirror(type);
 285                     try {
 286                         ClassLoader cl = clazz.getClassLoader();
 287                         if (cl != null) {
 288                             loaders.add(cl);
 289                         }
 290                     } catch (SecurityException e) {
 291                         // This loader can obviously not be used for resolving class names
 292                     }
 293                 }
 294             }
 295         }
 296         Description description = new Description(compilable, compilationId.toString(CompilationIdentifier.Verbosity.ID));
 297         return DebugContext.create(compilationOptions, description, metricValues, logStream, factories);
 298     }
 299 
 300     @Override
 301     public OptionValues getOptions() {
 302         return optionsRef.get();
 303     }
 304 
 305     @Override
 306     public Group createSnippetCounterGroup(String groupName) {
 307         if (snippetCounterGroups != null) {
 308             Group group = new Group(groupName);
 309             snippetCounterGroups.add(group);
 310             return group;
 311         }
 312         return null;
 313     }
 314 
 315     @Override
 316     public String getName() {
 317         return runtimeName;


< prev index next >