Path: blob/master/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/CommandOptionsBuilder.java
41161 views
/*1* Copyright (c) 2015, 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*/2223package compiler.compilercontrol.share.scenario;2425import java.util.function.Function;26import java.util.List;27import java.util.stream.Collectors;2829import static compiler.compilercontrol.share.method.MethodDescriptor.Separator.COMMA;30/**31* Creates VM options by adding CompileCommand prefix to commands32*/33public class CommandOptionsBuilder extends AbstractCommandBuilder {34@Override35public List<String> getOptions() {36Function<CompileCommand, String> mapper = cc -> {37StringBuilder sb = new StringBuilder("-XX:CompileCommand=");38sb.append(cc.command.name);39sb.append(COMMA.symbol);40sb.append(cc.methodDescriptor.getString());41if (cc.argument != null) {42sb.append(COMMA.symbol);43sb.append(cc.argument);44}45return sb.toString();46};4748List<String> options = compileCommands.stream()49.map(mapper).collect(Collectors.toList());5051return options;52}53}545556