Mercurial > hg > graal-compiler
view graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java @ 18130:b4e38f4ca414
Truffle: rename @SlowPath to @TruffleBoundary.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 21 Oct 2014 00:22:51 +0200 |
parents | 7bfbad29d331 |
children | c4f374adce13 |
line wrap: on
line source
/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.oracle.truffle.api.instrument; import com.oracle.truffle.api.source.*; /** * A collector of {@link ExecutionEvents} at a specific site (node) in a Truffle AST (generated by a * {@link Wrapper} inserted into the AST) for the purpose of <em>instrumentation</em>. For probes * associated with programmer-facing tools, there should be no more than one probe associated with a * particular piece of source code syntax (i.e. a {@link SourceSection}). * <p> * Any {@linkplain SyntaxTag tags} associated with a particular piece of source code syntax are * managed by the probe. * <p> * When ASTs are copied, it is presumed that the probe for a site is shared by all AST nodes * representing that site. * <p> * A probe holds zero or more {@link Instrument}s, which can be added and removed dynamically. * Events reported to a probe are propagated to every attached instrument; the order is undefined. * <p> * Probe methods must be amenable to Truffle/Graal inlining on the assumption that the collection of * attached instruments seldom changes. The assumption is invalidated when instruments are added or * removed, but some instruments may change their internal state in such a way that the assumption * should also be invalidated. * * @see Instrument * @see Wrapper */ public interface Probe extends ExecutionEvents, SyntaxTagged { /** * Get the {@link SourceSection} in some Truffle AST associated with this probe. * * @return The source associated with this probe. */ SourceSection getSourceLocation(); /** * Mark this probe as belonging to some tool-related category that can be used to guide tool * behavior at an associated AST node. For example, a debugger might add the tag * {@link StandardSyntaxTag#STATEMENT} as a way of configuring where execution should stop when * stepping. */ void tagAs(SyntaxTag tag); /** * Adds an {@link Instrument} to this probe's collection. No check is made to see if the same * instrument has already been added. * * @param newInstrument The instrument to add to this probe. */ void addInstrument(Instrument newInstrument); /** * Removes the given instrument from the probe's collection. * * @param oldInstrument The instrument to remove from this probe. * @throws RuntimeException if no matching instrument has been attached. */ void removeInstrument(Instrument oldInstrument) throws RuntimeException; }