1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 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 package org.graalvm.compiler.core.common; 24 25 import jdk.vm.ci.code.CompilationRequest; 26 27 /** 28 * A unique identifier for a compilation. Compiled code can be mapped to a single compilation id. 29 * The reverse is not true since the compiler might bailout in which case no code is installed. 30 */ 31 public interface CompilationIdentifier { 32 33 enum Verbosity { 34 /** 35 * Only the unique identifier of the compilation. 36 */ 37 ID, 38 /** 39 * Only the name of the compilation unit. 40 */ 41 NAME, 42 /** 43 * {@link #ID} + a readable description. 44 */ 45 DETAILED 46 } 47 48 CompilationRequestIdentifier INVALID_COMPILATION_ID = new CompilationRequestIdentifier() { 49 50 @Override 51 public String toString() { 52 return toString(Verbosity.DETAILED); 53 } 54 55 @Override 56 public String toString(Verbosity verbosity) { 57 return "InvalidCompilationID"; 58 } 59 60 @Override 61 public CompilationRequest getRequest() { 62 return null; 63 } 64 65 }; 66 67 /** 68 * This method is a shortcut for {@link #toString(Verbosity)} with {@link Verbosity#DETAILED}. 69 */ 70 @Override 71 String toString(); 72 73 /** 74 * Creates a String representation for this compilation identifier with a given 75 * {@link Verbosity}. 76 */ 77 String toString(Verbosity verbosity); 78 }