annotate graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleTreeDumpHandler.java @ 18858:db0af0d8d623

fixed JVM_GetGraalServiceImpls signature Contributed-by: Igor Ignatyev <igor.ignatyev@oracle.com>
author Doug Simon <doug.simon@oracle.com>
date Tue, 13 Jan 2015 13:12:01 +0100
parents c0f71f81708a
children b1530a6cce8c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13207
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
1 /*
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
4 *
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
8 *
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
13 * accompanied this code).
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
14 *
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
18 *
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
21 * questions.
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
22 */
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
23 package com.oracle.graal.truffle;
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
24
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
25 import com.oracle.graal.debug.*;
13760
a12017c18d5d Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13207
diff changeset
26 import com.oracle.truffle.api.*;
13207
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
27 import com.oracle.truffle.api.nodes.*;
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
28
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
29 public class TruffleTreeDumpHandler implements DebugDumpHandler {
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
30
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
31 @Override
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
32 public void dump(Object object, final String message) {
13760
a12017c18d5d Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13207
diff changeset
33 if (object instanceof RootCallTarget) {
a12017c18d5d Truffle API cleanup: Reduce the visibility of classes and constructors that are not intended to be instantiated by guest language implementations; provide abstract class RootCallTarget as a CallTarget to a RootNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13207
diff changeset
34 RootCallTarget callTarget = (RootCallTarget) object;
14983
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
35 dumpRootCallTarget(message, callTarget);
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
36 }
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
37 }
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
38
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
39 private static void dumpRootCallTarget(final String message, RootCallTarget callTarget) {
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
40 if (callTarget.getRootNode() != null) {
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
41 final GraphPrintVisitor visitor = new GraphPrintVisitor();
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
42
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
43 final OptimizedCallTarget oct = (OptimizedCallTarget) callTarget;
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
44
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
45 visitor.beginGroup(callTarget.toString());
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
46 dumpFullTree(visitor, message, oct);
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
47 visitor.printToNetwork(false);
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
48 }
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
49 }
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
50
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
51 private static void dumpFullTree(final GraphPrintVisitor visitor, final String message, final OptimizedCallTarget oct) {
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
52 visitor.beginGraph(message).visit(oct.getRootNode());
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
53 }
a31d807757ee Truffle: made inlining fully context sensitive.
Christian Humer <christian.humer@gmail.com>
parents: 13821
diff changeset
54
13207
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
55 public void close() {
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
56 // nothing to do
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
57 }
9500ac5269ff add truffle tree dump handler in order to make tree dumping respect the method filter.
Andreas Woess <andreas.woess@jku.at>
parents:
diff changeset
58 }