001/* 002 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.replacements; 024 025import java.lang.annotation.*; 026 027import com.oracle.graal.replacements.nodes.*; 028 029/** 030 * A snippet is a Graal graph expressed as a Java source method. Snippets are used for lowering 031 * nodes that have runtime dependent semantics (e.g. the {@code CHECKCAST} bytecode). 032 */ 033@Retention(RetentionPolicy.RUNTIME) 034@Target(ElementType.METHOD) 035public @interface Snippet { 036 037 /** 038 * Specifies whether all FrameStates within this snippet should always be removed. If this is 039 * false, FrameStates are only removed if there are no side-effecting instructions in the 040 * snippet. 041 */ 042 boolean removeAllFrameStates() default false; 043 044 /** 045 * Denotes a snippet parameter representing 0 or more arguments that will be bound during 046 * snippet template {@linkplain SnippetTemplate#instantiate instantiation}. During snippet 047 * template creation, its value must be an array whose length specifies the number of arguments 048 * (the contents of the array are ignored) bound to the parameter during 049 * {@linkplain SnippetTemplate#instantiate instantiation}. 050 * 051 * Such a parameter must be used in a counted loop in the snippet preceded by a call to 052 * {@link ExplodeLoopNode#explodeLoop()}. The counted looped must be a standard iteration over 053 * all the loop's elements (i.e. {@code for (T e : arr) ... }). 054 */ 055 @Retention(RetentionPolicy.RUNTIME) 056 @Target(ElementType.PARAMETER) 057 public @interface VarargsParameter { 058 } 059 060 /** 061 * Denotes a snippet parameter that will bound to a constant value during snippet template 062 * {@linkplain SnippetTemplate#instantiate instantiation}. 063 */ 064 @Retention(RetentionPolicy.RUNTIME) 065 @Target(ElementType.PARAMETER) 066 public @interface ConstantParameter { 067 } 068}