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.nodes; 024 025import com.oracle.graal.compiler.common.type.*; 026import com.oracle.graal.graph.*; 027import com.oracle.graal.nodeinfo.*; 028import com.oracle.graal.nodes.spi.*; 029 030/** 031 * A node that results in a platform dependent breakpoint instruction being emitted. A number of 032 * arguments can be associated with such a node for placing values of interest in the Java ABI 033 * specified parameter locations corresponding to the kinds of the values. That is, the arguments 034 * are set up as if the breakpoint instruction was a call to a compiled Java method. 035 * <p> 036 * A breakpoint is usually place by defining a node intrinsic method as follows: 037 * 038 * <pre> 039 * {@literal @}NodeIntrinsic(BreakpointNode.class) 040 * static void breakpoint(Object object, Word mark, Word value) { 041 * throw new JVMCIError(""); 042 * } 043 * </pre> 044 * 045 * Note that the signature is arbitrary. It's sole purpose is to capture values you may want to 046 * inspect in the native debugger when the breakpoint is hit. 047 */ 048@NodeInfo 049public final class BreakpointNode extends FixedWithNextNode implements LIRLowerable { 050 051 public static final NodeClass<BreakpointNode> TYPE = NodeClass.create(BreakpointNode.class); 052 @Input NodeInputList<ValueNode> arguments; 053 054 public BreakpointNode(ValueNode... arguments) { 055 super(TYPE, StampFactory.forVoid()); 056 this.arguments = new NodeInputList<>(this, arguments); 057 } 058 059 @Override 060 public void generate(NodeLIRBuilderTool gen) { 061 gen.visitBreakpointNode(this); 062 } 063 064 public NodeInputList<ValueNode> arguments() { 065 return arguments; 066 } 067 068 @NodeIntrinsic 069 public static native void breakpoint(); 070}