001/* 002 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package jdk.internal.jvmci.hotspot.events; 024 025import jdk.internal.jvmci.common.*; 026 027/** 028 * An empty implementation for {@link EventProvider}. This implementation is used when no logging is 029 * requested. 030 */ 031public final class EmptyEventProvider implements EventProvider { 032 033 public CompilationEvent newCompilationEvent() { 034 return new EmptyCompilationEvent(); 035 } 036 037 public static class EmptyCompilationEvent implements CompilationEvent { 038 public void commit() { 039 throw JVMCIError.shouldNotReachHere(); 040 } 041 042 public boolean shouldWrite() { 043 // Events of this class should never been written. 044 return false; 045 } 046 047 public void begin() { 048 } 049 050 public void end() { 051 } 052 053 public void setMethod(String method) { 054 throw JVMCIError.shouldNotReachHere(); 055 } 056 057 public void setCompileId(int compileId) { 058 throw JVMCIError.shouldNotReachHere(); 059 } 060 061 public void setCompileLevel(int compileLevel) { 062 throw JVMCIError.shouldNotReachHere(); 063 } 064 065 public void setSucceeded(boolean succeeded) { 066 throw JVMCIError.shouldNotReachHere(); 067 } 068 069 public void setIsOsr(boolean isOsr) { 070 throw JVMCIError.shouldNotReachHere(); 071 } 072 073 public void setCodeSize(int codeSize) { 074 throw JVMCIError.shouldNotReachHere(); 075 } 076 077 public void setInlinedBytes(int inlinedBytes) { 078 throw JVMCIError.shouldNotReachHere(); 079 } 080 } 081 082 public CompilerFailureEvent newCompilerFailureEvent() { 083 return new EmptyCompilerFailureEvent(); 084 } 085 086 public static class EmptyCompilerFailureEvent implements CompilerFailureEvent { 087 public void commit() { 088 throw JVMCIError.shouldNotReachHere(); 089 } 090 091 public boolean shouldWrite() { 092 // Events of this class should never been written. 093 return false; 094 } 095 096 public void setCompileId(int compileId) { 097 throw JVMCIError.shouldNotReachHere(); 098 } 099 100 public void setMessage(String message) { 101 throw JVMCIError.shouldNotReachHere(); 102 } 103 } 104 105}