1 /* 2 * Copyright (c) 2015, 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.lir.gen; 24 25 import org.graalvm.compiler.lir.LIRInstruction; 26 import org.graalvm.compiler.lir.StandardOp.SaveRegistersOp; 27 import jdk.vm.ci.code.Register; 28 import jdk.vm.ci.code.RegisterConfig; 29 import jdk.vm.ci.code.StackSlot; 30 import jdk.vm.ci.meta.JavaConstant; 31 import jdk.vm.ci.meta.Value; 32 33 public interface DiagnosticLIRGeneratorTool { 34 LIRInstruction createBenchmarkCounter(String name, String group, Value increment); 35 36 LIRInstruction createMultiBenchmarkCounter(String[] names, String[] groups, Value[] increments); 37 38 /** 39 * Creates a {@link SaveRegistersOp} that fills a given set of registers with known garbage 40 * value. 41 * 42 * The set of registers actually touched might be {@link SaveRegistersOp#remove reduced} later. 43 * 44 * @param zappedRegisters registers to be zapped 45 * @param zapValues values used for zapping 46 * 47 * @see DiagnosticLIRGeneratorTool#createZapRegisters() 48 */ 49 SaveRegistersOp createZapRegisters(Register[] zappedRegisters, JavaConstant[] zapValues); 50 51 /** 52 * Creates a {@link SaveRegistersOp} that fills all 53 * {@link RegisterConfig#getAllocatableRegisters() allocatable registers} with a 54 * {@link LIRGenerator#zapValueForKind known garbage value}. 55 * 56 * The set of registers actually touched might be {@link SaveRegistersOp#remove reduced} later. 57 * 58 * @see DiagnosticLIRGeneratorTool#createZapRegisters(Register[], JavaConstant[]) 59 */ 60 SaveRegistersOp createZapRegisters(); 61 62 /** 63 * Marker interface for {@link LIRInstruction instructions} that should be succeeded with a 64 * {@link DiagnosticLIRGeneratorTool#createZapRegisters() ZapRegisterOp} if assertions are 65 * enabled. 66 */ 67 interface ZapRegistersAfterInstruction { 68 } 69 70 /** 71 * Marker interface for {@link LIRInstruction instructions} that should be preceded with a 72 * {@link DiagnosticLIRGeneratorTool#zapArgumentSpace ZapArgumentSpaceOp} if assertions are 73 * enabled. 74 */ 75 interface ZapStackArgumentSpaceBeforeInstruction { 76 } 77 78 LIRInstruction createZapArgumentSpace(StackSlot[] zappedStack, JavaConstant[] zapValues); 79 80 LIRInstruction zapArgumentSpace(); 81 }