Path: blob/master/test/hotspot/jtreg/compiler/jvmci/common/JVMCIHelpers.java
41155 views
/*1* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package compiler.jvmci.common;2425import jdk.vm.ci.code.CompilationRequest;26import jdk.vm.ci.code.CompilationRequestResult;27import jdk.vm.ci.hotspot.HotSpotVMEventListener;28import jdk.vm.ci.services.JVMCIServiceLocator;29import jdk.vm.ci.runtime.JVMCICompiler;30import jdk.vm.ci.runtime.JVMCIRuntime;31import jdk.vm.ci.runtime.JVMCICompilerFactory;3233/*34* A stub classes to be able to use jvmci35*/36public class JVMCIHelpers extends JVMCIServiceLocator {3738@Override39public <S> S getProvider(Class<S> service) {40if (service == JVMCICompilerFactory.class) {41return service.cast(new EmptyCompilerFactory());42}43if (service == HotSpotVMEventListener.class) {44return service.cast(new EmptyVMEventListener());45}46return null;47}4849public static class EmptyVMEventListener implements HotSpotVMEventListener {50// just empty, using default interface methods51}5253public static class EmptyCompilationRequestResult implements CompilationRequestResult {54@Override55public Object getFailure() {56return "no compiler configured";57}58}59public static class EmptyHotspotCompiler implements JVMCICompiler {6061@Override62public CompilationRequestResult compileMethod(CompilationRequest request) {63// do nothing64return new EmptyCompilationRequestResult();65}66}6768public static class EmptyCompilerFactory implements JVMCICompilerFactory {6970@Override71public String getCompilerName() {72return "EmptyCompiler";73}7475@Override76public JVMCICompiler createCompiler(JVMCIRuntime runtime) {77return new EmptyHotspotCompiler();78}79}80}818283