Path: blob/master/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/TestConfiguration.java
41161 views
/*1* Copyright (c) 2014, 2020, 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*/22package gc.g1.unloading.configuration;2324/**25* Configuration object encapsulates test configuration.26*/27public class TestConfiguration {2829private ReleaseRefMode releaseRefMode = ReleaseRefMode.NONE;3031private WhatToKeep whatToKeep = WhatToKeep.CLASS;3233private ClassloadingMethod classloadingMethod = ClassloadingMethod.REFLECTION;3435private KeepRefMode keepRefMode = KeepRefMode.STRONG_REFERENCE;3637private boolean humongousClass = false;3839private int compilationLevel = 0;4041private int compilationNumber = 2;4243private boolean redefineClasses = false;4445private boolean inMemoryCompilation = false;4647public ReleaseRefMode getReleaseRefMode() {48return releaseRefMode;49}5051public WhatToKeep getWhatToKeep() {52return whatToKeep;53}5455public ClassloadingMethod getClassloadingMethod() {56return classloadingMethod;57}5859public KeepRefMode getKeepRefMode() {60return keepRefMode;61}6263public boolean isHumongousClass() {64return humongousClass;65}6667public int getCompilationLevel() {68return compilationLevel;69}7071public int getCompilationNumber() {72return compilationNumber;73}7475public boolean isRedefineClasses() {76return redefineClasses;77}7879public boolean isInMemoryCompilation() {80return inMemoryCompilation;81}8283public int getNumberOfGCsBeforeCheck() {84return numberOfGCsBeforeCheck;85}8687public int getNumberOfChecksLimit() {88return numberOfChecksLimit;89}9091private int numberOfGCsBeforeCheck = 50;9293private int numberOfChecksLimit = -1;9495public static TestConfiguration createTestConfiguration(String[] args) {96TestConfiguration c = new TestConfiguration();97for (int i = 0; i < args.length; i++) {98if ("-referenceMode".equalsIgnoreCase(args[i])) {99c.releaseRefMode = ReleaseRefMode.valueOf(args[i + 1].toUpperCase());100} else if ("-numberOfGCsBeforeCheck".equalsIgnoreCase(args[i])) {101c.numberOfGCsBeforeCheck = Integer.valueOf(args[i + 1].toUpperCase());102} else if ("-keep".equalsIgnoreCase(args[i])) {103c.whatToKeep = WhatToKeep.valueOf(args[i + 1].toUpperCase());104} else if ("-classloadingMethod".equalsIgnoreCase(args[i])) {105c.classloadingMethod = ClassloadingMethod.valueOf(args[ i + 1].toUpperCase());106} else if ("-keepRefMode".equalsIgnoreCase(args[i])) {107c.keepRefMode = KeepRefMode.valueOf(args[i + 1]);108} else if ("-humongousClass".equalsIgnoreCase(args[i])) {109c.humongousClass = "true".equals(args[i + 1]);110} else if ("-compilationLevel".equalsIgnoreCase(args[i])) {111c.compilationLevel = Integer.valueOf(args[i + 1]);112} else if ("-compilationNumber".equalsIgnoreCase(args[i])) {113c.compilationNumber = Integer.valueOf(args[i + 1]);114} else if ("-redefineClasses".equalsIgnoreCase(args[i])) {115c.redefineClasses = "true".equals(args[i + 1]);116} else if ("-inMemoryCompilation".equalsIgnoreCase(args[i])) {117c.inMemoryCompilation = "true".equals(args[i + 1]);118} else if ("-numberOfChecksLimit".equalsIgnoreCase(args[i])) {119c.numberOfChecksLimit = Integer.parseInt(args[i + 1]);120} else if (args[i].startsWith("-") && ! "-stressTime".equals(args[i])) {121System.out.println("\n\nWarning!! Unrecognized option " + args[i] + "\n\n");122}123}124System.out.println("releaseRefMode = " + c.releaseRefMode);125System.out.println("whatToKeep = " + c.whatToKeep);126System.out.println("classlodingMethod = " + c.classloadingMethod);127System.out.println("numberOfGCsBeforeCheck = " + c.numberOfGCsBeforeCheck);128System.out.println("keepRefMode = " + c.keepRefMode);129System.out.println("humongousClass = " + c.humongousClass);130System.out.println("compilationLevel = " + c.compilationLevel);131System.out.println("compilationNumber = " + c.compilationNumber);132System.out.println("redefineClasses = " + c.redefineClasses);133System.out.println("inMemoryCompilation = " + c.inMemoryCompilation);134System.out.println("numberOfChecksLimit = " + c.numberOfChecksLimit);135return c;136}137138}139140141