Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/DefaultVisualizer.java @ 22157:dc83cc1f94f2
Using fully qualified imports
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 16 Sep 2015 11:33:22 +0200 |
parents | 9c8c0937da41 |
children | ff5c0b5677cd |
rev | line source |
---|---|
15279
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
1 /* |
19699
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
15279
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
4 * |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
10 * |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
16 * |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
20 * |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
23 * questions. |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
24 */ |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.instrument.impl; |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
26 |
22157
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
27 import com.oracle.truffle.api.CallTarget; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
28 import com.oracle.truffle.api.frame.FrameSlot; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
29 import com.oracle.truffle.api.instrument.ASTPrinter; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
30 import com.oracle.truffle.api.instrument.Visualizer; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
31 import com.oracle.truffle.api.nodes.Node; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
32 import com.oracle.truffle.api.nodes.RootNode; |
dc83cc1f94f2
Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21951
diff
changeset
|
33 import com.oracle.truffle.api.source.SourceSection; |
15279
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
34 |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
35 public class DefaultVisualizer implements Visualizer { |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
36 |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
37 private final ASTPrinter astPrinter; |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
38 |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
39 public DefaultVisualizer() { |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
40 this.astPrinter = new DefaultASTPrinter(); |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
41 } |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
42 |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
43 public ASTPrinter getASTPrinter() { |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
44 return astPrinter; |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
45 } |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
46 |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
47 public String displaySourceLocation(Node node) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
48 if (node == null) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
49 return "<unknown>"; |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
50 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
51 SourceSection section = node.getSourceSection(); |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
52 boolean estimated = false; |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
53 if (section == null) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
54 section = node.getEncapsulatingSourceSection(); |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
55 estimated = true; |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
56 } |
21572
d6d7e51d9206
Truffle/instrumentation: catch a NPE error condition (when a tagged STATEMENT has no source information)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19699
diff
changeset
|
57 if (section == null) { |
d6d7e51d9206
Truffle/instrumentation: catch a NPE error condition (when a tagged STATEMENT has no source information)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19699
diff
changeset
|
58 return "<error: source location>"; |
d6d7e51d9206
Truffle/instrumentation: catch a NPE error condition (when a tagged STATEMENT has no source information)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19699
diff
changeset
|
59 } |
15486
8f09b84f325f
Truffle/Instrumentation: Revise DefaultVisualizer
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15450
diff
changeset
|
60 return section.getShortDescription() + (estimated ? "~" : ""); |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
61 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
62 |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
63 public String displayMethodName(Node node) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
64 if (node == null) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
65 return null; |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
66 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
67 RootNode root = node.getRootNode(); |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
68 if (root == null) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
69 return "unknown"; |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
70 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
71 return root.getCallTarget().toString(); |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
72 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
73 |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
74 public String displayCallTargetName(CallTarget callTarget) { |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
75 return callTarget.toString(); |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
76 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
77 |
21890
894f82515e38
Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
21572
diff
changeset
|
78 public String displayValue(Object value, int trim) { |
19699
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
79 return trim(value.toString(), trim); |
15279
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
80 } |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
81 |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
82 public String displayIdentifier(FrameSlot slot) { |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
83 return slot.getIdentifier().toString(); |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
84 } |
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
85 |
19699
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
86 /** |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
87 * Trims text if {@code trim > 0} to the shorter of {@code trim} or the length of the first line |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
88 * of test. Identity if {@code trim <= 0}. |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
89 */ |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
90 protected String trim(String text, int trim) { |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
91 if (trim == 0) { |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
92 return text; |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
93 } |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
94 final String[] lines = text.split("\n"); |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
95 String result = lines[0]; |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
96 if (lines.length == 1) { |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
97 if (result.length() <= trim) { |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
98 return result; |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
99 } |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
100 if (trim <= 3) { |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
101 return result.substring(0, Math.min(result.length() - 1, trim - 1)); |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
102 } else { |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
103 return result.substring(0, trim - 4) + "..."; |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
104 } |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
105 } |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
106 return (result.length() < trim - 3 ? result : result.substring(0, trim - 4)) + "..."; |
ef30b2318658
Truffle/Instrumentation: the Visualizer for language-specific values now has a "trim" option to limit result size.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16067
diff
changeset
|
107 } |
15279
0c6d8a08e31b
Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff
changeset
|
108 } |