Command.java revision 11707:ad7af1afda7a
1195534Sscottl/* 2195534Sscottl * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3195534Sscottl * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4195534Sscottl * 5195534Sscottl * This code is free software; you can redistribute it and/or modify it 6195534Sscottl * under the terms of the GNU General Public License version 2 only, as 7195534Sscottl * published by the Free Software Foundation. 8195534Sscottl * 9195534Sscottl * This code is distributed in the hope that it will be useful, but WITHOUT 10195534Sscottl * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11195534Sscottl * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12195534Sscottl * version 2 for more details (a copy is included in the LICENSE file that 13195534Sscottl * accompanied this code). 14195534Sscottl * 15195534Sscottl * You should have received a copy of the GNU General Public License version 16195534Sscottl * 2 along with this work; if not, write to the Free Software Foundation, 17195534Sscottl * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18195534Sscottl * 19195534Sscottl * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20195534Sscottl * or visit www.oracle.com if you need additional information or have any 21195534Sscottl * questions. 22195534Sscottl */ 23195534Sscottl 24195534Sscottlpackage compiler.compilercontrol.share.scenario; 25195534Sscottl 26195534Sscottlimport compiler.compilercontrol.share.processors.LogProcessor; 27195534Sscottl 28195534Sscottlimport java.util.Arrays; 29195534Sscottl 30195534Sscottl/** 31195534Sscottl * Represents a CompileCommand command set 32195534Sscottl */ 33195534Sscottlpublic enum Command { 34195534Sscottl COMPILEONLY("compileonly", ".*", "-Xbatch"), 35195534Sscottl EXCLUDE("exclude", "", "-Xbatch"), 36195534Sscottl INLINE("inline", ".*", "-Xbatch"), 37195534Sscottl DONTINLINE("dontinline", "", "-Xbatch"), 38195534Sscottl LOG("log", "", "-XX:+UnlockDiagnosticVMOptions", 39195534Sscottl "-XX:+LogCompilation", "-XX:LogFile=" + LogProcessor.LOG_FILE), 40195534Sscottl PRINT("print", ""), 41195534Sscottl QUIET("quiet", ""), 42195534Sscottl NONEXISTENT("nonexistent", ""); // wrong command for a negative case 43195534Sscottl 44195534Sscottl /** 45195534Sscottl * Command name 46195534Sscottl */ 47195534Sscottl public final String name; 48195534Sscottl 49195534Sscottl /** 50195534Sscottl * Base regular expression 51195534Sscottl */ 52195534Sscottl public final String regex; 53195534Sscottl 54195534Sscottl /** 55195534Sscottl * Additional VM options for this command 56195534Sscottl */ 57195534Sscottl public final String[] vmOpts; 58195534Sscottl 59195534Sscottl private Command(String name, String regex, String... vmOptions) { 60195534Sscottl this.name = name; 61195534Sscottl this.regex = regex; 62195534Sscottl String[] wbOpts = new String[] { "-Xbootclasspath/a:.", 63195534Sscottl "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI" }; 64195534Sscottl int length = (vmOptions != null) ? vmOptions.length : 0; 65195534Sscottl this.vmOpts = Arrays.copyOf(wbOpts, wbOpts.length + length); 66195534Sscottl if (vmOptions != null) { 67195534Sscottl System.arraycopy(vmOptions, 0, vmOpts, wbOpts.length, length); 68195534Sscottl } 69195534Sscottl } 70195534Sscottl} 71195534Sscottl