comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTProber.java @ 18985:867058575979

Truffle: Improved support for "probing" AST nodes: - Node.isSafelyReplacaeableBy(Node) checks in advance if Node.replace(Node) would be unsafe (crash the VM). - Hoist Probe() from language imlementations into Node; now completely language agnostic. - Language implementations support probing by implementing Node.isInstrumentable() and Node.createWrapperNode() - Node.Probe() throws ProbeException (without side effects) if the probe fails. -- ProbeException contains an instance of ProbeFailure that diagnoses the failure in detail - Additional measures to prevent instrumentation from being applied to internal InstrumentationNodes. - Promote ProbeListener to top level interface and add a default implementation
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 27 Jan 2015 20:24:54 -0800
parents e3c95cbbb50c
children
comparison
equal deleted inserted replaced
18984:0f462015296f 18985:867058575979
1 /* 1 /*
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
29 /** 29 /**
30 * Enables instrumentation by attaching {@linkplain Probe Probes} to some nodes in a (newly created, 30 * Enables instrumentation by attaching {@linkplain Probe Probes} to some nodes in a (newly created,
31 * not yet executed) AST. 31 * not yet executed) AST.
32 * 32 *
33 * @see Probe 33 * @see Probe
34 * @see Probe#addProbeListener(com.oracle.truffle.api.instrument.Probe.ProbeListener) 34 * @see Probe#addProbeListener(ProbeListener)
35 */ 35 */
36 public interface ASTProber { 36 public interface ASTProber {
37 37
38 /** 38 /**
39 * Walk the AST starting at a node and enable instrumentation at selected nodes by attaching 39 * Walk the AST starting at a node and enable instrumentation at selected nodes by attaching
40 * {@linkplain Probe Probes} to them. 40 * {@linkplain Probe Probes} to them. Ignore {@linkplain Node#isInstrumentable()
41 * non-instrumentable} nodes.
41 */ 42 */
42 void probeAST(Node node); 43 void probeAST(Node node);
43 44
44 } 45 }