1 /* 2 * Copyright (c) 2015, 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 jdk.vm.ci.code; 24 25 /** 26 * Simple class to provide information about the result of a compile request. 27 */ 28 public final class CompilationRequestResult { 29 30 /** 31 * A user readable description of the failure. 32 */ 33 private final String failureMessage; 34 35 /** 36 * Whether this is a transient failure where retrying would help. 37 */ 38 private final boolean retry; 39 40 /** 41 * Number of bytecodes inlined into the compilation, exclusive of the bytecodes in the root 42 * method. 43 */ 44 private final int inlinedBytecodes; 45 46 private CompilationRequestResult(String failureMessage, boolean retry, int inlinedBytecodes) { 47 this.failureMessage = failureMessage; 48 this.retry = retry; 49 this.inlinedBytecodes = inlinedBytecodes; 50 } 51 52 public static CompilationRequestResult success(int inlinedBytecodes) { 53 return new CompilationRequestResult(null, true, inlinedBytecodes); 54 } 55 56 public static CompilationRequestResult failure(String failureMessage, boolean retry) { 57 return new CompilationRequestResult(failureMessage, retry, 0); 58 } 59 60 public String getFailureMessage() { 61 return failureMessage; 62 } 63 64 public boolean getRetry() { 65 return retry; 66 } 67 68 public int getInlinedBytecodes() { 69 return inlinedBytecodes; 70 } 71 }